[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Artanis] Problem with sqlite db connection

From: Racket Noob
Subject: [Artanis] Problem with sqlite db connection
Date: Tue, 3 Feb 2015 18:13:34 +0100

Hi guys,

I have a question about artanis DB connectivity: I have tried to connect to an existing sqlite database file, but with no success.

I wrote something like this:

(define conn (connect-db 'sqlite3 #:db-name "mydb.sqlite"))
(define mtable (map-table-from-DB conn))
(mtable 'get 'Album #:columns '(*))   ; suppose there is a table Album in the database

But for some reason the code above doesn't work and I get the following error:

artanis/db.scm:199:8: In procedure DB-query:
artanis/db.scm:199:8: Throw to key `artanis-err' with args `(500 "DB-query failed: " "no such table: Album")'

Of course, table Album exist in that database, and I can connect to database via dbi library and access the Album table:

scheme@(guile-user)> (use-modules (dbi dbi))
scheme@(guile-user)> (define db-obj (dbi-open "sqlite3" "mydb.sqlite"))
scheme@(guile-user)> db-obj
$3 = #<guile-dbi open sqlite3 mydb.sqlite (0 . db connected)>
scheme@(guile-user)> (dbi-query db-obj "select * from album")
scheme@(guile-user)> (dbi-get_status db-obj)
$4 = (0 . "query ok")
scheme@(guile-user)> (dbi-get_row db-obj)
$5 = (("AlbumId" . 1) ("Title" . "For Those About To Rock We Salute You") ("ArtistId" . 1))
scheme@(guile-user)> (dbi-get_row db-obj)
$6 = (("AlbumId" . 2) ("Title" . "Balls to the Wall") ("ArtistId" . 2))

Please, can someone tell me what I'm doing wrong and how to correct this?

Racket Noob

reply via email to

[Prev in Thread] Current Thread [Next in Thread]