]> gitweb.factorcode.org Git - factor.git/commitdiff
sqlite patches for speed and test correction
authorBenjamin Pollack <benjamin.pollack@gmail.com>
Mon, 20 Nov 2006 17:23:08 +0000 (17:23 +0000)
committerBenjamin Pollack <benjamin.pollack@gmail.com>
Mon, 20 Nov 2006 17:23:08 +0000 (17:23 +0000)
contrib/sqlite/libsqlite.factor
contrib/sqlite/test.factor
contrib/sqlite/tuple-db-tests.factor

index ce52453c476c279570b078ef3eca6e885c203d71..75f3cd6b907b305b876b793e5d7a52c810305a8c 100644 (file)
@@ -12,33 +12,33 @@ IN: libsqlite
 USING: alien compiler errors kernel math namespaces sequences strings ;
 
 ! Return values from sqlite functions
-: SQLITE_OK           0   ; ! Successful result
-: SQLITE_ERROR        1   ; ! SQL error or missing database
-: SQLITE_INTERNAL     2   ; ! An internal logic error in SQLite 
-: SQLITE_PERM         3   ; ! Access permission denied 
-: SQLITE_ABORT        4   ; ! Callback routine requested an abort 
-: SQLITE_BUSY         5   ; ! The database file is locked 
-: SQLITE_LOCKED       6   ; ! A table in the database is locked 
-: SQLITE_NOMEM        7   ; ! A malloc() failed 
-: SQLITE_READONLY     8   ; ! Attempt to write a readonly database 
-: SQLITE_INTERRUPT    9   ; ! Operation terminated by sqlite_interrupt() 
-: SQLITE_IOERR       10   ; ! Some kind of disk I/O error occurred 
-: SQLITE_CORRUPT     11   ; ! The database disk image is malformed 
-: SQLITE_NOTFOUND    12   ; ! (Internal Only) Table or record not found 
-: SQLITE_FULL        13   ; ! Insertion failed because database is full 
-: SQLITE_CANTOPEN    14   ; ! Unable to open the database file 
-: SQLITE_PROTOCOL    15   ; ! Database lock protocol error 
-: SQLITE_EMPTY       16   ; ! (Internal Only) Database table is empty 
-: SQLITE_SCHEMA      17   ; ! The database schema changed 
-: SQLITE_TOOBIG      18   ; ! Too much data for one row of a table 
-: SQLITE_CONSTRAINT  19   ; ! Abort due to contraint violation 
-: SQLITE_MISMATCH    20   ; ! Data type mismatch 
-: SQLITE_MISUSE      21   ; ! Library used incorrectly 
-: SQLITE_NOLFS       22   ; ! Uses OS features not supported on host 
-: SQLITE_AUTH        23   ; ! Authorization denied 
-: SQLITE_FORMAT      24   ; ! Auxiliary database format error
-: SQLITE_RANGE       25   ; ! 2nd parameter to sqlite3_bind out of range
-: SQLITE_NOTADB      26   ; ! File opened that is not a database file
+: SQLITE_OK           0   ; inline ! Successful result
+: SQLITE_ERROR        1   ; inline ! SQL error or missing database
+: SQLITE_INTERNAL     2   ; inline ! An internal logic error in SQLite 
+: SQLITE_PERM         3   ; inline ! Access permission denied 
+: SQLITE_ABORT        4   ; inline ! Callback routine requested an abort 
+: SQLITE_BUSY         5   ; inline ! The database file is locked 
+: SQLITE_LOCKED       6   ; inline ! A table in the database is locked 
+: SQLITE_NOMEM        7   ; inline ! A malloc() failed 
+: SQLITE_READONLY     8   ; inline ! Attempt to write a readonly database 
+: SQLITE_INTERRUPT    9   ; inline ! Operation terminated by sqlite_interrupt() 
+: SQLITE_IOERR       10   ; inline ! Some kind of disk I/O error occurred 
+: SQLITE_CORRUPT     11   ; inline ! The database disk image is malformed 
+: SQLITE_NOTFOUND    12   ; inline ! (Internal Only) Table or record not found 
+: SQLITE_FULL        13   ; inline ! Insertion failed because database is full 
+: SQLITE_CANTOPEN    14   ; inline ! Unable to open the database file 
+: SQLITE_PROTOCOL    15   ; inline ! Database lock protocol error 
+: SQLITE_EMPTY       16   ; inline ! (Internal Only) Database table is empty 
+: SQLITE_SCHEMA      17   ; inline ! The database schema changed 
+: SQLITE_TOOBIG      18   ; inline ! Too much data for one row of a table 
+: SQLITE_CONSTRAINT  19   ; inline ! Abort due to contraint violation 
+: SQLITE_MISMATCH    20   ; inline ! Data type mismatch 
+: SQLITE_MISUSE      21   ; inline ! Library used incorrectly 
+: SQLITE_NOLFS       22   ; inline ! Uses OS features not supported on host 
+: SQLITE_AUTH        23   ; inline ! Authorization denied 
+: SQLITE_FORMAT      24   ; inline ! Auxiliary database format error
+: SQLITE_RANGE       25   ; inline ! 2nd parameter to sqlite3_bind out of range
+: SQLITE_NOTADB      26   ; inline ! File opened that is not a database file
 
 : sqlite-error-messages ( -- seq ) {
     "Successful result"
@@ -70,19 +70,19 @@ USING: alien compiler errors kernel math namespaces sequences strings ;
     "File opened that is not a database file"
 } ;
 
-: SQLITE_ROW         100  ; ! sqlite_step() has another row ready 
-: SQLITE_DONE        101  ; ! sqlite_step() has finished executing 
+: SQLITE_ROW         100  ; inline ! sqlite_step() has another row ready 
+: SQLITE_DONE        101  ; inline ! sqlite_step() has finished executing 
 
 ! Return values from the sqlite3_column_type function
-: SQLITE_INTEGER     1 ;
-: SQLITE_FLOAT       2 ;
-: SQLITE_TEXT        3 ;
-: SQLITE_BLOB        4 ;
-: SQLITE_NULL        5 ;
+: SQLITE_INTEGER     1 ; inline
+: SQLITE_FLOAT       2 ; inline
+: SQLITE_TEXT        3 ; inline
+: SQLITE_BLOB        4 ; inline
+: SQLITE_NULL        5 ; inline
 
 ! Values for the 'destructor' parameter of the 'bind' routines. 
-: SQLITE_STATIC      0  ;
-: SQLITE_TRANSIENT   -1 ;
+: SQLITE_STATIC      0  ; inline
+: SQLITE_TRANSIENT   -1 ; inline
 
 TYPEDEF: void sqlite3
 TYPEDEF: void sqlite3_stmt
index ab7682ab4098adc3cf3435fb78f468ce097903e2..7c6fe3e80884ba0773422c0eb3919f9b056914dd 100644 (file)
@@ -33,7 +33,7 @@ USE: kernel
 USE: io
 USE: prettyprint
 
-: test.db "contrib/sqlite/test.db" ;
+: test.db "contrib/sqlite/test.db" resource-path ;
 
 : show-people ( statement -- )
   dup 0 column-text write " from " write 1 column-text . ;
index 8ad5ce8d03c1b978d31183fbbdf6f23f0ba02ba5..19e4c631a64f2fd7ac33c7eb0e24e30cec9c3b64 100644 (file)
@@ -9,7 +9,7 @@ TUPLE: testdata one two ;
 
 testdata default-mapping set-mapping
 
-"contrib/sqlite/test.db" [
+"contrib/sqlite/test.db" resource-path [
 
     db get testdata create-tuple-table