Le Fri, 01 Apr 2011 11:12:03 +0200,
Detlev Zundel <d...@denx.de> a écrit :

> Hi David,
> 
> > Just tried guile-sqlite3  - after applying the 2 patches of Detlev - and
> > succeeded with
> > ...

> Thanks for testing.  Unfortunately currently I'm not able to reproduce
> your findings - in my little test I was successful in reading records
> from a small database.
> 
> Can you show me the exact calls and the database you used?

Hello Detlev,
Andy,

I spotted where the problem comes from: it is when a text value is empty. I have
produced a small but complete example [attached]: can you reproduce it ?

Thanks,
David
(define-module (empty-string)
  :use-module (ice-9 format)
  :use-module (sqlite3))

(export db
	create
	insert
	query-1
	query-2
	stmt)

(define stmt #f)


#!

April the 1st, 2011

  origin/HEAD -> origin/master
  origin/master

Retreiving an empty string triggers an error

!#


;;;
;;; Opening a test db
;;;

(define db (sqlite-open "/tmp/sqlite.db" 6))

(define create
  "create table test (
     reference integer primary key,
     name      text,
     firstname text,
     email     text
   );")

(define insert
  "insert into test 
        values (1,'BLAISE','Virginie','');")

(define query-1 "select reference, name, firstname from test;")
(define query-2 "select * from test;")

(for-each (lambda (sql-stmt)
	    (set! stmt (sqlite-prepare db sql-stmt))
	    (format #t "~S~%" (sqlite-step stmt))
	    (sqlite-finalize stmt))
    (list create
	  insert
	  query-1
	  query-2))


;;;
;;; Closing
;;;

(sqlite-close db)

Reply via email to