diff options
-rw-r--r-- | src/mysql.sml | 8 | ||||
-rw-r--r-- | tests/urblog.ur | 35 | ||||
-rw-r--r-- | tests/urblog.urp | 4 | ||||
-rw-r--r-- | tests/urblog.urs | 2 |
4 files changed, 46 insertions, 3 deletions
diff --git a/src/mysql.sml b/src/mysql.sml index 2f28f4dd..6077eb5c 100644 --- a/src/mysql.sml +++ b/src/mysql.sml @@ -675,7 +675,9 @@ fun p_getcol {loc, wontLeakStrings = _, col = i, typ = t} = newline, string "struct tm t = {mt->second, mt->minute, mt->hour, mt->day, mt->month-1, mt->year - 1900, 0, 0, -1};", newline, - string "mktime(&t);", + string "uw_Basis_time res = {mktime(&t), 0};", + newline, + string "res;", newline, string "})"] | Channel => box [string "({", @@ -1082,7 +1084,7 @@ fun queryPrepared {loc, id, query, inputs, cols, doCols, nested} = newline, string "if (localtime_r(&arg", string (Int.toString (i + 1)), - string ", &tms) == NULL) uw_error(ctx, FATAL, \"", + string ".seconds, &tms) == NULL) uw_error(ctx, FATAL, \"", string (ErrorMsg.spanToString loc), string ": error converting to MySQL time\");", newline, @@ -1366,7 +1368,7 @@ fun dmlPrepared {loc, id, dml, inputs, mode} = newline, string "if (localtime_r(&arg", string (Int.toString (i + 1)), - string ", &tms) == NULL) uw_error(ctx, FATAL, \"", + string ".seconds, &tms) == NULL) uw_error(ctx, FATAL, \"", string (ErrorMsg.spanToString loc), string ": error converting to MySQL time\");", newline, diff --git a/tests/urblog.ur b/tests/urblog.ur new file mode 100644 index 00000000..9e3cc27f --- /dev/null +++ b/tests/urblog.ur @@ -0,0 +1,35 @@ +table entry : { Id : int, Title : string, Created : time, Author : string, +Body : string } + PRIMARY KEY Id + +fun list () = + rows <- queryX (SELECT * FROM entry) + (fn row => + <xml> + <div> + <h1>{[row.Entry.Title]}</h1><br /> + <h2>By {[row.Entry.Author]} at {[row.Entry.Created]}</h2> + <p>{[row.Entry.Body]}</p> + </div> + </xml> + ); + return + <xml> + <head> + <title>All Entries</title> + </head> + <body> + <h1>All Entries</h1> + {rows} + </body> + </xml> + +fun main () = return <xml> + <head> + <title>UrBlog</title> + </head> + + <body> + <h1>UrBlog</h1> + </body> +</xml> diff --git a/tests/urblog.urp b/tests/urblog.urp new file mode 100644 index 00000000..08f0d657 --- /dev/null +++ b/tests/urblog.urp @@ -0,0 +1,4 @@ +database dbname=urblog +sql urblog.sql + +urblog diff --git a/tests/urblog.urs b/tests/urblog.urs new file mode 100644 index 00000000..febad7b3 --- /dev/null +++ b/tests/urblog.urs @@ -0,0 +1,2 @@ +val list : unit -> transaction page +val main : unit -> transaction page |