function db_field_exists
7.x database.inc | db_field_exists($table, $field) |
Checks if a column exists in the given table.
Parameters
$table: The name of the table in drupal (no prefixing).
$field: The name of the field.
Return value
TRUE if the given column exists, otherwise FALSE.
Related topics
6 calls to db_field_exists()
- DatabaseRegressionTestCase::testDBFieldExists in drupal-7.x/
modules/ simpletest/ tests/ database_test.test - Test the db_field_exists() function.
- field_sql_storage_update_7001 in drupal-7.x/
modules/ field/ modules/ field_sql_storage/ field_sql_storage.install - Remove the field_config_entity_type table and store 'entity_type' strings.
- SchemaTestCase::testUnsignedColumns in drupal-7.x/
modules/ simpletest/ tests/ schema.test - Tests creating unsigned columns and data integrity thereof.
- user_update_7002 in drupal-7.x/
modules/ user/ user.install - Convert user time zones from time zone offsets to time zone names.
- user_update_7006 in drupal-7.x/
modules/ user/ user.install - Add module data to {role_permission}.
File
- drupal-7.x/
includes/ database/ database.inc, line 2776 - Core systems for the database layer.
Code
function db_field_exists($table, $field) {
return Database::getConnection()->schema()->fieldExists($table, $field);
}