Mercurial > hg > fapweb
diff managedb.php @ 541:e5a088dd3a4b
Validate current table schema before actions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 15 Dec 2013 23:46:41 +0200 |
parents | ab08640b4302 |
children | 8c1a53532be0 |
line wrap: on
line diff
--- a/managedb.php Sun Dec 15 23:46:19 2013 +0200 +++ b/managedb.php Sun Dec 15 23:46:41 2013 +0200 @@ -685,6 +685,27 @@ exit; } +// Validate tables data +$errors = FALSE; +foreach ($sqlTables as $table => $data) +{ + if (strtolower($table) != $table) + { + echo "Invalid table definition '".$table."', table name must be lower case.\n"; + $errors = TRUE; + } + + foreach ($data as $def) + if (strtolower($def[0]) != $def[0]) + { + echo "Invalid table definition '".$table."', column key '".$def[0]."' must be lower case.\n"; + $errors = TRUE; + } +} + +if ($errors) + die("Errors in table definitions.\n"); + // Act according to specified command $addTestData = FALSE;