Board index » delphi » UpdateMode

UpdateMode

We are using Delphi C/S version 3.0 to develop some applications which are
accessing MS SQL 6.5.
All our tables have an identity field called ItemID since we want to
generate SQL commands which look like

UPDATE CUSTOMER
SET Lastname='newlastname'
where ItemID=1

As far as we know this should solve the concurrency problems which might
occure when not using a unique field for each row.
In order to get this functionality without too much programming we took the
following steps:

1) We have created a query with the RequestLive property set to true.
2) We set the SQL command to: select * from users.
3) We set the UpdateMode to upWhereChanged.

We expected the BDE to generate an SQL statement similar to the one above.
However no matter what the UpdateMode property was set to, the BDE always
generated an SQL statement using all table columns in the WHERE clause;
something like:

UPDATE CUSTOMER
SET Lastname='newlastname'
where Number=:1 AND Name=:2 AND Address=:3 AND ZIP=: 4

Why does this not work?

Alain Sienaert
E-mail: sienaert.cor...@skynet.be

 

Re:UpdateMode


Hi Alain

I believe the update mode you are after is

upWhereKeyOnly

this will use the primary key in the where clause.
upWhereAll will use all fields OLD_values (or original values) in the
where clause
upWhereChanged will use the fields where their current values are
different from their OLD_values (or original values)

HTH
Regards
Clint.

Quote

> We are using Delphi C/S version 3.0 to develop some applications which
> are
> accessing MS SQL 6.5.
> All our tables have an identity field called ItemID since we want to
> generate SQL commands which look like

> UPDATE CUSTOMER
> SET Lastname='newlastname'
> where ItemID=1

> As far as we know this should solve the concurrency problems which
> might
> occure when not using a unique field for each row.
> In order to get this functionality without too much programming we
> took the
> following steps:

> 1) We have created a query with the RequestLive property set to true.
> 2) We set the SQL command to: select * from users.
> 3) We set the UpdateMode to upWhereChanged.

> We expected the BDE to generate an SQL statement similar to the one
> above.
> However no matter what the UpdateMode property was set to, the BDE
> always
> generated an SQL statement using all table columns in the WHERE
> clause;
> something like:

> UPDATE CUSTOMER
> SET Lastname='newlastname'
> where Number=:1 AND Name=:2 AND Address=:3 AND ZIP=: 4

> Why does this not work?

> Alain Sienaert
> E-mail: sienaert.cor...@skynet.be

Re:UpdateMode


If you get stuck, you can use cached updates and a TUpdateSQL object to
get exactly the SQL you want.  It's not ideal, but it works.

--
Chris Cleveland
Genesee Development Group, Inc.
2000 North Racine Avenue, Suite 4100
Chicago, Illinois  60614
773.528.1700 voice, 773.528.8862 fax
http://genesee.net
cclevel...@genesee.net

Other Threads