/usr/share/common-lisp/source/sqlite/sqlite-ffi.lisp is in cl-sqlite 20130615-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | (defpackage :sqlite-ffi
(:use :cl :cffi)
(:export :error-code
:p-sqlite3
:sqlite3-open
:sqlite3-close
:sqlite3-errmsg
:sqlite3-busy-timeout
:p-sqlite3-stmt
:sqlite3-prepare
:sqlite3-finalize
:sqlite3-step
:sqlite3-reset
:sqlite3-clear-bindings
:sqlite3-column-count
:sqlite3-column-type
:sqlite3-column-text
:sqlite3-column-int64
:sqlite3-column-double
:sqlite3-column-bytes
:sqlite3-column-blob
:sqlite3-column-name
:sqlite3-bind-parameter-count
:sqlite3-bind-parameter-name
:sqlite3-bind-parameter-index
:sqlite3-bind-double
:sqlite3-bind-int64
:sqlite3-bind-null
:sqlite3-bind-text
:sqlite3-bind-blob
:destructor-transient
:destructor-static
:sqlite3-last-insert-rowid))
(in-package :sqlite-ffi)
(define-foreign-library sqlite3-lib
(:darwin (:default "libsqlite3"))
(:unix (:or "libsqlite3.so.0" "libsqlite3.so"))
(t (:or (:default "libsqlite3") (:default "sqlite3"))))
(use-foreign-library sqlite3-lib)
(defcenum error-code
(:OK 0)
(:ERROR 1)
(:INTERNAL 2)
(:PERM 3)
(:ABORT 4)
(:BUSY 5)
(:LOCKED 6)
(:NOMEM 7)
(:READONLY 8)
(:INTERRUPT 9)
(:IOERR 10)
(:CORRUPT 11)
(:NOTFOUND 12)
(:FULL 13)
(:CANTOPEN 14)
(:PROTOCOL 15)
(:EMPTY 16)
(:SCHEMA 17)
(:TOOBIG 18)
(:CONSTRAINT 19)
(:MISMATCH 20)
(:MISUSE 21)
(:NOLFS 22)
(:AUTH 23)
(:FORMAT 24)
(:RANGE 25)
(:NOTADB 26)
(:ROW 100)
(:DONE 101))
(defcstruct sqlite3)
(defctype p-sqlite3 (:pointer sqlite3))
(defcfun sqlite3-open error-code
(filename :string)
(db (:pointer p-sqlite3)))
(defcfun sqlite3-close error-code
(db p-sqlite3))
(defcfun sqlite3-errmsg :string
(db p-sqlite3))
(defcfun sqlite3-busy-timeout :int
(db p-sqlite3)
(ms :int))
(defcstruct sqlite3-stmt)
(defctype p-sqlite3-stmt (:pointer sqlite3-stmt))
(defcfun (sqlite3-prepare "sqlite3_prepare_v2") error-code
(db p-sqlite3)
(sql :string)
(sql-length-bytes :int)
(stmt (:pointer p-sqlite3-stmt))
(tail (:pointer (:pointer :char))))
(defcfun sqlite3-finalize error-code
(statement p-sqlite3-stmt))
(defcfun sqlite3-step error-code
(statement p-sqlite3-stmt))
(defcfun sqlite3-reset error-code
(statement p-sqlite3-stmt))
(defcfun sqlite3-clear-bindings error-code
(statement p-sqlite3-stmt))
(defcfun sqlite3-column-count :int
(statement p-sqlite3-stmt))
(defcenum type-code
(:integer 1)
(:float 2)
(:text 3)
(:blob 4)
(:null 5))
(defcfun sqlite3-column-type type-code
(statement p-sqlite3-stmt)
(column-number :int))
(defcfun sqlite3-column-text :string
(statement p-sqlite3-stmt)
(column-number :int))
(defcfun sqlite3-column-int64 :int64
(statement p-sqlite3-stmt)
(column-number :int))
(defcfun sqlite3-column-double :double
(statement p-sqlite3-stmt)
(column-number :int))
(defcfun sqlite3-column-bytes :int
(statement p-sqlite3-stmt)
(column-number :int))
(defcfun sqlite3-column-blob :pointer
(statement p-sqlite3-stmt)
(column-number :int))
(defcfun sqlite3-column-name :string
(statement p-sqlite3-stmt)
(column-number :int))
(defcfun sqlite3-bind-parameter-count :int
(statement p-sqlite3-stmt))
(defcfun sqlite3-bind-parameter-name :string
(statement p-sqlite3-stmt)
(column-number :int))
(defcfun sqlite3-bind-parameter-index :int
(statement p-sqlite3-stmt)
(name :string))
(defcfun sqlite3-bind-double error-code
(statement p-sqlite3-stmt)
(parameter-index :int)
(value :double))
(defcfun sqlite3-bind-int64 error-code
(statement p-sqlite3-stmt)
(parameter-index :int)
(value :int64))
(defcfun sqlite3-bind-null error-code
(statement p-sqlite3-stmt)
(parameter-index :int))
(defcfun sqlite3-bind-text error-code
(statement p-sqlite3-stmt)
(parameter-index :int)
(value :string)
(octets-count :int)
(destructor :pointer))
(defcfun sqlite3-bind-blob error-code
(statement p-sqlite3-stmt)
(parameter-index :int)
(value :pointer)
(bytes-count :int)
(destructor :pointer))
(defconstant destructor-transient-address (mod -1 (expt 2 (* 8 (cffi:foreign-type-size :pointer)))))
(defun destructor-transient () (cffi:make-pointer destructor-transient-address))
(defun destructor-static () (cffi:make-pointer 0))
(defcfun sqlite3-last-insert-rowid :int64
(db p-sqlite3))
|