Commit f000706b authored by Carsten  Rose's avatar Carsten Rose
Browse files

QuickFormQuery.php, Database.php: throw an error if table 'Form' is missing.

parent 0e1a1978
......@@ -146,42 +146,43 @@ const ERROR_EXPECTED_ARRAY = 1061;
const ERROR_REPORT_FAILED_ACTION = 1062;
const ERROR_MISSING_MESSAGE_FAIL = 1063;
const ERROR_MISSING_TABLE_NAME = 1064;
const ERROR_RECORD_NOT_FOUND = 1065;
const ERROR_INVALID_EDITOR_PROPERTY_NAME = 1066;
const ERROR_MISSING_TABLE = 1065;
const ERROR_RECORD_NOT_FOUND = 1066;
const ERROR_INVALID_EDITOR_PROPERTY_NAME = 1067;
// Subrecord
const ERROR_SUBRECORD_MISSING_COLUMN_ID = 1066;
const ERROR_SUBRECORD_MISSING_COLUMN_ID = 1100;
// Store
const ERROR_STORE_VALUE_ALREADY_CODPIED = 1100;
const ERROR_STORE_KEY_EXIST = 1101;
const ERROR_STORE_VALUE_ALREADY_CODPIED = 1200;
const ERROR_STORE_KEY_EXIST = 1201;
// I/O Error
const ERROR_IO_READ_FILE = 1200;
const ERROR_IO_WRITE = 1203;
const ERROR_IO_OPEN = 1204;
const ERROR_IO_UNLINK = 1205;
const ERROR_IO_FILE_EXIST = 1206;
const ERROR_IO_RENAME = 1207;
const ERROR_IO_INVALID_LINK = 1208;
const ERROR_IO_DIR_EXIST_AS_FILE = 1209;
const ERROR_IO_CHDIR = 1210;
const ERROR_IO_READ_FILE = 1300;
const ERROR_IO_WRITE = 1303;
const ERROR_IO_OPEN = 1304;
const ERROR_IO_UNLINK = 1305;
const ERROR_IO_FILE_EXIST = 1306;
const ERROR_IO_RENAME = 1307;
const ERROR_IO_INVALID_LINK = 1308;
const ERROR_IO_DIR_EXIST_AS_FILE = 1309;
const ERROR_IO_CHDIR = 1310;
//Report
const ERROR_UNKNOWN_LINK_QUALIFIER = 1300;
const ERROR_UNDEFINED_RENDER_CONTROL_COMBINATION = 1301;
const ERROR_MISSING_VALUE = 1302;
const ERROR_INVALID_VALUE = 1303;
const ERROR_MULTIPLE_DEFINITION = 1304;
const ERROR_MULTIPLE_URL_PAGE_MAILTO_DEFINITION = 1305;
const ERROR_UNKNOWN_TOKEN = 1306;
const ERROR_TOO_FEW_PARAMETER_FOR_SENDMAIL = 1307;
const ERROR_TOO_MANY_PARAMETER = 1308;
const ERROR_UNKNOWN_LINK_QUALIFIER = 1400;
const ERROR_UNDEFINED_RENDER_CONTROL_COMBINATION = 1401;
const ERROR_MISSING_VALUE = 1402;
const ERROR_INVALID_VALUE = 1403;
const ERROR_MULTIPLE_DEFINITION = 1404;
const ERROR_MULTIPLE_URL_PAGE_MAILTO_DEFINITION = 1405;
const ERROR_UNKNOWN_TOKEN = 1406;
const ERROR_TOO_FEW_PARAMETER_FOR_SENDMAIL = 1407;
const ERROR_TOO_MANY_PARAMETER = 1408;
// Upload
const ERROR_UPLOAD = 1400;
const ERROR_UNKNOWN_ACTION = 1402;
const ERROR_NO_TARGET_PATH_FILE_NAME = 1403;
const ERROR_UPLOAD = 1500;
const ERROR_UNKNOWN_ACTION = 1502;
const ERROR_NO_TARGET_PATH_FILE_NAME = 1503;
// KeyValueParser
const ERROR_KVP_VALUE_HAS_NO_KEY = 1900;
......
......@@ -567,4 +567,27 @@ class Database {
return $this->mysqli->insert_id;
}
/**
* Searches for the table '$name'.
*
* @param $name
* @return bool true if found, else false
*/
public function existTable($name) {
$found = false;
$tables = $this->sql("SHOW tables");
foreach ($tables as $t) {
foreach ($t as $key => $value) {
if ($value === $name) {
$found = true;
break 2;
}
}
}
return $found;
}
}
\ No newline at end of file
......@@ -319,6 +319,10 @@ class QuickFormQuery {
return false;
}
if (!$this->db->existTable('Form')) {
throw new UserFormException("Table 'Form' not found", ERROR_MISSING_TABLE);
}
// Preparation for Log, Debug
$this->store->setVar(SYSTEM_FORM, $formName, STORE_SYSTEM);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment