diff src/sqlite.sml @ 1011:16f7cb0891b6

Initial support for char in SQL
author Adam Chlipala <adamc@hcoop.net>
date Thu, 22 Oct 2009 16:15:56 -0400
parents 034eeb099564
children ea9f03ac2710
line wrap: on
line diff
--- a/src/sqlite.sml	Thu Oct 22 14:05:48 2009 -0400
+++ b/src/sqlite.sml	Thu Oct 22 16:15:56 2009 -0400
@@ -36,6 +36,7 @@
         Int => "integer"
       | Float => "real"
       | String => "text"
+      | Char => "integer"
       | Bool => "integer"
       | Time => "text"
       | Blob => "blob"
@@ -165,6 +166,8 @@
                   newline,
                   string "uw_sqlsuffixString = \"\";",
                   newline,
+                  string "uw_sqlsuffixChar = \"\";",
+                  newline,
                   string "uw_sqlsuffixBlob = \"\";",
                   newline,
                   string "uw_sqlfmtUint4 = \"%u%n\";",
@@ -370,6 +373,7 @@
                     box [string "sqlite3_column_text(stmt, ", string (Int.toString i), string ")"]
                 else
                     box [string "uw_strdup(ctx, sqlite3_column_text(stmt, ", string (Int.toString i), string "))"]
+              | Char => box [string "sqlite3_column_int(stmt, ", string (Int.toString i), string ")"]
               | Bool => box [string "(uw_Basis_bool)sqlite3_column_int(stmt, ", string (Int.toString i), string ")"]
               | Time => box [string "uw_Basis_stringToTime_error(ctx, sqlite3_column_text(stmt, ", string (Int.toString i), string "))"]
               | Blob => box [string "({",
@@ -523,6 +527,11 @@
                                                        string ", ",
                                                        arg,
                                                        string ", -1, SQLITE_TRANSIENT)"]
+                                      | Char => box [string "sqlite3_bind_int(stmt, ",
+                                                       string (Int.toString (i + 1)),
+                                                       string ", ",
+                                                       arg,
+                                                       string ")"]
                                       | Bool => box [string "sqlite3_bind_int(stmt, ",
                                                      string (Int.toString (i + 1)),
                                                      string ", ",