Search code examples
sqlitecommon-lispclsql

How to create sqlite3 database


I want to create a new sqlite3 database. Taking a look at the examples of clsql I found this scenario. Which implies that

(ql:quickload "clsql")
(ql:quickload "clsql-sqlite3")

(uffi:def-function
    ("create_iso_8859_15_ci_collation" create-coll)
    ((db sqlite3:sqlite3-db))
  :returning :int
  :module "sqlite3-utils")

(clsql:connect (list "home/user/test.db" #'create-coll) :database-type :sqlite3)

should create a new database. But instead I get:

The alien function "create_iso_8859_15_ci_collation" is undefined. [Condition of type SB-KERNEL::UNDEFINED-ALIEN-FUNCTION-ERROR]

How can I create a new sqlite3 database from scratch?


Solution

  • Just use

    (clsql:connect '("/path/to/your/database/data.sqlite3") 
                   :database-type :sqlite3)
    

    without init function.