Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
876:025806b3c014 | 877:dae141d911d9 |
---|---|
1281 string "\""]}] | 1281 string "\""]}] |
1282 | 1282 |
1283 fun nextval _ = box [] | 1283 fun nextval _ = box [] |
1284 fun nextvalPrepared _ = box [] | 1284 fun nextvalPrepared _ = box [] |
1285 | 1285 |
1286 fun sqlifyString s = "CAST('" ^ String.translate (fn #"'" => "\\'" | 1286 fun sqlifyString s = "'" ^ String.translate (fn #"'" => "\\'" |
1287 | #"\\" => "\\\\" | 1287 | #"\\" => "\\\\" |
1288 | ch => | 1288 | ch => |
1289 if Char.isPrint ch then | 1289 if Char.isPrint ch then |
1290 str ch | 1290 str ch |
1291 else | 1291 else |
1292 (ErrorMsg.error | 1292 (ErrorMsg.error |
1293 "Non-printing character found in SQL string literal"; | 1293 "Non-printing character found in SQL string literal"; |
1294 "")) | 1294 "")) |
1295 (String.toString s) ^ "' AS longtext)" | 1295 (String.toString s) ^ "'" |
1296 | 1296 |
1297 fun p_cast (s, t) = "CAST(" ^ s ^ " AS " ^ p_sql_type t ^ ")" | 1297 fun p_cast (s, _) = s |
1298 | 1298 |
1299 fun p_blank _ = "?" | 1299 fun p_blank _ = "?" |
1300 | 1300 |
1301 val () = addDbms {name = "mysql", | 1301 val () = addDbms {name = "mysql", |
1302 header = "mysql/mysql.h", | 1302 header = "mysql/mysql.h", |
1310 nextval = nextval, | 1310 nextval = nextval, |
1311 nextvalPrepared = nextvalPrepared, | 1311 nextvalPrepared = nextvalPrepared, |
1312 sqlifyString = sqlifyString, | 1312 sqlifyString = sqlifyString, |
1313 p_cast = p_cast, | 1313 p_cast = p_cast, |
1314 p_blank = p_blank, | 1314 p_blank = p_blank, |
1315 supportsDeleteAs = false} | 1315 supportsDeleteAs = false, |
1316 createSequence = fn s => "CREATE TABLE " ^ s ^ " (id INTEGER PRIMARY KEY AUTO_INCREMENT)", | |
1317 textKeysNeedLengths = true} | |
1316 | 1318 |
1317 end | 1319 end |