diff options
author | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-07-26 07:16:08 +0000 |
---|---|---|
committer | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-07-26 07:16:08 +0000 |
commit | b14a62210355e37382eee2f1c883623db77408a8 (patch) | |
tree | 73d6c86c0875e348cc10f98d69ab92fbcc58ae82 | |
parent | cfaa4b5f76ff2f5dbb21c1b03c319659963b7cd9 (diff) | |
download | brdo-b14a62210355e37382eee2f1c883623db77408a8.tar.gz brdo-b14a62210355e37382eee2f1c883623db77408a8.tar.bz2 |
#74997 by dww, add db_table_exists()
-rw-r--r-- | includes/database.mysql.inc | 7 | ||||
-rw-r--r-- | includes/database.mysqli.inc | 7 | ||||
-rw-r--r-- | includes/database.pgsql.inc | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc index 0326bd508..731107be8 100644 --- a/includes/database.mysql.inc +++ b/includes/database.mysql.inc @@ -365,6 +365,13 @@ function db_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". */ diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc index a84383357..f15f7cf01 100644 --- a/includes/database.mysqli.inc +++ b/includes/database.mysqli.inc @@ -367,6 +367,13 @@ function db_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". */ diff --git a/includes/database.pgsql.inc b/includes/database.pgsql.inc index bb7ffd1c0..e969f722a 100644 --- a/includes/database.pgsql.inc +++ b/includes/database.pgsql.inc @@ -344,6 +344,13 @@ function db_unlock_tables() { } /** + * 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. */ function db_check_setup() { |