aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mysql.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-11-18 17:44:12 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-11-18 17:44:12 -0500
commit13eb7555000c10b0c54e11364c42e0da75b98ca7 (patch)
tree683cd859883db5175662045e278f0b10056e587a /src/mysql.sml
parentaabcc562d7ad7266b6b1e338a14a19224c1169df (diff)
Fix catalog querying about empty tables
Diffstat (limited to 'src/mysql.sml')
-rw-r--r--src/mysql.sml42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/mysql.sml b/src/mysql.sml
index a8a10da7..0715d253 100644
--- a/src/mysql.sml
+++ b/src/mysql.sml
@@ -83,26 +83,28 @@ fun checkRel (table, checkNullable) (s, xts) =
val q' = String.concat ["SELECT COUNT(*) FROM information_schema.columns WHERE ",
both,
" AND (",
- String.concatWith " OR "
- (map (fn (x, t) =>
- String.concat ["(column_name IN ('uw_",
- CharVector.map
- Char.toLower (ident x),
- "', 'uw_",
- ident x,
- "') AND data_type = '",
- p_sql_type_base t,
- "'",
- if checkNullable then
- (" AND is_nullable = '"
- ^ (if isNotNull t then
- "NO"
- else
- "YES")
- ^ "'")
- else
- "",
- ")"]) xts),
+ case String.concatWith " OR "
+ (map (fn (x, t) =>
+ String.concat ["(column_name IN ('uw_",
+ CharVector.map
+ Char.toLower (ident x),
+ "', 'uw_",
+ ident x,
+ "') AND data_type = '",
+ p_sql_type_base t,
+ "'",
+ if checkNullable then
+ (" AND is_nullable = '"
+ ^ (if isNotNull t then
+ "NO"
+ else
+ "YES")
+ ^ "'")
+ else
+ "",
+ ")"]) xts) of
+ "" => "FALSE"
+ | s => s,
")"]
val q'' = String.concat ["SELECT COUNT(*) FROM information_schema.columns WHERE ",