Well, my problem is the above mentioned breaking change was not only mentioned NOWHERE in the docs or the forum but also you defend it as a 'fix' while to me it looks you just found out about it. Am I wrong and it's a common knowledge? Did anyone anywhere on this forum or elsewhere bring it up yet? Do you think that being upset about this is unreasonable?
We did the decision that we support users pushing UTF8 directly to the database using TStringField in ANSI Delphis.
ANSI Delphis have TWideStringField exactly for that purpose. That's where you were wrong at the start and everything else is consequences.
In this use case the user is responsible for making sure that not more than the allowed amount of characters gets pushed into the TString Field.
And the field length checks in TStringField flush down the drain. It's only something Delphi programmers relied on for decades now - no big deal.
There is no such support as using bools as Firbird Char(1) fields. You relied on behaviour that worked but was not intentionally working. At least from a Zeos point of view.
No support for meaningful TField.Size values as well?
Even if Zeos would do some kind of check here, it wouldn't be a truncation but raising an exception that there are too many characters stored in the field.
You don't have to do any checks at all, just return the actual field length. And surely not to try to convert WideString to Utf-8 or vice versa.
No - it wasn't. Do we need your approval before we make changes to the Zeos code? Do you want to step up and support or do Zeos development? If you don't want to do any of that then why do you demand that we discuss the development of Zeos with you before we do changes?
I want to read on the reasons why char(1) has Size=1 in 7.1 and 4 in 7.2. If there were any. The breaking changes need to be explained - am I asking too much?
I have done small contributions in the past and I don't see what it has to do with anything.
Too bad - the way you write here, I already did take offense.
Why, was it your personal decision to quadruple the advertised field size?
You still need to truncate to real field length in character, but do that on a WideString rather than AnsiString
TStringField already does that (did until you broke it in 7.2). No way I am running around the source code manually truncating each and every field I'm sending to the database. And surely it has nothing to do with WideStrings unless you confuse AnsiStrings with utf8's.
Again: Zeos does no intentional truncation. Delphi is doing the truncation in this example because it happens on this line of your example code:
Code: Select all
ZTable1['some_bool'] := Random(2) = 1;
During this assignment Delphi decides to truncate the string value of "False" to Fals or to F - depending on TStringField.Size.
God forbid you started truncating stuff in Zeos on top on what you already messed up with field Size.
Zeos (correctly) just sends the value that gets stored in the StringField to the database that in turn correctly raises an exception.
Oh yeah? And where does the TStringField.Size come from?
marsupilami wrote:
Soo - to bring this to an end:
- To me it seems that your connection character set is UTF8 while you use an ANSI Delphi. Why? This simply doesn't make sense. You might want to consider using the correct ANSI character set for your database connection. ZConnection.ClientCodepage='WIN1252' for example.
Because the DB is used by other applications but mine and some of them require the DB to be UTF-8.
[*]Another option might be to use ClientCodepage=UTF8 and ControlsCodePage=cCP_UTF16. On the SVN version of Zeos 7.2 this will make Zeos generate TWideStingField instead of TStringField with the correct number of characters. I am not 100% sure if the release version Zeos 7.2.4 will behave in the same way. Watch out for type casts like TStringField(DataSet.FieldByName('somefield')) in your code in that case because they might be incorrect afterwards and cause access violations then.[/list]
That changes exactly nothing. It's still Size=4 for char(1) with the inevitable runtime errors.
Soo - to bring this to an end:
- Consider one of the following
- Ban my forum account cause I'm not going to agree and call this bug an 'improvement'
- Agree to optionally return the ACTUAL field size
- Agree to optionally use TWideStringField's on unicode databases instead of TStringField