Queries with parameters fail in Delphi XE3

Hello Folks!

I have been attempting to move a Delphi XE2 DataSnap server & client project to Delphi XE3. I had to do some minor tweaks like adding the unit IPPeerServer.pas to the uses clause of the server container class but what has really caused me headaches are the parameterised queries. If I try to open a ClientDataSet on the client-side I run into a "Catastrophic failure". Here is the call stack on the client-side at the time:

System._DynArrayAddRef(???)
System.Classes.MoveData((0, 0, 0, ...
System.Classes.TMemoryStream.Write((0, 0, 0, ...
System.Classes.TStream.Write(???,???)
Data.DSUtil.TVariantStreamer.WriteVariant(24,$3213A40)
Data.DSUtil.TVariantStreamer.WriteArray(Variant array of Variant,$3213A40)
Data.DSUtil.TVariantStreamer.WriteVariant(Variant array of Variant,$3213A40)
Data.DSUtil.TVariantStreamer.WriteArray(Variant array of Variant,$3213A40)
Data.DSUtil.TVariantStreamer.WriteVariant(Variant array of Variant,$3213A40)
Data.DSUtil.VariantToStream(Variant array of Variant,$3213A40)
Data.DBXCommon.TDBXStreamValue.SetAsVariant(Variant array of Variant)
Datasnap.DSConnect.TDSProviderConnection.AS_GetRecords('dspEmployee',-1,0,1,'',Variant array of Variant,Unassigned)
Datasnap.DBClient.TCustomClientDataSet.DoGetRecords(-1,0,1,'',Variant array of Variant)
Datasnap.DBClient.TCustomClientDataSet.OpenCursor(False)
Data.DB.TDataSet.SetActive(???)
Data.DB.TDataSet.Open
DMain.TdmoMain.FilterByName('','')
FMain.TfrmMain.FormCreate($3198F40)
Vcl.Forms.TCustomForm.DoCreate
Vcl.Forms.TCustomForm.AfterConstruction
System._AfterConstruction($3198F40)
Vcl.Forms.TCustomForm.Create(???)
Vcl.Forms.TApplication.CreateForm(???,(no value))
Client.Client
:76393677 kernel32.BaseThreadInitThunk + 0x12
:772c9d72 ntdll.RtlInitializeExceptionChain + 0x63
:772c9d45 ntdll.RtlInitializeExceptionChain + 0x36

This call stack is based on a sample DataSnap server connecting to Firebird's Employee DB and a client app that wants to open the employee query using two parameters: FirstName & LastName. The client request doesn't even reach the DataSnap server.

The sample project can be downloaded from here:
http://www.maranatha-consulting.com/Delphi/BugExample.zip

Is there anything wrong in my code?

Salut,
  +Mathias+
0
Mathias
10/3/2012 1:41:33 AM
embarcadero.datasnap 643 articles. 1 followers. Follow

6 Replies
1611 Views

Similar Articles

[PageSpeed] 23

I just saw the Quality Central entry 108904 here:
http://qc.embarcadero.com/wc/qcmain.aspx?d=108904

This is pretty much what I experience too in VCL or FMX client-side applications. I have voted for it as it is a critical bug in moving my Delphi XE2 project to XE3.

Salut,
  +Mathias+
0
Mathias
10/3/2012 2:34:26 AM
Am 03.10.2012 04:34, schrieb Mathias Burbach:
> I have voted for it as it is a critical bug in moving my Delphi XE2 project to XE3.

I agree, this is a complete showstopper for datasnap applications under XE3.

-- 
Uwe Raabe
Embarcadero MVP
Uwe's Blog: The Art of Delphi Programming <http://www.uweraabe.de/>
0
Uwe
10/3/2012 8:24:23 AM
Upboats on QC for this.
0
Anders
10/3/2012 8:32:06 AM
{code}
class procedure TVariantStreamer.WriteVariant(const Value: OleVariant; const Data: TStream);
....
  if VType and varArray <> 0 then
    WriteArray(Value, Data)
  else
    case (VType and varTypeMask) of
      varEmpty, varNull:
        ...
      varOleStr:
          ByteArray := TEncoding.Unicode.GetBytes(Value);
          I := Length(ByteArray) div SizeOf(Char);
          Data.Write(VType, SizeOf(Integer));
          Data.Write(I, SizeOf(Integer));
          // Data.Write(ByteArray[0], I * SizeOf(Char));
          // Fix Range Error
          if I > 0 then
            Data.Write(ByteArray[0], I * SizeOf(Char));
      varVariant:
        ...
    else
      ...
      if VType and varByRef = varByRef then
        ...
      else
        //Data.Write( TVarData(Value).VPointer, VariantSize[VType and varTypeMask]);
        //Change to
        Data.Write( PPointer(TVarData(Value).VPointer), VariantSize[VType and varTypeMask]);
    end;
end;
{code} 

Data.Write call TStream.Write(const Buffer: TBytes; Count: Longint)
*TVarData(Value).VPointer is TBytes?*

Change 
Data.Write( TVarData(Value).VPointer, VariantSize[VType and varTypeMask]);
to
Data.Write( PPointer(TVarData(Value).VPointer), VariantSize[VType and varTypeMask]);

That's call old Methd
function TMemoryStream.Write(const Buffer; Count: Longint): Longint;
0
jackie
10/6/2012 6:05:19 PM
Hello Jackie,

Thanks for posting this fix. I used it in my sample Firebird - DataSnap - Employee application and I can now open the +ClientDataSet+ at run-time. For the design-time to work I will need to wait until Embarcadero ships a new +dsnap170.bpl+ package as part of a Delphi XE3 update pack?!?

Salut,
  +Mathias+

Edited by: Mathias Burbach on Oct 7, 2012 8:29 AM
0
Mathias
10/6/2012 9:29:31 PM
You can waiting...
0
jackie
10/11/2012 2:16:16 PM
Reply:

Similar Artilces:

Delphi XE3 plus CBuilder XE3 demo is still Delphi only
Have Delphi XE3 installed (and registered), tried to install the CBuilder XE3 demo to see if it work as required. The result is that only Delphi was updated and no CBuilder available. Is there a way to test it - I would have upgraded to full RadStudio but doubted the CBuilder 64 bit compiler would be available in time (deadline is almost here and already ported the code to VC++ but don't particularly like it). ...

Parameter query
Hi: I am trying to build maste/detail page.  1.  I have on my page drop down control based on sqldata sources with the concataned fields as follows:   SELECT DISTINCT LastName + ' ' + FirstName AS Expr1 FROM dbo.Table1 It displays First Name space and Last name in the box and works fine. 2. I placed on my form a grIdview In data source I am trying to use parameter filter in SQL select query and the same query as for drop down as follows: SELECT     LastName + ' ' + SiteFirstName AS Expr1, field1, field2, etc.........

Load report failed. Submit Query Submit Query Submit Query
Hi,I am trying to upload a crystal report for vb.net with asp.net 2.0 application on windows 2000 server. When i am trying to a access the report page it just displays an error Load Report Failedand follows the mix of Crystal viewer header's buttons and the word "Submit Query" many times. I am trying to solve this issue from last 3/4 days and really tired now and thinking of get rid of crystal report. Can any one please help me on this issue  Please note that this report runs fine on my local machine. Thanks  Please paste your Code here and let me know which model y...

How to use TDateTime parameters in Delphi XE5 DataSnap Rest
Hi all I create a Delphi XE5 DataSnap Rest server (using FireDac components). All working ok so far except RECEIVING TDATETIME as parameter. After some research I understand that this Type of Data is not usable in DataSnap (at least direct). So I want to make a basic function like this: InsertCustomer(aID : Integer; aDateOfBirth : TDateTime) : Integer; How can I make this function because I cannot use the TDateTime... My idea (request) is to put something similar(identic) with the field that is exported from TDataSet. when a column TDateTime from a TDataSet is exported is lik...

Getting parameter not found error at Delphi-SQLite query [Edit]
I am getting error like 'parameter not found' with following SQL query at Delphi In table emp usergroup_id :- integer and label, description are string data type. My code is as follows {code} gid: Integer; sdescription,ldescription: String; SQLQuery31: TSQLQuery; SQLQuery31 := TSQLQuery.Create(nil); sdescription := RzEdit1.Text; ldescription := RzMemo1.Text; gid := Integer(RzComboBox1.Items.Objects[RzComboBox1.Items.IndexOf(gname)]); try SQLConnection1.Connected := true;...

Problem with Delphi XE2 using parameters in SQL query [Edit]
Hello, I have problem with using SQL with parameters. This part of code works fine on Delphi 2007, but have Debugger Exception Notification in Delphi XE2 with ADOTmp do *//works fine on Delphi2007 and Delphi XE2, date value is inserted* begin SQL.Clear; *SQL.Add('UPDATE Table SET Date = ''2012-04-03 13:13:13'' ');* ExecSQL; end; with ADOTmp do *//works fine on Delphi2007* begin SQL.Clear; *SQL.Add('UPDATE Table SET Date = :D1 ');* Parameters.ParamByName('D1').DataType := ftDateTime; Parame...

XE3
Can someone help me with expanding a concept on enhancing the "Plain Old Delphi Objects" that are discussed in a DelphiLabs Youtube video http://www.youtube.com/watch?v=yWP2ZkVRx08. If I wanted to include a picture in the TPerson class example, how would I "Handle" the tstream object. Now, my class is not really a tperson class, but to stay with the example from the video I would add picjpg : tstream to the public section of the class. Add a constructor that "creates" the tstream object. With my actual custom class the server appears to put data in the ob...

Upgrading Delphi 7 Datasnap to XE: client fails to connect to server [Edit]
Hi, I'm currently working on upgrading a codebase from Delphi 7 to XE, and am currently just trying to get an older school Datasnap application working under XE. For reference: I'm developing/testing on Windows 7 64bit and currently using Delphi XE. The client application connects to the app server via a socket connection currently, and thus uses Borland Socket server, which includes using a registered "Interceptor" which does data compression/decompression. Now the problem: Currently I'm running into a problem trying to get the client to actually talk to t...

Delphi 2010 professional to Delphi XE3
Hello, Sorry for this is not right place to ask this question: I have Delphi 2010 professional version, I like to upgrade to Delphi XE3 Am eligible to upgrade or no not? I like answer from Delphi sales team. I couldn’t find email to ask them. Thanks Mike Thomas <> wrote in news:506459@forums.embarcadero.com: > Hello, > > Sorry for this is not right place to ask this question: > I have Delphi 2010 professional version, I like to upgrade to Delphi > XE3 Am eligible to upgrade or no not? I like answer from Delphi > sales team. I couldn’t find emai...

Migrating from Delphi 7 to Delphi XE3
Hello, Its time to leave the old Delphi 7 and move to the new (but not the latest) XE3. I was wondering if there is a good book or reference to learn all new things XE3 added. Any suggestions? On 5/3/2013 10:17 PM, George Karatsiolis wrote: > Hello, Its time to leave the old Delphi 7 and move to the new (but not the latest) XE3. > I was wondering if there is a good book or reference to learn all new things XE3 added. Try this one for starters: http://tinyurl.com/cgsu243 Aside from that you really need to evaluate your application. XE3 is Unicode for example.... So her...

Delphi 2010 DBexpress Datasnap imports Integer parameters in ORacle built-in procedures erroneously as ftFMTbcd
When proofreading the imported parameters in tSQLprocedure from an Oracle server, I find that what is declared as Integer in Oracle procedure call parameters are redefined to ftFMTbcd as parameter in the datasnap server. Is there some unknown parameter in setup that dictates such conversion, or is this a bug that maybe is fixed in later editions of Delphi? What evt. negative effect would the error have ? -- Delphi programmer at Dep.of Nutrition research, Faculty of Medicine, University of Oslo, Norway On 23.03.2013 18:05, Alf Christophersen wrote: > When proofreading t...

Create C# proxy for datasnap REST server fails on XE3
I followed this guide: http://docwiki.embarcadero.com/RADStudio/XE3/en/Getting_Started_with_DataSnap_Mobile_Connectors http://docwiki.embarcadero.com/RADStudio/XE3/en/Getting_Started_with_CSharp_Silverlight_DataSnap_Mobile_Connector When I try to fetch the proxy I just get a 404 error. http://localhost:8080/proxy/charp_silverlight.zip gives a 404 error and I tried downloading using the command line tool and it also reports 404. What's up? EDIT: NEVERMIND, it seems to work.. Edited by: Anders Andersen on Oct 9, 2012 3:09 PM ...

XE3 - Debugging mode
Hello, we have a big problem with Delphi XE3. If we run our application in the IDE with the Release Build-Configuration, all works fine. But if we run the application with the Debug-Configuration the IDE crashes with the message <Accessviolation in ntdll.dll'. After that Delphi have to restart. This happens before our application is started. We don't have AQTime installed. My collegue have the same problem and he has other components installed as I have. Without debugger we can't use Delphi XE3. I hope, you have some ideas, what we can do. Best wishes Bernhard Roos ...

C# Ado.net Sql query parameter query
Hi All, I'm trying to pass in a parameter value from an array in a loop that is used in a sql query and the results are populated to an xml file. The trouble is that I'm only getting the colums values in the outputted xml file. So I feel that the paramter is not being read. So can anyone help as I'm really stuck on this one. The code is as follows : public void DisplayUserInfo() { ArrayList UserIdArrayList = IdentifyUserID(); foreach(string ShowUserIDString in UserIdArrayList) { try { SqlConnection SqlConn = new SqlConnection(DBConnString)...

Web resources about - Queries with parameters fail in Delphi XE3 - embarcadero.datasnap

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google Webmaster Tools Parameter Handling - Flickr - Photo Sharing!
You aren't signed in Sign In Help Home The Tour Sign Up Explore Explore Home Last 7 Days Interesting Popular Tags Calendar Most Recent Uploads ...

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 11/25/2015 7:02:56 PM