summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-10-22 17:04:37 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-10-22 17:04:37 -0400
commit4e7c75607f1c93d4d3fe983aede819d1da483f1b (patch)
tree22cdd15c34154c7244c24ca0fbe8484846c6fd8e /src
parentd4ed57fc84badf4e675b9c637697e32bcd5e9eca (diff)
Get char working with MySQL
Diffstat (limited to 'src')
-rw-r--r--src/mysql.sml27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/mysql.sml b/src/mysql.sml
index d4db8710..f548b8d8 100644
--- a/src/mysql.sml
+++ b/src/mysql.sml
@@ -49,7 +49,7 @@ fun p_buffer_type t =
Int => "MYSQL_TYPE_LONGLONG"
| Float => "MYSQL_TYPE_DOUBLE"
| String => "MYSQL_TYPE_STRING"
- | Char => "MYSQL_TYPE_TINY"
+ | Char => "MYSQL_TYPE_STRING"
| Bool => "MYSQL_TYPE_LONG"
| Time => "MYSQL_TYPE_TIMESTAMP"
| Blob => "MYSQL_TYPE_BLOB"
@@ -790,6 +790,16 @@ fun queryCommon {loc, query, cols, doCols} =
string (Int.toString i),
string ";",
newline]
+ | Char => box [string "out[",
+ string (Int.toString i),
+ string "].buffer_length = 1;",
+ newline,
+ string "out[",
+ string (Int.toString i),
+ string "].buffer = &buffer",
+ string (Int.toString i),
+ string ";",
+ newline]
| Blob => box [string "out[",
string (Int.toString i),
string "].length = &length",
@@ -927,7 +937,8 @@ fun queryPrepared {loc, id, query, inputs, cols, doCols, nested} =
newline]
| Time => box [string "MYSQL_TIME in_buffer",
string (Int.toString i),
- string ";", newline]
+ string ";",
+ newline]
| _ => box []
in
box [case t of
@@ -1023,6 +1034,16 @@ fun queryPrepared {loc, id, query, inputs, cols, doCols, nested} =
string (Int.toString i),
string ";",
newline]
+ | Char => box [string "in[",
+ string (Int.toString i),
+ string "].buffer = &arg",
+ string (Int.toString (i + 1)),
+ string ";",
+ newline,
+ string "in[",
+ string (Int.toString i),
+ string "].buffer_length = 1;",
+ newline]
| Blob => box [string "in[",
string (Int.toString i),
string "].buffer = arg",
@@ -1185,7 +1206,7 @@ fun dmlCommon {loc, dml} =
fun dml loc =
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),