Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one-time query #14

Closed
Q-tester opened this issue May 30, 2014 · 5 comments
Closed

one-time query #14

Q-tester opened this issue May 30, 2014 · 5 comments

Comments

@Q-tester
Copy link

DB-FILLING> (dbi:with-connection (db-connection :sqlite3
                                                :database-name *db-path*) 
              (dbi:do-sql db-connection
                "CREATE TABLE colors (id integer primary key autoincrement, label text)")
              (let ((query (dbi:prepare db-connection
                                        "INSERT INTO colors(label) VALUES (?)")))
                (map nil
                     (lambda (color)
                       (dbi:execute query
                                    color))
                     (list "Red" "Blue" "Green")))
              (dbi:fetch-all
               (dbi:execute
                (dbi:prepare db-connection "SELECT * FROM colors;"))))
  0: (DBI.DRIVER:EXECUTE #<DBD.SQLITE3::<DBD-SQLITE3-QUERY> {B6A4C39}> "Red")
  0: DBI.DRIVER:EXECUTE returned #<DBD.SQLITE3::<DBD-SQLITE3-QUERY> {B6A4C39}>
  0: (DBI.DRIVER:EXECUTE #<DBD.SQLITE3::<DBD-SQLITE3-QUERY> {B6A4C39}> "Blue")
  0: DBI.DRIVER:EXECUTE returned #<DBD.SQLITE3::<DBD-SQLITE3-QUERY> {B6A4C39}>
  0: (DBI.DRIVER:EXECUTE #<DBD.SQLITE3::<DBD-SQLITE3-QUERY> {B6A4C39}> "Green")
  0: DBI.DRIVER:EXECUTE returned #<DBD.SQLITE3::<DBD-SQLITE3-QUERY> {B6A4C39}>
  0: (DBI.DRIVER:EXECUTE #<DBD.SQLITE3::<DBD-SQLITE3-QUERY> {B6B2E11}>)
  0: DBI.DRIVER:EXECUTE returned #<DBD.SQLITE3::<DBD-SQLITE3-QUERY> {B6B2E11}>
((:|id| 1 :|label| "Red"))
@Q-tester
Copy link
Author

Q-tester commented Jun 1, 2014

Maybe I don't understand something. DBI:EXECUTE doesn't for INSERT commands, does it?

@spacebat
Copy link

This is the first issue I've run into with this library. I'd like to do a lot of inserts so it seems natural to use a prepared statement rather than do-sql. Will have to figure out why this is.

@fukamachi
Copy link
Owner

This only happens only with SQLite3 driver. Probably a bug of cl-sqlite's bind-parameter.

@fukamachi
Copy link
Owner

It wasn't. Hopefully, it has been fixed.

@spacebat
Copy link

Fix confirmed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants