[racket] Deleting record from table using sqlite
Hello,
I'm trying to deal with sqlite on scheme.
I can create new table and insert new notes, but i can't delete records from
table.
#lang racket
(require (prefix-in sqlite: (planet jaymccarthy/sqlite:4)))
(define-struct notepad (db))
(define-struct note (notepad id))
(define (initialize-notepad! home)
(define db (sqlite:open home))
(define the-notepad (make-notepad db))
(with-handlers ([exn? void])
(sqlite:exec/ignore db
(string-append
"CREATE TABLE notes "
"(id INTEGER PRIMARY KEY,"
"description TEXT)")))
(sqlite:insert db (format "INSERT INTO notes (description) VALUES
('~a')" "Some text"))
the-notepad)
this works fine.
(define (delete-entry! a-notepad id)
(sqlite:exec/ignore (notepad-db a-notepad)
(format "DELETE FROM notes WHERE id = '~a'" id)))
but this doesn't remove anythng.
Where i'm wrong?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100923/9d1cdc3e/attachment.html>