Mercurial > urweb
diff src/mysql.sml @ 877:dae141d911d9
MySQL accepts generated demo DDL
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 16 Jul 2009 13:59:30 -0400 |
parents | 025806b3c014 |
children | a8952047e1d3 |
line wrap: on
line diff
--- a/src/mysql.sml Sun Jul 12 16:09:54 2009 -0400 +++ b/src/mysql.sml Thu Jul 16 13:59:30 2009 -0400 @@ -1283,18 +1283,18 @@ fun nextval _ = box [] fun nextvalPrepared _ = box [] -fun sqlifyString s = "CAST('" ^ String.translate (fn #"'" => "\\'" - | #"\\" => "\\\\" - | ch => - if Char.isPrint ch then - str ch - else - (ErrorMsg.error - "Non-printing character found in SQL string literal"; - "")) - (String.toString s) ^ "' AS longtext)" +fun sqlifyString s = "'" ^ String.translate (fn #"'" => "\\'" + | #"\\" => "\\\\" + | ch => + if Char.isPrint ch then + str ch + else + (ErrorMsg.error + "Non-printing character found in SQL string literal"; + "")) + (String.toString s) ^ "'" -fun p_cast (s, t) = "CAST(" ^ s ^ " AS " ^ p_sql_type t ^ ")" +fun p_cast (s, _) = s fun p_blank _ = "?" @@ -1312,6 +1312,8 @@ sqlifyString = sqlifyString, p_cast = p_cast, p_blank = p_blank, - supportsDeleteAs = false} + supportsDeleteAs = false, + createSequence = fn s => "CREATE TABLE " ^ s ^ " (id INTEGER PRIMARY KEY AUTO_INCREMENT)", + textKeysNeedLengths = true} end