diff src/sqlite.sml @ 887:9eb479691d1c

Timestamps working with SQLite
author Adam Chlipala <adamc@hcoop.net>
date Fri, 17 Jul 2009 17:09:55 -0400
parents 5805fa825fe8
children 034eeb099564
line wrap: on
line diff
--- a/src/sqlite.sml	Fri Jul 17 17:03:37 2009 -0400
+++ b/src/sqlite.sml	Fri Jul 17 17:09:55 2009 -0400
@@ -37,7 +37,7 @@
       | Float => "real"
       | String => "text"
       | Bool => "integer"
-      | Time => "integer"
+      | Time => "text"
       | Blob => "blob"
       | Channel => "integer"
       | Client => "integer"
@@ -371,7 +371,7 @@
                 else
                     box [string "uw_strdup(ctx, sqlite3_column_text(stmt, ", string (Int.toString i), string "))"]
               | Bool => box [string "(uw_Basis_bool)sqlite3_column_int(stmt, ", string (Int.toString i), string ")"]
-              | Time => box [string "(uw_Basis_time)sqlite3_column_int64(stmt, ", string (Int.toString i), string ")"]
+              | 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, ",
@@ -526,11 +526,11 @@
                                                      string ", ",
                                                      arg,
                                                      string ")"]
-                                      | Time => box [string "sqlite3_bind_int64(stmt, ",
+                                      | Time => box [string "sqlite3_bind_text(stmt, ",
                                                      string (Int.toString (i + 1)),
-                                                     string ", ",
+                                                     string ", uw_Basis_attrifyTime(ctx, ",
                                                      arg,
-                                                     string ")"]
+                                                     string "), -1, SQLITE_TRANSIENT)"]
                                       | Blob => box [string "sqlite3_bind_blob(stmt, ",
                                                      string (Int.toString (i + 1)),
                                                      string ", ",