Changes
2 changed files (+31/-5)
-
-
@@ -1,4 +1,30 @@namespace Sqlite.FFI namespace Constants def SQLITE_OPEN_READONLY : UInt32 := 1 def SQLITE_OPEN_READWRITE : UInt32 := 2 def SQLITE_OPEN_CREATE : UInt32 := 4 def SQLITE_OPEN_DELETEONCLOSE : UInt32 := 8 def SQLITE_OPEN_EXCLUSIVE : UInt32 := 16 def SQLITE_OPEN_AUTOPROXY : UInt32 := 32 def SQLITE_OPEN_URI : UInt32 := 64 def SQLITE_OPEN_MEMORY : UInt32 := 128 def SQLITE_OPEN_MAIN_DB : UInt32 := 256 def SQLITE_OPEN_TEMP_DB : UInt32 := 512 def SQLITE_OPEN_TRANSIENT_DB : UInt32 := 1024 def SQLITE_OPEN_MAIN_JOURNAL : UInt32 := 2048 def SQLITE_OPEN_TEMP_JOURNAL : UInt32 := 4096 def SQLITE_OPEN_SUBJOURNAL : UInt32 := 8192 def SQLITE_OPEN_SUPER_JOURNAL : UInt32 := 16384 def SQLITE_OPEN_NOMUTEX : UInt32 := 32768 def SQLITE_OPEN_FULLMUTEX : UInt32 := 65536 def SQLITE_OPEN_SHAREDCACHE : UInt32 := 131072 def SQLITE_OPEN_PRIVATECACHE : UInt32 := 262144 def SQLITE_OPEN_WAL : UInt32 := 524288 def SQLITE_OPEN_NOFOLLOW : UInt32 := 16777216 def SQLITE_OPEN_EXRESCODE : UInt32 := 33554432 end Constants private opaque Nonempty : NonemptyType
-
@@ -28,7 +54,7 @@ private opaque sqliteInit : IO Unitbuiltin_initialize sqliteInit @[extern "lean_sqlite_open"] private opaque sqliteOpen : String → IO RawConn private opaque sqliteOpen : String → UInt32 → IO RawConn @[extern "lean_sqlite_prepare"] private opaque sqlitePrepare : @&RawConn → String → IO (Except String RawCursor)
-
@@ -66,8 +92,8 @@ columnText := cursorColumnText c,columnInt := cursorColumnInt c } | Except.error e => Except.error e def connect (s : String) : IO Connection := do let rawconn ← sqliteOpen s def connect (s : String) (flags : UInt32) : IO Connection := do let rawconn ← sqliteOpen s flags pure { path := s, conn := rawconn, prepare := (sqlitePrepareWrap rawconn ·) }
-
-
-
@@ -45,13 +45,13 @@ g_sqlite_cursor_external_class = lean_register_external_class(cursor_finalize, noop_foreach);return lean_io_result_mk_ok(lean_box(0)); } lean_obj_res lean_sqlite_open(b_lean_obj_arg path) { lean_obj_res lean_sqlite_open(b_lean_obj_arg path, uint32_t flags) { const char* path_str = lean_string_cstr(path); sqlite3* conn = malloc(sizeof(sqlite3*)); int32_t c = sqlite3_open_v2(path_str, &conn, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); printf("initialize_connection: %x\n", conn); int32_t c = sqlite3_open_v2(path_str, &conn, flags, NULL); if (c == SQLITE_OK) return lean_io_result_mk_ok(box_connection(conn));
-