From 13eb7555000c10b0c54e11364c42e0da75b98ca7 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Fri, 18 Nov 2011 17:44:12 -0500 Subject: Fix catalog querying about empty tables --- src/mysql.sml | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'src/mysql.sml') 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 ", -- cgit v1.2.3