[fpc-pascal]SQLite and NULL Strings...
Michael Van Canneyt
michael.vancanneyt at wisa.be
Mon Jul 14 15:39:36 CEST 2003
On Mon, 14 Jul 2003, James Mills wrote:
> On Mon, Jul 14, 2003 at 09:59:17AM +0200, Michael Van Canneyt wrote:
> >
> >
> > On Mon, 14 Jul 2003, James Mills wrote:
> >
> > > Hi,
> > >
> > > This is a very weird behaviour I've found of either SQLite, or the Unit.
> > > I'm not sure... I have been discussing this same problem on the SQLite
> > > mailing list but without success there, so perhaps someone here might
> > > know...
> > >
> > > I have attached a test database, which contains 1 database entry, null
> > > strings are inserted using NULL... Check the database schema yourself.
> > >
> > > The problem therein lies in the fact that test3.pas returns "" for the
> > > query: SELECT channelNotice FROM channels WHERE channel LIKE '#ProLogiTech';
> > > It should return a null string as it does in test2.pas and in the sqlite
> > > shell program.
> >
> > The problem is that an implicity conversion from Nil to empty string is
> > done. You cannot solve this as long as stringlists are used to contain
> > the data. (ok, you could set 'Null' as the string, but that is sloppy)
> >
> > You'd need to have (as a minimum) an array of TField records:
> > TField = Record
> > IsNull : Boolean;
> > Value : String;
> > end;
> >
> > But this will require major changes, so I suggest trying to find or
> > implement a TDataset descendent for SQLIte, this will solve most of
> > your problems at once.
>
> Where might I find such a descendent that using SQLite ? I'm not quite
> sure what I'm looking for here... An initial search on google provides
> some delphi units that are probably not what I'm looking for.
On the contrary, on Torry's pages there are some units that do exactly
what I described.
Michael.
More information about the fpc-pascal
mailing list