Page 1 of 2
error on zupdatesql alias
Posted: 23.01.2014, 10:20
by ror0n
Need Help here, I just upgraded my Zeos Component from 7.0 stable (which is working fine) to 7.1 stable and there is an error I don't know how to fix.
Here is the sample code, ZQuery1.cachedupdates = true :
procedure TForm1.Button1Click(Sender: TObject);
begin
ZQuery1.Close;
ZQuery1.SQL.text := 'select CODE as "a code" from LOG_SCRIPT';
ZQuery1.Prepare;
ZQuery1.Open;
ZUpdateSQL1.InsertSQL.Text := 'insert into LOG_SCRIPT values (:"a code")';
ZQuery1.UpdateObject := ZUpdateSQL1;
ZQuery1.Append;
ZQuery1.Fields[0].AsString := 'a';
ZQuery1.Post;
ZQuery1.ApplyUpdates;
end;
And the error says "field a code cannot be modified", if the SQL text using alias without spaces it works ok, but if using spaces it didn't work.
So is my updatesql parameter wrong? how to fix this? thx
Re: error on zupdatesql alias
Posted: 27.01.2014, 11:30
by marsupilami
Hello ror0n,
which database do you use? Also I am not sure wether it is allowed to have spaces in SQL parameter names - and this in field names for the ZUpdateSQL...
Best regards,
Jan
Re: error on zupdatesql alias
Posted: 27.01.2014, 17:30
by ror0n
I use firebird 2.5 with Delphi 7.0
Before upgrading to 7.1.3a stable version of Zeos i used 7.0.4 stable and it is working fine with 7.0.4 stable.
I already tried installing 7.0.4 stable again and it's working fine again. Tried 7.1.3a stable again then it that error again.
If not allowed to use space on aliases then what should i do to show aliases with spaces on DBGrid and I can use ZUpdateSQL?
Btw thx for your help.
Re: error on zupdatesql alias
Posted: 28.01.2014, 09:37
by marsupilami
Hello ror0n,
it seems like your problem is also a problem for others so there might be a fix in the future:
http://zeoslib.sourceforge.net/viewtopic.php?p=25640#p25640
Until then I suggest you use field names without spaces and set the captions in the after open event of the data set:
Code: Select all
procedure ZQueryAfterOpen(Sender: TObject);
begin
ZQuery.FieldByName('A_FIELD').DisplayLabel := 'a caption';
end;
Best regards,
Jan
Re: error on zupdatesql alias
Posted: 29.01.2014, 04:46
by ror0n
Thank you for your help sir.
Last question, the link above seems on zeos 7.2 so if there is a fix then only zeos 7.2 will be fixed or 7.1 will be fixed too?
Re: error on zupdatesql alias
Posted: 29.01.2014, 08:45
by marsupilami
Hello ror0n,
you have good chances, that the solution of this problem will be backported to 7.1.
Best regards,
Jan
Re: error on zupdatesql alias
Posted: 04.02.2014, 11:10
by miab3
@ror0n,
If you are strong need or hurry try to adopt that fixes:
http://sourceforge.net/p/zeoslib/code-0/3089/
or move completely to 7.2.0-alpha (r3090 or up):
http://svn.code.sf.net/p/zeoslib/code-0 ... sting-7.2/
Michal
Re: error on zupdatesql alias
Posted: 06.02.2014, 00:04
by EgonHugeist
Got that fully running for all protocols. Fields/Aliases and Tables with spaces.
Patch list/log is available on SVN.Subversion of \testing-7.2. They are marked as *7.1* patches Rev[3089, 3091, 3094, 3096]
Re: error on zupdatesql alias
Posted: 06.02.2014, 04:26
by ror0n
Thank you for all your help sir.
Really appreciate it.
Edit :
Try to install Zeos7.2-alpha branches_ testing_r3099 on Delphi 7 there's an error on installing ZComponentDesign with this error "The procedure entry point @Zmessages@_SInvalidUpdateCount could not be located in the dynamic link library ZCore70.bpl"
Re: error on zupdatesql alias
Posted: 06.02.2014, 13:20
by miab3
@ror0n
Clear previous Zeos instalation and install it clean.
For me Zeos7.2-alpha_r3099 installs on D7 on Windows XP Mode.
Michal
Re: error on zupdatesql alias
Posted: 06.02.2014, 16:00
by ror0n
already uninstall pervious zeos installation, still the same error.
I install on windows XP running on virtualbox, pls tell me what I do wrong?
This is the screenshot of the error
Untitled.jpg
Re: error on zupdatesql alias
Posted: 06.02.2014, 17:06
by miab3
@ror0n,
I build zeosdbo.bpg from package as attached:
zeos72a_pack_d7.zip
Michal
Re: error on zupdatesql alias
Posted: 06.02.2014, 17:15
by ror0n
@ miab3
thank you sir, it worked.
Before i tried your package, I tried rev 3097 and it worked too, I don't know what's wrong with the rev 3099.
Re: error on zupdatesql alias
Posted: 06.02.2014, 17:59
by ror0n
Just tried on my program, alias with spaces is working fine but there is another error,
I don't know if this is the issue with DBGrid component(I used third NextDBGrid component) or the zeos,
If I use DBGrid.Cells[x,x] (DBGrid Columns as NumberColumn and Firebird data type is Decimal) it return with "$xxx,xxx.xx",
but if u revert back to zeos 7.0.4 stable it returns OK (xxx.xx), so i just assuming this is zeos bug (sorry if I'm wrong).
Re: error on zupdatesql alias
Posted: 06.02.2014, 21:31
by EgonHugeist
Not really a bug. Well... Most components assuming TCurrencyField for DECIMAL/Numeric with Digitt>20, precision >0 and <5. Just to avoid nasty rounding issues.
We are going this route too, now.
But i'm not 100% sure if it's the best solution.. The DB grid is calls the TCurrencyField.GetString Methodes and you'll get a Currency formated string now. Personally i didn't play with that stuff. Just get it running.
What about format changes of the Field?
Objections? Discussion is opened.