function db_field_exists

Same name in other branches
  1. 8.9.x core/includes/database.inc \db_field_exists()

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

7 calls to db_field_exists()
DatabaseRegressionTestCase::testDBFieldExists in modules/simpletest/tests/database_test.test
Test the db_field_exists() function.
field_sql_storage_update_7001 in 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 modules/simpletest/tests/schema.test
Tests creating unsigned columns and data integrity thereof.
user_update_7002 in modules/user/user.install
Convert user time zones from time zone offsets to time zone names.
user_update_7006 in modules/user/user.install
Add module data to {role_permission}.

... See full list

File

includes/database/database.inc, line 2895

Code

function db_field_exists($table, $field) {
    return Database::getConnection()->schema()
        ->fieldExists($table, $field);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.