summaryrefslogtreecommitdiff
path: root/src/postgres.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-10-22 16:15:56 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-10-22 16:15:56 -0400
commit7e1e019f3fef4c229c06ba2c0c2aa3ec021eedad (patch)
treea765ee0cd11f8b42d77606fa4d133daceefff056 /src/postgres.sml
parentc4becb5fa4357e7a27e6536f3a20e3d5d6136cb0 (diff)
Initial support for char in SQL
Diffstat (limited to 'src/postgres.sml')
-rw-r--r--src/postgres.sml6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/postgres.sml b/src/postgres.sml
index f3942db4..12142fe2 100644
--- a/src/postgres.sml
+++ b/src/postgres.sml
@@ -39,6 +39,7 @@ fun p_sql_type t =
Int => "int8"
| Float => "float8"
| String => "text"
+ | Char => "char"
| Bool => "bool"
| Time => "timestamp"
| Blob => "bytea"
@@ -51,6 +52,7 @@ fun p_sql_type_base t =
Int => "bigint"
| Float => "double precision"
| String => "text"
+ | Char => "character"
| Bool => "boolean"
| Time => "timestamp without time zone"
| Blob => "bytea"
@@ -257,6 +259,8 @@ fun init {dbstring, prepared = ss, tables, views, sequences} =
newline,
string "uw_sqlsuffixString = \"::text\";",
newline,
+ string "uw_sqlsuffixChar = \"::char\";",
+ newline,
string "uw_sqlsuffixBlob = \"::bytea\";",
newline,
string "uw_sqlfmtUint4 = \"%u::int4%n\";",
@@ -505,6 +509,7 @@ fun p_getcol {loc, wontLeakStrings, col = i, typ = t} =
e
else
box [string "uw_strdup(ctx, ", e, string ")"]
+ | Char => box [e, string "[0]"]
| Bool => box [string "uw_Basis_stringToBool_error(ctx, ", e, string ")"]
| Time => box [string "uw_Basis_unsqlTime(ctx, ", e, string ")"]
| Blob => box [string "uw_Basis_stringToBlob_error(ctx, ",
@@ -643,6 +648,7 @@ fun p_ensql t e =
Int => box [string "uw_Basis_attrifyInt(ctx, ", e, string ")"]
| Float => box [string "uw_Basis_attrifyFloat(ctx, ", e, string ")"]
| String => e
+ | Char => box [string "uw_Basis_attrifyChar(ctx, ", e, string ")"]
| Bool => box [string "(", e, string " ? \"TRUE\" : \"FALSE\")"]
| Time => box [string "uw_Basis_attrifyTime(ctx, ", e, string ")"]
| Blob => box [e, string ".data"]