db_column_exists
Definition
db_column_exists($table, $column)
includes/database.pgsql.inc, line 392
Description
Check if a column exists in the given table.
Related topics
| Name | Description |
|---|---|
| Database abstraction layer | Allow the use of different database servers using the same code base. |
Code
<?php
function db_column_exists($table, $column) {
return (bool) db_result(db_query("SELECT COUNT(pg_attribute.attname) FROM pg_class, pg_attribute WHERE pg_attribute.attrelid = pg_class.oid AND pg_class.relname = '{". db_escape_table($table) ."}' AND attname = '". db_escape_table($column) ."'"));
}
?> 