Board index » delphi » MS SQL Server - TQuery Update Mode is ignored!

MS SQL Server - TQuery Update Mode is ignored!

Hi,

I am using Delphi 3.0 with BDE 5.1.1.1 accessing the databases through
ODBC datasources.

I have an application that runs on Sybase SQL Anywhere and MS SQL Server
6.5 and 7.0. One area in the system allows you to edit the client
record. I use a requestlive TQuery component to "select * from clients
where client_id = ?". The update mode of the query if WhereKeyOnly.
After viewing the SQL Monitor log i noticed the following results using
the same executable.

MS SQL Server 6.5 and 7.0 (same results for both versions):

UPDATE "CLIENTS" SET "COMMENTS"=? WHERE "CLIENT_ID"=? AND "LASTNAME"=?
AND "FIRSTNAME"=? AND "MIDDLENAME" IS NULL  AND "SALUTATION" IS NULL
AND "ALIAS" IS NULL  AND "PERMADDR_1"=? AND "PERMADDR_2"=? AND
"PERM_CITY"=? AND "PERM_PROV"=? AND "PERM_POST"=? AND "PERM_CNTRY"=? AND
"HOME_PHONE"=? AND "WORK_PHONE" IS NULL  AND "FAX" IS NULL  AND
"BIRTHDATE"=? AND "MARITAL"=? AND "GENDER"=? AND "PRIDOCTOR" IS NULL
AND "PRIDIAG" IS NULL  AND "REFERRAL" IS NULL  AND "REF_DATE" IS NULL
AND "REF_REASON"=? AND "INTAKEDATE"=? AND "INTAKETIME"=? AND
"RES_DATE"=? AND "CURR_ADDR1"=? AND "CURR_ADDR2"=? AND "CURR_CITY"=? AND
"CURR_PROV"=? AND "CURR_POST"=? AND "CURR_CNTRY"=? AND "AREA"=? AND
"EMP_ADDR_1" IS NULL  AND "EMP_ADDR_2" IS NULL  AND "EMP_CITY" IS NULL
AND "EMP_POST" IS NULL  AND "EMP_CNTRY" IS NULL  AND "EMP_PHONE1" IS
NULL  AND "EMP_EXT1" IS NULL  AND "EMP_PHONE2" IS NULL  AND "OCCUPATION"
IS NULL  AND "RES_TYPE"=? AND "LIVING_ARR" IS NULL  AND "ADMISSDATE"=?
AND "EQUIPPRES"=? AND "PRICONTACT" IS NULL  AND "PRILANG" IS NULL  AND
"INTAKEUSER"=? AND "WORKEXT" IS NULL  AND "NOTIFYUSER"=? AND
"SAMEA{*word*237}"=? AND "EMPPROV" IS NULL  AND "EMPPLACE" IS NULL  AND "CODE"
IS NULL  AND "LOOKUP_ID" IS NULL  AND "ATTENDANCE"=? AND "BRANCH_ID" IS
NULL  AND "ALERT_TYPE_ID" IS NULL  AND "PIN" IS NULL  AND "REFUSAL"=?
AND "CURRESTYPE"=? AND "AUX_ID"=? AND "MAILADDR"=?

Sybase SQL Anywhere 5.5:

UPDATE "CLIENTS" SET "COMMENTS"=? WHERE "CLIENT_ID"=?

Why is MS SQL Server ingnoring the WhereKeyOnly property. Is this a bug
in MS SQL Server or Delphi 3.0 or BDE?

Any thoughts?

Thanks in advance,

Isaac Alexander
VP Software Development
Develus Systems Inc
Certified Delphi Consultant

 

Re:MS SQL Server - TQuery Update Mode is ignored!


This is BDE issue. For every "live" result set, it checks for aplicable
unique indexes. If it finds one, it will use index fields in where clause,
otherwise all fields.
And yes, seems at least with ODBC datasources, that the update mode is
allways ignored - above works regardless of UpdateMode setting. It caused me
some headaches.

--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.qwe.ce...@neosys.xrs.qwe.si

No questions via email, unless explicitly invited.

Quote
Isaac Alexander wrote in message <38C6BA0E.D95B3...@deveTHANKSlus.com>...
>Hi,

>I am using Delphi 3.0 with BDE 5.1.1.1 accessing the databases through
>ODBC datasources.

>I have an application that runs on Sybase SQL Anywhere and MS SQL Server
>6.5 and 7.0. One area in the system allows you to edit the client
>record. I use a requestlive TQuery component to "select * from clients
>where client_id = ?". The update mode of the query if WhereKeyOnly.
>After viewing the SQL Monitor log i noticed the following results using
>the same executable.

>MS SQL Server 6.5 and 7.0 (same results for both versions):

[snip]

Re:MS SQL Server - TQuery Update Mode is ignored!


Thanks for the input
Quote
Robert Cerny wrote:
> This is BDE issue. For every "live" result set, it checks for aplicable
> unique indexes. If it finds one, it will use index fields in where clause,
> otherwise all fields.
> And yes, seems at least with ODBC datasources, that the update mode is
> allways ignored - above works regardless of UpdateMode setting. It caused me
> some headaches.

Other Threads