mysql - Why is Delphi (Zeos) giving me widestring fields in SQLite when I ask for unsigned big int? -
i using latest zeos sqlite 3. going well, converting mysql, once made persistent integer field tlargeint
.
but when use column definition unsigned big int
(the unsigned type allowed according https://www.sqlite.org/datatype3.html), delphi calling resulting field ftwidestring
.
no, not "revert" string, sqlite stores data provided.
sqlite supports concept of "type affinity" on columns. type affinity of column recommended type data stored in column. important idea here type recommended, not required. column can still store type of data. columns, given choice, prefer use 1 storage class on another. preferred storage class column called "affinity".
if supplied/bind text value, store text value. there no conversion type supplied in create table statement, may appear in other more strict rbms, e.g. mysql.
so in case, if retrieve data ftwidestring
, guess because wrote data text. instance, tool or program creating sqlite3 content mysql writing column text.
about numbers, there no "signed"/"unsigned", nor precision check in sqlite3. if want store "unsigned big int" values, use integer, int64.
but, in cases, if sqlite3 api support unsigned 64 bit integers, sqlite3_uint64
type may hardly supported zeos/zdbc api or delphi (older versions of delphi not support uint64). sure, should better retrieve such values text, convert uint64
manually in delphi code.
update:
are using tdataset
descendant provided zeos? component tied db.pas
, expects single per-column type. may source of confusion of code (which did not show @ all, hard figure out what's happening).
you should better use lower level zdbc interface, allows retrieve column type each row, , call value getter method need.
Comments
Post a Comment