summaryrefslogtreecommitdiff
path: root/src/mysql.sml
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
commitfc3b6857ae9d41f0fa64dc53e135be6d27d85c76 (patch)
tree22cdd15c34154c7244c24ca0fbe8484846c6fd8e /src/mysql.sml
parent890bccbc6286d9e70618a9f4f64c289d407337ce (diff)
Get char working with MySQL
Diffstat (limited to 'src/mysql.sml')
-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),