diff src/sqlite.sml @ 890:034eeb099564

Blobs tested in MySQL and SQLite
author Adam Chlipala <adamc@hcoop.net>
date Sat, 18 Jul 2009 10:27:32 -0400
parents 9eb479691d1c
children 16f7cb0891b6
line wrap: on
line diff
--- a/src/sqlite.sml	Fri Jul 17 18:13:02 2009 -0400
+++ b/src/sqlite.sml	Sat Jul 18 10:27:32 2009 -0400
@@ -374,13 +374,15 @@
               | Time => box [string "uw_Basis_stringToTime_error(ctx, sqlite3_column_text(stmt, ", string (Int.toString i), string "))"]
               | Blob => box [string "({",
                              newline,
-                             string "char *data = sqlite3_column_blob(stmt, ",
+                             string "char *data = (char *)sqlite3_column_blob(stmt, ",
                              string (Int.toString i),
                              string ");",
                              newline,
-                             string "uw_Basis_blob b = {sqlite3_column_bytes(stmt, ",
+                             string "int len = sqlite3_column_bytes(stmt, ",
                              string (Int.toString i),
-                             string "), data};",
+                             string ");",
+                             newline,
+                             string "uw_Basis_blob b = {len, uw_memdup(ctx, data, len)};",
                              newline,
                              string "b;",
                              newline,
@@ -537,7 +539,7 @@
                                                      arg,
                                                      string ".data, ",
                                                      arg,
-                                                     string ".size, SQLITE_TRANSIENT"]
+                                                     string ".size, SQLITE_TRANSIENT)"]
                                       | Channel => box [string "sqlite3_bind_int64(stmt, ",
                                                         string (Int.toString (i + 1)),
                                                         string ", ((sqlite3_int64)",
@@ -767,6 +769,7 @@
                   textKeysNeedLengths = false,
                   supportsNextval = false,
                   supportsNestedPrepared = false,
-                  sqlPrefix = ""}
+                  sqlPrefix = "",
+                  supportsOctetLength = false}
 
 end