summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mysql.sml46
-rw-r--r--src/postgres.sml2
-rw-r--r--src/sources6
3 files changed, 33 insertions, 21 deletions
diff --git a/src/mysql.sml b/src/mysql.sml
index b1361a68..bada72ed 100644
--- a/src/mysql.sml
+++ b/src/mysql.sml
@@ -643,14 +643,14 @@ fun p_getcol {wontLeakStrings = _, col = i, typ = t} =
newline,
string "})"]
| Time => box [string "({",
- string "MYSQL_TIME *mt = buffer",
+ string "MYSQL_TIME *mt = &buffer",
string (Int.toString i),
string ";",
newline,
newline,
string "struct tm t = {mt->second, mt->minute, mt->hour, mt->day, mt->month, mt->year, 0, 0, -1};",
newline,
- string "mktime(&tm);",
+ string "mktime(&t);",
newline,
string "})"]
| _ => box [string "buffer",
@@ -717,6 +717,10 @@ fun queryCommon {loc, query, cols, doCols} =
string (Int.toString i),
string ";",
newline]
+ | Time => box [string "MYSQL_TIME buffer",
+ string (Int.toString i),
+ string ";",
+ newline]
| _ => box [string (p_sql_ctype t),
space,
string "buffer",
@@ -844,7 +848,7 @@ fun queryCommon {loc, query, cols, doCols} =
fun query {loc, cols, doCols} =
box [string "uw_conn *conn = uw_get_db(ctx);",
newline,
- string "MYSQL_stmt *stmt = mysql_stmt_init(conn->conn);",
+ string "MYSQL_STMT *stmt = mysql_stmt_init(conn->conn);",
newline,
string "if (stmt == NULL) uw_error(ctx, FATAL, \"",
string (ErrorMsg.spanToString loc),
@@ -882,9 +886,7 @@ fun queryPrepared {loc, id, query, inputs, cols, doCols} =
string (Int.toString i),
string ";",
newline]
- | Time => box [string (p_sql_ctype t),
- space,
- string "in_buffer",
+ | Time => box [string "MYSQL_TIME in_buffer",
string (Int.toString i),
string ";",
newline]
@@ -1023,18 +1025,24 @@ fun queryPrepared {loc, id, query, inputs, cols, doCols} =
| _ =>
box [string (p_sql_ctype t),
space,
- string "arg",
- string (Int.toString (i + 1)),
- string " = *arg",
+ string "tmp = *arg",
string (Int.toString (i + 1)),
string ";",
+ newline,
+ string (p_sql_ctype t),
+ space,
+ string "arg",
+ string (Int.toString (i + 1)),
+ string " = tmp;",
newline],
string "in_is_null",
string (Int.toString i),
string " = 0;",
newline,
buffers t,
- newline]]
+ newline],
+ string "}",
+ newline]
| _ => buffers t,
newline]
@@ -1100,9 +1108,7 @@ fun dmlPrepared {loc, id, dml, inputs} =
string (Int.toString i),
string ";",
newline]
- | Time => box [string (p_sql_ctype t),
- space,
- string "in_buffer",
+ | Time => box [string "MYSQL_TIME in_buffer",
string (Int.toString i),
string ";",
newline]
@@ -1241,18 +1247,24 @@ fun dmlPrepared {loc, id, dml, inputs} =
| _ =>
box [string (p_sql_ctype t),
space,
- string "arg",
- string (Int.toString (i + 1)),
- string " = *arg",
+ string "tmp = *arg",
string (Int.toString (i + 1)),
string ";",
+ newline,
+ string (p_sql_ctype t),
+ space,
+ string "arg",
+ string (Int.toString (i + 1)),
+ string " = tmp;",
newline],
string "in_is_null",
string (Int.toString i),
string " = 0;",
newline,
buffers t,
- newline]]
+ newline],
+ string "}",
+ newline]
| _ => buffers t,
newline]
diff --git a/src/postgres.sml b/src/postgres.sml
index 0b854efc..7096a5cf 100644
--- a/src/postgres.sml
+++ b/src/postgres.sml
@@ -247,7 +247,7 @@ fun checkRel (table, checkNullable) (s, xts) =
fun init {dbstring, prepared = ss, tables, views, sequences} =
box [if #persistent (currentProtocol ()) then
- box [string "void uw_client_init() { }",
+ box [string "void uw_client_init(void) { }",
newline,
newline,
diff --git a/src/sources b/src/sources
index 7ba0b999..b284e5a9 100644
--- a/src/sources
+++ b/src/sources
@@ -13,6 +13,9 @@ order.sml
errormsg.sig
errormsg.sml
+print.sig
+print.sml
+
settings.sig
settings.sml
@@ -31,9 +34,6 @@ postgres.sml
mysql.sig
mysql.sml
-print.sig
-print.sml
-
prim.sig
prim.sml