Commit b14a6221 authored by drumm's avatar drumm

#74997 by dww, add db_table_exists()

parent cfaa4b5f
......@@ -364,6 +364,13 @@ function db_unlock_tables() {
db_query('UNLOCK TABLES');
}
/**
* Check if a table exists.
*/
function db_table_exists($table) {
return db_num_rows(db_query("SHOW TABLES LIKE '{" . db_escape_table($table) . "}'"));
}
/**
* @} End of "ingroup database".
*/
......
......@@ -366,6 +366,13 @@ function db_unlock_tables() {
db_query('UNLOCK TABLES');
}
/**
* Check if a table exists.
*/
function db_table_exists($table) {
return db_num_rows(db_query("SHOW TABLES LIKE '{" . db_escape_table($table) . "}'"));
}
/**
* @} End of "ingroup database".
*/
......
......@@ -343,6 +343,13 @@ function db_unlock_tables() {
db_query('COMMIT');
}
/**
* Check if a table exists.
*/
function db_table_exists($table) {
return db_num_rows(db_query("SELECT relname FROM pg_class WHERE relname = '{" . db_escape_table($table) . "}'"));
}
/**
* Verify if the database is set up correctly.
*/
......
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