15,22c15,39 < if (db_result(db_query("DESC {term_access} 'grant_list'"))) { < drupal_set_message(t("Taxonomy Access - Update #2: No queries executed. Field 'grant_list' already exists in tables 'term_access'."), 'error'); < } < else { < $ret[] = update_sql("ALTER TABLE {term_access} ADD grant_list TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL"); < $ret[] = update_sql("UPDATE {term_access} SET grant_list = grant_view"); < $ret[] = update_sql("ALTER TABLE {term_access_defaults} ADD grant_list TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL"); < $ret[] = update_sql("UPDATE {term_access_defaults} SET grant_list = grant_view"); --- > > /* Allow for psql/mysql syntactic differences */ > switch ($GLOBALS['db_type']) { > case 'pgsql': > $ret[] = update_sql("ALTER TABLE {term_access} ADD grant_list smallint"); > $ret[] = update_sql("ALTER TABLE {term_access} ALTER COLUMN grant_list SET DEFAULT '0'"); > $ret[] = update_sql("UPDATE {term_access} SET grant_list = grant_view"); > $ret[] = update_sql("ALTER TABLE {term_access_defaults} ADD grant_list smallint"); > $ret[] = update_sql("ALTER TABLE {term_access_defaults} ALTER COLUMN grant_list SET DEFAULT '0'"); > $ret[] = update_sql("UPDATE {term_access_defaults} SET grant_list = grant_view"); > break; > case 'mysql': > case 'mysqli': > > /* Somebody tell me how we do this check for postgres! */ > if (db_result(db_query("DESC {term_access} 'grant_list'"))) { > drupal_set_message(t("Taxonomy Access - Update #2: No queries executed. Field 'grant_list' already exists in tables 'term_access'."), 'error'); > } > else { > $ret[] = update_sql("ALTER TABLE {term_access} ADD grant_list TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL"); > $ret[] = update_sql("UPDATE {term_access} SET grant_list = grant_view"); > $ret[] = update_sql("ALTER TABLE {term_access_defaults} ADD grant_list TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL"); > $ret[] = update_sql("UPDATE {term_access_defaults} SET grant_list = grant_view"); > } > break; 23a41 >