You are here

function _flag_column_exists in Flag 5

Same name and namespace in other branches
  1. 6 flag.install \_flag_column_exists()
2 calls to _flag_column_exists()
flag_update_5001 in ./flag.install
Move flag messages and link titles into the options array.
flag_update_5002 in ./flag.install
Add a 'serial' primary key, fcid, to the flag_content table.

File

./flag.install, line 408
Flag module install/update hooks.

Code

function _flag_column_exists($table, $column) {
  if (function_exists('db_column_exists')) {
    return db_column_exists($table, $column);
  }
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      return (bool) db_fetch_object(db_query("SHOW COLUMNS FROM {flags} LIKE 'flag_short'"));
    case 'pgsql':
      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) . "'"));
  }
}