help-guix
[Top][All Lists]
Advanced

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

Re: guile-dbi from guix not working


From: Zelphir Kaltstahl
Subject: Re: guile-dbi from guix not working
Date: Sun, 8 May 2022 12:33:01 +0000

Hello Luis!

On 5/7/22 20:44, Luis Felipe wrote:
Hi Zelphir,

On Saturday, May 7th, 2022 at 11:26 AM, Zelphir Kaltstahl 
<zelphirkaltstahl@posteo.de> wrote:

Is it really broken, or am I doing something wrong?
For what it's worth, it fails in the same way for me too. Trying to open a connection 
results in a handle with "file not found" status.

If you just need to work with SQLite databases, I tried guile-sqlite3 and it 
worked (connecting, inserting records, etc). It is not documented, but the 
tests help discover how to use some things 
(https://notabug.org/guile-sqlite3/guile-sqlite3.git).

For example, I don't know what I'm doing, but this works:

~~~
(import (sqlite3))

;; Log into the database.
(define db (sqlite-open "database.sqlite3"))

;; Create a table.
(sqlite-exec db "create table hellotable(id int, name varchar(15))")

;; Populate the table with values.
(sqlite-exec db "insert into hellotable ('id', 'name') values('33', 'ola')")
(sqlite-exec db "insert into hellotable ('id', 'name') values('34', 'dzien 
dobre')")
(sqlite-exec db "insert into hellotable ('id', 'name') values('44', 'annyong 
haseyo')")

;; Display each of the rows of the table, in turn.
(let* [(stmt (sqlite-prepare db "select * from hellotable"))
        (result (sqlite-map identity stmt))]

   (for-each
    (lambda (row) (begin (display row) (newline)))
    result))

;; Close connection.
(sqlite-close db)
~~~

This is exactly what I have done : )

I looked at the tests and changed the code a little: https://notabug.org/ZelphirKaltstahl/guile-examples/commit/a9e635b990f5384ccfb3613003489f47759ca690. However, I saw, that there are segfaults reported at https://notabug.org/guile-sqlite3/guile-sqlite3/issues/17 and also I realized, that on GNU Guix version 0.1.2 is available, while in the repo there is 0.1.3, which has trace functions (which I am not sure I will ever need). So I am a bit unsure, how solid of an option it really is.

Thanks for the idea nevertheless!

Best regards,
Zelphir

--
repositories: https://notabug.org/ZelphirKaltstahl




reply via email to

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