Field size problem with linux and firebird

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
User avatar
cappelletto
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: 17.06.2020, 10:55
Location: Italy

Field size problem with linux and firebird

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

Re: Field size problem with linux and firebird

Post 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
User avatar
cappelletto
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: 17.06.2020, 10:55
Location: Italy

Re: Field size problem with linux and firebird

Post by cappelletto »

OK.
Is it reliable to use this version in production? On a server?

Thank you
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Field size problem with linux and firebird

Post 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:
  1. 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.
  2. 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.
  3. 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.
User avatar
cappelletto
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: 17.06.2020, 10:55
Location: Italy

Re: Field size problem with linux and firebird

Post 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
User avatar
cappelletto
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: 17.06.2020, 10:55
Location: Italy

Re: Field size problem with linux and firebird

Post 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:
  1. 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.
  2. 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.
  3. 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.
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: Field size problem with linux and firebird

Post 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
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: Field size problem with linux and firebird

Post by miab3 »

@All,

It seems that in ZEOS 7.3_r6654 Michael has corrected the error and now StoredProc should work.

Michal
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Field size problem with linux and firebird

Post 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
Post Reply