[racket] Deleting record from table using sqlite

From: vannadis (vannadiz at gmail.com)
Date: Thu Sep 23 11:04:19 EDT 2010

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

#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
                           "CREATE TABLE notes "
                           "(id INTEGER PRIMARY KEY,"
                           "description TEXT)")))
      (sqlite:insert db (format "INSERT INTO notes (description) VALUES
('~a')"  "Some text"))

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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100923/9d1cdc3e/attachment.html>

Posted on the users mailing list.