Problem in "RowsAffected"

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
yoda
Posts: 6
Joined: Tue 15 May 2007 20:06
Location: Athens, Greece

Problem in "RowsAffected"

Post by yoda » Tue 15 May 2007 20:23

- i have created a tsqlquery, set its SQL.Text to an update statement with params.

- i start a transaction and then i prepare the query.

- then i perform a loop on a dataset. in each iteration i assign values from the dataset's fields to the params of the query, and then i do :

recs:=qry.ExecSQL(False);

...etc...some how i use the recs's value to perform other logic here....

Now the fact is that recs has a value of 1 (one) only during the first iteration. all subsequent iterations return 0 (zero).

I have tested that although the recs is returned as 0 the records in the database are UPDATED.

Now to me this seems like a BUG in the driver (since if i switch drivers and use the Borland's driver, the recs is getting the correct value - although it has other problems and that's why i'm testing your driver).

So, are you aware of this? are you going to fix it any time soon (time is critical - as always - in the project i'm going to need the driver).

TIA,
Yoda.

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Wed 16 May 2007 08:52

Thank you for assistance. We have reproduced and fixed this bug. But please note the following information. Depending on the value of the Prepared extended parameter, setting the TCustomSQLDataSet.Prepared property to True either prepares query on client side or on the server. So if you perform the same query multiple times and want to get performance gain, you should set the Prepared extended parameter to True, before setting the TCustomSQLDataSet.Prepared property.

yoda
Posts: 6
Joined: Tue 15 May 2007 20:06
Location: Athens, Greece

Post by yoda » Wed 16 May 2007 09:37

Very good!!! I'm really impressed. So, how do I get the fixed version trial?

yoda
Posts: 6
Joined: Tue 15 May 2007 20:06
Location: Athens, Greece

Post by yoda » Wed 16 May 2007 09:45

Challenger wrote:Thank you for assistance. We have reproduced and fixed this bug. But please note the following information. Depending on the value of the Prepared extended parameter, setting the TCustomSQLDataSet.Prepared property to True either prepares query on client side or on the server. So if you perform the same query multiple times and want to get performance gain, you should set the Prepared extended parameter to True, before setting the TCustomSQLDataSet.Prepared property.
I have a question here: what do you mean by prepares the query on client or server side? I thought that preparing a query is something that has to do with preparing/allocating server-side structures, execution plan, etc. So, I 'm a bit confused with the term client-side preparation? Could you explain that please?

Also, just to be crystal clear, in order to achieve server-side prep I should set extended param to true or to false?

TIA

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Fri 18 May 2007 08:18

This fix will be included in the next build of DbxIda. Because of some peculiarities of dbExpress (TCustomSQLDataSet component) we added this option to distinguish explicit (called by user) and implicit preparation (called by dbExpress internaly). So by the client side preparation I mean only operations that are performed by TCustomSQLDataSet component.
Set the Prepare extended option to True.

yoda
Posts: 6
Joined: Tue 15 May 2007 20:06
Location: Athens, Greece

Post by yoda » Fri 18 May 2007 13:13

So, let me see if I have understand correctly what you are saying:

if I do NOT set the extended prepared property to true then no matter what I do with my query's Prepared property I will NOT get the performance gain I expect. Is my understanding correct?

Personal opinion follows:
Because if it is then I'm really sorry to say that you are breaking SEMANTICS of DBXpress here. And this is ALWAYS the worst possible thing you can do.
Also I cannot imagine why would any one want to turn your extended Prepared property to False.

I really hope I got it wrong.

thanks

Post Reply