summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-07-17 17:09:55 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-07-17 17:09:55 -0400
commitca3ca2898d4da691936e318fa6b8962934452bac (patch)
tree6846986c807a6bfb17021ee1fbe3bc74470f6f6f
parent7ad34807bd19c3ad0c84a30401c1fafc37e59775 (diff)
Timestamps working with SQLite
-rw-r--r--include/urweb.h4
-rw-r--r--src/sqlite.sml10
2 files changed, 7 insertions, 7 deletions
diff --git a/include/urweb.h b/include/urweb.h
index da1299eb..0aec813f 100644
--- a/include/urweb.h
+++ b/include/urweb.h
@@ -159,13 +159,13 @@ uw_Basis_int *uw_Basis_stringToInt(uw_context, uw_Basis_string);
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);
diff --git a/src/sqlite.sml b/src/sqlite.sml
index ce87de6d..b515d313 100644
--- a/src/sqlite.sml
+++ b/src/sqlite.sml
@@ -37,7 +37,7 @@ fun p_sql_type t =
| Float => "real"
| String => "text"
| Bool => "integer"
- | Time => "integer"
+ | Time => "text"
| Blob => "blob"
| Channel => "integer"
| Client => "integer"
@@ -371,7 +371,7 @@ fun p_getcol {loc, wontLeakStrings, col = i, typ = t} =
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 @@ fun p_inputs loc =
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 ", ",