Hallo!
I have a big problem with the .edit and .post procedure.
The following programcode
Zquery1.SQL.Add('Select lastlogin from Benutzer where `Benutzername` = BINARY'''+AnsiToUTF8(konfig.benutzername)+''';')
If NOT form1.Zquery1.eof then
BEGIN
form1.ZQuery1.edit;
form1.Zquery1.FieldValues['lastlogin']:=Datum;
lastlogin:=datum;
form1.ZQuery1.post;
END;
becomes this sql code (i've logged it):
070324 12:23:01 170 Query Select lastlogin from Benutzer where `Benutzername` = BINARY'ScampiKutter'
170 Query UPDATE `GildenIdent Daten`.Benutzer SET lastlogin='2007-03-24 12:23:00' WHERE lastlogin='2007-03-24 12:21:34'
Now it changes more then one line.... t think the statemant should be something line .....'WHERE `PRIMARY`=xyz'
I use the newest Components but i tried it also with some older.....
Bye Sven!
Problem with edit and post
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
That depends on how you look at it. You need it for the update... I know you added it as a where-clause, but zeos isn't all-knowing and can't decide if it has to add your where clause. Here it would have worked, but not if the where clause had contained some random function.
When it recognizes the (full) PK in the columns and you choose TQuery.WhereMode := wmWhereKeyOnly (default) it only adds the PK to the where clause of the update statement. Otherwise all fields are used to make the update query as 'unique' as possible.
When it recognizes the (full) PK in the columns and you choose TQuery.WhereMode := wmWhereKeyOnly (default) it only adds the PK to the where clause of the update statement. Otherwise all fields are used to make the update query as 'unique' as possible.