[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: crash in guile-sqlite3
From: |
David Pirotte |
Subject: |
Re: crash in guile-sqlite3 |
Date: |
Fri, 27 Apr 2012 20:59:53 -0300 |
hello,
> ...
> (stmt (sqlite-prepare db "INSERT INTO foos(name) VALUES(?);")))
i'd rather bind the statment in scheme _anyway_ if i was you.
david
;; --
(use-modules (sqlite3))
(define db (sqlite-open "ex0.db"))
(define (sqlite/command db command)
(let ((stmt (sqlite-prepare db command)))
(sqlite-step stmt)
(sqlite-finalize stmt)
(if #f #f)))
(define (my-insert new-name)
(sqlite/command db (format #f "INSERT INTO foos(name) VALUES('~A')"
new-name)))
(sqlite/command db "DROP TABLE IF EXISTS foos;")
(sqlite/command db "CREATE TABLE foos(dbid INTEGER PRIMARY KEY, name TEXT);")
(for-each (lambda (name)
(my-insert name))
'("foo-1" "foo-2" "foo-3"))