Subject | Re: [IBO] Unusable Alpha Version for Delphi 2009 |
---|---|
Author | m. Th. |
Post date | 2009-04-27T17:42:17Z |
Andreas Hesse wrote:
some polls which showed that approx. 60% of users would be hit if the
.AsString would returning an Unicode string. As an aside, another reason
to use them was the ease of use. Ie. a simple .AsString compared to
binary access to a stream which must be created, read/write, destroyed
etc.. I didn't say that it was/is a good practice I said that it is/was
a (rather) _common_ practice.
Do we have the above situations in our code? (Ie. if someone has it
raise the hand).
good), the internal call to GetAsAnsiString returns an AnsiString so the
smallest denominator is AnsiString.
m. Th.
[Non-text portions of this message have been removed]
> m. Th. schrieb:Yes, of course. FTR, we don't use it (IIRC). But 'somewhere' there were
>
>> Andreas Hesse wrote:
>>
>> <snip>
>> Take care here!!
>>
>> This was a very big discussion 'somewhere' :-). I cannot tell you many
>> things but due of compatibility reasons - mainly concerns which are tied
>> to the fact that many users are storing non-text data (binary etc.)
>> using .AsString - the Get/SetAsString uses GetAsAnsiString internally.
>>
>
> Strings for storing Bytes is and was always bad design.
> The only reason for this was, because AnsiString is Referece-counted.
> But with D2009 it is a very bad design.
>
some polls which showed that approx. 60% of users would be hit if the
.AsString would returning an Unicode string. As an aside, another reason
to use them was the ease of use. Ie. a simple .AsString compared to
binary access to a stream which must be created, read/write, destroyed
etc.. I didn't say that it was/is a good practice I said that it is/was
a (rather) _common_ practice.
Do we have the above situations in our code? (Ie. if someone has it
raise the hand).
>Nope. Even if AsString returns a string which is UnicodeString (which is
>> From D2009's DB.PAS:
>>
>> function TStringField.GetAsString: string;
>> begin
>> Result := string(GetAsAnsiString);
>> end;
>>
>
> AsString returns a string (=UnicodeString)
>
good), the internal call to GetAsAnsiString returns an AnsiString so the
smallest denominator is AnsiString.
>Yes.
>> ....also you can have a look at TStringField.GetValue(var Value:
>> AnsiString): boolean;
>> and, of course at SetAsString.
>>
>>
>
> TStringField is really a TAnsiStringField.
> So for using Unicode within DB-Layer we must use TWideStringField.
>
>
>> The workaround (for the time being) is to use .AsWideString which
>> returns an Unicode string.
>>
>
> No, it returns only a Unicoded AnsiString for TStringField.
> see above, using TWideStringField is the only possibility.
>
>
>> Also, since the above hard-cast is in DB.Pas (iow outside of ourYes, but I speak more from TIBO layer POV which I use.
>> control) there will be problems with TIBO layer.
>>
>
> No, Text Fields should be now created as TWideStringField's (if they are
> created dynamically).
> But I don't check the source for it.
>
> The native TIB_Column does not differ between AnsiString and WideString
> Column. It only differ between Fixed Text (Char) and Variable Text
> (VarChar) columns.
> And if it is a AnsiString or a WideString Field depends on the
> connection charset.
>
>
m. Th.
[Non-text portions of this message have been removed]