You are here

function db_table_exists in Drupal 6

Same name in this branch
  1. 6 includes/database.mysqli.inc \db_table_exists()
  2. 6 includes/database.mysql.inc \db_table_exists()
  3. 6 includes/database.pgsql.inc \db_table_exists()
Same name and namespace in other branches
  1. 8 core/includes/database.inc \db_table_exists()
  2. 5 includes/database.mysqli.inc \db_table_exists()
  3. 5 includes/database.mysql.inc \db_table_exists()
  4. 5 includes/database.pgsql.inc \db_table_exists()
  5. 7 includes/database/database.inc \db_table_exists()

Check if a table exists.

Parameters

$table: The name of the table.

Return value

TRUE if the table exists, and FALSE if the table does not exist.

Related topics

16 calls to db_table_exists()
blogapi_update_6001 in modules/blogapi/blogapi.install
Add blogapi_files table to enable size restriction for BlogAPI file uploads.
system_update_6019 in modules/system/system.install
Reconcile small differences in the previous, manually created mysql and pgsql schemas so they are the same and can be represented by a single schema structure.
system_update_6030 in modules/system/system.install
Add the tables required by actions.inc.
system_update_6032 in modules/system/system.install
profile_fields.name used to be nullable but is part of a unique key and so shouldn't be.
system_update_6033 in modules/system/system.install
Change node_comment_statistics to be not autoincrement.

... See full list

File

includes/database.mysqli.inc, line 355
Database interface code for MySQL database servers using the mysqli client libraries. mysqli is included in PHP 5 by default and allows developers to use the advanced features of MySQL 4.1.x, 5.0.x and beyond.

Code

function db_table_exists($table) {
  return (bool) db_fetch_object(db_query("SHOW TABLES LIKE '{" . db_escape_table($table) . "}'"));
}