[Gambas-devel] Database Component

Benoit Minisini gambas at ...1...
Fri Apr 9 22:29:31 CEST 2004


On Tuesday 06 April 2004 17:59, Nigel Gerrard wrote:
> Benoit,
>
> I have been making some changes to the database drivers and will submit
> them later when complete, but I have noticed some strange behavour in what
> I believe to to be the interpreter.
>
> If you create a table thus:
>
> create table test ( id integer not null, name test , primary key (id));
>
> Then populate with a couple of records.
>
> insert into test ( 1, 'fred');
> insert into test ( 2, 'sid');
>
> Next create a gambas program to edit one of the records.
>
> .
> .
> .
> DIM rTest AS Result
> .
> .
> rTest = $hConn.Edit("test","id = 2")
> FOR EACH rTest.Field
>     PRINT rTest.Field.Name
> NEXT
>
> PRINT rTest!id & ":" & rTest!name
> rTest!name = "sidney"
> rTest.Update
>
>
> Now run with the MySQL and Sqlite drivers and you get:
>
> id
> name
> ...... #-1: Unknown field: Name
>
> With postgresql you get what you would expect:
> id
> name
> 2:sid
>
> You might think that this is a problem only with the two drivers, but if
> you print the the paramater name being handed to field_index in main.c you
> will see that the value is 'Name' and not 'name' and it is only because
> postgresql  is non case-sensative that it too doesn't fail.
>
> My belief is that during parsing, the token Name is mistaken for name.
>
> Nigel

Maybe the compiler use "Name" because of the first occurrence of name. This 
could be seen as a bug :-)

But I think the database component should be case insensitive. By forcing 
field names to lowercase for example. What do you think about that ?

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list