Mercurial > urweb
diff src/mysql.sml @ 876:025806b3c014
Demo compiles again with Postgres and MySQL; MySQL version lacks sequence code and so doesn't work yet
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 12 Jul 2009 16:09:54 -0400 |
parents | c50101ddf7fa |
children | dae141d911d9 |
line wrap: on
line diff
--- a/src/mysql.sml Sun Jul 12 15:42:24 2009 -0400 +++ b/src/mysql.sml Sun Jul 12 16:09:54 2009 -0400 @@ -643,14 +643,14 @@ 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 @@ 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 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 @@ 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 @@ | _ => box [string (p_sql_ctype t), space, + string "tmp = *arg", + string (Int.toString (i + 1)), + string ";", + newline, + string (p_sql_ctype t), + space, string "arg", string (Int.toString (i + 1)), - string " = *arg", - string (Int.toString (i + 1)), - string ";", + 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 @@ 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 @@ | _ => box [string (p_sql_ctype t), space, + string "tmp = *arg", + string (Int.toString (i + 1)), + string ";", + newline, + string (p_sql_ctype t), + space, string "arg", string (Int.toString (i + 1)), - string " = *arg", - string (Int.toString (i + 1)), - string ";", + string " = tmp;", newline], string "in_is_null", string (Int.toString i), string " = 0;", newline, buffers t, - newline]] + newline], + string "}", + newline] | _ => buffers t, newline]