Page 1 of 1
Field size problem with linux and firebird
Posted: 17.06.2020, 10:57
by cappelletto
I use lazarus 1.8.0 in linux x64 and zeos 7.2.6 and firebird 2.5. The database has WIN1252 as a code page.
ZConnection is set:
ClientCodePAge WIN1252
ControlsCodePage cCP_UTF8
ZQuery.SQL is "select * from home"
I click twice on ZQUERY and add the static fields.
The problem is that the size is wrong. For example
The "ID" field
In the DB it is varchar (10)
in lazarus it assigns me size = 40. This creates problems when I insert long strings generating exception in the database. :'( :'(
How can I solve it?
Re: Field size problem with linux and firebird
Posted: 17.06.2020, 13:22
by marsupilami
Hello,
this problem cannot be solved on Zeos 7.2. Please try Zeos 7.3. You can check it out using subversion or download a snapshot from
our Subversion page.
Bestz regards,
Jan
Re: Field size problem with linux and firebird
Posted: 17.06.2020, 13:53
by cappelletto
OK.
Is it reliable to use this version in production? On a server?
Thank you
Re: Field size problem with linux and firebird
Posted: 17.06.2020, 15:26
by marsupilami
Zeos 7.3 should be reliable to use. We currently prepare to have it go into beta state. There are no big changes planned anymore.
All in all your possibilities are:
- Use Zeos 7.3. There we have our own fields, that can give the correct value vor size. Make sure, your whole environment it using UTF8. Use cCP_UTF8.
- Use Zeos 7.2 but know that for TStringField the Size property is always (4 * Character Count) if ControlsCodepage is cCP_UTF8. For pure server applications that might be an option.
- Use Zeos 7.2, set ControlsCodepage to cCP_GETACP. In this scenario Zeos will ask the OS about the character set in use. If that character set uses 1 byte per character, the Size property will be correct. This mostly makes sense on Windows. But be aware that problems might arise if you need to interface to components that expect UTF8 - like the Lazarus LCL.
My suggestion: Stick to option number 1.
Re: Field size problem with linux and firebird
Posted: 17.06.2020, 15:59
by cappelletto
In 7.3, there is a problem with the TZStoredprocs. Parameter assignment does not work.
es:
TesProc.ParamByName('cli').AsInteger := 1;
It gives me the error: Parameter "cli" not found.
In addition to the transition between 7.2 and 7.3 I lose all the parameters and I have to recreate them
Re: Field size problem with linux and firebird
Posted: 17.06.2020, 16:04
by cappelletto
The problem is that with linux I can't set cCP_GETACP, otherwise I would be fine with this. With linux it gives me the possibility to choose cCP_UTF8 or cCP_UTF16, but not cCP_GETACP.
Is there any way to set cCP_GETACP?
marsupilami wrote: ↑17.06.2020, 15:26
Zeos 7.3 should be reliable to use. We currently prepare to have it go into beta state. There are no big changes planned anymore.
All in all your possibilities are:
- Use Zeos 7.3. There we have our own fields, that can give the correct value vor size. Make sure, your whole environment it using UTF8. Use cCP_UTF8.
- Use Zeos 7.2 but know that for TStringField the Size property is always (4 * Character Count) if ControlsCodepage is cCP_UTF8. For pure server applications that might be an option.
- Use Zeos 7.2, set ControlsCodepage to cCP_GETACP. In this scenario Zeos will ask the OS about the character set in use. If that character set uses 1 byte per character, the Size property will be correct. This mostly makes sense on Windows. But be aware that problems might arise if you need to interface to components that expect UTF8 - like the Lazarus LCL.
My suggestion: Stick to option number 1.
Re: Field size problem with linux and firebird
Posted: 18.06.2020, 10:49
by miab3
@cappelletto,
Pause a moment with a migration to 7.3.
For me, StoredProc, e.g. in MySQL (Delphi XE2), behave strangely, too.
Michal
Re: Field size problem with linux and firebird
Posted: 19.06.2020, 08:19
by miab3
@All,
It seems that in ZEOS 7.3_r6654 Michael has corrected the error and now StoredProc should work.
Michal
Re: Field size problem with linux and firebird
Posted: 19.06.2020, 08:52
by marsupilami
Hello
cappelletto wrote: ↑17.06.2020, 16:04
The problem is that with linux I can't set cCP_GETACP, otherwise I would be fine with this. With linux it gives me the possibility to choose cCP_UTF8 or cCP_UTF16, but not cCP_GETACP.
Is there any way to set cCP_GETACP?
On most Linux systems this would not help because GETACP would return UTF8. This is the default on most Linux distos these days. Zeos would behave the same as with cCP_UTF8 in that case.
So if you absolutely need the Size property to be correct, you only can stick to Zeos 7.3 and report any problems you find here on the forums or - even better - on the
bug tracker.
Best regards,
Jan