[fpc-devel] TField.AsString and Databases with UTF-8 charset
Joost van der Sluis
joost at cnoc.nl
Sat Jul 25 15:44:49 CEST 2009
Op vrijdag 24-07-2009 om 15:31 uur [tijdzone +0200], schreef Michael Van
Canneyt:
>
> On Fri, 24 Jul 2009, Graeme Geldenhuys wrote:
>
> > Michael Van Canneyt wrote:
> >>> No, not a second query, just keeping track of extra (other) meta data
> >>> information which was retrieved from the first API call to Firebird.
> >>
> >> My databases are HUGE, and I don't think that such a query is appropriate.
> >
> >
> > It's got nothing to do with the size of your database. It is simply SqlDB
> > that is using the wrong field to report the size of the Char(x) field
> > definitions.
>
> Which field should it use according to you then ?
And, Graeme, we need a field that is accesible through the
Firebird-C-API, not by some query we can run.
> 1. Foresee a charsize field in TStringField
Yes, or (ab?)use .Size for that, as we also have .DataSize. Depends on
Delphi2009, I would say.
Normally for TStringFields, Size is DataSize-1. I don't know if it leads
to any problems when we change that.
And note that this is not implemented in sqldb, nor TBufDataset, but
TDataset/TStringField itself...
> 2. Map UTF8 fields to widestring and convert them on the go.
With a property to set this, this seems ok
> 3. Introduce a TUTF8field which equals TStringField, but which reserves
> a buffer of 4 bytes per character.
Yes, or make it variable-length. In that case we can use part of
Martin's code. And not
> At that point, the firebird connection must be adapted to report the
> character length instead of the buffer length.
Which can be difficult, I don't know if they added an api-call for this.
Else we have to calculate the length ourselves by looping through the
characters. But if TDataset should do that or the end-uprogrammer, I
don't know.
Joost.
More information about the fpc-devel
mailing list