changeset 887:9eb479691d1c

Timestamps working with SQLite
author Adam Chlipala <adamc@hcoop.net>
date Fri, 17 Jul 2009 17:09:55 -0400
parents 5805fa825fe8
children ba3569f4fe89
files include/urweb.h src/sqlite.sml
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/include/urweb.h	Fri Jul 17 17:03:37 2009 -0400
+++ b/include/urweb.h	Fri Jul 17 17:09:55 2009 -0400
@@ -159,13 +159,13 @@
 uw_Basis_float *uw_Basis_stringToFloat(uw_context, uw_Basis_string);
 uw_Basis_char *uw_Basis_stringToChar(uw_context, uw_Basis_string);
 uw_Basis_bool *uw_Basis_stringToBool(uw_context, uw_Basis_string);
-uw_Basis_time *uw_Basis_stringToTime(uw_context, uw_Basis_string);
+uw_Basis_time *uw_Basis_stringToTime(uw_context, const char *);
 
 uw_Basis_int uw_Basis_stringToInt_error(uw_context, uw_Basis_string);
 uw_Basis_float uw_Basis_stringToFloat_error(uw_context, uw_Basis_string);
 uw_Basis_char uw_Basis_stringToChar_error(uw_context, uw_Basis_string);
 uw_Basis_bool uw_Basis_stringToBool_error(uw_context, uw_Basis_string);
-uw_Basis_time uw_Basis_stringToTime_error(uw_context, uw_Basis_string);
+uw_Basis_time uw_Basis_stringToTime_error(uw_context, const char *);
 uw_Basis_blob uw_Basis_stringToBlob_error(uw_context, uw_Basis_string, size_t);
 uw_Basis_channel uw_Basis_stringToChannel_error(uw_context, uw_Basis_string);
 uw_Basis_client uw_Basis_stringToClient_error(uw_context, uw_Basis_string);
--- 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 ", ",