]> gitweb.factorcode.org Git - factor.git/commitdiff
db.sqlite.lib: there is no u64 type in sqlite and i'm tired of pretending
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 27 Feb 2024 16:38:40 +0000 (10:38 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 27 Feb 2024 16:39:08 +0000 (10:39 -0600)
add a way to get the db filename that is in use

basis/db/sqlite/lib/lib.factor

index bcc86154447c8bcad51e6023c916434a5d365a3b..d89002f349bb3d8453c84fdf161f5d9c78529ba1 100644 (file)
@@ -59,7 +59,8 @@ ERROR: sqlite-error < db-error n string ;
     sqlite3_bind_int64 sqlite-check-result ;
 
 : sqlite-bind-uint64 ( handle i n -- )
-    sqlite3-bind-uint64 sqlite-check-result ;
+    ! there is no sqlite3_bind_uint64 function
+    sqlite3_bind_int64 sqlite-check-result ;
 
 : sqlite-bind-double ( handle i x -- )
     sqlite3_bind_double sqlite-check-result ;
@@ -149,7 +150,8 @@ ERROR: sqlite-error < db-error n string ;
     2dup sqlite3_column_int64 dup 0 = [ sqlite3-column-null ] [ 2nip ] if ;
 
 : sqlite3-column-uint64 ( handle index -- int/f )
-    2dup sqlite3_column_uint64 dup 0 = [ sqlite3-column-null ] [ 2nip ] if ;
+    ! there is no sqlite3_column_uint64
+    2dup sqlite3_column_int64 dup 0 = [ sqlite3-column-null ] [ 2nip ] if ;
 
 : sqlite3-column-double ( handle index -- int/f )
     2dup sqlite3_column_double dup 0.0 = [ sqlite3-column-null ] [ 2nip ] if ;
@@ -197,3 +199,6 @@ ERROR: sqlite-error < db-error n string ;
 
 : sqlite-next ( prepared -- ? )
     sqlite3_step sqlite-step-has-more-rows? ;
+
+: current-sqlite-filename ( -- path/f )
+    db-connection get [ handle>> f sqlite3_db_filename ] [ f ] if* ;
\ No newline at end of file