sqlite3 module
Scheme C Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dbd
example
.gitignore
DIST
Makefile.in
README
TODO
configure.ac
dbd_sqlite3.c
dbd_sqlite3lib.stub
gauche_dbd_sqlite3.h
test.scm
test2.scm

README

Gauche-dbd-sqlite3 is a dbd module for Gauche.

[Requirements]

- GCC
- Gauche 0.9.2 or later (http://www.practical-scheme.net/gauche/)
- SQLite 3.7.3 or later (http://www.sqlite.org/)

[Developing Environment]

- Gauche scheme shell, version 0.9.3.3 [utf-8,pthreads], x86_64-unknown-linux-gnu
- SQLite 3.7.3, 3.7.15

[Building]

  $ ./DIST gen
  $ ./configure
  $ make
  % make install


[How to use]

* Connect

** sqlite3 driver support following connect-options

  1. flags: pass to sqlite3_open_v2 with
            SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE flag
  
      See more details here
      http://www.sqlite.org/c3ref/c_open_autoproxy.html
  
  2. db   : Do not use this. Only support backward compatibility.

** Following two examples will return same result.

  (dbi-make-connection (make <sqlite3-driver>) "filename.db;flags=262144" '())
  (dbi-connect "dbi:sqlite3:filename.db;flags=262144")

  Please try URI filename if libsqlite3 support it. Refer to following instruction.

** after libsqlite3 3.7.7, support URI filenames

  1. this open "filename.db" at current-directory with on memory mode and NOMUTEX.

  (dbi-make-connection (make <sqlite3-driver>) "file:filename.db?mode=memory;flags=32768" '())

  2. this open "filename.db?mode=memory" at current directory with NOMUTEX.

  (dbi-make-connection (make <sqlite3-driver>) "filename.db?mode=memory;flags=32768" '())


* Sqlite3 specifics

[Function] sqlite3-libversion

Get libsqlite3 version as a string.

Example: "3.7.15"

[Function] sqlite3-set-timeout

Set timeout milli seconds to the connection.
Sqlite3 default behavior, make immediately error if the database is locked.

http://www.sqlite.org/c3ref/busy_timeout.html
http://www.sqlite.org/c3ref/busy_handler.html

[Function] sqlite3-last-id

Get ROWID which is INSERT into the argument connection in most recently.

http://www.sqlite.org/c3ref/last_insert_rowid.html

[Function] sqlite3-error-message

Get error message from Sqlite3

http://www.sqlite.org/c3ref/errcode.html

[Function] sqlite3-table-columns

Get a list of all columns from argument table.

[Function] with-transaction (may be removed future release)

Execute proc one of the started transaction.  Commit automatically
when proc is returned normally.  Rollback when proc raise error.

[Function] call-with-transaction (may be removed future release)

Same as with-transaction but proc must accept a transaction object.

[Function] dbi-tables (may be changed future release)

Get a list of tables from the argument connection.