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: Luis Felipe
Subject: Re: guile-dbi from guix not working
Date: Sat, 07 May 2022 18:44:09 +0000

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)
~~~

Attachment: publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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