At 20:14 Uhr +0100 25.01.2006, Christian wrote:
I've written a quick DBI interface--see below.
I've noticed a problem: the number/false conversion doesn't accept the "0E0" string returned by DBI as "0 but true" value:
(define sth (dbh.prepare db "create table Foo (id int not null auto_increment primary key, Text varchar(255)) type=innodb")) (sth.execute sth)
*** ERROR IN (console)@21.1 -- Unknown error (gperl#sv->number/false '#<SV* #2 0x8537B64>) 1>
(sv->string #2)
"0E0"
I've put a patch to the current gperl and to the p-dbi sent in my previous mail at this address: http://scheme.mine.nu/gambit/downloads/gperl-and-p-dbi-20050225.patch (I've also added a more verbose message to stderr for the above case. BTW: I should probably change all ".../false" type and conversion-function names to "maybe-...")
With this patch, after rebuilding gperl (bruse gperl) and dopping the Foo table (mysql> drop table Foo;) it now gives:
(sth.execute sth)
0
(sth.execute sth)
DBD::mysql::st execute failed: Table 'Foo' already exists. #f
(define sth (dbh.prepare db "insert into Foo set Text=?")) (sth.execute sth "Hello")
1
(sth.execute sth "World")
1
Cheers Christian.