Ticket #162 (closed defect)

Opened 16 years ago

Last modified 16 years ago

Contracts not working or documentation incorrect

Reported by: erast Owned by: jaymccarthy
Priority: major Milestone:
Component: jaymccarthy/sqlite.plt Keywords:
Cc: erich@… Version: (4 1)
Racket Version: 4.1.5

Description

Either I'm systematically doing something wrong, the documentation is not up-to-date, or there is a bug somewhere. The following code yields an error:

#lang scheme
(require (prefix-in sqlite3: (planet jaymccarthy/ sqlite:3)))
(define (test)

(define db (sqlite3:open (build-path "test")))
(sqlite3:exec/ignore

db
"CREATE TABLE ? (notesID INTEGER PRIMARY KEY, data TEXT, timeCreated DATE, timeModified DATE, misc BLOB);"
"test")

db)

(test)

==> procedure exec/ignore: expects 2 arguments, given 3: #<db> "CREATE TABLE ? (notesID INTEGER PRIMARY KEY, data TEXT, timeCreated DATE, timeM... "test"

Worse, I can't get parameter to work at all. Sqlite always reports a syntax error near "?" for the following code:

#lang scheme
(require (prefix-in sqlite3: (planet jaymccarthy/ sqlite:3)))
(define (test)

(define db (sqlite3:open (build-path "test")))
(define stm (sqlite3:prepare db "CREATE TABLE ? (notesID INTEGER PRIMARY KEY, data TEXT, timeCreated DATE, timeModified DATE, misc BLOB);"))
(sqlite3:load-params db stm "name"))

(test)

==> SQLite Error: near "?": syntax error

Are these bugs or am I missing something obvious?

Change History

in reply to: ↑ description   Changed 16 years ago by jaymccarthy

  • status changed from new to closed

Replying to erast:

You are using version 3 of the package, but only version 4 has that support. Change your require line to:

(require (prefix-in sqlite3: (planet jaymccarthy/ sqlite:4)))

(Annoying: The 4 is for the version of the FFI, not sqlite)

However, after I fix that and try to run your code, SQLite reports it as illegal because it is an incomplete statement. Not sure why... if you can produce C code that does it I can compare with mine.

Jay

Either I'm systematically doing something wrong, the documentation is not up-to-date, or there is a bug somewhere. The following code yields an error:

#lang scheme
(require (prefix-in sqlite3: (planet jaymccarthy/ sqlite:3)))
(define (test)
(define db (sqlite3:open (build-path "test")))
(sqlite3:exec/ignore
db
"CREATE TABLE ? (notesID INTEGER PRIMARY KEY, data TEXT, timeCreated DATE, timeModified DATE, misc BLOB);"
"test")
db)

(test)

==> procedure exec/ignore: expects 2 arguments, given 3: #<db> "CREATE TABLE ? (notesID INTEGER PRIMARY KEY, data TEXT, timeCreated DATE, timeM... "test"

Worse, I can't get parameter to work at all. Sqlite always reports a syntax error near "?" for the following code:

#lang scheme
(require (prefix-in sqlite3: (planet jaymccarthy/ sqlite:3)))
(define (test)
(define db (sqlite3:open (build-path "test")))
(define stm (sqlite3:prepare db "CREATE TABLE ? (notesID INTEGER PRIMARY KEY, data TEXT, timeCreated DATE, timeModified DATE, misc BLOB);"))
(sqlite3:load-params db stm "name"))
(test)

==> SQLite Error: near "?": syntax error

Are these bugs or am I missing something obvious?

Note: See TracTickets for help on using tickets.