[fpc-pascal] Trim db-fieldnames, or not?

Michael Van Canneyt michael at freepascal.org
Sat Apr 19 22:19:33 CEST 2008



On Sat, 19 Apr 2008, Joost van der Sluis wrote:

> Op zaterdag 19-04-2008 om 22:08 uur [tijdzone +0200], schreef Michael
> Van Canneyt:
> > 
> > On Sat, 19 Apr 2008, Joost van der Sluis wrote:
> > 
> > > Op vrijdag 18-04-2008 om 22:06 uur [tijdzone +0200], schreef Michael Van
> > > Canneyt:
> > > > 
> > > > IMHO, no trimming should be added, because databases can have fields
> > > > with spaces. Weird, but true.
> > > 
> > > Not at the begin or end, I hope?
> > 
> > Even there:
> > 
> > home: >fisql /home/firebird/contacts.fb
> > Database:  /home/firebird/contacts.fb
> > SQL> create table test ("my field " int);
> > SQL> show table test;
> > my field                        INTEGER Nullable
> > SQL> alter table test add " another field" int;
> > SQL> show table test;
> > my field                        INTEGER Nullable
> >  another field                  INTEGER Nullable
> > SQL> show table test;
> > my field                        INTEGER Nullable
> >  another field                  INTEGER Nullable
> > SQL> select " another field" from test;
> > 
> >  another field
> > ==============
> >         <null>
> > 
> > SQL> select "another field" from test;
> > Statement failed, SQLCODE = -206
> > Dynamic SQL Error
> > -SQL error code = -206
> > -Column unknown
> > -another field
> > -At line 1, column 24
> > 
> > Try and find where your query goes wrong :)
> 
> That is just sick!

It is. 
Courtesy of MS-Access users... That was the first to support it, AFAIK.
(although access uses [] instead of "", as far as I remember)

Michael.



More information about the fpc-pascal mailing list