Page 1 of 1

SQL statment at TzUpdatesql is not getting saved when adding new field

Posted: 24.12.2015, 14:02
by rrricci
Hi.. Since last version, I noticed that when we add a new field at TzQuery and then, we Generate a new SQL Statment at TzUpdateSQL, this new field is not kept when you close IDE.. Even if you save your project.

Try to repreduce this steps:

1) Add "select field_a, field_b from test;" to TzQuery;
2) Go to TzUpdateSQL and genetare sql statments..
3) Save your project. Close IDE(in my case, Lazarus)..


Open IDE and open you project again.. Now we will add the new field.

1) add a nes field at TzqUERY.. Exemple: field_c;
2) Goto TzUpdateSQL and select the new field among with the others existing ones.. and generate a new SQL..
3) Save your project..
4) Close IDE


Now if you open the project again, you will not find the field_c at TzUpdateSQl.. its lost for some reason I dont know why..

Any idea? Is it a little bug?

Thanks,
Renato Ricci

Re: SQL statment at TzUpdatesql is not getting saved when adding new field

Posted: 03.01.2016, 20:01
by marsupilami
Hello rrricci,

which version of Zeos is the "last Version" that you refer to?
With best regards,

Jan

Re: SQL statment at TzUpdatesql is not getting saved when adding new field

Posted: 04.01.2016, 21:20
by rrricci
Hi Jan..

I am currently using Zeos 7.2.0-beta.. But I noticed this same behavior on past versions too..

Thanks!
Renato Ricci
http://www.singlesistemas.com.br

Re: SQL statment at TzUpdatesql is not getting saved when adding new field

Posted: 06.01.2016, 12:57
by marsupilami
Hello Renato,

hmmm - I tried to test this and didn't see this behaviour on Delphi XE2 or the current Version of Lazarus using the current SVN version of Zeos 7.2. But there are some things, I noted: If you add a field to the Query, you need to manually add it to the selection in the UpdateSQL editor. Also if you save your project and then use the UpdateSQL editor Delphi as well as Lazarus don't seem to notice the chaged properties because both IDEs don't enable the Save all button. Doing any minor change to the project remedies that and then everything will get saved. I am not sure wether this is some kind of Zeos bug or if it is a bug in the IDEs because I am not aware on how the assistant should interact with the IDE to tell the IDE that there have been changes done.

With best regards,

Jan

Re: SQL statment at TzUpdatesql is not getting saved when adding new field

Posted: 05.08.2016, 09:54
by Fr0sT
Fixed. Info

Diff:

Code: Select all

 src/component/ZUpdateSqlEditor.pas | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/component/ZUpdateSqlEditor.pas b/src/component/ZUpdateSqlEditor.pas
index f6453db..160eb8b 100644
--- a/src/component/ZUpdateSqlEditor.pas
+++ b/src/component/ZUpdateSqlEditor.pas
@@ -235,7 +235,8 @@ end;
 
 procedure TZUpdateSqlEditor.Edit;
 begin
-  EditUpdateSQL(TZUpdateSQL(Component));
+  if EditUpdateSQL(TZUpdateSQL(Component)) then
+    Designer.Modified;
 end;
 
 { Global Interface functions }
@@ -637,8 +638,11 @@ begin
     if ShowModal = mrOk then
     begin
       for Index := low(TUpdateKind) to high(TUpdateKind) do
-        UpdateSQL.SQL[Index] := SQLText[Index];
-      Result := True;
+        if UpdateSQL.SQL[Index].Text <> SQLText[Index].Text then
+        begin
+          UpdateSQL.SQL[Index] := SQLText[Index];
+          Result := True;
+        end;
     end;
   finally
     for Index := Low(TUpdateKind) to High(TUpdateKind) do
This changes behavior of TZUpdateSQLEditForm.Edit - now it returns True only if changes were made, while old version returned True every time the dialog was closed with OK button. But I didn't find any other references to this method so it shouldn't affect anything.

Re: SQL statment at TzUpdatesql is not getting saved when adding new field

Posted: 19.09.2016, 17:52
by marsupilami
Hello Fr0st,

The patch has been applied. See Zeos 7.2 Rev. 3930. Thanks for your help.
With Best regards,

Jan