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

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
rrricci
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 05.04.2014, 02:12

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

Post 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
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

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

Post by marsupilami »

Hello rrricci,

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

Jan
rrricci
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 05.04.2014, 02:12

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

Post 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
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

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

Post 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
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

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

Post 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.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

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

Post by marsupilami »

Hello Fr0st,

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

Jan
Post Reply