? BODY-AS-FIELD.patch ? FIELD-TO-COLUMN-PARTIAL.patch ? Makefile ? constants.pl ? d6-50-nodes.sql.gz ? d7-50-nodes.sql.gz ? head.kpf ? patches ? modules/field/field.delete.inc ? modules/field/modules/combo ? scripts/generate-autoload.pl ? sites/all/modules/cck ? sites/all/modules/devel ? sites/all/modules/pbs ? sites/all/modules/taint ? sites/default/files ? sites/default/settings.php Index: update.php =================================================================== RCS file: /cvs/drupal/drupal/update.php,v retrieving revision 1.283 diff -u -F^[fc] -r1.283 update.php --- update.php 16 May 2009 20:25:19 -0000 1.283 +++ update.php 17 May 2009 15:43:25 -0000 @@ -32,7 +32,7 @@ * * Note: when you add a column with NOT NULL and you are not sure if there are * already rows in the table, you MUST also add DEFAULT. Otherwise PostgreSQL - * won't work when the table is not empty, and db_add_column() will fail. + * won't work when the table is not empty, and db_old_add_column() will fail. * To have an empty string as the default, you must use: 'default' => "''" * in the $attributes array. If NOT NULL and DEFAULT are set the PostgreSQL * version will set values of the added column in old rows to the @@ -53,7 +53,7 @@ * @return * nothing, but modifies $ret parameter. */ -function db_add_column(&$ret, $table, $column, $type, $attributes = array()) { +function db_old_add_column(&$ret, $table, $column, $type, $attributes = array()) { if (array_key_exists('not null', $attributes) and $attributes['not null']) { $not_null = 'NOT NULL'; } @@ -109,7 +109,7 @@ function db_add_column(&$ret, $table, $c * @return * nothing, but modifies $ret parameter. */ -function db_change_column(&$ret, $table, $column, $column_new, $type, $attributes = array()) { +function db_old_change_column(&$ret, $table, $column, $column_new, $type, $attributes = array()) { if (array_key_exists('not null', $attributes) and $attributes['not null']) { $not_null = 'NOT NULL'; } @@ -457,7 +457,7 @@ function update_create_batch_table() { } $schema['batch'] = array( - 'fields' => array( + 'columns' => array( 'bid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), 'token' => array('type' => 'varchar', 'length' => 64, 'not null' => TRUE), 'timestamp' => array('type' => 'int', 'not null' => TRUE), @@ -539,25 +539,25 @@ function update_fix_d6_requirements() { if (drupal_get_installed_schema_version('system') < 6000 && !variable_get('update_d6_requirements', FALSE)) { $spec = array('type' => 'int', 'size' => 'small', 'default' => 0, 'not null' => TRUE); - db_add_field($ret, 'cache', 'serialized', $spec); - db_add_field($ret, 'cache_filter', 'serialized', $spec); - db_add_field($ret, 'cache_page', 'serialized', $spec); - db_add_field($ret, 'cache_menu', 'serialized', $spec); + db_add_column($ret, 'cache', 'serialized', $spec); + db_add_column($ret, 'cache_filter', 'serialized', $spec); + db_add_column($ret, 'cache_page', 'serialized', $spec); + db_add_column($ret, 'cache_menu', 'serialized', $spec); - db_add_field($ret, 'system', 'info', array('type' => 'text')); - db_add_field($ret, 'system', 'owner', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')); + db_add_column($ret, 'system', 'info', array('type' => 'text')); + db_add_column($ret, 'system', 'owner', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')); if (db_table_exists('locales_target')) { - db_add_field($ret, 'locales_target', 'language', array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => '')); + db_add_column($ret, 'locales_target', 'language', array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => '')); } if (db_table_exists('locales_source')) { - db_add_field($ret, 'locales_source', 'textgroup', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'default')); - db_add_field($ret, 'locales_source', 'version', array('type' => 'varchar', 'length' => 20, 'not null' => TRUE, 'default' => 'none')); + db_add_column($ret, 'locales_source', 'textgroup', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'default')); + db_add_column($ret, 'locales_source', 'version', array('type' => 'varchar', 'length' => 20, 'not null' => TRUE, 'default' => 'none')); } variable_set('update_d6_requirements', TRUE); // Create the cache_block table. See system_update_6027() for more details. $schema['cache_block'] = array( - 'fields' => array( + 'columns' => array( 'cid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'data' => array('type' => 'blob', 'not null' => FALSE, 'size' => 'big'), 'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), Index: includes/actions.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/actions.inc,v retrieving revision 1.26 diff -u -F^[fc] -r1.26 actions.inc --- includes/actions.inc 18 Mar 2009 09:50:46 -0000 1.26 +++ includes/actions.inc 17 May 2009 15:43:25 -0000 @@ -63,10 +63,10 @@ function actions_do($action_ids, $object // instance data. if (!empty($conditions)) { $query = db_select('actions'); - $query->addField('actions', 'aid'); - $query->addField('actions', 'type'); - $query->addField('actions', 'callback'); - $query->addField('actions', 'parameters'); + $query->addColumn('actions', 'aid'); + $query->addColumn('actions', 'type'); + $query->addColumn('actions', 'callback'); + $query->addColumn('actions', 'parameters'); $query->condition('aid', $conditions, 'IN'); $result = $query->execute(); foreach ($result as $action) { @@ -235,7 +235,7 @@ function actions_function_lookup($hash) } // Must be an instance; must check database. - return db_query("SELECT aid FROM {actions} WHERE MD5(aid) = :hash AND parameters <> ''", array(':hash' => $hash))->fetchField(); + return db_query("SELECT aid FROM {actions} WHERE MD5(aid) = :hash AND parameters <> ''", array(':hash' => $hash))->fetchColumn(); } /** @@ -267,7 +267,7 @@ function actions_synchronize($delete_orp else { // This is a new singleton that we don't have an aid for; assign one. db_insert('actions') - ->fields(array( + ->columns(array( 'aid' => $callback, 'type' => $array['type'], 'callback' => $callback, @@ -326,7 +326,7 @@ function actions_save($function, $type, db_merge('actions') ->key(array('aid' => $aid)) - ->fields(array( + ->columns(array( 'callback' => $function, 'type' => $type, 'parameters' => serialize($params), Index: includes/batch.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/batch.inc,v retrieving revision 1.35 diff -u -F^[fc] -r1.35 batch.inc --- includes/batch.inc 6 May 2009 10:41:29 -0000 1.35 +++ includes/batch.inc 17 May 2009 15:43:25 -0000 @@ -32,7 +32,7 @@ function _batch_page() { $batch = db_query("SELECT batch FROM {batch} WHERE bid = :bid AND token = :token", array( ':bid' => $_REQUEST['id'], ':token' => drupal_get_token($_REQUEST['id'])) - )->fetchField(); + )->fetchColumn(); if (!$batch) { drupal_set_message(t('No active batch.'), 'error'); @@ -454,7 +454,7 @@ function _batch_finished() { function _batch_shutdown() { if ($batch = batch_get()) { db_update('batch') - ->fields(array('batch' => serialize($batch))) + ->columns(array('batch' => serialize($batch))) ->condition('bid', $batch['id']) ->execute(); } Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.280 diff -u -F^[fc] -r1.280 bootstrap.inc --- includes/bootstrap.inc 12 May 2009 18:08:42 -0000 1.280 +++ includes/bootstrap.inc 17 May 2009 15:43:25 -0000 @@ -572,7 +572,7 @@ function drupal_get_filename($type, $nam // the database. This is required because this function is called both // before we have a database connection (i.e. during installation) and // when a database connection fails. - elseif (db_is_active() && (($file = db_query("SELECT filename FROM {system} WHERE name = :name AND type = :type", array(':name' => $name, ':type' => $type))->fetchField()) && file_exists($file))) { + elseif (db_is_active() && (($file = db_query("SELECT filename FROM {system} WHERE name = :name AND type = :type", array(':name' => $name, ':type' => $type))->fetchColumn()) && file_exists($file))) { $files[$type][$name] = $file; } else { @@ -647,7 +647,7 @@ function variable_get($name, $default = function variable_set($name, $value) { global $conf; - db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); + db_merge('variable')->key(array('name' => $name))->columns(array('value' => serialize($value)))->execute(); cache_clear_all('variables', 'cache'); @@ -1241,7 +1241,7 @@ function drupal_is_denied($ip) { return in_array($ip, $blocked_ips); } else { - return (bool)db_query("SELECT 1 FROM {blocked_ips} WHERE ip = :ip", array(':ip' => $ip))->fetchField(); + return (bool)db_query("SELECT 1 FROM {blocked_ips} WHERE ip = :ip", array(':ip' => $ip))->fetchColumn(); } } @@ -1785,7 +1785,7 @@ function _registry_check_code($type, $na ':name' => $name, ':type' => $type, )) - ->fetchField(); + ->fetchColumn(); // Flag that we've run a lookup query and need to update the cache. $cache_update_needed = TRUE; Index: includes/cache.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/cache.inc,v retrieving revision 1.32 diff -u -F^[fc] -r1.32 cache.inc --- includes/cache.inc 16 May 2009 16:06:04 -0000 1.32 +++ includes/cache.inc 17 May 2009 15:43:25 -0000 @@ -119,7 +119,7 @@ function cache_set($cid, $data, $table = db_merge($table) ->key(array('cid' => $cid)) - ->fields($fields) + ->columns($fields) ->execute(); } Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.904 diff -u -F^[fc] -r1.904 common.inc --- includes/common.inc 16 May 2009 19:58:38 -0000 1.904 +++ includes/common.inc 17 May 2009 15:43:25 -0000 @@ -1221,7 +1221,7 @@ function valid_url($url, $absolute = FAL */ function flood_register_event($name) { db_insert('flood') - ->fields(array( + ->columns(array( 'event' => $name, 'hostname' => ip_address(), 'timestamp' => REQUEST_TIME, @@ -1247,7 +1247,7 @@ function flood_is_allowed($name, $thresh ':event' => $name, ':hostname' => ip_address(), ':timestamp' => REQUEST_TIME - 3600)) - ->fetchField(); + ->fetchColumn(); return ($number < $threshold); } @@ -3855,7 +3855,7 @@ function _drupal_initialize_schema($modu **/ function drupal_schema_fields_sql($table, $prefix = NULL) { $schema = drupal_get_schema($table); - $fields = array_keys($schema['fields']); + $fields = array_keys($schema['columns']); if ($prefix) { $columns = array(); foreach ($fields as $field) { @@ -3915,7 +3915,7 @@ function drupal_write_record($table, &$o // Go through our schema, build SQL, and when inserting, fill in defaults for // fields that are not set. - foreach ($schema['fields'] as $field => $info) { + foreach ($schema['columns'] as $field => $info) { // Special case -- skip serial types if we are updating. if ($info['type'] == 'serial' && !empty($primary_keys)) { continue; @@ -3978,11 +3978,11 @@ function drupal_write_record($table, &$o // Build the SQL. if (empty($primary_keys)) { - $query = db_insert($table)->fields($fields); + $query = db_insert($table)->columns($fields); $return = SAVED_NEW; } else { - $query = db_update($table)->fields($fields); + $query = db_update($table)->columns($fields); foreach ($primary_keys as $key) { $query->condition($key, $object->$key); } Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.168 diff -u -F^[fc] -r1.168 file.inc --- includes/file.inc 17 May 2009 10:42:16 -0000 1.168 +++ includes/file.inc 17 May 2009 15:43:25 -0000 @@ -11,7 +11,7 @@ * @{ * Common file handling functions. * - * Fields on the file object: + * Columns on the file object: * - fid - File ID * - uid - The {users}.uid of the user who is associated with the file. * - filename - Name of the file with no path components. This may differ from @@ -272,7 +272,7 @@ function file_check_location($source, $d * @see file_load() */ function file_load_multiple($fids = array(), $conditions = array()) { - $query = db_select('files', 'f')->fields('f'); + $query = db_select('files', 'f')->columns('f'); // If the $fids array is populated, add those to the query. if ($fids) { @@ -857,7 +857,7 @@ function file_space_used($uid = NULL, $s if (!is_null($uid)) { $query->condition('f.uid', $uid); } - return $query->execute()->fetchField(); + return $query->execute()->fetchColumn(); } /** Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.335 diff -u -F^[fc] -r1.335 form.inc --- includes/form.inc 13 May 2009 17:23:48 -0000 1.335 +++ includes/form.inc 17 May 2009 15:43:25 -0000 @@ -2758,11 +2758,11 @@ function form_clean_id($id = NULL, $flus * if (empty($context['sandbox'])) { * $context['sandbox']['progress'] = 0; * $context['sandbox']['current_node'] = 0; - * $context['sandbox']['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchField(); + * $context['sandbox']['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchColumn(); * } * $limit = 5; * $result = db_select('node') - * ->fields('node', array('nid')) + * ->columns('node', array('nid')) * ->condition('nid', $context['sandbox']['current_node'], '>') * ->orderBy('nid') * ->range(0, $limit) @@ -2932,7 +2932,7 @@ function batch_process($redirect = NULL, // Initiate db storage in order to get a batch id. We have to provide // at least an empty string for the (not null) 'token' column. $batch['id'] = db_insert('batch') - ->fields(array( + ->columns(array( 'token' => '', 'timestamp' => REQUEST_TIME, )) @@ -2946,7 +2946,7 @@ function batch_process($redirect = NULL, // Actually store the batch data and the token generated form the batch id. db_update('batch') ->condition('bid', $batch['id']) - ->fields(array( + ->columns(array( 'token' => drupal_get_token($batch['id']), 'batch' => serialize($batch), )) Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.90 diff -u -F^[fc] -r1.90 install.inc --- includes/install.inc 12 May 2009 18:08:42 -0000 1.90 +++ includes/install.inc 17 May 2009 15:43:25 -0000 @@ -153,7 +153,7 @@ function drupal_get_installed_schema_ver */ function drupal_set_installed_schema_version($module, $version) { db_update('system') - ->fields(array('schema_version' => $version)) + ->columns(array('schema_version' => $version)) ->condition('name', $module) ->execute(); } @@ -580,7 +580,7 @@ function drupal_install_system() { $system_versions = drupal_get_schema_versions('system'); $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED; db_insert('system') - ->fields(array('filename', 'name', 'type', 'owner', 'status', 'schema_version')) + ->columns(array('filename', 'name', 'type', 'owner', 'status', 'schema_version')) ->values(array( 'filename' => $system_path . '/system.module', 'name' => 'system', @@ -628,7 +628,7 @@ function drupal_uninstall_modules($modul $placeholders = implode(', ', array_fill(0, count($paths), "'%s'")); $result = db_select('menu_links') - ->fields('menu_links') + ->columns('menu_links') ->condition('router_path', $paths, 'IN') ->condition('external', 0) ->orderBy('depth') Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.215 diff -u -F^[fc] -r1.215 locale.inc --- includes/locale.inc 12 May 2009 08:37:44 -0000 1.215 +++ includes/locale.inc 17 May 2009 15:43:25 -0000 @@ -127,7 +127,7 @@ function locale_languages_overview_form_ } $language->weight = $form_state['values']['weight'][$langcode]; db_update('languages') - ->fields(array( + ->columns(array( 'enabled' => $language->enabled, 'weight' => $language->weight, )) @@ -303,7 +303,7 @@ function _locale_languages_common_contro function locale_languages_predefined_form_validate($form, &$form_state) { $langcode = $form_state['values']['langcode']; - if (($duplicate = db_query("SELECT COUNT(*) FROM {languages} WHERE language = :language", array(':language' => $langcode))->fetchField()) != 0) { + if (($duplicate = db_query("SELECT COUNT(*) FROM {languages} WHERE language = :language", array(':language' => $langcode))->fetchColumn()) != 0) { form_set_error('langcode', t('The language %language (%code) already exists.', array('%language' => $form_state['values']['name'], '%code' => $langcode))); } @@ -356,13 +356,13 @@ function locale_languages_edit_form_vali if (!empty($form_state['values']['domain']) && !empty($form_state['values']['prefix'])) { form_set_error('prefix', t('Domain and path prefix values should not be set at the same time.')); } - if (!empty($form_state['values']['domain']) && $duplicate = db_query("SELECT language FROM {languages} WHERE domain = :domain AND language <> :language", array(':domain' => $form_state['values']['domain'], ':language' => $form_state['values']['langcode']))->fetchField()) { + if (!empty($form_state['values']['domain']) && $duplicate = db_query("SELECT language FROM {languages} WHERE domain = :domain AND language <> :language", array(':domain' => $form_state['values']['domain'], ':language' => $form_state['values']['langcode']))->fetchColumn()) { form_set_error('domain', t('The domain (%domain) is already tied to a language (%language).', array('%domain' => $form_state['values']['domain'], '%language' => $duplicate->language))); } if (empty($form_state['values']['prefix']) && language_default('language') != $form_state['values']['langcode'] && empty($form_state['values']['domain'])) { form_set_error('prefix', t('Only the default language can have both the domain and prefix empty.')); } - if (!empty($form_state['values']['prefix']) && $duplicate = db_query("SELECT language FROM {languages} WHERE prefix = :prefix AND language <> :language", array(':prefix' => $form_state['values']['prefix'], ':language' => $form_state['values']['langcode']))->fetchField()) { + if (!empty($form_state['values']['prefix']) && $duplicate = db_query("SELECT language FROM {languages} WHERE prefix = :prefix AND language <> :language", array(':prefix' => $form_state['values']['prefix'], ':language' => $form_state['values']['langcode']))->fetchColumn()) { form_set_error('prefix', t('The prefix (%prefix) is already tied to a language (%language).', array('%prefix' => $form_state['values']['prefix'], '%language' => $duplicate->language))); } } @@ -372,7 +372,7 @@ function locale_languages_edit_form_vali */ function locale_languages_edit_form_submit($form, &$form_state) { db_update('languages') - ->fields(array( + ->columns(array( 'name' => $form_state['values']['name'], 'native' => $form_state['values']['native'], 'domain' => $form_state['values']['domain'], @@ -449,7 +449,7 @@ function locale_languages_delete_form_su ->condition('language', $form_state['values']['langcode']) ->execute(); db_update('node') - ->fields(array('language' => '')) + ->columns(array('language' => '')) ->condition('language', $form_state['values']['langcode']) ->execute(); $variables = array('%locale' => $languages[$form_state['values']['langcode']]->name); @@ -982,12 +982,12 @@ function locale_translate_edit_form_vali function locale_translate_edit_form_submit($form, &$form_state) { $lid = $form_state['values']['lid']; foreach ($form_state['values']['translations'] as $key => $value) { - $translation = db_query("SELECT translation FROM {locales_target} WHERE lid = :lid AND language = :language", array(':lid' => $lid, ':language' => $key))->fetchField(); + $translation = db_query("SELECT translation FROM {locales_target} WHERE lid = :lid AND language = :language", array(':lid' => $lid, ':language' => $key))->fetchColumn(); if (!empty($value)) { // Only update or insert if we have a value to use. if (!empty($translation)) { db_update('locales_target') - ->fields(array( + ->columns(array( 'translation' => $value, )) ->condition('lid', $lid) @@ -996,7 +996,7 @@ function locale_translate_edit_form_subm } else { db_insert('locales_target') - ->fields(array( + ->columns(array( 'lid' => $lid, 'translation' => $value, 'language' => $key, @@ -1117,7 +1117,7 @@ function locale_add_language($langcode, } db_insert('languages') - ->fields(array( + ->columns(array( 'language' => $langcode, 'name' => $name, 'native' => $native, @@ -1171,7 +1171,7 @@ function _locale_import_po($file, $langc } // Check if we have the language already in the database. - if (!db_query("SELECT COUNT(language) FROM {languages} WHERE language = :language", array(':language' => $langcode))->fetchField()) { + if (!db_query("SELECT COUNT(language) FROM {languages} WHERE language = :language", array(':language' => $langcode))->fetchColumn()) { drupal_set_message(t('The language selected for import is not supported.'), 'error'); return FALSE; } @@ -1421,7 +1421,7 @@ function _locale_import_one_string($op, if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) { list($nplurals, $plural) = $p; db_update('languages') - ->fields(array( + ->columns(array( 'plurals' => $nplurals, 'formula' => $plural, )) @@ -1430,7 +1430,7 @@ function _locale_import_one_string($op, } else { db_update('languages') - ->fields(array( + ->columns(array( 'plurals' => 0, 'formula' => '', )) @@ -1497,7 +1497,7 @@ function _locale_import_one_string($op, * The string ID of the existing string modified or the new string added. */ function _locale_import_one_string_db(&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid = 0, $plural = 0) { - $lid = db_query("SELECT lid FROM {locales_source} WHERE source = :source AND textgroup = :textgroup", array(':source' => $source, ':textgroup' => $textgroup))->fetchField(); + $lid = db_query("SELECT lid FROM {locales_source} WHERE source = :source AND textgroup = :textgroup", array(':source' => $source, ':textgroup' => $textgroup))->fetchColumn(); if (!empty($translation)) { // Skip this string unless it passes a check for dangerous code. @@ -1510,18 +1510,18 @@ function _locale_import_one_string_db(&$ elseif ($lid) { // We have this source string saved already. db_update('locales_source') - ->fields(array( + ->columns(array( 'location' => $location, )) ->condition('lid', $lid) ->execute(); - $exists = db_query("SELECT COUNT(lid) FROM {locales_target} WHERE lid = :lid AND language = :language", array(':lid' => $lid, ':language' => $langcode))->fetchField(); + $exists = db_query("SELECT COUNT(lid) FROM {locales_target} WHERE lid = :lid AND language = :language", array(':lid' => $lid, ':language' => $langcode))->fetchColumn(); if (!$exists) { // No translation in this language. db_insert('locales_target') - ->fields(array( + ->columns(array( 'lid' => $lid, 'language' => $langcode, 'translation' => $translation, @@ -1535,7 +1535,7 @@ function _locale_import_one_string_db(&$ elseif ($mode == LOCALE_IMPORT_OVERWRITE) { // Translation exists, only overwrite if instructed. db_update('locales_target') - ->fields(array( + ->columns(array( 'translation' => $translation, 'plid' => $plid, 'plural' => $plural, @@ -1550,11 +1550,11 @@ function _locale_import_one_string_db(&$ else { // No such source string in the database yet. $lid = db_insert('locales_source') - ->fields(array('location' => $location, 'source' => $source, 'textgroup' => $textgroup)) + ->columns(array('location' => $location, 'source' => $source, 'textgroup' => $textgroup)) ->execute(); db_insert('locales_target') - ->fields(array( + ->columns(array( 'lid' => $lid, 'language' => $langcode, 'translation' => $translation, @@ -1922,7 +1922,7 @@ function _locale_parse_js_file($filepath // Save the new locations string to the database. db_update('locales_source') - ->fields(array( + ->columns(array( 'location' => $locations, )) ->condition('lid', $source->lid) @@ -1932,7 +1932,7 @@ function _locale_parse_js_file($filepath else { // We don't have the source string yet, thus we insert it into the database. db_insert('locales_source') - ->fields(array( + ->columns(array( 'location' => $filepath, 'source' => $string, 'textgroup' => 'default', @@ -2202,8 +2202,8 @@ function _locale_translate_seek() { $sql_query = db_select('locales_source', 's'); $sql_query->leftJoin('locales_target', 't', 't.lid = s.lid'); - $sql_query->fields('s', array('source', 'location', 'lid', 'textgroup')); - $sql_query->fields('t', array('translation', 'language')); + $sql_query->columns('s', array('source', 'location', 'lid', 'textgroup')); + $sql_query->columns('t', array('translation', 'language')); // Compute LIKE section. switch ($query['translation']) { @@ -2430,7 +2430,7 @@ function _locale_rebuild_js($langcode = // just got deleted). Act only if some operation was executed. if ($status) { db_update('languages') - ->fields(array( + ->columns(array( 'javascript' => $language->javascript, )) ->condition('language', $language->language) @@ -2546,7 +2546,7 @@ function locale_batch_by_language($langc $files = array(); $components = array(); $query = db_select('system', 's'); - $query->fields('s', array('name', 'filename')); + $query->columns('s', array('name', 'filename')); $query->condition('s.status', 1); if (count($skip)) { $query->condition('name', $skip, 'NOT IN'); Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.324 diff -u -F^[fc] -r1.324 menu.inc --- includes/menu.inc 14 May 2009 08:35:58 -0000 1.324 +++ includes/menu.inc 17 May 2009 15:43:26 -0000 @@ -362,7 +362,7 @@ function menu_get_item($path = NULL, $ro $parts = array_slice($original_map, 0, MENU_MAX_PARTS); $ancestors = menu_get_ancestors($parts); $router_item = db_select('menu_router') - ->fields('menu_router') + ->columns('menu_router') ->condition('path', $ancestors, 'IN') ->orderBy('fit', 'DESC') ->range(0, 1) @@ -866,8 +866,8 @@ function menu_tree_all_data($menu_name, // Build and run the query, and build the tree. $query = db_select('menu_links', 'ml'); $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path'); - $query->fields('ml'); - $query->fields('m', array( + $query->columns('ml'); + $query->columns('m', array( 'load_functions', 'to_arg_functions', 'access_callback', @@ -967,7 +967,7 @@ function menu_tree_page_data($menu_name) $args[] = ''; } $parents = db_select('menu_links') - ->fields('menu_links', array( + ->columns('menu_links', array( 'p1', 'p2', 'p3', @@ -985,7 +985,7 @@ function menu_tree_page_data($menu_name) // If no link exists, we may be on a local task that's not in the links. // TODO: Handle the case like a local task on a specific node in the menu. $parents = db_select('menu_links') - ->fields('menu_links', array( + ->columns('menu_links', array( 'p1', 'p2', 'p3', @@ -1011,7 +1011,7 @@ function menu_tree_page_data($menu_name) // their children to the list as well. do { $result = db_select('menu_links', NULL, array('fetch' => PDO::FETCH_ASSOC)) - ->fields('menu_links', array('mlid')) + ->columns('menu_links', array('mlid')) ->condition('menu_name', $menu_name) ->condition('expanded', 1) ->condition('has_children', 1) @@ -1036,8 +1036,8 @@ function menu_tree_page_data($menu_name) // link. $query = db_select('menu_links', 'ml'); $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path'); - $query->fields('ml'); - $query->fields('m', array( + $query->columns('ml'); + $query->columns('m', array( 'load_functions', 'to_arg_functions', 'access_callback', @@ -1121,7 +1121,7 @@ function menu_tree_check_access(&$tree, // Use db_rewrite_sql to evaluate view access without loading each full node. $nids = array_keys($node_links); $select = db_select('node'); - $select->addField('node', 'nid'); + $select->addColumn('node', 'nid'); $select->condition('status', 1); $select->condition('nid', $nids, 'IN'); $select->addTag('node_access'); @@ -1333,7 +1333,7 @@ function menu_get_names() { if (empty($names)) { $names = db_select('menu_links') ->distinct() - ->fields('menu_links', 'menu_name') + ->columns('menu_links', 'menu_name') ->orderBy('menu_name') ->execute()->fetchCol(); } @@ -1443,7 +1443,7 @@ function menu_local_tasks($level = 0, $r } // Get all tabs and the root page. $result = db_select('menu_router', NULL, array('fetch' => PDO::FETCH_ASSOC)) - ->fields('menu_router') + ->columns('menu_router') ->condition('tab_root', $router_item['tab_root']) ->orderBy('weight') ->orderBy('title') @@ -1667,7 +1667,7 @@ function menu_set_active_trail($new_trai // Determine if the current page is a link in any of the active menus. if ($menu_names) { $query = db_select('menu_links', 'ml'); - $query->fields('ml', array('menu_name')); + $query->columns('ml', array('menu_name')); $query->condition('ml.link_path', $item['href']); $query->condition('ml.menu_name', $menu_names, 'IN'); $result = $query->execute(); @@ -1773,8 +1773,8 @@ function menu_link_load($mlid) { if (is_numeric($mlid)) { $query = db_select('menu_links', 'ml'); $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path'); - $query->fields('ml'); - $query->fields('m'); + $query->columns('ml'); + $query->columns('m'); $query->condition('ml.mlid', $mlid); if ($item = $query->execute()->fetchAssoc()) { _menu_link_translate($item); @@ -1920,7 +1920,7 @@ function _menu_navigation_links_rebuild( foreach ($menu_links as $item) { $existing_item = db_select('menu_links') - ->fields('menu_links', array( + ->columns('menu_links', array( 'mlid', 'menu_name', 'plid', @@ -1954,7 +1954,7 @@ function _menu_navigation_links_rebuild( $paths = array_keys($menu); // Updated and customized items whose router paths are gone need new ones. $result = db_select('menu_links', NULL, array('fetch' => PDO::FETCH_ASSOC)) - ->fields('menu_links', array( + ->columns('menu_links', array( 'link_path', 'mlid', 'router_path', @@ -1976,7 +1976,7 @@ function _menu_navigation_links_rebuild( // item, so we clear the updated flag. $updated = $item['updated'] && $router_path != $item['link_path']; db_update('menu_links') - ->fields(array( + ->columns(array( 'router_path' => $router_path, 'updated' => (int) $updated, )) @@ -1986,7 +1986,7 @@ function _menu_navigation_links_rebuild( } // Find any item whose router path does not exist any more. $result = db_select('menu_links') - ->fields('menu_links') + ->columns('menu_links') ->condition('router_path', $paths, 'NOT IN') ->condition('external', 0) ->condition('updated', 0) @@ -2122,8 +2122,8 @@ function menu_link_save(&$item) { $new_query = clone $query; $new_query->condition('link_path', $parent_path); // Only valid if we get a unique result. - if ($new_query->countQuery()->execute()->fetchField() == 1) { - $parent = $new_query->fields('menu_links')->execute()->fetchAssoc(); + if ($new_query->countQuery()->execute()->fetchColumn() == 1) { + $parent = $new_query->columns('menu_links')->execute()->fetchAssoc(); } } while ($parent === FALSE && $parent_path); } @@ -2142,7 +2142,7 @@ function menu_link_save(&$item) { if (!$existing_item) { $item['mlid'] = db_insert('menu_links') - ->fields(array( + ->columns(array( 'menu_name' => $item['menu_name'], 'plid' => $item['plid'], 'link_path' => $item['link_path'], @@ -2203,7 +2203,7 @@ function menu_link_save(&$item) { // The intersect removes the extra keys, allowing a meaningful comparison. if (!$existing_item || (array_intersect_assoc($item, $existing_item)) != $existing_item) { db_update('menu_links') - ->fields(array( + ->columns(array( 'menu_name' => $item['menu_name'], 'plid' => $item['plid'], 'link_path' => $item['link_path'], @@ -2292,11 +2292,11 @@ function _menu_find_router_path($link_pa if (empty($menu)) { // Not during a menu rebuild, so look up in the database. $router_path = (string) db_select('menu_router') - ->fields('menu_router', array('path')) + ->columns('menu_router', array('path')) ->condition('path', $ancestors, 'IN') ->orderBy('fit', 'DESC') ->range(0, 1) - ->execute()->fetchField(); + ->execute()->fetchColumn(); } elseif (!isset($menu[$router_path])) { // Add an empty router path as a fallback. @@ -2340,13 +2340,13 @@ function menu_link_maintain($module, $op break; case 'update': db_update('menu_links') - ->fields(array('link_title' => $link_title)) + ->columns(array('link_title' => $link_title)) ->condition('link_path', $link_path) ->condition('customized', 0) ->condition('module', $module) ->execute(); $result = db_select('menu_links') - ->fields('menu_links', array('menu_name')) + ->columns('menu_links', array('menu_name')) ->condition('link_path', $link_path) ->condition('customized', 0) ->condition('module', $module) @@ -2376,7 +2376,7 @@ function menu_link_maintain($module, $op */ function menu_link_children_relative_depth($item) { $query = db_select('menu_links'); - $query->addField('menu_links', 'depth'); + $query->addColumn('menu_links', 'depth'); $query->condition('menu_name', $item['menu_name']); $query->orderBy('depth', 'DESC'); $query->range(0, 1); @@ -2388,7 +2388,7 @@ function menu_link_children_relative_dep $p = 'p' . ++$i; } - $max_depth = $query->execute()->fetchField(); + $max_depth = $query->execute()->fetchColumn(); return ($max_depth > $item['depth']) ? $max_depth - $item['depth'] : 0; } @@ -2402,18 +2402,18 @@ function menu_link_children_relative_dep function _menu_link_move_children($item, $existing_item) { $query = db_update('menu_links'); - $query->fields(array('menu_name' => $item['menu_name'])); + $query->columns(array('menu_name' => $item['menu_name'])); $p = 'p1'; for ($i = 1; $i <= $item['depth']; $p = 'p' . ++$i) { - $query->fields(array($p => $item[$p])); + $query->columns(array($p => $item[$p])); } $j = $existing_item['depth'] + 1; while ($i <= MENU_MAX_DEPTH && $j <= MENU_MAX_DEPTH) { $query->expression('p' . $i++, 'p' . $j++); } while ($i <= MENU_MAX_DEPTH) { - $query->fields(array('p' . $i++ => 0)); + $query->columns(array('p' . $i++ => 0)); } $shift = $item['depth'] - $existing_item['depth']; @@ -2444,7 +2444,7 @@ function _menu_update_parental_status($i if ($item['plid']) { // Check if at least one visible child exists in the table. $query = db_select('menu_links'); - $query->addField('menu_links', 'mlid'); + $query->addColumn('menu_links', 'mlid'); $query->condition('menu_name', $item['menu_name']); $query->condition('hidden', 0); $query->condition('plid', $item['plid']); @@ -2452,9 +2452,9 @@ function _menu_update_parental_status($i if ($exclude) { $query->condition('mlid', $item['mlid'], '<>'); } - $parent_has_children = ((bool) $query->execute()->fetchField()) ? 1 : 0; + $parent_has_children = ((bool) $query->execute()->fetchColumn()) ? 1 : 0; db_update('menu_links') - ->fields(array('has_children' => $parent_has_children)) + ->columns(array('has_children' => $parent_has_children)) ->condition('mlid', $item['plid']) ->execute(); } @@ -2646,7 +2646,7 @@ function _menu_router_save($menu, $masks // Prepare insert object. $insert = db_insert('menu_router') - ->fields(array( + ->columns(array( 'path', 'load_functions', 'to_arg_functions', Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.141 diff -u -F^[fc] -r1.141 module.inc --- includes/module.inc 12 May 2009 18:08:42 -0000 1.141 +++ includes/module.inc 17 May 2009 15:43:26 -0000 @@ -120,7 +120,7 @@ function module_rebuild_cache() { // Update the contents of the system table: if (isset($file->status) || (isset($file->old_filepath) && $file->old_filepath != $file->filepath)) { db_update('system') - ->fields(array( + ->columns(array( 'info' => serialize($files[$filepath]->info), 'name' => $file->name, 'filename' => $file->filepath)) @@ -131,7 +131,7 @@ function module_rebuild_cache() { // This is a new module. $files[$filepath]->status = 0; db_insert('system') - ->fields(array( + ->columns(array( 'name' => $file->name, 'info' => serialize($files[$filepath]->info), 'type' => 'module', @@ -252,7 +252,7 @@ function module_enable($module_list) { if ($existing->status == 0) { module_load_install($module); db_update('system') - ->fields(array('status' => 1)) + ->columns(array('status' => 1)) ->condition('type', 'module') ->condition('name', $module) ->execute(); @@ -305,7 +305,7 @@ function module_disable($module_list) { module_load_install($module); module_invoke($module, 'disable'); db_update('system') - ->fields(array('status' => 0)) + ->columns(array('status' => 0)) ->condition('type', 'module') ->condition('name', $module) ->execute(); Index: includes/pager.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/pager.inc,v retrieving revision 1.67 diff -u -F^[fc] -r1.67 pager.inc --- includes/pager.inc 12 May 2009 18:26:41 -0000 1.67 +++ includes/pager.inc 17 May 2009 15:43:26 -0000 @@ -68,7 +68,7 @@ class PagerDefault extends SelectQueryEx } // We calculate the total of pages as ceil(items / limit). - $pager_total_items[$this->element] = $this->getCountQuery()->execute()->fetchField(); + $pager_total_items[$this->element] = $this->getCountQuery()->execute()->fetchColumn(); $pager_total[$this->element] = ceil($pager_total_items[$this->element] / $this->limit); $pager_page_array[$this->element] = max(0, min((int)$pager_page_array[$this->element], ((int)$pager_total[$this->element]) - 1)); $this->range($pager_page_array[$this->element] * $this->limit, $this->limit); Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.36 diff -u -F^[fc] -r1.36 path.inc --- includes/path.inc 16 May 2009 19:07:02 -0000 1.36 +++ includes/path.inc 17 May 2009 15:43:26 -0000 @@ -57,7 +57,7 @@ function drupal_lookup_path($action, $pa // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases if (!isset($count)) { - $count = db_query('SELECT COUNT(pid) FROM {url_alias}')->fetchField(); + $count = db_query('SELECT COUNT(pid) FROM {url_alias}')->fetchColumn(); } if ($action == 'wipe') { @@ -99,7 +99,7 @@ function drupal_lookup_path($action, $pa $alias = db_query("SELECT dst FROM {url_alias} WHERE src = :src AND language IN(:language, '') ORDER BY language DESC", array( ':src' => $path, ':language' => $path_language - ))->fetchField(); + ))->fetchColumn(); $map[$path_language][$path] = $alias; return $alias; } @@ -114,7 +114,7 @@ function drupal_lookup_path($action, $pa if ($src = db_query("SELECT src FROM {url_alias} WHERE dst = :dst AND language IN(:language, '') ORDER BY language DESC", array( ':dst' => $path, ':language' => $path_language)) - ->fetchField()) { + ->fetchColumn()) { $map[$path_language][$src] = $path; } else { Index: includes/registry.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/registry.inc,v retrieving revision 1.16 diff -u -F^[fc] -r1.16 registry.inc --- includes/registry.inc 16 May 2009 16:04:42 -0000 1.16 +++ includes/registry.inc 17 May 2009 15:43:26 -0000 @@ -131,7 +131,7 @@ function _registry_parse_files($files) { $file['md5'] = $md5; db_merge('registry_file') ->key(array('filename' => $filename)) - ->fields(array('md5' => $md5)) + ->columns(array('md5' => $md5)) ->execute(); } } @@ -188,7 +188,7 @@ function _registry_parse_file($filename, // function names have been purged from Drupal. db_merge('registry') ->key(array('name' => $resource_name, 'type' => $type)) - ->fields($fields) + ->columns($fields) ->execute(); // We skip the body because classes may contain functions. Index: includes/session.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/session.inc,v retrieving revision 1.68 diff -u -F^[fc] -r1.68 session.inc --- includes/session.inc 3 Apr 2009 17:41:32 -0000 1.68 +++ includes/session.inc 17 May 2009 15:43:26 -0000 @@ -134,7 +134,7 @@ function _sess_write($key, $value) { db_merge('sessions') ->key(array('sid' => $key)) - ->fields(array( + ->columns(array( 'uid' => $user->uid, 'cache' => isset($user->cache) ? $user->cache : 0, 'hostname' => ip_address(), @@ -147,7 +147,7 @@ function _sess_write($key, $value) { // This reduces contention in the users table. if ($user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval', 180)) { db_update('users') - ->fields(array( + ->columns(array( 'access' => REQUEST_TIME )) ->condition('uid', $user->uid) @@ -233,7 +233,7 @@ function drupal_session_regenerate() { session_set_cookie_params($lifetime, $path, $domain, $secure, TRUE); session_regenerate_id(); db_update('sessions') - ->fields(array( + ->columns(array( 'sid' => session_id() )) ->condition('sid', $old_session_id) @@ -261,7 +261,7 @@ function drupal_session_count($timestamp $query->addExpression('COUNT(sid)', 'count'); $query->condition('timestamp', $timestamp, '>='); $query->condition('uid', 0, $anonymous ? '=' : '>'); - return $query->execute()->fetchField(); + return $query->execute()->fetchColumn(); } /** Index: includes/database/database.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/database.inc,v retrieving revision 1.53 diff -u -F^[fc] -r1.53 database.inc --- includes/database/database.inc 3 May 2009 08:55:06 -0000 1.53 +++ includes/database/database.inc 17 May 2009 15:43:26 -0000 @@ -110,8 +110,8 @@ * @endcode * one would instead write: * @code - * $fields = array('nid' => 1, 'title' => 'my title', 'body' => 'my body'); - * db_insert('my_table')->fields($fields)->execute(); + * $columns = array('nid' => 1, 'title' => 'my title', 'body' => 'my body'); + * db_insert('my_table')->columns($columns)->execute(); * @endcode * This method allows databases that need special data type handling to do so, * while also allowing optimizations such as multi-insert queries. UPDATE and @@ -136,9 +136,9 @@ * * try { * $id = db_insert('example') - * ->fields(array( - * 'field1' => 'mystring', - * 'field2' => 5, + * ->columns(array( + * 'column1' => 'mystring', + * 'column2' => 5, * )) * ->execute(); * @@ -163,7 +163,7 @@ * if ($id % 2 == 0) { * db_update('example') * ->condition('id', $id) - * ->fields(array('field2' => 10)) + * ->columns(array('column2' => 10)) * ->execute(); * } * } @@ -510,20 +510,20 @@ } /** - * Create the appropriate sequence name for a given table and serial field. + * Create the appropriate sequence name for a given table and serial column. * * This information is exposed to all database drivers, although it is only * useful on some of them. This method is table prefix-aware. * * @param $table * The table name to use for the sequence. - * @param $field - * The field name to use for the sequence. + * @param $column + * The column name to use for the sequence. * @return * A table prefix-parsed string for the sequence name. */ - public function makeSequenceName($table, $field) { - return $this->prefixTables('{' . $table . '}_' . $field . '_seq'); + public function makeSequenceName($table, $column) { + return $this->prefixTables('{' . $table . '}_' . $column . '_seq'); } /** @@ -542,7 +542,7 @@ * * It is extremely rare that module code will need to pass a statement * object to this method. It is used primarily for database drivers for - * databases that require special LOB field handling. + * databases that require special LOB column handling. * @param $args * An array of arguments for the prepared statement. If the prepared * statement uses ? placeholders, this array must be an indexed array. @@ -1547,14 +1547,14 @@ class DatabaseTransaction { // public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL); /** - * Return a single field out of the current + * Return a single column out of the current * * @param $index - * The numeric index of the field to return. Defaults to the first field. + * The numeric index of the column to return. Defaults to the first column. * @return - * A single field from the next record. + * A single column from the next record. */ - public function fetchField($index = 0); + public function fetchColumn($index = 0); /** * Fetches the next row and returns it as an object. @@ -1607,22 +1607,22 @@ class DatabaseTransaction { * * This method is only useful for two-column result sets. It will return * an associative array where the key is one column from the result set - * and the value is another field. In most cases, the default of the first two + * and the value is another column. In most cases, the default of the first two * columns is appropriate. * * Note that this method will run the result set to the end. * * @param $key_index - * The numeric index of the field to use as the array key. + * The numeric index of the column to use as the array key. * @param $value_index - * The numeric index of the field to use as the array value. + * The numeric index of the column to use as the array value. * @return * An associative array. */ public function fetchAllKeyed($key_index = 0, $value_index = 1); /** - * Returns an entire result set as an associative array keyed by the named field. + * Returns an entire result set as an associative array keyed by the named column. * * If the given key appears multiple times, later records will overwrite * earlier ones. @@ -1630,7 +1630,7 @@ class DatabaseTransaction { * Note that this method will run the result set to the end. * * @param $key - * The name of the field on which to index the array. + * The name of the column on which to index the array. * @param $fetch * The fetchmode to use. If set to PDO::FETCH_ASSOC, PDO::FETCH_NUM, or * PDO::FETCH_BOTH the returned value with be an array of arrays. For any @@ -1670,8 +1670,8 @@ class DatabaseStatementBase extends PDOS public function execute($args = array(), $options = array()) { if (isset($options['fetch'])) { if (is_string($options['fetch'])) { - // Default to an object. Note: db fields will be added to the object - // before the constructor is run. If you need to assign fields after + // Default to an object. Note: db columns will be added to the object + // before the constructor is run. If you need to assign columns after // the constructor is run, see http://drupal.org/node/315092. $this->setFetchMode(PDO::FETCH_CLASS, $options['fetch']); } @@ -1729,9 +1729,9 @@ class DatabaseStatementBase extends PDOS return $return; } - public function fetchField($index = 0) { - // Call PDOStatement::fetchColumn to fetch the field. - return $this->fetchColumn($index); + public function fetchColumn($index = 0) { + // Call PDOStatement::fetchColumn to fetch the column. + return parent::fetchColumn($index); } public function fetchAssoc() { @@ -2022,14 +2022,14 @@ function update_sql($sql) { /** * Generate placeholders for an array of query arguments of a single type. * - * Given a Schema API field type, return correct %-placeholders to + * Given a Schema API column type, return correct %-placeholders to * embed in a query * * @todo This may be possible to remove in favor of db_select(). * @param $arguments * An array with at least one element. * @param $type - * The Schema API type of a field (e.g. 'int', 'text', or 'varchar'). + * The Schema API type of a column (e.g. 'int', 'text', or 'varchar'). */ function db_placeholders($arguments, $type = 'int') { $placeholder = db_type_placeholder($type); @@ -2037,23 +2037,23 @@ function db_placeholders($arguments, $ty } /** - * Wraps the given table.field entry with a DISTINCT(). The wrapper is added to + * Wraps the given table.column entry with a DISTINCT(). The wrapper is added to * the SELECT list entry of the given query and the resulting query is returned. * This function only applies the wrapper if a DISTINCT doesn't already exist in * the query. * * @todo Remove this. * @param $table - * Table containing the field to set as DISTINCT - * @param $field - * Field to set as DISTINCT + * Table containing the column to set as DISTINCT + * @param $column + * Column to set as DISTINCT * @param $query * Query to apply the wrapper to * @return - * SQL query with the DISTINCT wrapper surrounding the given table.field. + * SQL query with the DISTINCT wrapper surrounding the given table.column. */ -function db_distinct_field($table, $field, $query) { - return Database::getConnection()->distinctField($table, $field, $query); +function db_distinct_column($table, $column, $query) { + return Database::getConnection()->distinctColumn($table, $column, $query); } /** @@ -2092,18 +2092,18 @@ function db_create_table(&$ret, $name, $ } /** - * Return an array of field names from an array of key/index column specifiers. + * Return an array of column names from an array of key/index column specifiers. * * This is usually an identity function but if a key/index uses a column prefix * specification, this function extracts just the name. * - * @param $fields + * @param $columns * An array of key/index column specifiers. * @return - * An array of field names. + * An array of column names. */ -function db_field_names($fields) { - return Database::getConnection()->schema()->fieldNames($fields); +function db_column_names($columns) { + return Database::getConnection()->schema()->columnNames($columns); } /** @@ -2134,14 +2134,14 @@ function db_find_tables($table_expressio } /** - * Given a Schema API field type, return the correct %-placeholder. + * Given a Schema API column type, return the correct %-placeholder. * * Embed the placeholder in a query to be passed to db_query and and pass as an * argument to db_query a value of the specified type. * * @todo Remove this after all queries are converted to type-agnostic form. * @param $type - * The Schema API type of a field. + * The Schema API type of a column. * @return * The placeholder string to embed in a query for that type. */ @@ -2186,7 +2186,7 @@ function _db_create_keys_sql($spec) { * to the engine-specific data type. */ function db_type_map() { - return Database::getConnection()->schema()->getFieldTypeMap(); + return Database::getConnection()->schema()->getColumnTypeMap(); } /** @@ -2216,75 +2216,75 @@ function db_drop_table(&$ret, $table) { } /** - * Add a new field to a table. + * Add a new column to a table. * * @param $ret * Array to which query results will be added. * @param $table * Name of the table to be altered. - * @param $field - * Name of the field to be added. + * @param $column + * Name of the column to be added. * @param $spec - * The field specification array, as taken from a schema definition. + * The column specification array, as taken from a schema definition. * The specification may also contain the key 'initial', the newly - * created field will be set to the value of the key in all rows. + * created column will be set to the value of the key in all rows. * This is most useful for creating NOT NULL columns with no default * value in existing tables. * @param $keys_new * Optional keys and indexes specification to be created on the - * table along with adding the field. The format is the same as a - * table specification but without the 'fields' element. If you are - * adding a type 'serial' field, you MUST specify at least one key - * or index including it in this array. See db_change_field() for more + * table along with adding the column. The format is the same as a + * table specification but without the 'columns' element. If you are + * adding a type 'serial' column, you MUST specify at least one key + * or index including it in this array. See db_change_column() for more * explanation why. - * @see db_change_field() + * @see db_change_column() */ -function db_add_field(&$ret, $table, $field, $spec, $keys_new = array()) { - return Database::getConnection()->schema()->addField($ret, $table, $field, $spec, $keys_new); +function db_add_column(&$ret, $table, $column, $spec, $keys_new = array()) { + return Database::getConnection()->schema()->addColumn($ret, $table, $column, $spec, $keys_new); } /** - * Drop a field. + * Drop a column. * * @param $ret * Array to which query results will be added. * @param $table * The table to be altered. - * @param $field - * The field to be dropped. + * @param $column + * The column to be dropped. */ -function db_drop_field(&$ret, $table, $field) { - return Database::getConnection()->schema()->dropField($ret, $table, $field); +function db_drop_column(&$ret, $table, $column) { + return Database::getConnection()->schema()->dropColumn($ret, $table, $column); } /** - * Set the default value for a field. + * Set the default value for a column. * * @param $ret * Array to which query results will be added. * @param $table * The table to be altered. - * @param $field - * The field to be altered. + * @param $column + * The column to be altered. * @param $default * Default value to be set. NULL for 'default NULL'. */ -function db_field_set_default(&$ret, $table, $field, $default) { - return Database::getConnection()->schema()->fieldSetDefault($ret, $table, $field, $default); +function db_column_set_default(&$ret, $table, $column, $default) { + return Database::getConnection()->schema()->columnSetDefault($ret, $table, $column, $default); } /** - * Set a field to have no default value. + * Set a column to have no default value. * * @param $ret * Array to which query results will be added. * @param $table * The table to be altered. - * @param $field - * The field to be altered. + * @param $column + * The column to be altered. */ -function db_field_set_no_default(&$ret, $table, $field) { - return Database::getConnection()->schema()->fieldSetNoDefault($ret, $table, $field); +function db_column_set_no_default(&$ret, $table, $column) { + return Database::getConnection()->schema()->columnSetNoDefault($ret, $table, $column); } /** @@ -2294,11 +2294,11 @@ function db_field_set_no_default(&$ret, * Array to which query results will be added. * @param $table * The table to be altered. - * @param $fields - * Fields for the primary key. + * @param $columns + * Columns for the primary key. */ -function db_add_primary_key(&$ret, $table, $fields) { - return Database::getConnection()->schema()->addPrimaryKey($ret, $table, $fields); +function db_add_primary_key(&$ret, $table, $columns) { + return Database::getConnection()->schema()->addPrimaryKey($ret, $table, $columns); } /** @@ -2322,11 +2322,11 @@ function db_drop_primary_key(&$ret, $tab * The table to be altered. * @param $name * The name of the key. - * @param $fields - * An array of field names. + * @param $columns + * An array of column names. */ -function db_add_unique_key(&$ret, $table, $name, $fields) { - return Database::getConnection()->schema()->addUniqueKey($ret, $table, $name, $fields); +function db_add_unique_key(&$ret, $table, $name, $columns) { + return Database::getConnection()->schema()->addUniqueKey($ret, $table, $name, $columns); } /** @@ -2352,11 +2352,11 @@ function db_drop_unique_key(&$ret, $tabl * The table to be altered. * @param $name * The name of the index. - * @param $fields - * An array of field names. + * @param $columns + * An array of column names. */ -function db_add_index(&$ret, $table, $name, $fields) { - return Database::getConnection()->schema()->addIndex($ret, $table, $name, $fields); +function db_add_index(&$ret, $table, $name, $columns) { + return Database::getConnection()->schema()->addIndex($ret, $table, $name, $columns); } /** @@ -2374,20 +2374,20 @@ function db_drop_index(&$ret, $table, $n } /** - * Change a field definition. + * Change a column definition. * * IMPORTANT NOTE: To maintain database portability, you have to explicitly - * recreate all indices and primary keys that are using the changed field. + * recreate all indices and primary keys that are using the changed column. * * That means that you have to drop all affected keys and indexes with - * db_drop_{primary_key,unique_key,index}() before calling db_change_field(). + * db_drop_{primary_key,unique_key,index}() before calling db_change_column(). * To recreate the keys and indices, pass the key definitions as the - * optional $keys_new argument directly to db_change_field(). + * optional $keys_new argument directly to db_change_column(). * * For example, suppose you have: * @code * $schema['foo'] = array( - * 'fields' => array( + * 'columns' => array( * 'bar' => array('type' => 'int', 'not null' => TRUE) * ), * 'primary key' => array('bar') @@ -2397,47 +2397,47 @@ function db_drop_index(&$ret, $table, $n * primary key. The correct sequence is: * @code * db_drop_primary_key($ret, 'foo'); - * db_change_field($ret, 'foo', 'bar', 'bar', + * db_change_column($ret, 'foo', 'bar', 'bar', * array('type' => 'serial', 'not null' => TRUE), * array('primary key' => array('bar'))); * @endcode * * The reasons for this are due to the different database engines: * - * On PostgreSQL, changing a field definition involves adding a new field + * On PostgreSQL, changing a column definition involves adding a new column * and dropping an old one which* causes any indices, primary keys and - * sequences (from serial-type fields) that use the changed field to be dropped. + * sequences (from serial-type columns) that use the changed column to be dropped. * - * On MySQL, all type 'serial' fields must be part of at least one key + * On MySQL, all type 'serial' columns must be part of at least one key * or index as soon as they are created. You cannot use * db_add_{primary_key,unique_key,index}() for this purpose because * the ALTER TABLE command will fail to add the column without a key * or index specification. The solution is to use the optional * $keys_new argument to create the key or index at the same time as - * field. + * column. * * You could use db_add_{primary_key,unique_key,index}() in all cases - * unless you are converting a field to be type serial. You can use + * unless you are converting a column to be type serial. You can use * the $keys_new argument in all cases. * * @param $ret * Array to which query results will be added. * @param $table * Name of the table. - * @param $field - * Name of the field to change. - * @param $field_new - * New name for the field (set to the same as $field if you don't want to change the name). + * @param $column + * Name of the column to change. + * @param $column_new + * New name for the column (set to the same as $column if you don't want to change the name). * @param $spec - * The field specification for the new field. + * The column specification for the new column. * @param $keys_new * Optional keys and indexes specification to be created on the - * table along with changing the field. The format is the same as a - * table specification but without the 'fields' element. + * table along with changing the column. The format is the same as a + * table specification but without the 'columns' element. */ -function db_change_field(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) { - return Database::getConnection()->schema()->changeField($ret, $table, $field, $field_new, $spec, $keys_new); +function db_change_column(&$ret, $table, $column, $column_new, $spec, $keys_new = array()) { + return Database::getConnection()->schema()->changeColumn($ret, $table, $column, $column_new, $spec, $keys_new); } /** @@ -2476,7 +2476,7 @@ function db_fetch_array(DatabaseStatemen } function db_result(DatabaseStatementInterface $statement) { - return $statement->fetchField(); + return $statement->fetchColumn(); } /** @@ -2517,7 +2517,7 @@ function _db_query_process_args($query, } // A large number of queries pass FALSE or empty-string for - // int/float fields because the previous version of db_query() + // int/float columns because the previous version of db_query() // casted them to int/float, resulting in 0. MySQL PDO happily // accepts these values as zero but PostgreSQL PDO does not, and I // do not feel like tracking down and fixing every such query at @@ -2545,11 +2545,11 @@ function _db_query_process_args($query, * @todo Remove this function when all queries have been ported to db_insert(). * @param $table * The name of the table you inserted into. - * @param $field - * The name of the autoincrement field. + * @param $column + * The name of the autoincrement column. */ -function db_last_insert_id($table, $field) { - $sequence_name = Database::getConnection()->makeSequenceName($table, $field); +function db_last_insert_id($table, $column) { + $sequence_name = Database::getConnection()->makeSequenceName($table, $column); return Database::getConnection()->lastInsertId($sequence_name); } @@ -2578,23 +2578,23 @@ function db_affected_rows() { * @param $query * Query to be rewritten. * @param $primary_table - * Name or alias of the table which has the primary key field for this query. + * Name or alias of the table which has the primary key column for this query. * Typical table names would be: {block}, {comment}, {forum}, {node}, * {menu}, {taxonomy_term_data} or {taxonomy_vocabulary}. However, in most cases the usual * table alias (b, c, f, n, m, t or v) is used instead of the table name. - * @param $primary_field - * Name of the primary field. + * @param $primary_column + * Name of the primary column. * @param $args * Array of additional arguments. * @return - * An array: join statements, where statements, field or DISTINCT(field). + * An array: join statements, where statements, column or DISTINCT(column). */ -function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'nid', $args = array()) { +function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_column = 'nid', $args = array()) { $where = array(); $join = array(); $distinct = FALSE; foreach (module_implements('db_rewrite_sql') as $module) { - $result = module_invoke($module, 'db_rewrite_sql', $query, $primary_table, $primary_field, $args); + $result = module_invoke($module, 'db_rewrite_sql', $query, $primary_table, $primary_column, $args); if (isset($result) && is_array($result)) { if (isset($result['where'])) { $where[] = $result['where']; @@ -2625,23 +2625,23 @@ function _db_rewrite_sql($query = '', $p * @param $query * Query to be rewritten. * @param $primary_table - * Name or alias of the table which has the primary key field for this query. + * Name or alias of the table which has the primary key column for this query. * Typical table names would be: {block}, {comment}, {forum}, {node}, * {menu}, {taxonomy_term_data} or {taxonomy_vocabulary}. However, it is more common to use the * the usual table aliases: b, c, f, n, m, t or v. - * @param $primary_field - * Name of the primary field. + * @param $primary_column + * Name of the primary column. * @param $args * An array of arguments, passed to the implementations of hook_db_rewrite_sql. * @return * The original query with JOIN and WHERE statements inserted from * hook_db_rewrite_sql implementations. nid is rewritten if needed. */ -function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $args = array()) { - list($join, $where, $distinct) = _db_rewrite_sql($query, $primary_table, $primary_field, $args); +function db_rewrite_sql($query, $primary_table = 'n', $primary_column = 'nid', $args = array()) { + list($join, $where, $distinct) = _db_rewrite_sql($query, $primary_table, $primary_column, $args); if ($distinct) { - $query = db_distinct_field($primary_table, $primary_field, $query); + $query = db_distinct_column($primary_table, $primary_column, $query); } if (!empty($where) || !empty($join)) { Index: includes/database/prefetch.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/prefetch.inc,v retrieving revision 1.5 diff -u -F^[fc] -r1.5 prefetch.inc --- includes/database/prefetch.inc 20 Apr 2009 20:02:30 -0000 1.5 +++ includes/database/prefetch.inc 17 May 2009 15:43:26 -0000 @@ -373,7 +373,7 @@ class DatabaseStatementPrefetch implemen } } - public function fetchField($index = 0) { + public function fetchColumn($index = 0) { if (isset($this->currentRow) && isset($this->columnNames[$index])) { // We grab the value directly from $this->data, and format it. $return = $this->currentRow[$this->columnNames[$index]]; Index: includes/database/query.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/query.inc,v retrieving revision 1.21 diff -u -F^[fc] -r1.21 query.inc --- includes/database/query.inc 3 May 2009 08:55:06 -0000 1.21 +++ includes/database/query.inc 17 May 2009 15:43:26 -0000 @@ -20,13 +20,13 @@ * Helper function to build most common conditional clauses. * * This method can take a variable number of parameters. If called with two - * parameters, they are taken as $field and $value with $operator having a value + * parameters, they are taken as $column and $value with $operator having a value * of =. * - * @param $field - * The name of the field to check. + * @param $column + * The name of the column to check. * @param $value - * The value to test the field against. In most cases, this is a scalar. For more + * The value to test the column against. In most cases, this is a scalar. For more * complex options, it is an array. The meaning of each element in the array is * dependent on the $operator. * @param $operator @@ -38,7 +38,7 @@ * @return * The called object. */ - public function condition($field, $value = NULL, $operator = NULL); + public function condition($column, $value = NULL, $operator = NULL); /** * Add an arbitrary WHERE clause to the query. @@ -54,24 +54,24 @@ public function where($snippet, $args = array()); /** - * Set a condition that the specified field be NULL. + * Set a condition that the specified column be NULL. * - * @param $field - * The name of the field to check. + * @param $column + * The name of the column to check. * @return * The called object. */ - public function isNull($field); + public function isNull($column); /** - * Set a condition that the specified field be NOT NULL. + * Set a condition that the specified column be NOT NULL. * - * @param $field - * The name of the field to check. + * @param $column + * The name of the column to check. * @return * The called object. */ - public function isNotNull($field); + public function isNotNull($column); /** * Gets a complete list of all conditions in this conditional clause. @@ -83,12 +83,12 @@ * each entry looks like the following: * * array( - * 'field' => $field, + * 'column' => $column, * 'value' => $value, * 'operator' => $operator, * ); * - * In the special case that $operator is NULL, the $field is taken as a raw + * In the special case that $operator is NULL, the $column is taken as a raw * SQL snippet (possibly containing a function) and $value is an associative * array of placeholders for the snippet. * @@ -261,27 +261,27 @@ class InsertQuery extends Query { protected $delay; /** - * An array of fields on which to insert. + * An array of columns on which to insert. * * @var array */ - protected $insertFields = array(); + protected $insertColumns = array(); /** - * An array of fields which should be set to their database-defined defaults. + * An array of columns which should be set to their database-defined defaults. * * @var array */ - protected $defaultFields = array(); + protected $defaultColumns = array(); /** * A nested array of values to insert. * * $insertValues itself is an array of arrays. Each sub-array is an array of - * field names to values to insert. Whether multiple insert sets + * column names to values to insert. Whether multiple insert sets * will be run in a single query or multiple queries is left to individual drivers * to implement in whatever manner is most efficient. The order of values in each - * sub-array must match the order of fields in $insertFields. + * sub-array must match the order of columns in $insertColumns. * * @var string */ @@ -295,33 +295,33 @@ class InsertQuery extends Query { } /** - * Add a set of field->value pairs to be inserted. + * Add a set of column->value pairs to be inserted. * * This method may only be called once. Calling it a second time will be * ignored. To queue up multiple sets of values to be inserted at once, * use the values() method. * - * @param $fields - * An array of fields on which to insert. This array may be indexed or - * associative. If indexed, the array is taken to be the list of fields. - * If associative, the keys of the array are taken to be the fields and + * @param $columns + * An array of columns on which to insert. This array may be indexed or + * associative. If indexed, the array is taken to be the list of columns. + * If associative, the keys of the array are taken to be the columns and * the values are taken to be corresponding values to insert. If a - * $values argument is provided, $fields must be indexed. + * $values argument is provided, $columns must be indexed. * @param $values - * An array of fields to insert into the database. The values must be - * specified in the same order as the $fields array. + * An array of columns to insert into the database. The values must be + * specified in the same order as the $columns array. * @return * The called object. */ - public function fields(array $fields, array $values = array()) { - if (empty($this->insertFields)) { + public function columns(array $columns, array $values = array()) { + if (empty($this->insertColumns)) { if (empty($values)) { - if (!is_numeric(key($fields))) { - $values = array_values($fields); - $fields = array_keys($fields); + if (!is_numeric(key($columns))) { + $values = array_values($columns); + $columns = array_keys($columns); } } - $this->insertFields = $fields; + $this->insertColumns = $columns; if (!empty($values)) { $this->insertValues[] = $values; } @@ -334,9 +334,9 @@ class InsertQuery extends Query { * Add another set of values to the query to be inserted. * * If $values is a numeric array, it will be assumed to be in the same - * order as the original fields() call. If it is associative, it may be + * order as the original columns() call. If it is associative, it may be * in any order as long as the keys of the array match the names of the - * fields. + * columns. * * @param $values * An array of values to add to the query. @@ -348,8 +348,8 @@ class InsertQuery extends Query { $this->insertValues[] = $values; } else { - // Reorder the submitted values to match the fields array. - foreach ($this->insertFields as $key) { + // Reorder the submitted values to match the columns array. + foreach ($this->insertColumns as $key) { $insert_values[$key] = $values[$key]; } // For consistency, the values array is always numerically indexed. @@ -359,25 +359,25 @@ class InsertQuery extends Query { } /** - * Specify fields for which the database-defaults should be used. + * Specify columns for which the database-defaults should be used. * - * If you want to force a given field to use the database-defined default, + * If you want to force a given column to use the database-defined default, * not NULL or undefined, use this method to instruct the database to use * default values explicitly. In most cases this will not be necessary * unless you are inserting a row that is all default values, as you cannot * specify no values in an INSERT query. * - * Specifying a field both in fields() and in useDefaults() is an error + * Specifying a column both in columns() and in useDefaults() is an error * and will not execute. * - * @param $fields + * @param $columns * An array of values for which to use the default values * specified in the table definition. * @return * The called object. */ - public function useDefaults(array $fields) { - $this->defaultFields = $fields; + public function useDefaults(array $columns) { + $this->defaultColumns = $columns; return $this; } @@ -416,7 +416,7 @@ class InsertQuery extends Query { * was given multiple sets of values to insert, the return value is * undefined. If the query is flagged "delayed", then the insert ID * won't be created until later when the query actually runs so the - * return value is also undefined. If no fields are specified, this + * return value is also undefined. If no columns are specified, this * method will do nothing and return NULL. That makes it safe to use * in multi-insert loops. */ @@ -425,17 +425,17 @@ class InsertQuery extends Query { $last_insert_id = 0; // Confirm that the user did not try to specify an identical - // field and default field. - if (array_intersect($this->insertFields, $this->defaultFields)) { - throw new PDOException('You may not specify the same field to have a value and a schema-default value.'); + // column and default column. + if (array_intersect($this->insertColumns, $this->defaultColumns)) { + throw new PDOException('You may not specify the same column to have a value and a schema-default value.'); } - if (count($this->insertFields) + count($this->defaultFields) == 0) { + if (count($this->insertColumns) + count($this->defaultColumns) == 0) { return NULL; } // Don't execute query without values. - if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) { + if (!isset($this->insertValues[0]) && count($this->insertColumns) > 0) { return NULL; } @@ -458,17 +458,17 @@ class InsertQuery extends Query { public function __toString() { - // Default fields are always placed first for consistency. - $insert_fields = array_merge($this->defaultFields, $this->insertFields); + // Default columns are always placed first for consistency. + $insert_columns = array_merge($this->defaultColumns, $this->insertColumns); // For simplicity, we will use the $placeholders array to inject // default keywords even though they are not, strictly speaking, // placeholders for prepared statements. $placeholders = array(); - $placeholders = array_pad($placeholders, count($this->defaultFields), 'default'); - $placeholders = array_pad($placeholders, count($this->insertFields), '?'); + $placeholders = array_pad($placeholders, count($this->defaultColumns), 'default'); + $placeholders = array_pad($placeholders, count($this->insertColumns), '?'); - return 'INSERT INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES (' . implode(', ', $placeholders) . ')'; + return 'INSERT INTO {' . $this->table . '} (' . implode(', ', $insert_columns) . ') VALUES (' . implode(', ', $placeholders) . ')'; } } @@ -485,46 +485,46 @@ class MergeQuery extends Query { protected $table; /** - * An array of fields on which to insert. + * An array of columns on which to insert. * * @var array */ - protected $insertFields = array(); + protected $insertColumns = array(); /** - * An array of fields to update instead of the values specified in - * $insertFields; + * An array of columns to update instead of the values specified in + * $insertColumns; * * @var array */ - protected $updateFields = array(); + protected $updateColumns = array(); /** - * An array of key fields for this query. + * An array of key columns for this query. * * @var array */ - protected $keyFields = array(); + protected $keyColumns = array(); /** - * An array of fields to not update in case of a duplicate record. + * An array of columns to not update in case of a duplicate record. * * @var array */ - protected $excludeFields = array(); + protected $excludeColumns = array(); /** - * An array of fields to update to an expression in case of a duplicate record. + * An array of columns to update to an expression in case of a duplicate record. * * This variable is a nested array in the following format: - * => array( + * => array( * 'condition' => * 'arguments' => * ); * * @var array */ - protected $expressionFields = array(); + protected $expressionColumns = array(); public function __construct($connection, $table, array $options = array()) { $options['return'] = Database::RETURN_AFFECTED; @@ -533,130 +533,130 @@ class MergeQuery extends Query { } /** - * Set the field->value pairs to be merged into the table. + * Set the column->value pairs to be merged into the table. * * This method should only be called once. It may be called either * with a single associative array or two indexed arrays. If called - * with an associative array, the keys are taken to be the fields + * with an associative array, the keys are taken to be the columns * and the values are taken to be the corresponding values to set. - * If called with two arrays, the first array is taken as the fields + * If called with two arrays, the first array is taken as the columns * and the second array is taken as the corresponding values. * - * @param $fields - * An array of fields to set. + * @param $columns + * An array of columns to set. * @param $values - * An array of fields to set into the database. The values must be - * specified in the same order as the $fields array. + * An array of columns to set into the database. The values must be + * specified in the same order as the $columns array. * @return * The called object. */ - public function fields(array $fields, array $values = array()) { + public function columns(array $columns, array $values = array()) { if (count($values) > 0) { - $fields = array_combine($fields, $values); + $columns = array_combine($columns, $values); } - $this->insertFields = $fields; + $this->insertColumns = $columns; return $this; } /** - * Set the key field(s) to be used to insert or update into the table. + * Set the key column(s) to be used to insert or update into the table. * * This method should only be called once. It may be called either * with a single associative array or two indexed arrays. If called - * with an associative array, the keys are taken to be the fields + * with an associative array, the keys are taken to be the columns * and the values are taken to be the corresponding values to set. - * If called with two arrays, the first array is taken as the fields + * If called with two arrays, the first array is taken as the columns * and the second array is taken as the corresponding values. * - * These fields are the "pivot" fields of the query. Typically they - * will be the fields of the primary key. If the record does not + * These columns are the "pivot" columns of the query. Typically they + * will be the columns of the primary key. If the record does not * yet exist, they will be inserted into the table along with the - * values set in the fields() method. If the record does exist, - * these fields will be used in the WHERE clause to select the + * values set in the columns() method. If the record does exist, + * these columns will be used in the WHERE clause to select the * record to update. * - * @param $fields - * An array of fields to set. + * @param $columns + * An array of columns to set. * @param $values - * An array of fields to set into the database. The values must be - * specified in the same order as the $fields array. + * An array of columns to set into the database. The values must be + * specified in the same order as the $columns array. * @return * The called object. */ - public function key(array $fields, array $values = array()) { + public function key(array $columns, array $values = array()) { if ($values) { - $fields = array_combine($fields, $values); + $columns = array_combine($columns, $values); } - $this->keyFields = $fields; + $this->keyColumns = $columns; return $this; } /** - * Specify fields to update in case of a duplicate record. + * Specify columns to update in case of a duplicate record. * - * If a record with the values in keys() already exists, the fields and values + * If a record with the values in keys() already exists, the columns and values * specified here will be updated in that record. If this method is not called, - * it defaults to the same values as were passed to the fields() method. + * it defaults to the same values as were passed to the columns() method. * - * @param $fields - * An array of fields to set. + * @param $columns + * An array of columns to set. * @param $values - * An array of fields to set into the database. The values must be - * specified in the same order as the $fields array. + * An array of columns to set into the database. The values must be + * specified in the same order as the $columns array. * @return * The called object. */ - public function update(array $fields, array $values = array()) { + public function update(array $columns, array $values = array()) { if ($values) { - $fields = array_combine($fields, $values); + $columns = array_combine($columns, $values); } - $this->updateFields = $fields; + $this->updateColumns = $columns; return $this; } /** - * Specify fields that should not be updated in case of a duplicate record. + * Specify columns that should not be updated in case of a duplicate record. * * If this method is called and a record with the values in keys() already * exists, Drupal will instead update the record with the values passed - * in the fields() method except for the fields specified in this method. That + * in the columns() method except for the columns specified in this method. That * is, calling this method is equivalent to calling update() with identical - * parameters as fields() minus the keys specified here. + * parameters as columns() minus the keys specified here. * * The update() method takes precedent over this method. If update() is called, * this method has no effect. * - * @param $exclude_fields - * An array of fields in the query that should not be updated to match those - * specified by the fields() method. - * Alternatively, the fields may be specified as a variable number of string + * @param $exclude_columns + * An array of columns in the query that should not be updated to match those + * specified by the columns() method. + * Alternatively, the columns may be specified as a variable number of string * parameters. * @return * The called object. */ - public function updateExcept($exclude_fields) { - if (!is_array($exclude_fields)) { - $exclude_fields = func_get_args(); + public function updateExcept($exclude_columns) { + if (!is_array($exclude_columns)) { + $exclude_columns = func_get_args(); } - $this->excludeFields = $exclude_fields; + $this->excludeColumns = $exclude_columns; return $this; } /** - * Specify fields to be updated as an expression. + * Specify columns to be updated as an expression. * - * Expression fields are cases such as counter=counter+1. This method only + * Expression columns are cases such as counter=counter+1. This method only * applies if a duplicate key is detected. This method takes precedent over * both update() and updateExcept(). * - * @param $field - * The field to set. + * @param $column + * The column to set. * @param $expression - * The field will be set to the value of this expression. This parameter + * The column will be set to the value of this expression. This parameter * may include named placeholders. * @param $arguments * If specified, this is an array of key/value pairs for named placeholders @@ -664,8 +664,8 @@ class MergeQuery extends Query { * @return * The called object. */ - public function expression($field, $expression, array $arguments = NULL) { - $this->expressionFields[$field] = array( + public function expression($column, $expression, array $arguments = NULL) { + $this->expressionColumns[$column] = array( 'expression' => $expression, 'arguments' => $arguments, ); @@ -675,9 +675,9 @@ class MergeQuery extends Query { public function execute() { - // A merge query without any key field is invalid. - if (count($this->keyFields) == 0) { - throw new InvalidMergeQueryException("You need to specify key fields before executing a merge query"); + // A merge query without any key column is invalid. + if (count($this->keyColumns) == 0) { + throw new InvalidMergeQueryException("You need to specify key columns before executing a merge query"); } // In the degenerate case of this query type, we have to run multiple @@ -692,45 +692,45 @@ class MergeQuery extends Query { // Manually check if the record already exists. $select = $this->connection->select($this->table); - foreach ($this->keyFields as $field => $value) { - $select->condition($field, $value); + foreach ($this->keyColumns as $column => $value) { + $select->condition($column, $value); } $select = $select->countQuery(); $sql = (string)$select; $arguments = $select->getArguments(); - $num_existing = db_query($sql, $arguments)->fetchField(); + $num_existing = db_query($sql, $arguments)->fetchColumn(); if ($num_existing) { // If there is already an existing record, run an update query. - if ($this->updateFields) { - $update_fields = $this->updateFields; + if ($this->updateColumns) { + $update_columns = $this->updateColumns; } else { - $update_fields = $this->insertFields; - // If there are no exclude fields, this is a no-op. - foreach ($this->excludeFields as $exclude_field) { - unset($update_fields[$exclude_field]); + $update_columns = $this->insertColumns; + // If there are no exclude columns, this is a no-op. + foreach ($this->excludeColumns as $exclude_column) { + unset($update_columns[$exclude_column]); } } - if ($update_fields || $this->expressionFields) { - // Only run the update if there are no fields or expressions to update. - $update = $this->connection->update($this->table, $this->queryOptions)->fields($update_fields); - foreach ($this->keyFields as $field => $value) { - $update->condition($field, $value); + if ($update_columns || $this->expressionColumns) { + // Only run the update if there are no columns or expressions to update. + $update = $this->connection->update($this->table, $this->queryOptions)->columns($update_columns); + foreach ($this->keyColumns as $column => $value) { + $update->condition($column, $value); } - foreach ($this->expressionFields as $field => $expression) { - $update->expression($field, $expression['expression'], $expression['arguments']); + foreach ($this->expressionColumns as $column => $expression) { + $update->expression($column, $expression['expression'], $expression['arguments']); } $update->execute(); } } else { // If there is no existing record, run an insert query. - $insert_fields = $this->insertFields + $this->keyFields; - $this->connection->insert($this->table, $this->queryOptions)->fields($insert_fields)->execute(); + $insert_columns = $this->insertColumns + $this->keyColumns; + $this->connection->insert($this->table, $this->queryOptions)->columns($insert_columns)->execute(); } // Transaction commits here where $transaction looses scope. @@ -772,21 +772,21 @@ class DeleteQuery extends Query implemen $this->condition = new DatabaseCondition('AND'); } - public function condition($field, $value = NULL, $operator = '=') { + public function condition($column, $value = NULL, $operator = '=') { if (!isset($num_args)) { $num_args = func_num_args(); } - $this->condition->condition($field, $value, $operator, $num_args); + $this->condition->condition($column, $value, $operator, $num_args); return $this; } - public function isNull($field) { - $this->condition->isNull($field); + public function isNull($column) { + $this->condition->isNull($column); return $this; } - public function isNotNull($field) { - $this->condition->isNotNull($field); + public function isNotNull($column) { + $this->condition->isNotNull($column); return $this; } @@ -874,11 +874,11 @@ class UpdateQuery extends Query implemen protected $table; /** - * An array of fields that will be updated. + * An array of columns that will be updated. * * @var array */ - protected $fields = array(); + protected $columns = array(); /** * An array of values to update to. @@ -896,17 +896,17 @@ class UpdateQuery extends Query implemen protected $condition; /** - * An array of fields to update to an expression in case of a duplicate record. + * An array of columns to update to an expression in case of a duplicate record. * * This variable is a nested array in the following format: - * => array( + * => array( * 'condition' => * 'arguments' => * ); * * @var array */ - protected $expressionFields = array(); + protected $expressionColumns = array(); public function __construct(DatabaseConnection $connection, $table, array $options = array()) { @@ -917,21 +917,21 @@ class UpdateQuery extends Query implemen $this->condition = new DatabaseCondition('AND'); } - public function condition($field, $value = NULL, $operator = '=') { + public function condition($column, $value = NULL, $operator = '=') { if (!isset($num_args)) { $num_args = func_num_args(); } - $this->condition->condition($field, $value, $operator, $num_args); + $this->condition->condition($column, $value, $operator, $num_args); return $this; } - public function isNull($field) { - $this->condition->isNull($field); + public function isNull($column) { + $this->condition->isNull($column); return $this; } - public function isNotNull($field) { - $this->condition->isNotNull($field); + public function isNotNull($column) { + $this->condition->isNotNull($column); return $this; } @@ -953,29 +953,29 @@ class UpdateQuery extends Query implemen } /** - * Add a set of field->value pairs to be updated. + * Add a set of column->value pairs to be updated. * - * @param $fields - * An associative array of fields to write into the database. The array keys - * are the field names while the values are the values to which to set them. + * @param $columns + * An associative array of columns to write into the database. The array keys + * are the column names while the values are the values to which to set them. * @return * The called object. */ - public function fields(array $fields) { - $this->fields = $fields; + public function columns(array $columns) { + $this->columns = $columns; return $this; } /** - * Specify fields to be updated as an expression. + * Specify columns to be updated as an expression. * - * Expression fields are cases such as counter=counter+1. This method takes - * precedence over fields(). + * Expression columns are cases such as counter=counter+1. This method takes + * precedence over columns(). * - * @param $field - * The field to set. + * @param $column + * The column to set. * @param $expression - * The field will be set to the value of this expression. This parameter + * The column will be set to the value of this expression. This parameter * may include named placeholders. * @param $arguments * If specified, this is an array of key/value pairs for named placeholders @@ -983,8 +983,8 @@ class UpdateQuery extends Query implemen * @return * The called object. */ - public function expression($field, $expression, array $arguments = NULL) { - $this->expressionFields[$field] = array( + public function expression($column, $expression, array $arguments = NULL) { + $this->expressionColumns[$column] = array( 'expression' => $expression, 'arguments' => $arguments, ); @@ -994,21 +994,21 @@ class UpdateQuery extends Query implemen public function execute() { - // Expressions take priority over literal fields, so we process those first - // and remove any literal fields that conflict. - $fields = $this->fields; + // Expressions take priority over literal columns, so we process those first + // and remove any literal columns that conflict. + $columns = $this->columns; $update_values = array(); - foreach ($this->expressionFields as $field => $data) { + foreach ($this->expressionColumns as $column => $data) { if (!empty($data['arguments'])) { $update_values += $data['arguments']; } - unset($fields[$field]); + unset($columns[$column]); } - // Because we filter $fields the same way here and in __toString(), the + // Because we filter $columns the same way here and in __toString(), the // placeholders will all match up properly. $max_placeholder = 0; - foreach ($fields as $field => $value) { + foreach ($columns as $column => $value) { $update_values[':db_update_placeholder_' . ($max_placeholder++)] = $value; } @@ -1021,21 +1021,21 @@ class UpdateQuery extends Query implemen } public function __toString() { - // Expressions take priority over literal fields, so we process those first - // and remove any literal fields that conflict. - $fields = $this->fields; - $update_fields = array(); - foreach ($this->expressionFields as $field => $data) { - $update_fields[] = $field . '=' . $data['expression']; - unset($fields[$field]); + // Expressions take priority over literal columns, so we process those first + // and remove any literal columns that conflict. + $columns = $this->columns; + $update_columns = array(); + foreach ($this->expressionColumns as $column => $data) { + $update_columns[] = $column . '=' . $data['expression']; + unset($columns[$column]); } $max_placeholder = 0; - foreach ($fields as $field => $value) { - $update_fields[] = $field . '=:db_update_placeholder_' . ($max_placeholder++); + foreach ($columns as $column => $value) { + $update_columns[] = $column . '=:db_update_placeholder_' . ($max_placeholder++); } - $query = 'UPDATE {' . $this->connection->escapeTable($this->table) . '} SET ' . implode(', ', $update_fields); + $query = 'UPDATE {' . $this->connection->escapeTable($this->table) . '} SET ' . implode(', ', $update_columns); if (count($this->condition)) { $this->condition->compile($this->connection); @@ -1072,9 +1072,9 @@ class DatabaseCondition implements Query return count($this->conditions) - 1; } - public function condition($field, $value = NULL, $operator = '=') { + public function condition($column, $value = NULL, $operator = '=') { $this->conditions[] = array( - 'field' => $field, + 'column' => $column, 'value' => $value, 'operator' => $operator, ); @@ -1086,7 +1086,7 @@ class DatabaseCondition implements Query public function where($snippet, $args = array()) { $this->conditions[] = array( - 'field' => $snippet, + 'column' => $snippet, 'value' => $args, 'operator' => NULL, ); @@ -1095,12 +1095,12 @@ class DatabaseCondition implements Query return $this; } - public function isNull($field) { - return $this->condition($field, NULL, 'IS NULL'); + public function isNull($column) { + return $this->condition($column, NULL, 'IS NULL'); } - public function isNotNull($field) { - return $this->condition($field, NULL, 'IS NOT NULL'); + public function isNotNull($column) { + return $this->condition($column, NULL, 'IS NOT NULL'); } public function &conditions() { @@ -1135,16 +1135,16 @@ class DatabaseCondition implements Query foreach ($conditions as $condition) { if (empty($condition['operator'])) { // This condition is a literal string, so let it through as is. - $condition_fragments[] = ' (' . $condition['field'] . ') '; + $condition_fragments[] = ' (' . $condition['column'] . ') '; $arguments += $condition['value']; } else { // It's a structured condition, so parse it out accordingly. - if ($condition['field'] instanceof QueryConditionInterface) { + if ($condition['column'] instanceof QueryConditionInterface) { // Compile the sub-condition recursively and add it to the list. - $condition['field']->compile($connection); - $condition_fragments[] = '(' . (string)$condition['field'] . ')'; - $arguments += $condition['field']->arguments(); + $condition['column']->compile($connection); + $condition_fragments[] = '(' . (string)$condition['column'] . ')'; + $arguments += $condition['column']->arguments(); } else { // For simplicity, we treat all operators as the same data structure. @@ -1180,7 +1180,7 @@ class DatabaseCondition implements Query $placeholders[] = $placeholder; } } - $condition_fragments[] = ' (' . $condition['field'] . ' ' . $operator['operator'] . ' ' . $operator['prefix'] . implode($operator['delimiter'], $placeholders) . $operator['postfix'] . ') '; + $condition_fragments[] = ' (' . $condition['column'] . ' ' . $operator['operator'] . ' ' . $operator['prefix'] . implode($operator['delimiter'], $placeholders) . $operator['postfix'] . ') '; } } Index: includes/database/schema.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/schema.inc,v retrieving revision 1.12 diff -u -F^[fc] -r1.12 schema.inc --- includes/database/schema.inc 14 Mar 2009 20:34:17 -0000 1.12 +++ includes/database/schema.inc 17 May 2009 15:43:26 -0000 @@ -30,22 +30,22 @@ * curly-brackets. For example, the node_revisions table * description field might contain "Stores per-revision title and * body data for each {node}." - * - 'fields': An associative array ('fieldname' => specification) + * - 'columns': An associative array ('columnname' => specification) * that describes the table's database columns. The specification * is also an array. The following specification parameters are defined: * - * - 'description': A string describing this field and its purpose. + * - 'description': A string describing this column and its purpose. * References to other tables should be enclosed in - * curly-brackets. For example, the node table vid field + * curly-brackets. For example, the node table vid column * description might contain "Always holds the largest (most * recent) {node_revision}.vid value for this nid." * - 'type': The generic datatype: 'varchar', 'int', 'serial' * 'float', 'numeric', 'text', 'blob' or 'datetime'. Most types * just map to the according database engine specific - * datatypes. Use 'serial' for auto incrementing fields. This + * datatypes. Use 'serial' for auto incrementing columns. This * will expand to 'int auto_increment' on mysql. * - 'size': The data size: 'tiny', 'small', 'medium', 'normal', - * 'big'. This is a hint about the largest value the field will + * 'big'. This is a hint about the largest value the column will * store and determines which of the database engine specific * datatypes will be used (e.g. on MySQL, TINYINT vs. INT vs. BIGINT). * 'normal', the default, selects the base type (e.g. on MySQL, @@ -55,20 +55,20 @@ * db_type_map() for possible combinations. * - 'not null': If true, no NULL values will be allowed in this * database column. Defaults to false. - * - 'default': The field's default value. The PHP type of the + * - 'default': The column's default value. The PHP type of the * value matters: '', '0', and 0 are all different. If you - * specify '0' as the default value for a type 'int' field it + * specify '0' as the default value for a type 'int' column it * will not work because '0' is a string containing the * character "zero", not an integer. * - 'length': The maximal length of a type 'varchar' or 'text' - * field. Ignored for other field types. + * column. Ignored for other column types. * - 'unsigned': A boolean indicating whether a type 'int', 'float' * and 'numeric' only is signed or unsigned. Defaults to - * FALSE. Ignored for other field types. - * - 'precision', 'scale': For type 'numeric' fields, indicates + * FALSE. Ignored for other column types. + * - 'precision', 'scale': For type 'numeric' columns, indicates * the precision (total number of significant digits) and scale * (decimal digits right of the decimal point). Both values are - * mandatory. Ignored for other field types. + * mandatory. Ignored for other column types. * * All parameters apart from 'type' are optional except that type * 'numeric' columns must specify 'precision' and 'scale'. @@ -92,15 +92,15 @@ * of the named column. * * As an example, here is a SUBSET of the schema definition for - * Drupal's 'node' table. It show four fields (nid, vid, type, and - * title), the primary key on field 'nid', a unique key named 'vid' on - * field 'vid', and two indexes, one named 'nid' on field 'nid' and - * one named 'node_title_type' on the field 'title' and the first four - * bytes of the field 'type': + * Drupal's 'node' table. It show four columns (nid, vid, type, and + * title), the primary key on column 'nid', a unique key named 'vid' on + * column 'vid', and two indexes, one named 'nid' on column 'nid' and + * one named 'node_title_type' on the column 'title' and the first four + * bytes of the column 'type': * * @code * $schema['node'] = array( - * 'fields' => array( + * 'columns' => array( * 'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), * 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), * 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), @@ -187,7 +187,7 @@ // concatination for conditionals like this however, we // couldn't use db_select() here because it would prefix // information_schema.tables and the query would fail. - return db_query("SELECT table_name FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchField(); + return db_query("SELECT table_name FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchColumn(); } /** @@ -227,7 +227,7 @@ * This maps a generic data type in combination with its data size * to the engine-specific data type. */ - abstract public function getFieldTypeMap(); + abstract public function getColumnTypeMap(); /** * Rename a table. @@ -252,67 +252,67 @@ abstract public function dropTable(&$ret, $table); /** - * Add a new field to a table. + * Add a new column to a table. * * @param $ret * Array to which query results will be added. * @param $table * Name of the table to be altered. - * @param $field - * Name of the field to be added. + * @param $column + * Name of the column to be added. * @param $spec - * The field specification array, as taken from a schema definition. + * The column specification array, as taken from a schema definition. * The specification may also contain the key 'initial', the newly - * created field will be set to the value of the key in all rows. + * created column will be set to the value of the key in all rows. * This is most useful for creating NOT NULL columns with no default * value in existing tables. * @param $keys_new * Optional keys and indexes specification to be created on the - * table along with adding the field. The format is the same as a - * table specification but without the 'fields' element. If you are - * adding a type 'serial' field, you MUST specify at least one key - * or index including it in this array. @see db_change_field for more + * table along with adding the column. The format is the same as a + * table specification but without the 'columns' element. If you are + * adding a type 'serial' column, you MUST specify at least one key + * or index including it in this array. @see db_change_column for more * explanation why. */ - abstract public function addField(&$ret, $table, $field, $spec, $keys_new = array()); + abstract public function addColumn(&$ret, $table, $column, $spec, $keys_new = array()); /** - * Drop a field. + * Drop a column. * * @param $ret * Array to which query results will be added. * @param $table * The table to be altered. - * @param $field - * The field to be dropped. + * @param $column + * The column to be dropped. */ - abstract public function dropField(&$ret, $table, $field); + abstract public function dropColumn(&$ret, $table, $column); /** - * Set the default value for a field. + * Set the default value for a column. * * @param $ret * Array to which query results will be added. * @param $table * The table to be altered. - * @param $field - * The field to be altered. + * @param $column + * The column to be altered. * @param $default * Default value to be set. NULL for 'default NULL'. */ - abstract public function fieldSetDefault(&$ret, $table, $field, $default); + abstract public function columnSetDefault(&$ret, $table, $column, $default); /** - * Set a field to have no default value. + * Set a column to have no default value. * * @param $ret * Array to which query results will be added. * @param $table * The table to be altered. - * @param $field - * The field to be altered. + * @param $column + * The column to be altered. */ - abstract public function fieldSetNoDefault(&$ret, $table, $field); + abstract public function columnSetNoDefault(&$ret, $table, $column); /** * Add a primary key. @@ -321,10 +321,10 @@ * Array to which query results will be added. * @param $table * The table to be altered. - * @param $fields - * Fields for the primary key. + * @param $columns + * Columns for the primary key. */ - abstract public function addPrimaryKey(&$ret, $table, $fields); + abstract public function addPrimaryKey(&$ret, $table, $columns); /** * Drop the primary key. @@ -345,10 +345,10 @@ * The table to be altered. * @param $name * The name of the key. - * @param $fields - * An array of field names. + * @param $columns + * An array of column names. */ - abstract public function addUniqueKey(&$ret, $table, $name, $fields); + abstract public function addUniqueKey(&$ret, $table, $name, $columns); /** * Drop a unique key. @@ -371,10 +371,10 @@ * The table to be altered. * @param $name * The name of the index. - * @param $fields - * An array of field names. + * @param $columns + * An array of column names. */ - abstract public function addIndex(&$ret, $table, $name, $fields); + abstract public function addIndex(&$ret, $table, $name, $columns); /** * Drop an index. @@ -390,20 +390,20 @@ /** - * Change a field definition. + * Change a column definition. * * IMPORTANT NOTE: To maintain database portability, you have to explicitly - * recreate all indices and primary keys that are using the changed field. + * recreate all indices and primary keys that are using the changed column. * * That means that you have to drop all affected keys and indexes with - * db_drop_{primary_key,unique_key,index}() before calling db_change_field(). + * db_drop_{primary_key,unique_key,index}() before calling db_change_column(). * To recreate the keys and indices, pass the key definitions as the - * optional $keys_new argument directly to db_change_field(). + * optional $keys_new argument directly to db_change_column(). * * For example, suppose you have: * @code * $schema['foo'] = array( - * 'fields' => array( + * 'columns' => array( * 'bar' => array('type' => 'int', 'not null' => TRUE) * ), * 'primary key' => array('bar') @@ -413,45 +413,45 @@ * primary key. The correct sequence is: * @code * db_drop_primary_key($ret, 'foo'); - * db_change_field($ret, 'foo', 'bar', 'bar', + * db_change_column($ret, 'foo', 'bar', 'bar', * array('type' => 'serial', 'not null' => TRUE), * array('primary key' => array('bar'))); * @endcode * * The reasons for this are due to the different database engines: * - * On PostgreSQL, changing a field definition involves adding a new field + * On PostgreSQL, changing a column definition involves adding a new column * and dropping an old one which* causes any indices, primary keys and - * sequences (from serial-type fields) that use the changed field to be dropped. + * sequences (from serial-type columns) that use the changed column to be dropped. * - * On MySQL, all type 'serial' fields must be part of at least one key + * On MySQL, all type 'serial' columns must be part of at least one key * or index as soon as they are created. You cannot use * db_add_{primary_key,unique_key,index}() for this purpose because * the ALTER TABLE command will fail to add the column without a key * or index specification. The solution is to use the optional * $keys_new argument to create the key or index at the same time as - * field. + * column. * * You could use db_add_{primary_key,unique_key,index}() in all cases - * unless you are converting a field to be type serial. You can use + * unless you are converting a column to be type serial. You can use * the $keys_new argument in all cases. * * @param $ret * Array to which query results will be added. * @param $table * Name of the table. - * @param $field - * Name of the field to change. - * @param $field_new - * New name for the field (set to the same as $field if you don't want to change the name). + * @param $column + * Name of the column to change. + * @param $column_new + * New name for the column (set to the same as $column if you don't want to change the name). * @param $spec - * The field specification for the new field. + * The column specification for the new column. * @param $keys_new * Optional keys and indexes specification to be created on the - * table along with changing the field. The format is the same as a - * table specification but without the 'fields' element. + * table along with changing the column. The format is the same as a + * table specification but without the 'columns' element. */ - abstract public function changeField(&$ret, $table, $field, $field_new, $spec, $keys_new = array()); + abstract public function changeColumn(&$ret, $table, $column, $column_new, $spec, $keys_new = array()); /** * Create a new table from a Drupal table definition. @@ -471,24 +471,24 @@ } /** - * Return an array of field names from an array of key/index column specifiers. + * Return an array of column names from an array of key/index column specifiers. * * This is usually an identity function but if a key/index uses a column prefix * specification, this function extracts just the name. * - * @param $fields + * @param $columns * An array of key/index column specifiers. * @return - * An array of field names. + * An array of column names. */ - public function fieldNames($fields) { + public function columnNames($columns) { $ret = array(); - foreach ($fields as $field) { - if (is_array($field)) { - $ret[] = $field[0]; + foreach ($columns as $column) { + if (is_array($column)) { + $ret[] = $column[0]; } else { - $ret[] = $field; + $ret[] = $column; } } return $ret; Index: includes/database/select.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/select.inc,v retrieving revision 1.16 diff -u -F^[fc] -r1.16 select.inc --- includes/database/select.inc 11 May 2009 20:13:43 -0000 1.16 +++ includes/database/select.inc 17 May 2009 15:43:26 -0000 @@ -40,22 +40,22 @@ /* Alter accessors to expose the query data to alter hooks. */ /** - * Returns a reference to the fields array for this query. + * Returns a reference to the columns array for this query. * - * Because this method returns by reference, alter hooks may edit the fields - * array directly to make their changes. If just adding fields, however, the - * use of addField() is preferred. + * Because this method returns by reference, alter hooks may edit the columns + * array directly to make their changes. If just adding columns, however, the + * use of addColumn() is preferred. * * Note that this method must be called by reference as well: * * @code - * $fields =& $query->getFields(); + * $columns =& $query->getColumns(); * @endcode * * @return - * A reference to the fields array structure. + * A reference to the columns array structure. */ - public function &getFields(); + public function &getColumns(); /** * Returns a reference to the expressions array for this query. @@ -67,7 +67,7 @@ * Note that this method must be called by reference as well: * * @code - * $fields =& $query->getExpressions(); + * $columns =& $query->getExpressions(); * @endcode * * @return @@ -80,12 +80,12 @@ * * Because this method returns by reference, alter hooks may edit the order-by * array directly to make their changes. If just adding additional ordering - * fields, however, the use of orderBy() is preferred. + * columns, however, the use of orderBy() is preferred. * * Note that this method must be called by reference as well: * * @code - * $fields =& $query->getOrderBy(); + * $columns =& $query->getOrderBy(); * @endcode * * @return @@ -103,7 +103,7 @@ * Note that this method must be called by reference as well: * * @code - * $fields =& $query->getTables(); + * $columns =& $query->getTables(); * @endcode * * @return @@ -132,49 +132,49 @@ public function distinct($distinct = TRUE); /** - * Adds a field to the list to be SELECTed. + * Adds a column to the list to be SELECTed. * * @param $table_alias - * The name of the table from which the field comes, as an alias. Generally + * The name of the table from which the column comes, as an alias. Generally * you will want to use the return value of join() here to ensure that it is * valid. - * @param $field - * The name of the field. + * @param $column + * The name of the column. * @param $alias - * The alias for this field. If not specified, one will be generated - * automatically based on the $table_alias and $field. The alias will be + * The alias for this column. If not specified, one will be generated + * automatically based on the $table_alias and $column. The alias will be * checked for uniqueness, so the requested alias may not be the alias * that is assigned in all cases. * @return - * The unique alias that was assigned for this field. + * The unique alias that was assigned for this column. */ - public function addField($table_alias, $field, $alias = NULL); + public function addColumn($table_alias, $column, $alias = NULL); /** - * Add multiple fields from the same table to be SELECTed. + * Add multiple columns from the same table to be SELECTed. * - * This method does not return the aliases set for the passed fields. In the - * majority of cases that is not a problem, as the alias will be the field - * name. However, if you do need to know the alias you can call getFields() + * This method does not return the aliases set for the passed columns. In the + * majority of cases that is not a problem, as the alias will be the column + * name. However, if you do need to know the alias you can call getColumns() * and examine the result to determine what alias was created. Alternatively, - * simply use addField() for the few fields you care about and this method for + * simply use addColumn() for the few columns you care about and this method for * the rest. * * @param $table_alias - * The name of the table from which the field comes, as an alias. Generally + * The name of the table from which the column comes, as an alias. Generally * you will want to use the return value of join() here to ensure that it is * valid. - * @param $fields - * An indexed array of fields present in the specified table that should be + * @param $columns + * An indexed array of columns present in the specified table that should be * included in this query. If not specified, $table_alias.* will be generated * without any aliases. * @return * The called object. */ - public function fields($table_alias, array $fields = array()); + public function columns($table_alias, array $columns = array()); /** - * Adds an expression to the list of "fields" to be SELECTed. + * Adds an expression to the list of "columns" to be SELECTed. * * An expression can be any arbitrary string that is valid SQL. That includes * various functions, which may in some cases be database-dependent. This @@ -285,7 +285,7 @@ * * This method does the "hard" work of queuing up a table to be joined against. * In some cases, that may include dipping into the Schema API to find the necessary - * fields on which to join. + * columns on which to join. * * @param $type * The type of join. Typically one one of INNER, LEFT OUTER, and RIGHT OUTER. @@ -310,19 +310,19 @@ public function addJoin($type, $table, $alias = NULL, $condition = NULL, $arguments = array()); /** - * Orders the result set by a given field. + * Orders the result set by a given column. * - * If called multiple times, the query will order by each specified field in the + * If called multiple times, the query will order by each specified column in the * order this method is called. * - * @param $field - * The field on which to order. + * @param $column + * The column on which to order. * @param $direction * The direction to sort. Legal values are "ASC" and "DESC". * @return * The called object. */ - public function orderBy($field, $direction = 'ASC'); + public function orderBy($column, $direction = 'ASC'); /** * Restricts a query to a given range in the result set. @@ -341,20 +341,20 @@ public function range($start = NULL, $length = NULL); /** - * Groups the result set by the specified field. + * Groups the result set by the specified column. * - * @param $field - * The field on which to group. This should be the field as aliased. + * @param $column + * The column on which to group. This should be the column as aliased. * @return * The called object. */ - public function groupBy($field); + public function groupBy($column); /** * Get the equivalent COUNT query of this query as a new query object. * * @return - * A new SelectQuery object with no fields or expressions besides COUNT(*). + * A new SelectQuery object with no columns or expressions besides COUNT(*). */ public function countQuery(); @@ -423,8 +423,8 @@ class SelectQueryExtender implements Sel /* Implementations of QueryConditionInterface for the WHERE clause. */ - public function condition($field, $value = NULL, $operator = '=') { - $this->query->condition($field, $value, $operator); + public function condition($column, $value = NULL, $operator = '=') { + $this->query->condition($column, $value, $operator); return $this; } @@ -447,8 +447,8 @@ class SelectQueryExtender implements Sel /* Implmeentations of QueryConditionInterface for the HAVING clause. */ - public function havingCondition($field, $value = NULL, $operator = '=') { - $this->query->condition($field, $value, $operator, $num_args); + public function havingCondition($column, $value = NULL, $operator = '=') { + $this->query->condition($column, $value, $operator, $num_args); return $this; } @@ -481,8 +481,8 @@ class SelectQueryExtender implements Sel /* Alter accessors to expose the query data to alter hooks. */ - public function &getFields() { - return $this->query->getFields(); + public function &getColumns() { + return $this->query->getColumns(); } public function &getExpressions() { @@ -510,12 +510,12 @@ class SelectQueryExtender implements Sel return $this; } - public function addField($table_alias, $field, $alias = NULL) { - return $this->query->addField($table_alias, $field, $alias); + public function addColumn($table_alias, $column, $alias = NULL) { + return $this->query->addColumn($table_alias, $column, $alias); } - public function fields($table_alias, array $fields = array()) { - $this->query->fields($table_alias, $fields); + public function columns($table_alias, array $columns = array()) { + $this->query->columns($table_alias, $columns); return $this; } @@ -543,8 +543,8 @@ class SelectQueryExtender implements Sel return $this->query->addJoin($type, $table, $alias, $condition, $arguments); } - public function orderBy($field, $direction = 'ASC') { - $this->query->orderBy($field, $direction); + public function orderBy($column, $direction = 'ASC') { + $this->query->orderBy($column, $direction); return $this; } @@ -553,8 +553,8 @@ class SelectQueryExtender implements Sel return $this; } - public function groupBy($field) { - $this->query->groupBy($field); + public function groupBy($column) { + $this->query->groupBy($column); return $this; } @@ -562,16 +562,16 @@ class SelectQueryExtender implements Sel // Create our new query object that we will mutate into a count query. $count = clone($this); - // Zero-out existing fields and expressions. - $fields =& $count->getFields(); - $fields = array(); + // Zero-out existing columns and expressions. + $columns =& $count->getColumns(); + $columns = array(); $expressions =& $count->getExpressions(); $expressions = array(); - // Also remove 'all_fields' statements, which are expanded into tablename.* + // Also remove 'all_columns' statements, which are expanded into tablename.* // when the query is executed. foreach ($count->tables as $alias => &$table) { - unset($table['all_fields']); + unset($table['all_columns']); } // Ordering a count query is a waste of cycles, and breaks on some @@ -585,13 +585,13 @@ class SelectQueryExtender implements Sel return $count; } - function isNull($field) { - $this->query->isNull($field); + function isNull($column) { + $this->query->isNull($column); return $this; } - function isNotNull($field) { - $this->query->isNotNull($field); + function isNotNull($column) { + $this->query->isNotNull($column); return $this; } @@ -637,14 +637,14 @@ class SelectQueryExtender implements Sel class SelectQuery extends Query implements SelectQueryInterface { /** - * The fields to SELECT. + * The columns to SELECT. * * @var array */ - protected $fields = array(); + protected $columns = array(); /** - * The expressions to SELECT as virtual fields. + * The expressions to SELECT as virtual columns. * * @var array */ @@ -662,7 +662,7 @@ class SelectQuery extends Query implemen * 'alias' => $alias_of_the_table, * 'condition' => $condition_clause_on_which_to_join, * 'arguments' => $array_of_arguments_for_placeholders_in_the condition. - * 'all_fields' => TRUE to SELECT $alias.*, FALSE or NULL otherwise. + * 'all_columns' => TRUE to SELECT $alias.*, FALSE or NULL otherwise. * ) * * If $table is a string, it is taken as the name of a table. If it is @@ -673,9 +673,9 @@ class SelectQuery extends Query implemen protected $tables = array(); /** - * The fields by which to order this query. + * The columns by which to order this query. * - * This is an associative array. The keys are the fields to order, and the value + * This is an associative array. The keys are the columns to order, and the value * is the direction to order, either ASC or DESC. * * @var array @@ -683,7 +683,7 @@ class SelectQuery extends Query implemen protected $order = array(); /** - * The fields by which to group. + * The columns by which to group. * * @var array */ @@ -755,11 +755,11 @@ class SelectQuery extends Query implemen /* Implementations of QueryConditionInterface for the WHERE clause. */ - public function condition($field, $value = NULL, $operator = '=') { + public function condition($column, $value = NULL, $operator = '=') { if (!isset($num_args)) { $num_args = func_num_args(); } - $this->where->condition($field, $value, $operator, $num_args); + $this->where->condition($column, $value, $operator, $num_args); return $this; } @@ -776,13 +776,13 @@ class SelectQuery extends Query implemen return $this; } - public function isNull($field) { - $this->where->isNull($field); + public function isNull($column) { + $this->where->isNull($column); return $this; } - public function isNotNull($field) { - $this->where->isNotNull($field); + public function isNotNull($column) { + $this->where->isNotNull($column); return $this; } @@ -793,11 +793,11 @@ class SelectQuery extends Query implemen /* Implmeentations of QueryConditionInterface for the HAVING clause. */ - public function havingCondition($field, $value = NULL, $operator = '=') { + public function havingCondition($column, $value = NULL, $operator = '=') { if (!isset($num_args)) { $num_args = func_num_args(); } - $this->having->condition($field, $value, $operator, $num_args); + $this->having->condition($column, $value, $operator, $num_args); return $this; } @@ -828,21 +828,21 @@ class SelectQuery extends Query implemen return new $extender_name($this, $this->connection); } - public function havingIsNull($field) { - $this->having->isNull($field); + public function havingIsNull($column) { + $this->having->isNull($column); return $this; } - public function havingIsNotNull($field) { - $this->having->isNotNull($field); + public function havingIsNotNull($column) { + $this->having->isNotNull($column); return $this; } /* Alter accessors to expose the query data to alter hooks. */ - public function &getFields() { - return $this->fields; + public function &getColumns() { + return $this->columns; } public function &getExpressions() { @@ -901,15 +901,15 @@ class SelectQuery extends Query implemen return $this; } - public function addField($table_alias, $field, $alias = NULL) { - // If no alias is specified, first try the field name itself. + public function addColumn($table_alias, $column, $alias = NULL) { + // If no alias is specified, first try the column name itself. if (empty($alias)) { - $alias = $field; + $alias = $column; } - // If that's already in use, try the table name and field name. + // If that's already in use, try the table name and column name. if (!empty($this->tables[$alias])) { - $alias = $table_alias . '_' . $field; + $alias = $table_alias . '_' . $column; } // If that is already used, just add a counter until we find an unused alias. @@ -920,8 +920,8 @@ class SelectQuery extends Query implemen } $alias = $alias_candidate; - $this->fields[$alias] = array( - 'field' => $field, + $this->columns[$alias] = array( + 'column' => $column, 'table' => $table_alias, 'alias' => $alias, ); @@ -929,17 +929,17 @@ class SelectQuery extends Query implemen return $alias; } - public function fields($table_alias, array $fields = array()) { + public function columns($table_alias, array $columns = array()) { - if ($fields) { - foreach ($fields as $field) { + if ($columns) { + foreach ($columns as $column) { // We don't care what alias was assigned. - $this->addField($table_alias, $field); + $this->addColumn($table_alias, $column); } } else { - // We want all fields from this table. - $this->tables[$table_alias]['all_fields'] = TRUE; + // We want all columns from this table. + $this->tables[$table_alias]['all_columns'] = TRUE; } return $this; @@ -1011,8 +1011,8 @@ class SelectQuery extends Query implemen return $alias; } - public function orderBy($field, $direction = 'ASC') { - $this->order[$field] = $direction; + public function orderBy($column, $direction = 'ASC') { + $this->order[$column] = $direction; return $this; } @@ -1021,8 +1021,8 @@ class SelectQuery extends Query implemen return $this; } - public function groupBy($field) { - $this->group[] = $field; + public function groupBy($column) { + $this->group[] = $column; return $this; } @@ -1030,17 +1030,17 @@ class SelectQuery extends Query implemen // Create our new query object that we will mutate into a count query. $count = clone($this); - // Zero-out existing fields and expressions. - $fields =& $count->getFields(); - $fields = array(); + // Zero-out existing columns and expressions. + $columns =& $count->getColumns(); + $columns = array(); $expressions =& $count->getExpressions(); $expressions = array(); - // Also remove 'all_fields' statements, which are expanded into tablename.* + // Also remove 'all_columns' statements, which are expanded into tablename.* // when the query is executed. foreach ($count->tables as $alias => &$table) { - unset($table['all_fields']); + unset($table['all_columns']); } // Ordering a count query is a waste of cycles, and breaks on some @@ -1062,22 +1062,22 @@ class SelectQuery extends Query implemen $query .= 'DISTINCT '; } - // FIELDS and EXPRESSIONS - $fields = array(); - foreach ($this->fields as $alias => $field) { - // Always use the AS keyword for field aliases, as some + // COLUMNS and EXPRESSIONS + $columns = array(); + foreach ($this->columns as $alias => $column) { + // Always use the AS keyword for column aliases, as some // databases require it (e.g., PostgreSQL). - $fields[] = (isset($field['table']) ? $field['table'] . '.' : '') . $field['field'] . ' AS ' . $field['alias']; + $columns[] = (isset($column['table']) ? $column['table'] . '.' : '') . $column['column'] . ' AS ' . $column['alias']; } foreach ($this->expressions as $alias => $expression) { - $fields[] = $expression['expression'] . ' AS ' . $expression['alias']; + $columns[] = $expression['expression'] . ' AS ' . $expression['alias']; } foreach ($this->tables as $alias => $table) { - if (!empty($table['all_fields'])) { - $fields[] = $alias . '.*'; + if (!empty($table['all_columns'])) { + $columns[] = $alias . '.*'; } } - $query .= implode(', ', $fields); + $query .= implode(', ', $columns); // FROM - We presume all queries have a FROM, as any query that doesn't won't need the query builder anyway. @@ -1127,11 +1127,11 @@ class SelectQuery extends Query implemen // ORDER BY if ($this->order) { $query .= "\nORDER BY "; - $fields = array(); - foreach ($this->order as $field => $direction) { - $fields[] = $field . ' ' . $direction; + $columns = array(); + foreach ($this->order as $column => $direction) { + $columns[] = $column . ' ' . $direction; } - $query .= implode(', ', $fields); + $query .= implode(', ', $columns); } // RANGE is database specific, so we can't do it here. Index: includes/database/mysql/query.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/mysql/query.inc,v retrieving revision 1.11 diff -u -F^[fc] -r1.11 query.inc --- includes/database/mysql/query.inc 20 Apr 2009 20:02:30 -0000 1.11 +++ includes/database/mysql/query.inc 17 May 2009 15:43:26 -0000 @@ -18,16 +18,16 @@ class InsertQuery_mysql extends InsertQu // Confirm that the user did not try to specify an identical // field and default field. - if (array_intersect($this->insertFields, $this->defaultFields)) { - throw new PDOException('You may not specify the same field to have a value and a schema-default value.'); + if (array_intersect($this->insertColumns, $this->defaultColumns)) { + throw new PDOException('You may not specify the same column to have a value and a schema-default value.'); } - if (count($this->insertFields) + count($this->defaultFields) == 0) { + if (count($this->insertColumns) + count($this->defaultColumns) == 0) { return NULL; } // Don't execute query without values. - if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) { + if (!isset($this->insertValues[0]) && count($this->insertColumns) > 0) { return NULL; } @@ -53,10 +53,10 @@ class InsertQuery_mysql extends InsertQu $delay = $this->queryOptions['delay'] ? 'DELAYED' : ''; - // Default fields are always placed first for consistency. - $insert_fields = array_merge($this->defaultFields, $this->insertFields); + // Default columns are always placed first for consistency. + $insert_columns = array_merge($this->defaultColumns, $this->insertColumns); - $query = "INSERT $delay INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES '; + $query = "INSERT $delay INTO {" . $this->table . '} (' . implode(', ', $insert_columns) . ') VALUES '; $max_placeholder = 0; $values = array(); @@ -64,9 +64,9 @@ class InsertQuery_mysql extends InsertQu foreach ($this->insertValues as $insert_values) { $placeholders = array(); - // Default fields aren't really placeholders, but this is the most convenient + // Default columns aren't really placeholders, but this is the most convenient // way to handle them. - $placeholders = array_pad($placeholders, count($this->defaultFields), 'default'); + $placeholders = array_pad($placeholders, count($this->defaultColumns), 'default'); $new_placeholder = $max_placeholder + count($insert_values); for ($i = $max_placeholder; $i < $new_placeholder; ++$i) { @@ -78,7 +78,7 @@ class InsertQuery_mysql extends InsertQu } else { // If there are no values, then this is a default-only query. We still need to handle that. - $placeholders = array_fill(0, count($this->defaultFields), 'default'); + $placeholders = array_fill(0, count($this->defaultColumns), 'default'); $values[] = '(' . implode(', ', $placeholders) . ')'; } @@ -92,45 +92,45 @@ class MergeQuery_mysql extends MergeQuer public function execute() { - // A merge query without any key field is invalid. - if (count($this->keyFields) == 0) { - throw new InvalidMergeQueryException("You need to specify key fields before executing a merge query"); + // A merge query without any key column is invalid. + if (count($this->keyColumns) == 0) { + throw new InvalidMergeQueryException("You need to specify key columns before executing a merge query"); } // Set defaults. - if ($this->updateFields) { - $update_fields = $this->updateFields; + if ($this->updateColumns) { + $update_columns = $this->updateColumns; } else { - // When update fields are derived from insert fields, we don't need + // When update columns are derived from insert columns, we don't need // placeholders since we can tell MySQL to reuse insert supplied // values using the VALUES(col_name) function. - $update_fields = array(); + $update_columns = array(); } - $insert_fields = $this->insertFields + $this->keyFields; + $insert_columns = $this->insertColumns + $this->keyColumns; $max_placeholder = 0; $values = array(); // We assume that the order here is the same as in __toString(). If that's // not the case, then we have serious problems. - foreach ($insert_fields as $value) { + foreach ($insert_columns as $value) { $values[':db_insert_placeholder_' . $max_placeholder++] = $value; } - // Expressions take priority over literal fields, so we process those first - // and remove any literal fields that conflict. - foreach ($this->expressionFields as $field => $data) { + // Expressions take priority over literal columns, so we process those first + // and remove any literal columns that conflict. + foreach ($this->expressionColumns as $column => $data) { if (!empty($data['arguments'])) { $values += $data['arguments']; } - unset($update_fields[$field]); + unset($update_columns[$column]); } - // Because we filter $fields the same way here and in __toString(), the + // Because we filter $columns the same way here and in __toString(), the // placeholders will all match up properly. $max_placeholder = 0; - foreach ($update_fields as $field => $value) { + foreach ($update_columns as $column => $value) { $values[':db_update_placeholder_' . ($max_placeholder++)] = $value; } @@ -143,53 +143,53 @@ class MergeQuery_mysql extends MergeQuer public function __toString() { // Set defaults. - if ($this->updateFields) { - $update_fields = $this->updateFields; + if ($this->updateColumns) { + $update_columns = $this->updateColumns; } else { - $update_fields = $this->insertFields; - // If there are no exclude fields, this is a no-op. - foreach ($this->excludeFields as $exclude_field) { - unset($update_fields[$exclude_field]); + $update_columns = $this->insertColumns; + // If there are no exclude columns, this is a no-op. + foreach ($this->excludeColumns as $exclude_column) { + unset($update_columns[$exclude_column]); } } - // If the merge query has no fields to update, add the first key as an - // update field so the query will not fail if a duplicate key is found. - if (!$update_fields && !$this->expressionFields) { - $update_fields = array_slice($this->keyFields, 0, 1, TRUE); + // If the merge query has no columns to update, add the first key as an + // update column so the query will not fail if a duplicate key is found. + if (!$update_columns && !$this->expressionColumns) { + $update_columns = array_slice($this->keyColumns, 0, 1, TRUE); } - $insert_fields = $this->insertFields + $this->keyFields; + $insert_columns = $this->insertColumns + $this->keyColumns; - $query = "INSERT INTO {" . $this->table . '} (' . implode(', ', array_keys($insert_fields)) . ') VALUES '; + $query = "INSERT INTO {" . $this->table . '} (' . implode(', ', array_keys($insert_columns)) . ') VALUES '; $max_placeholder = 0; $values = array(); - // We don't need the $field, but this is a convenient way to count. - foreach ($insert_fields as $field) { + // We don't need the $column, but this is a convenient way to count. + foreach ($insert_columns as $column) { $values[] = ':db_insert_placeholder_' . $max_placeholder++; } $query .= '(' . implode(', ', $values) . ') ON DUPLICATE KEY UPDATE '; - // Expressions take priority over literal fields, so we process those first - // and remove any literal fields that conflict. + // Expressions take priority over literal columns, so we process those first + // and remove any literal columns that conflict. $max_placeholder = 0; $update = array(); - foreach ($this->expressionFields as $field => $data) { - $update[] = $field . '=' . $data['expression']; - unset($update_fields[$field]); + foreach ($this->expressionColumns as $column => $data) { + $update[] = $column . '=' . $data['expression']; + unset($update_columns[$column]); } - // Build update fields clauses based on caller supplied list, or derived + // Build update columns clauses based on caller supplied list, or derived // from insert supplied values using the VALUES(col_name) function. - foreach ($update_fields as $field => $value) { - if ($this->updateFields) { - $update[] = ($field . '=:db_update_placeholder_' . $max_placeholder++); + foreach ($update_columns as $column => $value) { + if ($this->updateColumns) { + $update[] = ($column . '=:db_update_placeholder_' . $max_placeholder++); } else { - $update[] = ($field . '=VALUES(' . $field . ')'); + $update[] = ($column . '=VALUES(' . $column . ')'); } } Index: includes/database/mysql/schema.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/mysql/schema.inc,v retrieving revision 1.18 diff -u -F^[fc] -r1.18 schema.inc --- includes/database/mysql/schema.inc 25 Apr 2009 16:57:19 -0000 1.18 +++ includes/database/mysql/schema.inc 17 May 2009 15:43:26 -0000 @@ -68,7 +68,7 @@ class DatabaseSchema_mysql extends Datab $sql = "CREATE TABLE {" . $name . "} (\n"; // Add the SQL statement for each field. - foreach ($table['fields'] as $field_name => $field) { + foreach ($table['columns'] as $field_name => $field) { $sql .= $this->createFieldSql($field_name, $this->processField($field)) . ", \n"; } @@ -172,7 +172,7 @@ class DatabaseSchema_mysql extends Datab return $field; } - public function getFieldTypeMap() { + public function getColumnTypeMap() { // Put :normal last so it gets preserved by array_flip. This makes // it much easier for modules (such as schema.module) to map // database types back into schema types. @@ -272,7 +272,7 @@ class DatabaseSchema_mysql extends Datab $ret[] = update_sql('DROP TABLE {' . $table . '}'); } - public function addField(&$ret, $table, $field, $spec, $keys_new = array()) { + public function addColumn(&$ret, $table, $field, $spec, $keys_new = array()) { $fixnull = FALSE; if (!empty($spec['not null']) && !isset($spec['default'])) { $fixnull = TRUE; @@ -292,15 +292,15 @@ class DatabaseSchema_mysql extends Datab } if ($fixnull) { $spec['not null'] = TRUE; - $this->changeField($ret, $table, $field, $field, $spec); + $this->changeColumn($ret, $table, $field, $field, $spec); } } - public function dropField(&$ret, $table, $field) { + public function dropColumn(&$ret, $table, $field) { $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP ' . $field); } - public function fieldSetDefault(&$ret, $table, $field, $default) { + public function columnSetDefault(&$ret, $table, $field, $default) { if (is_null($default)) { $default = 'NULL'; } @@ -311,7 +311,7 @@ class DatabaseSchema_mysql extends Datab $ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' SET DEFAULT ' . $default); } - public function fieldSetNoDefault(&$ret, $table, $field) { + public function columnSetNoDefault(&$ret, $table, $field) { $ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' DROP DEFAULT'); } @@ -340,7 +340,7 @@ class DatabaseSchema_mysql extends Datab $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP INDEX ' . $name); } - public function changeField(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) { + public function changeColumn(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) { $sql = 'ALTER TABLE {' . $table . '} CHANGE `' . $field . '` ' . $this->createFieldSql($field_new, $this->processField($spec)); if (count($keys_new)) { $sql .= ', ADD ' . implode(', ADD ', $this->createKeysSql($keys_new)); @@ -372,10 +372,10 @@ class DatabaseSchema_mysql extends Datab if (isset($column)) { $condition->condition('column_name', $column); $condition->compile($this->connection); - return db_query("SELECT column_comment FROM information_schema.columns WHERE " . (string) $condition, $condition->arguments())->fetchField(); + return db_query("SELECT column_comment FROM information_schema.columns WHERE " . (string) $condition, $condition->arguments())->fetchColumn(); } $condition->compile($this->connection); - $comment = db_query("SELECT table_comment FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchField(); + $comment = db_query("SELECT table_comment FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchColumn(); // Work-around for MySQL 5.0 bug http://bugs.mysql.com/bug.php?id=11379 return preg_replace('/; InnoDB free:.*$/', '', $comment); } Index: includes/database/pgsql/query.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/pgsql/query.inc,v retrieving revision 1.10 diff -u -F^[fc] -r1.10 query.inc --- includes/database/pgsql/query.inc 20 Apr 2009 20:02:30 -0000 1.10 +++ includes/database/pgsql/query.inc 17 May 2009 15:43:26 -0000 @@ -23,16 +23,16 @@ class InsertQuery_pgsql extends InsertQu // Confirm that the user did not try to specify an identical // field and default field. - if (array_intersect($this->insertFields, $this->defaultFields)) { + if (array_intersect($this->insertColumns, $this->defaultColumns)) { throw new PDOException('You may not specify the same field to have a value and a schema-default value.'); } - if (count($this->insertFields) + count($this->defaultFields) == 0) { + if (count($this->insertColumns) + count($this->defaultColumns) == 0) { return NULL; } // Don't execute query without values. - if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) { + if (!isset($this->insertValues[0]) && count($this->insertColumns) > 0) { return NULL; } @@ -45,7 +45,7 @@ class InsertQuery_pgsql extends InsertQu $blobs = array(); $blob_count = 0; foreach ($this->insertValues as &$insert_values) { - foreach ($this->insertFields as $idx => $field) { + foreach ($this->insertColumns as $idx => $field) { if (isset($table_information->blob_fields[$field])) { $blobs[$blob_count] = fopen('php://memory', 'a'); fwrite($blobs[$blob_count], $insert_values[$idx]); @@ -82,7 +82,7 @@ class InsertQuery_pgsql extends InsertQu public function __toString() { // Default fields are always placed first for consistency. - $insert_fields = array_merge($this->defaultFields, $this->insertFields); + $insert_fields = array_merge($this->defaultColumns, $this->insertColumns); $query = "INSERT INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES '; @@ -94,7 +94,7 @@ class InsertQuery_pgsql extends InsertQu // Default fields aren't really placeholders, but this is the most convenient // way to handle them. - $placeholders = array_pad($placeholders, count($this->defaultFields), 'default'); + $placeholders = array_pad($placeholders, count($this->defaultColumns), 'default'); $new_placeholder = $max_placeholder + count($insert_values); for ($i = $max_placeholder; $i < $new_placeholder; ++$i) { @@ -106,7 +106,7 @@ class InsertQuery_pgsql extends InsertQu } else { // If there are no values, then this is a default-only query. We still need to handle that. - $placeholders = array_fill(0, count($this->defaultFields), 'default'); + $placeholders = array_fill(0, count($this->defaultColumns), 'default'); $values[] = '(' . implode(', ', $placeholders) . ')'; } @@ -133,7 +133,7 @@ class UpdateQuery_pgsql extends UpdateQu // and remove any literal fields that conflict. $fields = $this->fields; $expression_fields = array(); - foreach ($this->expressionFields as $field => $data) { + foreach ($this->expressionColumns as $field => $data) { if (!empty($data['arguments'])) { foreach ($data['arguments'] as $placeholder => $argument) { // We assume that an expression will never happen on a BLOB field, Index: includes/database/pgsql/schema.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/pgsql/schema.inc,v retrieving revision 1.13 diff -u -F^[fc] -r1.13 schema.inc --- includes/database/pgsql/schema.inc 20 Apr 2009 20:02:30 -0000 1.13 +++ includes/database/pgsql/schema.inc 17 May 2009 15:43:26 -0000 @@ -80,7 +80,7 @@ class DatabaseSchema_pgsql extends Datab */ protected function createTableSql($name, $table) { $sql_fields = array(); - foreach ($table['fields'] as $field_name => $field) { + foreach ($table['columns'] as $field_name => $field) { $sql_fields[] = $this->createFieldSql($field_name, $this->processField($field)); } @@ -115,7 +115,7 @@ class DatabaseSchema_pgsql extends Datab } // Add column comments. - foreach ($table['fields'] as $field_name => $field) { + foreach ($table['columns'] as $field_name => $field) { if (!empty($field['description'])) { $statements[] = 'COMMENT ON COLUMN {' . $name . '}.' . $field_name . ' IS ' . $this->prepareComment($field['description']); } @@ -176,7 +176,7 @@ class DatabaseSchema_pgsql extends Datab } // Set the correct database-engine specific datatype. if (!isset($field['pgsql_type'])) { - $map = $this->getFieldTypeMap(); + $map = $this->getColumnTypeMap(); $field['pgsql_type'] = $map[$field['type'] . ':' . $field['size']]; } if (!empty($field['unsigned'])) { @@ -187,7 +187,7 @@ class DatabaseSchema_pgsql extends Datab // to ensure that a value inserted is >= 0. To provide the extra // integer capacity, here, we bump up the column field size. if (!isset($map)) { - $map = $this->getFieldTypeMap(); + $map = $this->getColumnTypeMap(); } switch ($field['pgsql_type']) { case 'smallint': @@ -209,7 +209,7 @@ class DatabaseSchema_pgsql extends Datab * This maps a generic data type in combination with its data size * to the engine-specific data type. */ - function getFieldTypeMap() { + function getColumnTypeMap() { // Put :normal last so it gets preserved by array_flip. This makes // it much easier for modules (such as schema.module) to map // database types back into schema types. @@ -309,14 +309,14 @@ class DatabaseSchema_pgsql extends Datab * @param $keys_new * Optional keys and indexes specification to be created on the * table along with adding the field. The format is the same as a - * table specification but without the 'fields' element. If you are + * table specification but without the 'columns' element. If you are * adding a type 'serial' field, you MUST specify at least one key * or index including it in this array. See db_change_field() for more * explanation why. * * @see db_change_field() */ - public function addField(&$ret, $table, $field, $spec, $new_keys = array()) { + public function addColumn(&$ret, $table, $field, $spec, $new_keys = array()) { $fixnull = FALSE; if (!empty($spec['not null']) && !isset($spec['default'])) { $fixnull = TRUE; @@ -353,7 +353,7 @@ class DatabaseSchema_pgsql extends Datab * @param $field * The field to be dropped. */ - public function dropField(&$ret, $table, $field) { + public function dropColumn(&$ret, $table, $field) { $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP COLUMN ' . $field); } @@ -369,7 +369,7 @@ class DatabaseSchema_pgsql extends Datab * @param $default * Default value to be set. NULL for 'default NULL'. */ - public function fieldSetDefault(&$ret, $table, $field, $default) { + public function columnSetDefault(&$ret, $table, $field, $default) { if (is_null($default)) { $default = 'NULL'; } @@ -390,7 +390,7 @@ class DatabaseSchema_pgsql extends Datab * @param $field * The field to be altered. */ - public function fieldSetNoDefault(&$ret, $table, $field) { + public function columnSetNoDefault(&$ret, $table, $field) { $ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' DROP DEFAULT'); } @@ -402,7 +402,7 @@ class DatabaseSchema_pgsql extends Datab * @param $table * The table to be altered. * @param $fields - * Fields for the primary key. + * Columns for the primary key. */ public function addPrimaryKey(&$ret, $table, $fields) { $ret[] = update_sql('ALTER TABLE {' . $table . '} ADD PRIMARY KEY (' . implode(',', $fields) . ')'); @@ -497,7 +497,7 @@ class DatabaseSchema_pgsql extends Datab * For example, suppose you have: * @code * $schema['foo'] = array( - * 'fields' => array( + * 'columns' => array( * 'bar' => array('type' => 'int', 'not null' => TRUE) * ), * 'primary key' => array('bar') @@ -543,9 +543,9 @@ class DatabaseSchema_pgsql extends Datab * @param $new_keys * Optional keys and indexes specification to be created on the * table along with changing the field. The format is the same as a - * table specification but without the 'fields' element. + * table specification but without the 'columns' element. */ - public function changeField(&$ret, $table, $field, $field_new, $spec, $new_keys = array()) { + public function changeColumn(&$ret, $table, $field, $field_new, $spec, $new_keys = array()) { $ret[] = update_sql("ALTER TABLE {" . $table . "} RENAME $field TO " . $field . "_old"); $not_null = isset($spec['not null']) ? $spec['not null'] : FALSE; unset($spec['not null']); @@ -553,12 +553,12 @@ class DatabaseSchema_pgsql extends Datab if (!array_key_exists('size', $spec)) { $spec['size'] = 'normal'; } - $this->addField($ret, $table, "$field_new", $spec); + $this->addColumn($ret, $table, "$field_new", $spec); // We need to typecast the new column to best be able to transfer the data - // Schema_pgsql::getFieldTypeMap() will return possibilities that are not + // Schema_pgsql::getColumnTypeMap() will return possibilities that are not // 'cast-able' such as 'serial' - so they need to be casted int instead. - $map = $this->getFieldTypeMap(); + $map = $this->getColumnTypeMap(); $typecast = $map[$spec['type'] . ':' . $spec['size']]; if (in_array($typecast, array('serial', 'bigserial', 'numeric'))) { $typecast = 'int'; @@ -569,7 +569,7 @@ class DatabaseSchema_pgsql extends Datab $ret[] = update_sql("ALTER TABLE {" . $table . "} ALTER $field_new SET NOT NULL"); } - $this->dropField($ret, $table, $field . '_old'); + $this->dropColumn($ret, $table, $field . '_old'); if (isset($new_keys)) { $this->_createKeys($ret, $table, $new_keys); @@ -604,8 +604,8 @@ class DatabaseSchema_pgsql extends Datab public function getComment($table, $column = NULL) { $table = $this->connection->prefixTables('{' . $table . '}'); if (isset($column)) { - return db_query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?', array($table, $column))->fetchField(); + return db_query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?', array($table, $column))->fetchColumn(); } - return db_query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?', array('pg_class', $table))->fetchField(); + return db_query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?', array('pg_class', $table))->fetchColumn(); } } Index: includes/database/sqlite/query.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/sqlite/query.inc,v retrieving revision 1.5 diff -u -F^[fc] -r1.5 query.inc --- includes/database/sqlite/query.inc 3 May 2009 08:55:06 -0000 1.5 +++ includes/database/sqlite/query.inc 17 May 2009 15:43:26 -0000 @@ -21,14 +21,14 @@ class InsertQuery_sqlite extends InsertQuery { public function execute() { - if (count($this->insertFields) + count($this->defaultFields) == 0) { + if (count($this->insertColumns) + count($this->defaultColumns) == 0) { return NULL; } // Don't execute query without values. - if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) { + if (!isset($this->insertValues[0]) && count($this->insertColumns) > 0) { return NULL; } - if (count($this->insertFields)) { + if (count($this->insertColumns)) { return parent::execute(); } else { @@ -38,8 +38,8 @@ class InsertQuery_sqlite extends InsertQ public function __toString() { // Produce as many generic placeholders as necessary. - $placeholders = array_fill(0, count($this->insertFields), '?'); - return 'INSERT INTO {' . $this->table . '} (' . implode(', ', $this->insertFields) . ') VALUES (' . implode(', ', $placeholders) . ')'; + $placeholders = array_fill(0, count($this->insertColumns), '?'); + return 'INSERT INTO {' . $this->table . '} (' . implode(', ', $this->insertColumns) . ') VALUES (' . implode(', ', $placeholders) . ')'; } } @@ -66,10 +66,10 @@ class UpdateQuery_sqlite extends UpdateQ * @param QueryConditionInterface $condition * A database condition. */ - protected function removeFieldsInCondition(&$fields, QueryConditionInterface $condition) { + protected function removeColumnsInCondition(&$fields, QueryConditionInterface $condition) { foreach ($condition->conditions() as $child_condition) { if ($child_condition['field'] instanceof QueryConditionInterface) { - $this->removeFieldsInCondition($fields, $child_condition['field']); + $this->removeColumnsInCondition($fields, $child_condition['field']); } else { unset($fields[$child_condition['field']]); @@ -80,8 +80,8 @@ class UpdateQuery_sqlite extends UpdateQ public function execute() { // Get the fields used in the update query, and remove those that are already // in the condition. - $fields = $this->expressionFields + $this->fields; - $this->removeFieldsInCondition($fields, $this->condition); + $fields = $this->expressionColumns + $this->fields; + $this->removeColumnsInCondition($fields, $this->condition); // Add the inverse of the fields to the condition. $condition = new DatabaseCondition('OR'); @@ -125,7 +125,7 @@ class UpdateQuery_sqlite extends UpdateQ class DeleteQuery_sqlite extends DeleteQuery { public function execute() { if (!count($this->condition)) { - $total_rows = $this->connection->query('SELECT COUNT(*) FROM {' . $this->connection->escapeTable($this->table) . '}')->fetchField(); + $total_rows = $this->connection->query('SELECT COUNT(*) FROM {' . $this->connection->escapeTable($this->table) . '}')->fetchColumn(); parent::execute(); return $total_rows; } Index: includes/database/sqlite/schema.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/sqlite/schema.inc,v retrieving revision 1.4 diff -u -F^[fc] -r1.4 schema.inc --- includes/database/sqlite/schema.inc 20 Apr 2009 20:02:31 -0000 1.4 +++ includes/database/sqlite/schema.inc 17 May 2009 15:43:26 -0000 @@ -15,12 +15,12 @@ class DatabaseSchema_sqlite extends DatabaseSchema { public function tableExists($table) { - return (bool) $this->connection->query("SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE '{" . $table . "}'", array(), array())->fetchField(); + return (bool) $this->connection->query("SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE '{" . $table . "}'", array(), array())->fetchColumn(); } public function columnExists($table, $column) { $schema = $this->introspectSchema($table); - return !empty($schema['fields'][$column]); + return !empty($schema['columns'][$column]); } /** @@ -64,7 +64,7 @@ class DatabaseSchema_sqlite extends Data $sql_array = array(); // Add the SQL statement for each field. - foreach ($schema['fields'] as $name => $field) { + foreach ($schema['columns'] as $name => $field) { if ($field['type'] == 'serial') { if (isset($schema['primary key']) && ($key = array_search($name, $schema['primary key'])) !== FALSE) { unset($schema['primary key'][$key]); @@ -109,7 +109,7 @@ class DatabaseSchema_sqlite extends Data } // Set the correct database-engine specific datatype. if (!isset($field['sqlite_type'])) { - $map = $this->getFieldTypeMap(); + $map = $this->getColumnTypeMap(); $field['sqlite_type'] = $map[$field['type'] . ':' . $field['size']]; } @@ -164,7 +164,7 @@ class DatabaseSchema_sqlite extends Data * This maps a generic data type in combination with its data size * to the engine-specific data type. */ - public function getFieldTypeMap() { + public function getColumnTypeMap() { // Put :normal last so it gets preserved by array_flip. This makes // it much easier for modules (such as schema.module) to map // database types back into schema types. @@ -244,7 +244,7 @@ class DatabaseSchema_sqlite extends Data * @param $spec * The field specification array, as taken from a schema definition. */ - public function addField(&$ret, $table, $field, $spec, $keys_new = array()) { + public function addColumn(&$ret, $table, $field, $spec, $keys_new = array()) { // TODO: $keys_new is not supported yet. $query = 'ALTER TABLE {' . $table . '} ADD '; $query .= $this->createFieldSql($field, $this->processField($spec)); @@ -270,10 +270,10 @@ class DatabaseSchema_sqlite extends Data $new_table = $table . '_' . $i++; } while ($this->tableExists($new_table)); $this->createTable($ret, $new_table, $new_schema); - $fields = implode(', ', array_keys($new_schema['fields'])); + $fields = implode(', ', array_keys($new_schema['columns'])); $ret[] = update_sql('INSERT INTO {' . $new_table . "} ($fields) SELECT $fields FROM {" . $table . '}'); - $old_count = db_query('SELECT COUNT(*) FROM {' . $table . '}')->fetchField(); - $new_count = db_query('SELECT COUNT(*) FROM {' . $new_table . '}')->fetchField(); + $old_count = db_query('SELECT COUNT(*) FROM {' . $table . '}')->fetchColumn(); + $new_count = db_query('SELECT COUNT(*) FROM {' . $new_table . '}')->fetchColumn(); if ($old_count == $new_count) { do { $temp_table = $table . '_' . $i++; @@ -298,7 +298,7 @@ class DatabaseSchema_sqlite extends Data * @see drupal_get_schema() */ protected function introspectSchema($table) { - $mapped_fields = array_flip($this->getFieldTypeMap()); + $mapped_fields = array_flip($this->getColumnTypeMap()); $schema = array(); foreach (db_query("PRAGMA table_info('{" . $table . "}')") as $row) { if (preg_match('/^([^(]+)\((.*)\)$/', $row->type, $matches)) { @@ -311,14 +311,14 @@ class DatabaseSchema_sqlite extends Data } if (isset($mapped_fields[$type])) { list($type, $size) = explode(':', $mapped_fields[$type]); - $schema['fields'][$row->name] = array( + $schema['columns'][$row->name] = array( 'type' => $type, 'size' => $size, 'not null' => !empty($row->notnull), 'default' => trim($row->dflt_value, "'"), ); if ($length) { - $schema['fields'][$row->name]['length'] = $length; + $schema['columns'][$row->name]['length'] = $length; } if ($row->pk) { $schema['primary key'][] = $row->name; @@ -361,9 +361,9 @@ class DatabaseSchema_sqlite extends Data * @param $field * The field to be dropped. */ - public function dropField(&$ret, $table, $field) { + public function dropColumn(&$ret, $table, $field) { $new_schema = $this->introspectSchema($table); - unset($new_schema['fields'][$field]); + unset($new_schema['columns'][$field]); foreach ($new_schema['indexes'] as $index => $fields) { foreach ($fields as $key => $field_name) { if ($field_name == $field) { @@ -397,12 +397,12 @@ class DatabaseSchema_sqlite extends Data * @param $keys_new * Optional keys and indexes specification to be created on the * table along with changing the field. The format is the same as a - * table specification but without the 'fields' element. + * table specification but without the 'columns' element. */ - public function changeField(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) { + public function changeColumn(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) { $new_schema = $this->introspectSchema($table); - unset($new_schema['fields'][$field]); - $new_schema['fields'][$field_new] = $spec; + unset($new_schema['columns'][$field]); + $new_schema['columns'][$field_new] = $spec; if (isset($keys_new['primary keys'])) { $new_schema['primary keys'] = $keys_new['primary keys']; $keys_new['primary keys']; @@ -489,7 +489,7 @@ class DatabaseSchema_sqlite extends Data * @param $table * The table to be altered. * @param $fields - * Fields for the primary key. + * Columns for the primary key. */ public function addPrimaryKey(&$ret, $table, $fields) { $new_schema = $this->introspectSchema($table); @@ -529,9 +529,9 @@ class DatabaseSchema_sqlite extends Data * @param $default * Default value to be set. NULL for 'default NULL'. */ - public function fieldSetDefault(&$ret, $table, $field, $default) { + public function columnSetDefault(&$ret, $table, $field, $default) { $new_schema = $this->introspectSchema($table); - $new_schema['fields'][$field]['default'] = $default; + $new_schema['columns'][$field]['default'] = $default; $this->alterTable($ret, $table, $new_schema); } @@ -548,9 +548,9 @@ class DatabaseSchema_sqlite extends Data * @param $field * The field to be altered. */ - public function fieldSetNoDefault(&$ret, $table, $field) { + public function columnSetNoDefault(&$ret, $table, $field) { $new_schema = $this->introspectSchema($table); - unset($new_schema['fields'][$field]['default']); + unset($new_schema['columns'][$field]['default']); $this->alterTable($ret, $table, $new_schema); } Index: modules/aggregator/aggregator.fetcher.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.fetcher.inc,v retrieving revision 1.4 diff -u -F^[fc] -r1.4 aggregator.fetcher.inc --- modules/aggregator/aggregator.fetcher.inc 26 Jan 2009 14:08:42 -0000 1.4 +++ modules/aggregator/aggregator.fetcher.inc 17 May 2009 15:43:26 -0000 @@ -39,7 +39,7 @@ function aggregator_aggregator_fetch($fe switch ($result->code) { case 304: db_update('aggregator_feed') - ->fields(array('checked' => REQUEST_TIME)) + ->columns(array('checked' => REQUEST_TIME)) ->condition('fid', $feed->fid) ->execute(); drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => $feed->title))); @@ -64,7 +64,7 @@ function aggregator_aggregator_fetch($fe if ($feed->hash == $md5) { db_update('aggregator_feed') ->condition('fid', $feed->fid) - ->fields(array('checked' => REQUEST_TIME)) + ->columns(array('checked' => REQUEST_TIME)) ->execute(); drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => $feed->title))); break; Index: modules/aggregator/aggregator.install =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.install,v retrieving revision 1.21 diff -u -F^[fc] -r1.21 aggregator.install --- modules/aggregator/aggregator.install 13 May 2009 19:42:14 -0000 1.21 +++ modules/aggregator/aggregator.install 17 May 2009 15:43:26 -0000 @@ -36,7 +36,7 @@ function aggregator_uninstall() { function aggregator_schema() { $schema['aggregator_category'] = array( 'description' => 'Stores categories for aggregator feeds and feed items.', - 'fields' => array( + 'columns' => array( 'cid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -71,7 +71,7 @@ function aggregator_schema() { $schema['aggregator_category_feed'] = array( 'description' => 'Bridge table; maps feeds to categories.', - 'fields' => array( + 'columns' => array( 'fid' => array( 'type' => 'int', 'not null' => TRUE, @@ -93,7 +93,7 @@ function aggregator_schema() { $schema['aggregator_category_item'] = array( 'description' => 'Bridge table; maps feed items to categories.', - 'fields' => array( + 'columns' => array( 'iid' => array( 'type' => 'int', 'not null' => TRUE, @@ -115,7 +115,7 @@ function aggregator_schema() { $schema['aggregator_feed'] = array( 'description' => 'Stores feeds to be parsed by the aggregator.', - 'fields' => array( + 'columns' => array( 'fid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -203,7 +203,7 @@ function aggregator_schema() { $schema['aggregator_item'] = array( 'description' => 'Stores the individual items imported from feeds.', - 'fields' => array( + 'columns' => array( 'iid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -268,6 +268,6 @@ function aggregator_schema() { */ function aggregator_update_7000() { $ret = array(); - db_add_field($ret, 'aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => '')); + db_add_column($ret, 'aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => '')); return $ret; } Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.408 diff -u -F^[fc] -r1.408 aggregator.module --- modules/aggregator/aggregator.module 17 May 2009 08:54:08 -0000 1.408 +++ modules/aggregator/aggregator.module 17 May 2009 15:43:26 -0000 @@ -254,7 +254,7 @@ function aggregator_init() { * TRUE if there is at least one category and the user has access to them, FALSE otherwise. */ function _aggregator_has_categories() { - return user_access('access news feeds') && db_query('SELECT COUNT(*) FROM {aggregator_category}')->fetchField(); + return user_access('access news feeds') && db_query('SELECT COUNT(*) FROM {aggregator_category}')->fetchColumn(); } /** @@ -307,7 +307,7 @@ function aggregator_block_list() { function aggregator_block_configure($delta = '') { list($type, $id) = explode('-', $delta); if ($type == 'category') { - $value = db_query('SELECT block FROM {aggregator_category} WHERE cid = :cid', array(':cid' => $id))->fetchField(); + $value = db_query('SELECT block FROM {aggregator_category} WHERE cid = :cid', array(':cid' => $id))->fetchColumn(); $form['block'] = array( '#type' => 'select', '#title' => t('Number of news items in block'), @@ -325,7 +325,7 @@ function aggregator_block_save($delta = list($type, $id) = explode('-', $delta); if ($type == 'category') { db_update('aggregator_category') - ->fields(array('block' => $edit['block'])) + ->columns(array('block' => $edit['block'])) ->condition('cid', $id) ->execute(); } @@ -383,7 +383,7 @@ function aggregator_save_category($edit) if (!empty($edit['title'])) { db_merge('aggregator_category') ->key(array('cid' => $edit['cid'])) - ->fields(array( + ->columns(array( 'title' => $edit['title'], 'description' => $edit['description'], )) @@ -406,7 +406,7 @@ function aggregator_save_category($edit) elseif (!empty($edit['title'])) { // A single unique id for bundles and feeds, to use in blocks. $link_path .= db_insert('aggregator_category') - ->fields(array( + ->columns(array( 'title' => $edit['title'], 'description' => $edit['description'], 'block' => 5, @@ -435,7 +435,7 @@ function aggregator_save_feed($edit) { if (!empty($edit['fid']) && !empty($edit['title'])) { db_update('aggregator_feed') ->condition('fid', $edit['fid']) - ->fields(array( + ->columns(array( 'title' => $edit['title'], 'url' => $edit['url'], 'refresh' => $edit['refresh'], @@ -464,7 +464,7 @@ function aggregator_save_feed($edit) { } elseif (!empty($edit['title'])) { $edit['fid'] = db_insert('aggregator_feed') - ->fields(array( + ->columns(array( 'title' => $edit['title'], 'url' => $edit['url'], 'refresh' => $edit['refresh'], @@ -482,7 +482,7 @@ function aggregator_save_feed($edit) { if ($value) { db_merge('aggregator_category_feed') ->key(array('fid' => $edit['fid'])) - ->fields(array( + ->columns(array( 'cid' => $cid, )) ->execute(); @@ -504,7 +504,7 @@ function aggregator_remove($feed) { // Reset feed. db_merge('aggregator_feed') ->key(array('fid' => $feed->fid)) - ->fields(array( + ->columns(array( 'checked' => 0, 'hash' => '', 'etag' => '', Index: modules/aggregator/aggregator.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.pages.inc,v retrieving revision 1.26 diff -u -F^[fc] -r1.26 aggregator.pages.inc --- modules/aggregator/aggregator.pages.inc 26 Apr 2009 19:44:37 -0000 1.26 +++ modules/aggregator/aggregator.pages.inc 17 May 2009 15:43:26 -0000 @@ -207,7 +207,7 @@ function aggregator_categorize_items_sub db_delete('aggregator_category_item') ->condition('iid', $iid) ->execute(); - $insert = db_insert('aggregator_category_item')->fields(array('iid', 'cid')); + $insert = db_insert('aggregator_category_item')->columns(array('iid', 'cid')); $has_values = FALSE; foreach ($selection as $cid) { if ($cid && $iid) { Index: modules/aggregator/aggregator.parser.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.parser.inc,v retrieving revision 1.1 diff -u -F^[fc] -r1.1 aggregator.parser.inc --- modules/aggregator/aggregator.parser.inc 22 Dec 2008 19:38:31 -0000 1.1 +++ modules/aggregator/aggregator.parser.inc 17 May 2009 15:43:26 -0000 @@ -47,7 +47,7 @@ function aggregator_aggregator_parse($fe // Update the feed data. db_merge('aggregator_feed') ->key(array('fid' => $feed->fid)) - ->fields(array( + ->columns(array( 'url' => $feed->url, 'checked' => REQUEST_TIME, 'link' => !empty($channel['LINK']) ? $channel['LINK'] : '', Index: modules/aggregator/aggregator.processor.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.processor.inc,v retrieving revision 1.4 diff -u -F^[fc] -r1.4 aggregator.processor.inc --- modules/aggregator/aggregator.processor.inc 16 May 2009 17:58:30 -0000 1.4 +++ modules/aggregator/aggregator.processor.inc 17 May 2009 15:43:26 -0000 @@ -129,7 +129,7 @@ function aggregator_form_aggregator_admi function aggregator_save_item($edit) { if ($edit['title'] && empty($edit['iid'])) { $edit['iid'] = db_insert('aggregator_item') - ->fields(array( + ->columns(array( 'title' => $edit['title'], 'link' => $edit['link'], 'author' => $edit['author'], @@ -154,7 +154,7 @@ function aggregator_save_item($edit) { foreach ($result as $category) { db_merge('aggregator_category_item') ->key(array('iid' => $edit['iid'])) - ->fields(array( + ->columns(array( 'cid' => $category->cid, )) ->execute(); Index: modules/aggregator/aggregator.test =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.test,v retrieving revision 1.23 diff -u -F^[fc] -r1.23 aggregator.test --- modules/aggregator/aggregator.test 29 Apr 2009 12:08:27 -0000 1.23 +++ modules/aggregator/aggregator.test 17 May 2009 15:43:26 -0000 @@ -73,7 +73,7 @@ class AggregatorTestCase extends DrupalW */ function getDefaultFeedItemCount() { // Our tests are based off of rss.xml, so let's find out how many elements should be related. - $feed_count = db_query_range('SELECT COUNT(*) FROM {node} n WHERE n.promote = 1 AND n.status = 1', 0, variable_get('feed_default_items', 10))->fetchField(); + $feed_count = db_query_range('SELECT COUNT(*) FROM {node} n WHERE n.promote = 1 AND n.status = 1', 0, variable_get('feed_default_items', 10))->fetchColumn(); return $feed_count > 10 ? 10 : $feed_count; } @@ -127,7 +127,7 @@ class AggregatorTestCase extends DrupalW $this->updateFeedItems($feed, $expected_count); $this->assertText('There is new syndicated content from'); $this->removeFeedItems($feed); - $count = db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchField(); + $count = db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchColumn(); $this->assertTrue($count == 0); } @@ -156,7 +156,7 @@ class AggregatorTestCase extends DrupalW * TRUE if feed is unique. */ function uniqueFeed($feed_name, $feed_url) { - $result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed_name, ':url' => $feed_url))->fetchField(); + $result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed_name, ':url' => $feed_url))->fetchColumn(); return (1 == $result); } @@ -345,7 +345,7 @@ class RemoveFeedTestCase extends Aggrega $this->assertResponse(404, t('Deleted feed source does not exists.')); // Check database for feed. - $result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed->title, ':url' => $feed->url))->fetchField(); + $result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed->title, ':url' => $feed->url))->fetchColumn(); $this->assertFalse($result, t('Feed not found in database')); } } @@ -390,13 +390,13 @@ class UpdateFeedItemTestCase extends Agg $feed = db_query("SELECT * FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url']))->fetchObject(); $this->drupalGet('admin/content/aggregator/update/' . $feed->fid); - $before = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchField(); + $before = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchColumn(); // Sleep for 3 second. sleep(3); db_update('aggregator_feed') ->condition('fid', $feed->fid) - ->fields(array( + ->columns(array( 'checked' => 0, 'hash' => '', 'etag' => '', @@ -405,7 +405,7 @@ class UpdateFeedItemTestCase extends Agg ->execute(); $this->drupalGet('admin/content/aggregator/update/' . $feed->fid); - $after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchField(); + $after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchColumn(); $this->assertTrue($before === $after, t('Publish timestamp of feed item was not updated (!before === !after)', array('!before' => $before, '!after' => $after))); } @@ -479,7 +479,7 @@ class CategorizeFeedItemTestCase extends $feed = $this->createFeed(); db_insert('aggregator_category_feed') - ->fields(array( + ->columns(array( 'cid' => $category->cid, 'fid' => $feed->fid, )) @@ -495,7 +495,7 @@ class CategorizeFeedItemTestCase extends ->condition('iid', $feed->items, 'IN') ->countQuery() ->execute() - ->fetchField(); + ->fetchColumn(); $this->assertEqual($feed->item_count, $categorized_count, t('Total items in feed equal to the total categorized feed items in database')); } @@ -523,7 +523,7 @@ class ImportOPMLTestCase extends Aggrega $category = $this->randomName(10); $cid = db_insert('aggregator_category') - ->fields(array( + ->columns(array( 'title' => $category, 'description' => '', )) @@ -541,7 +541,7 @@ class ImportOPMLTestCase extends Aggrega * Submit form filled with invalid fields. */ function validateImportFormFields() { - $before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); + $before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchColumn(); $form = array(); $this->drupalPost('admin/content/aggregator/add/opml', $form, t('Import')); @@ -559,7 +559,7 @@ class ImportOPMLTestCase extends Aggrega $this->drupalPost('admin/content/aggregator/add/opml', $form, t('Import')); $this->assertText(t('This URL is not valid.'), t('Error if the URL is invalid.')); - $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); + $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchColumn(); $this->assertEqual($before, $after, t('No feeds were added during the three last form submissions.')); } @@ -567,7 +567,7 @@ class ImportOPMLTestCase extends Aggrega * Submit form with invalid, empty and valid OPML files. */ function submitImportForm() { - $before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); + $before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchColumn(); $form['files[upload]'] = $this->getInvalidOpml(); $this->drupalPost('admin/content/aggregator/add/opml', $form, t('Import')); @@ -577,7 +577,7 @@ class ImportOPMLTestCase extends Aggrega $this->drupalPost('admin/content/aggregator/add/opml', $form, t('Import')); $this->assertText(t('No new feed has been added.'), t('Attempting to load empty OPML from remote URL.')); - $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); + $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchColumn(); $this->assertEqual($before, $after, t('No feeds were added during the two last form submissions.')); db_delete('aggregator_feed')->execute(); @@ -586,7 +586,7 @@ class ImportOPMLTestCase extends Aggrega $category = $this->randomName(10); db_insert('aggregator_category') - ->fields(array( + ->columns(array( 'cid' => 1, 'title' => $category, 'description' => '', @@ -605,7 +605,7 @@ class ImportOPMLTestCase extends Aggrega $this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), t('Verifying that a duplicate URL was identified')); $this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), t('Verifying that a duplicate title was identified')); - $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); + $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchColumn(); $this->assertEqual($after, 2, t('Verifying that two distinct feeds were added.')); $feeds_from_db = db_query("SELECT f.title, f.url, f.refresh, cf.cid FROM {aggregator_feed} f LEFT JOIN {aggregator_category_feed} cf ON f.fid = cf.fid"); Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.38 diff -u -F^[fc] -r1.38 block.admin.inc --- modules/block/block.admin.inc 16 May 2009 15:23:15 -0000 1.38 +++ modules/block/block.admin.inc 17 May 2009 15:43:26 -0000 @@ -272,7 +272,7 @@ function block_admin_configure(&$form_st function block_admin_configure_validate($form, &$form_state) { if ($form_state['values']['module'] == 'block') { - $box_exists = (bool) db_query_range('SELECT 1 FROM {box} WHERE bid <> :bid AND info = :info', array(':bid' => $form_state['values']['delta'], ':info' => $form_state['values']['info']), 0, 1)->fetchField(); + $box_exists = (bool) db_query_range('SELECT 1 FROM {box} WHERE bid <> :bid AND info = :info', array(':bid' => $form_state['values']['delta'], ':info' => $form_state['values']['info']), 0, 1)->fetchColumn(); if (empty($form_state['values']['info']) || $box_exists) { form_set_error('info', t('Please ensure that each block description is unique.')); } @@ -302,7 +302,7 @@ function block_add_block_form(&$form_sta } function block_add_block_form_validate($form, &$form_state) { - $box_exists = (bool) db_query_range('SELECT 1 FROM {box} WHERE info = :info', array(':info' => $form_state['values']['info']), 0, 1)->fetchField(); + $box_exists = (bool) db_query_range('SELECT 1 FROM {box} WHERE info = :info', array(':info' => $form_state['values']['info']), 0, 1)->fetchColumn(); if (empty($form_state['values']['info']) || $box_exists) { form_set_error('info', t('Please ensure that each block description is unique.')); Index: modules/block/block.install =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.install,v retrieving revision 1.23 diff -u -F^[fc] -r1.23 block.install --- modules/block/block.install 13 May 2009 19:42:14 -0000 1.23 +++ modules/block/block.install 17 May 2009 15:43:26 -0000 @@ -12,7 +12,7 @@ function block_schema() { $schema['block'] = array( 'description' => 'Stores block settings, such as region and visibility settings.', - 'fields' => array( + 'columns' => array( 'bid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -105,7 +105,7 @@ function block_schema() { $schema['block_role'] = array( 'description' => 'Sets up access permissions for blocks based on user roles', - 'fields' => array( + 'columns' => array( 'module' => array( 'type' => 'varchar', 'length' => 64, @@ -133,7 +133,7 @@ function block_schema() { $schema['box'] = array( 'description' => 'Stores contents of custom-made blocks.', - 'fields' => array( + 'columns' => array( 'bid' => array( 'type' => 'serial', 'unsigned' => TRUE, Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.332 diff -u -F^[fc] -r1.332 block.module --- modules/block/block.module 16 May 2009 15:23:15 -0000 1.332 +++ modules/block/block.module 17 May 2009 15:43:26 -0000 @@ -463,7 +463,7 @@ function block_form_system_performance_s ->condition('status', 1) ->countQuery() ->execute() - ->fetchField(); + ->fetchColumn(); // If the "Who's online" block is enabled, append some descriptive text to // the end of the form description. @@ -494,7 +494,7 @@ function block_system_themes_form_submit } if ($form_state['values']['admin_theme'] && $form_state['values']['admin_theme'] != variable_get('admin_theme', 0)) { // If we're changing themes, make sure the theme has its blocks initialized. - $has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', array(':theme' => $form_state['values']['admin_theme']), 0, 1)->fetchField(); + $has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', array(':theme' => $form_state['values']['admin_theme']), 0, 1)->fetchColumn(); if (!$has_blocks) { block_initialize_theme_blocks($form_state['values']['admin_theme']); } @@ -515,7 +515,7 @@ function block_system_themes_form_submit */ function block_initialize_theme_blocks($theme) { // Initialize theme's blocks if none already registered. - $has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', array(':theme' => $theme), 0, 1)->fetchField(); + $has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', array(':theme' => $theme), 0, 1)->fetchColumn(); if (!$has_blocks) { $default_theme = variable_get('theme_default', 'garland'); $regions = system_region_list($theme); Index: modules/blog/blog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v retrieving revision 1.319 diff -u -F^[fc] -r1.319 blog.module --- modules/blog/blog.module 3 May 2009 10:11:33 -0000 1.319 +++ modules/blog/blog.module 17 May 2009 15:43:26 -0000 @@ -162,14 +162,14 @@ function blog_page_user_access($account) */ function _blog_post_exists($account) { return (bool)db_select('node', 'n') - ->fields('n', array('nid')) + ->columns('n', array('nid')) ->condition('type', 'blog') ->condition('uid', $account->uid) ->condition('status', 1) ->range(0, 1) ->addTag('node_access') ->execute() - ->fetchField(); + ->fetchColumn(); } /** @@ -190,7 +190,7 @@ function blog_block_view($delta = '') { if (user_access('access content')) { $result = db_select('node', 'n') - ->fields('n', array('nid', 'title', 'created')) + ->columns('n', array('nid', 'title', 'created')) ->condition('type', 'blog') ->condition('status', 1) ->orderBy('created', 'DESC') Index: modules/blog/blog.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v retrieving revision 1.18 diff -u -F^[fc] -r1.18 blog.pages.inc --- modules/blog/blog.pages.inc 26 Apr 2009 19:44:38 -0000 1.18 +++ modules/blog/blog.pages.inc 17 May 2009 15:43:26 -0000 @@ -31,7 +31,7 @@ function blog_page_user($account) { $query = db_select('node', 'n')->extend('PagerDefault'); $nids = $query - ->fields('n', array('nid', 'sticky', 'created')) + ->columns('n', array('nid', 'sticky', 'created')) ->condition('type', 'blog') ->condition('uid', $account->uid) ->condition('status', 1) @@ -81,7 +81,7 @@ function blog_page_last() { $query = db_select('node', 'n')->extend('PagerDefault'); $nids = $query - ->fields('n', array('nid', 'sticky', 'created')) + ->columns('n', array('nid', 'sticky', 'created')) ->condition('type', 'blog') ->condition('status', 1) ->orderBy('sticky', 'DESC') @@ -113,7 +113,7 @@ function blog_page_last() { function blog_feed_user($account) { $nids = db_select('node', 'n') - ->fields('n', array('nid', 'created')) + ->columns('n', array('nid', 'created')) ->condition('type', 'blog') ->condition('uid', $account->uid) ->condition('status', 1) @@ -134,7 +134,7 @@ function blog_feed_user($account) { */ function blog_feed_last() { $nids = db_select('node', 'n') - ->fields('n', array('nid', 'created')) + ->columns('n', array('nid', 'created')) ->condition('type', 'blog') ->condition('status', 1) ->orderBy('created', 'DESC') Index: modules/blogapi/blogapi.install =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.install,v retrieving revision 1.7 diff -u -F^[fc] -r1.7 blogapi.install --- modules/blogapi/blogapi.install 13 May 2009 19:42:14 -0000 1.7 +++ modules/blogapi/blogapi.install 17 May 2009 15:43:26 -0000 @@ -29,7 +29,7 @@ function blogapi_uninstall() { function blogapi_schema() { $schema['blogapi_files'] = array( 'description' => 'Stores information for files uploaded via the blogapi.', - 'fields' => array( + 'columns' => array( 'fid' => array( 'description' => 'Primary Key: Unique file ID.', 'type' => 'serial', Index: modules/blogapi/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v retrieving revision 1.150 diff -u -F^[fc] -r1.150 blogapi.module --- modules/blogapi/blogapi.module 9 May 2009 18:28:11 -0000 1.150 +++ modules/blogapi/blogapi.module 17 May 2009 15:43:26 -0000 @@ -969,6 +969,6 @@ function _blogapi_get_node_types() { } function _blogapi_space_used($uid) { - return db_query('SELECT SUM(filesize) FROM {blogapi_files} f WHERE f.uid = :uid', array(':uid' => $uid))->fetchField(); + return db_query('SELECT SUM(filesize) FROM {blogapi_files} f WHERE f.uid = :uid', array(':uid' => $uid))->fetchColumn(); } Index: modules/book/book.install =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.install,v retrieving revision 1.28 diff -u -F^[fc] -r1.28 book.install --- modules/book/book.install 13 May 2009 19:42:14 -0000 1.28 +++ modules/book/book.install 17 May 2009 15:43:26 -0000 @@ -68,7 +68,7 @@ function book_update_6000() { if (!isset($_SESSION['book_update_6000'])) { $schema['book'] = array( - 'fields' => array( + 'columns' => array( 'mlid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'bid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), @@ -115,7 +115,7 @@ function book_update_6000() { if (db_result(db_query("SELECT COUNT(*) FROM {book}"))) { // Temporary table for the old book hierarchy; we'll discard revision info. $schema['book_temp'] = array( - 'fields' => array( + 'columns' => array( 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'parent' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny') @@ -257,7 +257,7 @@ function book_update_6000() { function book_schema() { $schema['book'] = array( 'description' => 'Stores book outline information. Uniquely connects each node in the outline to a link in {menu_links}', - 'fields' => array( + 'columns' => array( 'mlid' => array( 'type' => 'int', 'unsigned' => TRUE, Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.493 diff -u -F^[fc] -r1.493 book.module --- modules/book/book.module 9 May 2009 18:28:11 -0000 1.493 +++ modules/book/book.module 17 May 2009 15:43:26 -0000 @@ -231,10 +231,10 @@ function book_block_view($delta = '') { elseif ($current_bid) { // Only display this block when the user is browsing a book. $select = db_select('node'); - $select->addField('node', 'title'); + $select->addColumn('node', 'title'); $select->condition('nid', $node->book['bid']); $select->addTag('node_access'); - $title = $select->execute()->fetchField(); + $title = $select->execute()->fetchColumn(); // Only show the block if the user has view access for the top-level node. if ($title) { $tree = menu_tree_all_data($node->book['menu_name'], $node->book); @@ -304,10 +304,10 @@ function book_get_books() { $query = db_select('book', 'b', array('fetch' => PDO::FETCH_ASSOC)); $node_alias = $query->join('node', 'n', 'b.nid = n.nid'); $menu_links_alias = $query->join('menu_links', 'ml', 'b.mlid = ml.mlid'); - $query->addField('n', 'type', 'type'); - $query->addField('n', 'title', 'title'); - $query->fields('b'); - $query->fields($menu_links_alias); + $query->addColumn('n', 'type', 'type'); + $query->addColumn('n', 'title', 'title'); + $query->columns('b'); + $query->columns($menu_links_alias); $query->condition('n.nid', $nids, 'IN'); $query->condition('n.status', 1); $query->orderBy('ml.weight'); @@ -514,7 +514,7 @@ function _book_update_outline($node) { if (empty($node->book['plid']) || !$parent || $parent['bid'] != $node->book['bid']) { $node->book['plid'] = db_query("SELECT mlid FROM {book} WHERE nid = :nid", array( ':nid' => $node->book['bid'], - ))->fetchField(); + ))->fetchColumn(); $node->book['parent_mismatch'] = TRUE; // Likely when JS is disabled. } } @@ -523,7 +523,7 @@ function _book_update_outline($node) { if ($new) { // Insert new. db_insert('book') - ->fields(array( + ->columns(array( 'nid' => $node->nid, 'mlid' => $node->book['mlid'], 'bid' => $node->book['bid'], @@ -533,7 +533,7 @@ function _book_update_outline($node) { else { if ($node->book['bid'] != db_query("SELECT bid FROM {book} WHERE nid = :nid", array( ':nid' => $node->nid, - ))->fetchField()) { + ))->fetchColumn()) { // Update the bid for this page and all children. book_update_bid($node->book); } @@ -554,7 +554,7 @@ function _book_update_outline($node) { */ function book_update_bid($book_link) { $query = db_select('menu_links'); - $query->addField('menu_links', 'mlid'); + $query->addColumn('menu_links', 'mlid'); for ($i = 1; $i <= MENU_MAX_DEPTH && $book_link["p$i"]; $i++) { $query->condition("p$i", $book_link["p$i"]); } @@ -562,7 +562,7 @@ function book_update_bid($book_link) { if ($mlids) { db_update('book') - ->fields(array('bid' => $book_link['bid'])) + ->columns(array('bid' => $book_link['bid'])) ->condition('mlid', $mlids, 'IN') ->execute(); } @@ -1167,9 +1167,9 @@ function book_menu_subtree_data($item) { $query = db_select('menu_links', 'ml'); $menu_router_alias = $query->join('menu_router', 'm', 'm.path = ml.router_path'); $book_alias = $query->join('book', 'b', 'ml.mlid = b.mlid'); - $query->fields($book_alias); - $query->fields($menu_router_alias, array('load_functions', 'to_arg_functions', 'access_callback', 'access_arguments', 'page_callback', 'page_arguments', 'title', 'title_callback', 'title_arguments', 'type')); - $query->fields('ml'); + $query->columns($book_alias); + $query->columns($menu_router_alias, array('load_functions', 'to_arg_functions', 'access_callback', 'access_arguments', 'page_callback', 'page_arguments', 'title', 'title_callback', 'title_arguments', 'type')); + $query->columns('ml'); $query->condition('menu_name', $item['menu_name']); for ($i = 1; $i <= MENU_MAX_DEPTH && $item["p$i"]; ++$i) { $query->condition("p$i", $item["p$i"]); Index: modules/comment/comment.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v retrieving revision 1.19 diff -u -F^[fc] -r1.19 comment.admin.inc --- modules/comment/comment.admin.inc 12 May 2009 08:37:44 -0000 1.19 +++ modules/comment/comment.admin.inc 17 May 2009 15:43:27 -0000 @@ -69,11 +69,11 @@ function comment_admin_overview($type = $query = db_select('comment', 'c'); $query->join('users', 'u', 'u.uid = c.uid'); $query->join('node', 'n', 'n.nid = c.nid'); - $query->addField('u', 'name', 'registered_name'); - $query->addField('n', 'title', 'node_title'); + $query->addColumn('u', 'name', 'registered_name'); + $query->addColumn('n', 'title', 'node_title'); $query - ->fields('c', array('subject', 'nid', 'cid', 'comment', 'timestamp', 'status', 'name', 'homepage')) - ->fields('u', array('uid')) + ->columns('c', array('subject', 'nid', 'cid', 'comment', 'timestamp', 'status', 'name', 'homepage')) + ->columns('u', array('uid')) ->condition('c.status', $status) ->extend('PagerDefault')->extend('TableSort') ->limit(50) Index: modules/comment/comment.install =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v retrieving revision 1.33 diff -u -F^[fc] -r1.33 comment.install --- modules/comment/comment.install 13 May 2009 19:42:14 -0000 1.33 +++ modules/comment/comment.install 17 May 2009 15:43:27 -0000 @@ -164,7 +164,7 @@ function comment_update_7002() { function comment_schema() { $schema['comment'] = array( 'description' => 'Stores comments and associated data.', - 'fields' => array( + 'columns' => array( 'cid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -265,7 +265,7 @@ function comment_schema() { $schema['node_comment_statistics'] = array( 'description' => 'Maintains statistics of node and comments posts to show "new" and "updated" flags.', - 'fields' => array( + 'columns' => array( 'nid' => array( 'type' => 'int', 'unsigned' => TRUE, Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.709 diff -u -F^[fc] -r1.709 comment.module --- modules/comment/comment.module 12 May 2009 08:37:44 -0000 1.709 +++ modules/comment/comment.module 17 May 2009 15:43:27 -0000 @@ -333,7 +333,7 @@ function comment_get_recent($number = 10 // find the $number of most recent comments. // Using Query Builder here for the IN-Statement. $query = db_select('comment', 'c'); - $query->fields('c', array('nid', 'subject', 'cid', 'timestamp')); + $query->columns('c', array('nid', 'subject', 'cid', 'timestamp')); $query->innerJoin('node', 'n', 'n.nid = c.nid'); $query->condition('c.nid', $nids, 'IN'); $query->condition('c.status', COMMENT_PUBLISHED); @@ -381,12 +381,12 @@ function comment_new_page_count($num_com AND status = 0 ORDER BY timestamp DESC) ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1))', array(':nid' => $node->nid), 0, $new_replies) - ->fetchField(); + ->fetchColumn(); $thread = substr($result, 0, -1); $count = db_query('SELECT COUNT(*) FROM {comment} WHERE nid = :nid AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < :thread', array( ':nid' => $node->nid, ':thread' => $thread)) - ->fetchField(); + ->fetchColumn(); $pageno = $count / $comments_per_page; } @@ -594,7 +594,7 @@ function comment_form_alter(&$form, $for '#attached_js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'), '#weight' => 30, ); - $comment_count = isset($node->nid) ? db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() : 0; + $comment_count = isset($node->nid) ? db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array(':nid' => $node->nid))->fetchColumn() : 0; $comment_settings = ($node->comment == COMMENT_NODE_HIDDEN && empty($comment_count)) ? COMMENT_NODE_CLOSED : $node->comment; $form['comment_settings']['comment'] = array( '#type' => 'radios', @@ -688,7 +688,7 @@ function comment_node_prepare($node) { */ function comment_node_insert($node) { db_insert('node_comment_statistics') - ->fields(array( + ->columns(array( 'nid' => $node->nid, 'last_comment_timestamp' => $node->changed, 'last_comment_name' => NULL, @@ -726,14 +726,14 @@ function comment_node_update_index($node */ function comment_update_index() { // Store the maximum possible comments per thread (used for ranking by reply count) - variable_set('node_cron_comments_scale', 1.0 / max(1, db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')->fetchField())); + variable_set('node_cron_comments_scale', 1.0 / max(1, db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')->fetchColumn())); } /** * Implementation of hook_node_search_result(). */ function comment_node_search_result($node) { - $comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField(); + $comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchColumn(); return format_plural($comments, '1 comment', '@count comments'); } @@ -743,18 +743,18 @@ function comment_node_search_result($nod function comment_user_cancel($edit, $account, $method) { switch ($method) { case 'user_cancel_block_unpublish': - db_update('comment')->fields(array('status' => 0))->condition('uid', $account->uid)->execute(); - db_update('node_comment_statistics')->fields(array('last_comment_uid' => 0))->condition('last_comment_uid', $account->uid)->execute(); + db_update('comment')->columns(array('status' => 0))->condition('uid', $account->uid)->execute(); + db_update('node_comment_statistics')->columns(array('last_comment_uid' => 0))->condition('last_comment_uid', $account->uid)->execute(); break; case 'user_cancel_reassign': - db_update('comment')->fields(array('uid' => 0))->condition('uid', $account->uid)->execute(); - db_update('node_comment_statistics')->fields(array('last_comment_uid' => 0))->condition('last_comment_uid', $account->uid)->execute(); + db_update('comment')->columns(array('uid' => 0))->condition('uid', $account->uid)->execute(); + db_update('node_comment_statistics')->columns(array('last_comment_uid' => 0))->condition('last_comment_uid', $account->uid)->execute(); break; case 'user_cancel_delete': module_load_include('inc', 'comment', 'comment.admin'); - $comments = db_select('comment', 'c')->fields('c', array('cid'))->condition('uid', $account->uid)->execute()->fetchCol(); + $comments = db_select('comment', 'c')->columns('c', array('cid'))->condition('uid', $account->uid)->execute()->fetchCol(); foreach ($comments as $cid) { $comment = comment_load($cid); // Delete the comment and its replies. @@ -822,7 +822,7 @@ function comment_save($edit) { if ($edit['cid']) { // Update the comment in the database. db_update('comment') - ->fields(array( + ->columns(array( 'status' => $edit['status'], 'timestamp' => $edit['timestamp'], 'subject' => $edit['subject'], @@ -846,7 +846,7 @@ function comment_save($edit) { if ($edit['pid'] == 0) { // This is a comment with no parent comment (depth 0): we start // by retrieving the maximum thread level. - $max = db_query('SELECT MAX(thread) FROM {comment} WHERE nid = :nid', array(':nid' => $edit['nid']))->fetchField(); + $max = db_query('SELECT MAX(thread) FROM {comment} WHERE nid = :nid', array(':nid' => $edit['nid']))->fetchColumn(); // Strip the "/" from the end of the thread. $max = rtrim($max, '/'); // Finally, build the thread field for this new comment. @@ -864,7 +864,7 @@ function comment_save($edit) { $max = db_query("SELECT MAX(thread) FROM {comment} WHERE thread LIKE :thread AND nid = :nid", array( ':thread' => $parent->thread .'.%', ':nid' => $edit['nid'])) - ->fetchField(); + ->fetchColumn(); if ($max == '') { // First child of this parent. @@ -891,7 +891,7 @@ function comment_save($edit) { } $edit['cid'] = db_insert('comment') - ->fields(array( + ->columns(array( 'nid' => $edit['nid'], 'pid' => empty($edit['pid']) ? 0 : $edit['pid'], 'uid' => $edit['uid'], @@ -1097,9 +1097,9 @@ function comment_render($node, $cid = 0) if ($cid && is_numeric($cid)) { // Single comment view. $query = db_select('comment', 'c'); - $query->fields('c', array('cid', 'nid', 'pid', 'comment', 'subject', 'format', 'timestamp', 'name', 'mail', 'homepage', 'status') ); - $query->fields('u', array( 'uid', 'signature', 'picture', 'data', 'status') ); - $query->addField('u', 'name', 'registered_name'); + $query->columns('c', array('cid', 'nid', 'pid', 'comment', 'subject', 'format', 'timestamp', 'name', 'mail', 'homepage', 'status') ); + $query->columns('u', array( 'uid', 'signature', 'picture', 'data', 'status') ); + $query->addColumn('u', 'name', 'registered_name'); $query->innerJoin('users', 'u', 'c.uid = u.uid'); $query->condition('c.cid', $cid); @@ -1217,20 +1217,20 @@ function comment_render($node, $cid = 0) function comment_operations($action = NULL) { if ($action == 'publish') { $operations = array( - 'publish' => array(t('Publish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_PUBLISHED)) ), + 'publish' => array(t('Publish the selected comments'), db_update('comment')->columns(array( 'status' => COMMENT_PUBLISHED)) ), 'delete' => array(t('Delete the selected comments'), '') ); } elseif ($action == 'unpublish') { $operations = array( - 'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_NOT_PUBLISHED)) ), + 'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->columns(array( 'status' => COMMENT_NOT_PUBLISHED)) ), 'delete' => array(t('Delete the selected comments'), '') ); } else { $operations = array( - 'publish' => array(t('Publish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_PUBLISHED)) ), - 'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_NOT_PUBLISHED)) ), + 'publish' => array(t('Publish the selected comments'), db_update('comment')->columns(array( 'status' => COMMENT_PUBLISHED)) ), + 'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->columns(array( 'status' => COMMENT_NOT_PUBLISHED)) ), 'delete' => array(t('Delete the selected comments'), '') ); } @@ -1269,7 +1269,7 @@ function comment_num_replies($pid) { $cache[$pid] = db_query('SELECT COUNT(cid) FROM {comment} WHERE pid = :pid AND status = :status', array( ':pid' => $pid, ':status' => COMMENT_PUBLISHED)) - ->fetchField(); + ->fetchColumn(); } return $cache[$pid]; @@ -1300,7 +1300,7 @@ function comment_num_new($nid, $timestam ':nid' => $nid, ':timestamp' => $timestamp, ':status' => COMMENT_PUBLISHED )) - ->fetchField(); + ->fetchColumn(); } else { return FALSE; @@ -1337,11 +1337,11 @@ function comment_validate($edit) { if (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) { if ($edit['name']) { $query = db_select('users', 'u'); - $query->addField('u', 'uid', 'uid'); + $query->addColumn('u', 'uid', 'uid'); $taken = $query->where('LOWER(name) = :name', array(':name' => $edit['name'])) ->countQuery() ->execute() - ->fetchField(); + ->fetchColumn(); if ($taken != 0) { form_set_error('name', t('The name you used belongs to a registered user.')); } @@ -2028,13 +2028,13 @@ function _comment_get_display_setting($s * - comment_count: the total number of approved/published comments on this node. */ function _comment_update_node_statistics($nid) { - $count = db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED))->fetchField(); + $count = db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED))->fetchColumn(); if ($count > 0) { // Comments exist. $last_reply = db_query_range('SELECT cid, name, timestamp, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED), 0, 1)->fetchObject(); db_update('node_comment_statistics') - ->fields( array( + ->columns( array( 'comment_count' => $count, 'last_comment_timestamp' => $last_reply->timestamp, 'last_comment_name' => $last_reply->uid ? '' : $last_reply->name, @@ -2046,7 +2046,7 @@ function _comment_update_node_statistics // Comments do not exist. $node = db_query('SELECT uid, created FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchObject(); db_update('node_comment_statistics') - ->fields( array( + ->columns( array( 'comment_count' => 0, 'last_comment_timestamp' => $node->created, 'last_comment_name' => '', @@ -2172,10 +2172,10 @@ function comment_unpublish_action($comme } else { $cid = $context['cid']; - $subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(':cid', $cid))->fetchField(); + $subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(':cid', $cid))->fetchColumn(); } db_update('comment') - ->fields(array('status' => COMMENT_NOT_PUBLISHED,)) + ->columns(array('status' => COMMENT_NOT_PUBLISHED,)) ->condition('cid', $cid) ->execute(); watchdog('action', 'Unpublished comment %subject.', array('%subject' => $subject)); @@ -2220,7 +2220,7 @@ function comment_unpublish_by_keyword_ac foreach ($context['keywords'] as $keyword) { if (strpos($comment->comment, $keyword) !== FALSE || strpos($comment->subject, $keyword) !== FALSE) { db_update('comment') - ->fields(array('status' => COMMENT_NOT_PUBLISHED,)) + ->columns(array('status' => COMMENT_NOT_PUBLISHED,)) ->condition('cid', $comment->cid) ->execute(); watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject)); Index: modules/contact/contact.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.admin.inc,v retrieving revision 1.10 diff -u -F^[fc] -r1.10 contact.admin.inc --- modules/contact/contact.admin.inc 29 Apr 2009 08:04:23 -0000 1.10 +++ modules/contact/contact.admin.inc 17 May 2009 15:43:27 -0000 @@ -110,7 +110,7 @@ function contact_admin_edit_submit($form if ($form_state['values']['selected']) { // Unselect all other contact categories. db_update('contact') - ->fields(array('selected' => '0')) + ->columns(array('selected' => '0')) ->execute(); } $recipients = explode(',', $form_state['values']['recipients']); Index: modules/contact/contact.install =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.install,v retrieving revision 1.12 diff -u -F^[fc] -r1.12 contact.install --- modules/contact/contact.install 13 May 2009 19:42:14 -0000 1.12 +++ modules/contact/contact.install 17 May 2009 15:43:27 -0000 @@ -32,7 +32,7 @@ function contact_uninstall() { function contact_schema() { $schema['contact'] = array( 'description' => 'Contact form category settings.', - 'fields' => array( + 'columns' => array( 'cid' => array( 'type' => 'serial', 'unsigned' => TRUE, Index: modules/contact/contact.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v retrieving revision 1.21 diff -u -F^[fc] -r1.21 contact.pages.inc --- modules/contact/contact.pages.inc 10 May 2009 05:06:50 -0000 1.21 +++ modules/contact/contact.pages.inc 17 May 2009 15:43:27 -0000 @@ -14,7 +14,7 @@ function contact_site_page() { if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3)) && !user_access('administer site-wide contact form')) { $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); } - elseif (!db_query("SELECT COUNT(cid) FROM {contact}")->fetchField()) { + elseif (!db_query("SELECT COUNT(cid) FROM {contact}")->fetchColumn()) { if (user_access('administer site-wide contact form')) { $output = t('The contact form has not been configured. Add one or more categories to the form.', array('@add' => url('admin/build/contact/add'))); } @@ -36,7 +36,7 @@ function contact_site_form() { global $user; $categories = db_query("SELECT cid, category FROM {contact} ORDER BY weight, category")->fetchAllKeyed(); - $default_category = (int) db_query("SELECT cid FROM {contact} WHERE selected = 1")->fetchField(); + $default_category = (int) db_query("SELECT cid FROM {contact} WHERE selected = 1")->fetchColumn(); // If there is more than one category available and no default category has been selected, // prepend a default placeholder value. Index: modules/contact/contact.test =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.test,v retrieving revision 1.22 diff -u -F^[fc] -r1.22 contact.test --- modules/contact/contact.test 10 May 2009 05:06:50 -0000 1.22 +++ modules/contact/contact.test 17 May 2009 15:43:27 -0000 @@ -93,7 +93,7 @@ class ContactSitewideTestCase extends Dr // Clear flood table in preparation for flood test and allow other checks to complete. db_delete('flood')->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {flood}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {flood}")->fetchColumn(); $this->assertIdentical($num_records_after, '0', t('Flood table emptied.')); // Check to see that anonymous user cannot see contact page without permission. @@ -129,7 +129,7 @@ class ContactSitewideTestCase extends Dr // Test contact form with no default category selected. db_update('contact') - ->fields(array('selected' => 0)) + ->columns(array('selected' => 0)) ->execute(); $this->drupalGet('contact'); $this->assertRaw(t('- Please choose -'), t('Without selected categories the visitor is asked to chose a category.')); @@ -213,7 +213,7 @@ class ContactSitewideTestCase extends Dr function deleteCategories() { $categories = $this->getCategories(); foreach ($categories as $category) { - $category_name = db_query("SELECT category FROM {contact} WHERE cid = :cid", array(':cid' => $category))->fetchField(); + $category_name = db_query("SELECT category FROM {contact} WHERE cid = :cid", array(':cid' => $category))->fetchColumn(); $this->drupalPost('admin/build/contact/delete/' . $category, array(), t('Delete')); $this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), t('Category deleted sucessfully.')); } @@ -237,7 +237,7 @@ class ContactSitewideTestCase extends Dr */ function setPermission($role, $permissions) { // Get role id (rid) for specified role. - $rid = db_query("SELECT rid FROM {role} WHERE name = :name", array(':name' => $role))->fetchField(); + $rid = db_query("SELECT rid FROM {role} WHERE name = :name", array(':name' => $role))->fetchColumn(); if ($rid === FALSE) { $this->fail(t(' [permission] Role "' . $role . '" not found.')); } @@ -304,7 +304,7 @@ class ContactPersonalTestCase extends Dr // Clear flood table in preparation for flood test and allow other checks to complete. db_delete('flood')->execute(); - $num_records_flood = db_query("SELECT COUNT(*) FROM {flood}")->fetchField(); + $num_records_flood = db_query("SELECT COUNT(*) FROM {flood}")->fetchColumn(); $this->assertIdentical($num_records_flood, '0', t('Flood table emptied.')); // Submit contact form with correct values and check flood interval. Index: modules/dblog/dblog.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.admin.inc,v retrieving revision 1.17 diff -u -F^[fc] -r1.17 dblog.admin.inc --- modules/dblog/dblog.admin.inc 12 May 2009 08:37:44 -0000 1.17 +++ modules/dblog/dblog.admin.inc 17 May 2009 15:43:27 -0000 @@ -62,8 +62,8 @@ function dblog_overview() { $query = db_select('watchdog', 'w'); $query->join('users', 'u', 'w.uid = u.uid'); $query - ->fields('w', array('wid', 'uid', 'severity', 'type', 'timestamp', 'message', 'variables', 'link')) - ->addField('u', 'name'); + ->columns('w', array('wid', 'uid', 'severity', 'type', 'timestamp', 'message', 'variables', 'link')) + ->addColumn('u', 'name'); if (!empty($filter['where'])) { //setHeader may not be chainable see Line 138 $query @@ -125,7 +125,7 @@ function dblog_top($type) { $query = db_select('watchdog', 'w'); $query->addExpression('COUNT(wid)', 'count'); $query = $query - ->fields('w', array('message', 'variables')) + ->columns('w', array('message', 'variables')) ->condition('w.type', $type) ->groupBy('message') ->groupBy('variables') Index: modules/dblog/dblog.install =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.install,v retrieving revision 1.15 diff -u -F^[fc] -r1.15 dblog.install --- modules/dblog/dblog.install 13 May 2009 19:42:14 -0000 1.15 +++ modules/dblog/dblog.install 17 May 2009 15:43:27 -0000 @@ -28,7 +28,7 @@ function dblog_uninstall() { function dblog_schema() { $schema['watchdog'] = array( 'description' => 'Table that contains logs of all system events.', - 'fields' => array( + 'columns' => array( 'wid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -113,8 +113,8 @@ function dblog_schema() { */ function dblog_update_7001() { $ret = array(); - db_change_field($ret, 'watchdog', 'link', 'link', array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'default' => '')); - db_change_field($ret, 'watchdog', 'referer', 'referer', array('type' => 'text', 'not null' => FALSE)); + db_change_column($ret, 'watchdog', 'link', 'link', array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'default' => '')); + db_change_column($ret, 'watchdog', 'referer', 'referer', array('type' => 'text', 'not null' => FALSE)); return $ret; } @@ -132,6 +132,6 @@ function dblog_update_7002() { */ function dblog_update_7003() { $ret = array(); - db_change_field($ret, 'watchdog', 'type', 'type', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => '')); + db_change_column($ret, 'watchdog', 'type', 'type', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => '')); return $ret; } Index: modules/dblog/dblog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v retrieving revision 1.37 diff -u -F^[fc] -r1.37 dblog.module --- modules/dblog/dblog.module 13 Apr 2009 08:48:58 -0000 1.37 +++ modules/dblog/dblog.module 17 May 2009 15:43:27 -0000 @@ -89,7 +89,7 @@ function dblog_init() { */ function dblog_cron() { // Cleanup the watchdog table - $max = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField(); + $max = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchColumn(); db_delete('watchdog') ->condition('wid', $max - variable_get('dblog_row_limit', 1000), '<=') ->execute(); @@ -102,7 +102,7 @@ function dblog_user_cancel($edit, $accou switch ($method) { case 'user_cancel_reassign': db_update('watchdog') - ->fields(array('uid' => 0)) + ->columns(array('uid' => 0)) ->condition('uid', $account->uid) ->execute(); break; @@ -133,7 +133,7 @@ function _dblog_get_message_types() { */ function dblog_watchdog(array $log_entry) { Database::getConnection('default', 'default')->insert('watchdog') - ->fields(array( + ->columns(array( 'uid' => $log_entry['user']->uid, 'type' => substr($log_entry['type'], 0, 64), 'message' => $log_entry['message'], Index: modules/dblog/dblog.test =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.test,v retrieving revision 1.18 diff -u -F^[fc] -r1.18 dblog.test --- modules/dblog/dblog.test 13 Apr 2009 08:48:59 -0000 1.18 +++ modules/dblog/dblog.test 17 May 2009 15:43:27 -0000 @@ -57,7 +57,7 @@ class DBLogTestCase extends DrupalWebTes $current_limit = variable_get('dblog_row_limit', 1000); $this->assertTrue($current_limit == $row_limit, t('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit))); // Verify dblog row limit equals specified row limit. - $current_limit = unserialize(db_query("SELECT value FROM {variable} WHERE name = :dblog_limit", array(':dblog_limit' => 'dblog_row_limit'))->fetchField()); + $current_limit = unserialize(db_query("SELECT value FROM {variable} WHERE name = :dblog_limit", array(':dblog_limit' => 'dblog_row_limit'))->fetchColumn()); $this->assertTrue($current_limit == $row_limit, t('[Variable table] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit))); } @@ -70,7 +70,7 @@ class DBLogTestCase extends DrupalWebTes // Generate additional log entries. $this->generateLogEntries($row_limit + 10); // Verify dblog row count exceeds row limit. - $count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField(); + $count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchColumn(); $this->assertTrue($count > $row_limit, t('Dblog row count of @count exceeds row limit of @limit', array('@count' => $count, '@limit' => $row_limit))); // Run cron job. @@ -78,7 +78,7 @@ class DBLogTestCase extends DrupalWebTes $this->assertResponse(200); $this->assertText(t('Cron ran successfully'), t('Cron ran successfully')); // Verify dblog row count equals row limit plus one because cron adds a record after it runs. - $count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField(); + $count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchColumn(); $this->assertTrue($count == $row_limit + 1, t('Dblog row count of @count equals row limit of @limit plus one', array('@count' => $count, '@limit' => $row_limit))); } @@ -210,7 +210,7 @@ class DBLogTestCase extends DrupalWebTes $this->drupalPost('user/' . $user->uid . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account')); // Count rows that have uids for the user. - $count = db_query('SELECT COUNT(wid) FROM {watchdog} WHERE uid = %d', $user->uid)->fetchField(); + $count = db_query('SELECT COUNT(wid) FROM {watchdog} WHERE uid = %d', $user->uid)->fetchColumn(); $this->assertTrue($count == 0, t('DBLog contains @count records for @name', array('@count' => $count, '@name' => $user->name))); // Count rows in watchdog that previously related to the deleted user. @@ -220,7 +220,7 @@ class DBLogTestCase extends DrupalWebTes if ($ids) { $select->condition('wid', $ids, 'IN'); } - $count_after = $select->execute()->fetchField(); + $count_after = $select->execute()->fetchColumn(); $this->assertTrue($count_after == $count_before, t('DBLog contains @count records for @name that now have uid = 0', array('@count' => $count_before, '@name' => $user->name))); unset($ids); // Fetch row ids in watchdog that relate to the user. @@ -364,7 +364,7 @@ class DBLogTestCase extends DrupalWebTes protected function testDBLogAddAndClear() { global $base_root; // Get a count of how many watchdog entries there are. - $count = db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(); + $count = db_query('SELECT COUNT(*) FROM {watchdog}')->fetchColumn(); $log = array( 'type' => 'custom', 'message' => 'Log entry added to test the doClearTest clear down.', @@ -380,13 +380,13 @@ class DBLogTestCase extends DrupalWebTes // Add a watchdog entry. dblog_watchdog($log); // Make sure the table count has actually incremented. - $this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), t('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count))); + $this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchColumn(), t('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count))); // Login the admin user. $this->drupalLogin($this->big_user); // Now post to clear the db table. $this->drupalPost('admin/reports/dblog', array(), t('Clear log messages')); // Count rows in watchdog that previously related to the deleted user. - $count = db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(); + $count = db_query('SELECT COUNT(*) FROM {watchdog}')->fetchColumn(); $this->assertEqual($count, 0, t('DBLog contains :count records after a clear.', array(':count' => $count))); } } Index: modules/field/field.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.api.php,v retrieving revision 1.10 diff -u -F^[fc] -r1.10 field.api.php --- modules/field/field.api.php 17 May 2009 00:32:29 -0000 1.10 +++ modules/field/field.api.php 17 May 2009 15:43:27 -0000 @@ -880,7 +880,7 @@ function hook_field_read_instance($insta * TODO * * Note : Right now this belongs to the "Fieldable Type API". - * Whether 'build modes' is actually a 'fields' concept is to be debated + * Whether 'build modes' is actually a 'columns' concept is to be debated * in a separate overhaul patch for core. */ function hook_field_build_modes($obj_type) { Index: modules/field/field.attach.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.attach.inc,v retrieving revision 1.17 diff -u -F^[fc] -r1.17 field.attach.inc --- modules/field/field.attach.inc 17 May 2009 03:12:17 -0000 1.17 +++ modules/field/field.attach.inc 17 May 2009 15:43:27 -0000 @@ -753,7 +753,7 @@ function _field_attach_create_bundle($bu function _field_attach_rename_bundle($bundle_old, $bundle_new) { module_invoke(variable_get('field_storage_module', 'field_sql_storage'), 'field_storage_rename_bundle', $bundle_old, $bundle_new); db_update('field_config_instance') - ->fields(array('bundle' => $bundle_new)) + ->columns(array('bundle' => $bundle_new)) ->condition('bundle', $bundle_old) ->execute(); Index: modules/field/field.crud.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.crud.inc,v retrieving revision 1.11 diff -u -F^[fc] -r1.11 field.crud.inc --- modules/field/field.crud.inc 30 Apr 2009 14:40:03 -0000 1.11 +++ modules/field/field.crud.inc 17 May 2009 15:43:27 -0000 @@ -269,7 +269,7 @@ function field_read_field($field_name, $ */ function field_read_fields($params = array(), $include_additional = array()) { $query = db_select('field_config', 'fc', array('fetch' => PDO::FETCH_ASSOC)); - $query->fields('fc'); + $query->columns('fc'); // Turn the conditions into a query. foreach ($params as $key => $value) { @@ -308,13 +308,13 @@ function field_read_fields($params = arr function field_delete_field($field_name) { // Mark the field for deletion. db_update('field_config') - ->fields(array('deleted' => 1)) + ->columns(array('deleted' => 1)) ->condition('field_name', $field_name) ->execute(); // Mark any instances of the field for deletion. db_update('field_config_instance') - ->fields(array('deleted' => 1)) + ->columns(array('deleted' => 1)) ->condition('field_name', $field_name) ->execute(); module_invoke(variable_get('field_storage_module', 'field_sql_storage'), 'field_storage_delete_field', $field_name); @@ -533,8 +533,8 @@ function field_read_instance($field_name function field_read_instances($params = array(), $include_additional = array()) { $query = db_select('field_config_instance', 'fci', array('fetch' => PDO::FETCH_ASSOC)); $query->join('field_config', 'fc', 'fc.id = fci.field_id'); - $query->fields('fci'); - #$query->fields('fc', array('type')); + $query->columns('fci'); + #$query->columns('fc', array('type')); // Turn the conditions into a query. foreach ($params as $key => $value) { @@ -585,7 +585,7 @@ function field_read_instances($params = function field_delete_instance($field_name, $bundle) { // Mark the field instance for deletion. db_update('field_config_instance') - ->fields(array('deleted' => 1)) + ->columns(array('deleted' => 1)) ->condition('field_name', $field_name) ->condition('bundle', $bundle) ->execute(); Index: modules/field/field.info.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.info.inc,v retrieving revision 1.5 diff -u -F^[fc] -r1.5 field.info.inc --- modules/field/field.info.inc 13 Apr 2009 05:18:17 -0000 1.5 +++ modules/field/field.info.inc 17 May 2009 15:43:27 -0000 @@ -178,7 +178,7 @@ function _field_info_collate_fields($res } else { $info = array( - 'fields' => field_read_fields(), + 'columns' => field_read_fields(), 'instances' => array_fill_keys(array_keys(field_info_bundles()), array()), ); @@ -186,7 +186,7 @@ function _field_info_collate_fields($res $instances = field_read_instances(); foreach ($instances as $instance) { $info['instances'][$instance['bundle']][$instance['field_name']] = $instance; - $info['fields'][$instance['field_name']]['bundles'][] = $instance['bundle']; + $info['columns'][$instance['field_name']]['bundles'][] = $instance['bundle']; } cache_set('field_info_fields', $info, 'cache_field'); @@ -398,7 +398,7 @@ function _field_info_bundle_entity($bund */ function _field_info_fields() { $info = _field_info_collate_fields(); - return $info['fields']; + return $info['columns']; } /** @@ -413,8 +413,8 @@ function _field_info_fields() { */ function _field_info_field($field_name) { $info = _field_info_collate_fields(); - if (isset($info['fields'][$field_name])) { - return $info['fields'][$field_name]; + if (isset($info['columns'][$field_name])) { + return $info['columns'][$field_name]; } } Index: modules/field/field.install =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.install,v retrieving revision 1.5 diff -u -F^[fc] -r1.5 field.install --- modules/field/field.install 13 May 2009 19:42:15 -0000 1.5 +++ modules/field/field.install 17 May 2009 15:43:27 -0000 @@ -19,7 +19,7 @@ function field_install() { function field_schema() { // Static (meta) tables. $schema['field_config'] = array( - 'fields' => array( + 'columns' => array( 'id' => array( 'type' => 'serial', 'not null' => TRUE, @@ -88,7 +88,7 @@ function field_schema() { ), ); $schema['field_config_instance'] = array( - 'fields' => array( + 'columns' => array( 'id' => array( 'type' => 'serial', 'not null' => TRUE, Index: modules/field/field.module =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.module,v retrieving revision 1.7 diff -u -F^[fc] -r1.7 field.module --- modules/field/field.module 26 Mar 2009 13:31:24 -0000 1.7 +++ modules/field/field.module 17 May 2009 15:43:27 -0000 @@ -194,11 +194,11 @@ function field_modules_enabled($modules) function field_modules_disabled($modules) { foreach ($modules as $module) { db_update('field_config') - ->fields(array('active' => 0)) + ->columns(array('active' => 0)) ->condition('module', $module) ->execute(); db_update('field_config_instance') - ->fields(array('widget_active' => 0)) + ->columns(array('widget_active' => 0)) ->condition('widget_module', $module) ->execute(); field_cache_clear(TRUE); @@ -217,7 +217,7 @@ function field_associate_fields($module) foreach ($module_fields as $name => $field_info) { watchdog('field', 'Updating field type %type with module %module.', array('%type' => $name, '%module' => $module)); db_update('field_config') - ->fields(array('module' => $module, 'active' => 1)) + ->columns(array('module' => $module, 'active' => 1)) ->condition('type', $name) ->execute(); } @@ -227,7 +227,7 @@ function field_associate_fields($module) foreach ($module_widgets as $name => $widget_info) { watchdog('field', 'Updating widget type %type with module %module.', array('%type' => $name, '%module' => $module)); db_update('field_config_instance') - ->fields(array('widget_module' => $module, 'widget_active' => 1)) + ->columns(array('widget_module' => $module, 'widget_active' => 1)) ->condition('widget_type', $name) ->execute(); } Index: modules/field/modules/field_sql_storage/field_sql_storage.install =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/field_sql_storage/field_sql_storage.install,v retrieving revision 1.4 diff -u -F^[fc] -r1.4 field_sql_storage.install --- modules/field/modules/field_sql_storage/field_sql_storage.install 13 May 2009 19:42:15 -0000 1.4 +++ modules/field/modules/field_sql_storage/field_sql_storage.install 17 May 2009 15:43:27 -0000 @@ -28,7 +28,7 @@ function field_sql_storage_schema() { // Static (meta-data) tables. $schema['field_config_entity_type'] = array( - 'fields' => array( + 'columns' => array( 'etid' => array( 'type' => 'serial', 'unsigned' => TRUE, Index: modules/field/modules/field_sql_storage/field_sql_storage.module =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/field_sql_storage/field_sql_storage.module,v retrieving revision 1.7 diff -u -F^[fc] -r1.7 field_sql_storage.module --- modules/field/modules/field_sql_storage/field_sql_storage.module 17 May 2009 00:32:29 -0000 1.7 +++ modules/field/modules/field_sql_storage/field_sql_storage.module 17 May 2009 15:43:27 -0000 @@ -69,7 +69,7 @@ function _field_sql_storage_columnname($ function _field_sql_storage_etid($obj_type) { $etid = variable_get('field_sql_storage_' . $obj_type . '_etid', NULL); if (is_null($etid)) { - $etid = db_insert('field_config_entity_type')->fields(array('type' => $obj_type))->execute(); + $etid = db_insert('field_config_entity_type')->columns(array('type' => $obj_type))->execute(); variable_set('field_sql_storage_' . $obj_type . '_etid', $etid); } return $etid; @@ -89,7 +89,7 @@ function _field_sql_storage_etid($obj_ty function _field_sql_storage_schema($field) { $current = array( 'description' => 'Data storage for field ' . $field['field_name'], - 'fields' => array( + 'columns' => array( 'etid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -135,7 +135,7 @@ function _field_sql_storage_schema($fiel // Add field columns. foreach ($field['columns'] as $column_name => $attributes) { - $current['fields'][_field_sql_storage_columnname($field['field_name'], $column_name)] = $attributes; + $current['columns'][_field_sql_storage_columnname($field['field_name'], $column_name)] = $attributes; } // Construct the revision table. The primary key includes @@ -169,7 +169,7 @@ function field_sql_storage_field_storage // Mark all data associated with the field for deletion. $table = _field_sql_storage_tablename($field_name); db_update($table) - ->fields(array('deleted' => 1)) + ->columns(array('deleted' => 1)) ->execute(); } @@ -199,7 +199,7 @@ function field_sql_storage_field_storage $table = $load_current ? _field_sql_storage_tablename($field_name) : _field_sql_storage_revision_tablename($field_name); $results = db_select($table, 't') - ->fields('t') + ->columns('t') ->condition('etid', $etid) ->condition($load_current ? 'entity_id' : 'revision_id', $ids, 'IN') ->condition('deleted', 0) @@ -261,9 +261,9 @@ function field_sql_storage_field_storage foreach ($field['columns'] as $column => $attributes) { $columns[] = _field_sql_storage_columnname($field_name, $column); } - $query = db_insert($table_name)->fields($columns); + $query = db_insert($table_name)->columns($columns); if (isset($vid)) { - $revision_query = db_insert($revision_name)->fields($columns); + $revision_query = db_insert($revision_name)->columns($columns); } $delta_count = 0; @@ -355,11 +355,11 @@ function field_sql_storage_field_storage $table_name = _field_sql_storage_tablename($field_name); $revision_name = _field_sql_storage_revision_tablename($field_name); db_update($table_name) - ->fields(array('deleted' => 1)) + ->columns(array('deleted' => 1)) ->condition('bundle', $bundle) ->execute(); db_update($revision_name) - ->fields(array('deleted' => 1)) + ->columns(array('deleted' => 1)) ->condition('bundle', $bundle) ->execute(); } @@ -373,11 +373,11 @@ function field_sql_storage_field_storage $table_name = _field_sql_storage_tablename($instance['field_name']); $revision_name = _field_sql_storage_revision_tablename($instance['field_name']); db_update($table_name) - ->fields(array('bundle' => $bundle_new)) + ->columns(array('bundle' => $bundle_new)) ->condition('bundle', $bundle_old) ->execute(); db_update($revision_name) - ->fields(array('bundle' => $bundle_new)) + ->columns(array('bundle' => $bundle_new)) ->condition('bundle', $bundle_old) ->execute(); } Index: modules/field/modules/field_sql_storage/field_sql_storage.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/field_sql_storage/field_sql_storage.test,v retrieving revision 1.3 diff -u -F^[fc] -r1.3 field_sql_storage.test --- modules/field/modules/field_sql_storage/field_sql_storage.test 29 Apr 2009 21:33:00 -0000 1.3 +++ modules/field/modules/field_sql_storage/field_sql_storage.test 17 May 2009 15:43:27 -0000 @@ -61,7 +61,7 @@ class FieldSqlStorageTestCase extends Dr $columns = array('etid', 'entity_id', 'revision_id', 'delta', $this->field_name . '_value'); // Insert data for four revisions to the field revisions table - $query = db_insert($this->revision_table)->fields($columns); + $query = db_insert($this->revision_table)->columns($columns); for ($evid = 0; $evid < 4; ++$evid) { $values[$evid] = array(); // Note: we insert one extra value ('<=' instead of '<'). @@ -74,7 +74,7 @@ class FieldSqlStorageTestCase extends Dr $query->execute(); // Insert data for the "most current revision" into the field table - $query = db_insert($this->table)->fields($columns); + $query = db_insert($this->table)->columns($columns); foreach ($values[0] as $delta => $value) { $query->values(array($etid, $eid, 0, $delta, $value)); } @@ -125,7 +125,7 @@ class FieldSqlStorageTestCase extends Dr $entity->{$this->field_name} = $rev_values[0] = $values; field_attach_insert($entity_type, $entity); - $rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC); + $rows = db_select($this->table, 't')->columns('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC); foreach ($values as $delta => $value) { if ($delta < $this->field['cardinality']) { $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Value $delta is inserted correctly")); @@ -144,7 +144,7 @@ class FieldSqlStorageTestCase extends Dr } $entity->{$this->field_name} = $rev_values[1] = $values; field_attach_update($entity_type, $entity); - $rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC); + $rows = db_select($this->table, 't')->columns('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC); foreach ($values as $delta => $value) { if ($delta < $this->field['cardinality']) { $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Value $delta is updated correctly")); @@ -160,7 +160,7 @@ class FieldSqlStorageTestCase extends Dr // put one extra value in $values per revision), unset the entire // revision. Then, if $rev_values is empty at the end, all // revision data was found. - $results = db_select($this->revision_table, 't')->fields('t')->execute(); + $results = db_select($this->revision_table, 't')->columns('t')->execute(); foreach ($results as $row) { $this->assertEqual($row->{$this->field_name . '_value'}, $rev_values[$row->revision_id][$row->delta]['value'], "Value {$row->delta} for revision {$row->revision_id} stored correctly"); unset($rev_values[$row->revision_id][$row->delta]); @@ -174,7 +174,7 @@ class FieldSqlStorageTestCase extends Dr // $field_name key. unset($entity->{$this->field_name}); field_attach_update($entity_type, $entity); - $rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC); + $rows = db_select($this->table, 't')->columns('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC); foreach ($values as $delta => $value) { if ($delta < $this->field['cardinality']) { $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Update with no field_name entry leaves value $delta untouched")); @@ -184,7 +184,7 @@ class FieldSqlStorageTestCase extends Dr // Check that update with an empty $object->$field_name empties the field. $entity->{$this->field_name} = NULL; field_attach_update($entity_type, $entity); - $rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC); + $rows = db_select($this->table, 't')->columns('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC); $this->assertEqual(count($rows), 0, t("Update with an empty field_name entry empties the field.")); } Index: modules/field/modules/text/text.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.test,v retrieving revision 1.6 diff -u -F^[fc] -r1.6 text.test --- modules/field/modules/text/text.test 29 Apr 2009 12:08:28 -0000 1.6 +++ modules/field/modules/text/text.test 17 May 2009 15:43:27 -0000 @@ -169,7 +169,7 @@ class TextFieldTestCase extends DrupalWe $this->assertRaw(str_replace('
', '', $value), t('Filtered value is displayed correctly')); // Allow the user to use the 'Full HTML' format. - db_update('filter_format')->fields(array('roles' => ',2,'))->condition('format', 2)->execute(); + db_update('filter_format')->columns(array('roles' => ',2,'))->condition('format', 2)->execute(); // Display edition form. // We should now have a 'text format' selector. Index: modules/filter/filter.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v retrieving revision 1.27 diff -u -F^[fc] -r1.27 filter.admin.inc --- modules/filter/filter.admin.inc 26 Apr 2009 06:00:31 -0000 1.27 +++ modules/filter/filter.admin.inc 17 May 2009 15:43:27 -0000 @@ -51,7 +51,7 @@ function filter_admin_overview_submit($f if (is_array($data) && isset($data['weight'])) { // Only update if this is a form element with weight. db_update('filter_format') - ->fields(array('weight' => $data['weight'])) + ->columns(array('weight' => $data['weight'])) ->condition('format', $id) ->execute(); } @@ -243,7 +243,7 @@ function filter_admin_format_form_submit } db_update('filter_format') - ->fields(array( + ->columns(array( 'cache' => $cache, 'name' => $name, 'roles' => $roles, @@ -303,18 +303,18 @@ function filter_admin_delete_submit($for $default = variable_get('filter_default_format', 1); // Replace existing instances of the deleted format with the default format. db_update('node_revision') - ->fields(array('format' => $default)) + ->columns(array('format' => $default)) ->condition('format', $form_state['values']['format']) ->execute(); if (db_table_exists('comment')) { db_update('comment') - ->fields(array('format' => $default)) + ->columns(array('format' => $default)) ->condition('format', $form_state['values']['format']) ->execute(); } if (db_table_exists('box')) { db_update('box') - ->fields(array('format' => $default)) + ->columns(array('format' => $default)) ->condition('format', $form_state['values']['format']) ->execute(); } @@ -432,7 +432,7 @@ function filter_admin_order_submit($form foreach ($form_state['values']['weights'] as $id => $weight) { list($module, $delta) = explode('/', $id); db_update('filter') - ->fields(array('weight' => $weight)) + ->columns(array('weight' => $weight)) ->condition('format', $form_state['values']['format']) ->condition('module', $module) ->condition('delta', $delta) Index: modules/filter/filter.install =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.install,v retrieving revision 1.15 diff -u -F^[fc] -r1.15 filter.install --- modules/filter/filter.install 16 May 2009 16:06:04 -0000 1.15 +++ modules/filter/filter.install 17 May 2009 15:43:27 -0000 @@ -12,7 +12,7 @@ function filter_schema() { $schema['filter'] = array( 'description' => 'Table that maps filters (HTML corrector) to text formats (Filtered HTML).', - 'fields' => array( + 'columns' => array( 'fid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -56,7 +56,7 @@ function filter_schema() { ); $schema['filter_format'] = array( 'description' => 'Stores text formats: custom groupings of filters, such as Filtered HTML.', - 'fields' => array( + 'columns' => array( 'format' => array( 'type' => 'serial', 'not null' => TRUE, @@ -108,7 +108,7 @@ function filter_schema() { */ function filter_update_7000() { $ret = array(); - db_add_field($ret, 'filter_formats', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); + db_add_column($ret, 'filter_formats', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); return $ret; } Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.250 diff -u -F^[fc] -r1.250 filter.module --- modules/filter/filter.module 14 May 2009 08:23:14 -0000 1.250 +++ modules/filter/filter.module 17 May 2009 15:43:27 -0000 @@ -296,11 +296,11 @@ function filter_formats($index = NULL) { $formats = array(); $query = db_select('filter_format', 'f'); - $query->addField('f', 'format', 'format'); - $query->addField('f', 'name', 'name'); - $query->addField('f', 'roles', 'roles'); - $query->addField('f', 'cache', 'cache'); - $query->addField('f', 'weight', 'weight'); + $query->addColumn('f', 'format', 'format'); + $query->addColumn('f', 'name', 'name'); + $query->addColumn('f', 'roles', 'roles'); + $query->addColumn('f', 'cache', 'cache'); + $query->addColumn('f', 'weight', 'weight'); $query->orderBy('weight'); // Build query for selecting the format(s) based on the user's roles. @@ -361,7 +361,7 @@ function filter_format_allowcache($forma static $cache = array(); $format = filter_resolve_format($format); if (!isset($cache[$format])) { - $cache[$format] = db_query('SELECT cache FROM {filter_format} WHERE format = :format', array(':format' => $format))->fetchField(); + $cache[$format] = db_query('SELECT cache FROM {filter_format} WHERE format = :format', array(':format' => $format))->fetchColumn(); } return $cache[$format]; } Index: modules/forum/forum.install =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.install,v retrieving revision 1.27 diff -u -F^[fc] -r1.27 forum.install --- modules/forum/forum.install 13 May 2009 19:42:15 -0000 1.27 +++ modules/forum/forum.install 17 May 2009 15:43:27 -0000 @@ -71,7 +71,7 @@ function forum_uninstall() { function forum_schema() { $schema['forum'] = array( 'description' => 'Stores the relationship of nodes to forum terms.', - 'fields' => array( + 'columns' => array( 'nid' => array( 'type' => 'int', 'unsigned' => TRUE, Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.492 diff -u -F^[fc] -r1.492 forum.module --- modules/forum/forum.module 9 May 2009 18:28:12 -0000 1.492 +++ modules/forum/forum.module 17 May 2009 15:43:27 -0000 @@ -506,10 +506,10 @@ function forum_block_view($delta = '') { $tn_alias = $query->join('taxonomy_term_node', 'tn', 'tn.vid = n.vid'); $td_alias = $query->join('taxonomy_term_data', 'td', 'td.tid = tn.tid'); $l_alias = $query->join('node_comment_statistics', 'l', 'n.nid = l.nid'); - $query->addField('n', 'nid', 'nid'); - $query->addField('n', 'title', 'title'); - $query->addField($l_alias, 'comment_count', 'comment_count'); - $query->addField($l_alias, 'last_comment_timestamp'); + $query->addColumn('n', 'nid', 'nid'); + $query->addColumn('n', 'title', 'title'); + $query->addColumn($l_alias, 'comment_count', 'comment_count'); + $query->addColumn($l_alias, 'last_comment_timestamp'); $query->condition("n.status", 1); $query->condition("{$td_alias}.vid", variable_get('forum_nav_vocabulary', '')); $query->orderBy("{$l_alias}.last_comment_timestamp", 'DESC'); Index: modules/locale/locale.install =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.install,v retrieving revision 1.37 diff -u -F^[fc] -r1.37 locale.install --- modules/locale/locale.install 13 May 2009 19:42:15 -0000 1.37 +++ modules/locale/locale.install 17 May 2009 15:43:27 -0000 @@ -32,7 +32,7 @@ function locale_update_6000() { $ret = array(); $schema['languages'] = array( - 'fields' => array( + 'columns' => array( 'language' => array( 'type' => 'varchar', 'length' => 12, @@ -128,7 +128,7 @@ function locale_update_6000() { function locale_update_6001() { $ret = array(); $ret[] = update_sql('UPDATE {locales_target} SET language = locale'); - db_drop_field($ret, 'locales_target', 'locale'); + db_drop_column($ret, 'locales_target', 'locale'); return $ret; } @@ -254,7 +254,7 @@ function locale_uninstall() { function locale_schema() { $schema['languages'] = array( 'description' => 'List of all available languages in the system.', - 'fields' => array( + 'columns' => array( 'language' => array( 'type' => 'varchar', 'length' => 12, @@ -337,7 +337,7 @@ function locale_schema() { $schema['locales_source'] = array( 'description' => 'List of English source strings.', - 'fields' => array( + 'columns' => array( 'lid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -379,7 +379,7 @@ function locale_schema() { $schema['locales_target'] = array( 'description' => 'Stores translated versions of strings.', - 'fields' => array( + 'columns' => array( 'lid' => array( 'type' => 'int', 'not null' => TRUE, Index: modules/menu/menu.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v retrieving revision 1.47 diff -u -F^[fc] -r1.47 menu.admin.inc --- modules/menu/menu.admin.inc 15 May 2009 04:07:20 -0000 1.47 +++ modules/menu/menu.admin.inc 17 May 2009 15:43:28 -0000 @@ -477,7 +477,7 @@ function menu_delete_menu_page($menu) { function menu_delete_menu_confirm(&$form_state, $menu) { $form['#menu'] = $menu; $caption = ''; - $num_links = db_query("SELECT COUNT(*) FROM {menu_links} WHERE menu_name = :menu", array(':menu' => $menu['menu_name']))->fetchField(); + $num_links = db_query("SELECT COUNT(*) FROM {menu_links} WHERE menu_name = :menu", array(':menu' => $menu['menu_name']))->fetchColumn(); if ($num_links) { $caption .= '

' . format_plural($num_links, 'Warning: There is currently 1 menu link in %title. It will be deleted (system-defined items will be reset).', 'Warning: There are currently @count menu links in %title. They will be deleted (system-defined links will be reset).', array('%title' => $menu['title'])) . '

'; } @@ -493,7 +493,7 @@ function menu_delete_menu_confirm_submit $form_state['redirect'] = 'admin/build/menu'; // System-defined menus may not be deleted - only menus defined by this module. $system_menus = menu_list_system_menus(); - if (isset($system_menus[$menu['menu_name']]) || !(db_query("SELECT 1 FROM {menu_custom} WHERE menu_name = :menu", array(':menu' => $menu['menu_name']))->fetchField())) { + if (isset($system_menus[$menu['menu_name']]) || !(db_query("SELECT 1 FROM {menu_custom} WHERE menu_name = :menu", array(':menu' => $menu['menu_name']))->fetchColumn())) { return; } // Reset all the menu links defined by the system via hook_menu. @@ -546,8 +546,8 @@ function menu_edit_menu_validate($form, // We will add 'menu-' to the menu name to help avoid name-space conflicts. $item['menu_name'] = 'menu-' . $item['menu_name']; - $custom_exists = db_query('SELECT menu_name FROM {menu_custom} WHERE menu_name = :menu', array(':menu' => $item['menu_name']))->fetchField(); - $link_exists = db_query_range("SELECT menu_name FROM {menu_links} WHERE menu_name = :menu", array(':menu' => $item['menu_name']), 0, 1)->fetchField(); + $custom_exists = db_query('SELECT menu_name FROM {menu_custom} WHERE menu_name = :menu', array(':menu' => $item['menu_name']))->fetchColumn(); + $link_exists = db_query_range("SELECT menu_name FROM {menu_links} WHERE menu_name = :menu", array(':menu' => $item['menu_name']), 0, 1)->fetchColumn(); if ($custom_exists || $link_exists) { form_set_error('menu_name', t('The menu already exists.')); } @@ -571,11 +571,11 @@ function menu_edit_menu_submit($form, &$ ':link' => 'admin/build/menu', ':module' => 'system' )) - ->fetchField(); + ->fetchColumn(); menu_link_save($link); db_insert('menu_custom') - ->fields(array( + ->columns(array( 'menu_name' => $menu['menu_name'], 'title' => $menu['title'], 'description' => $menu['description'], @@ -584,7 +584,7 @@ function menu_edit_menu_submit($form, &$ } else { db_update('menu_custom') - ->fields(array( + ->columns(array( 'title' => $menu['title'], 'description' => $menu['description'], )) Index: modules/menu/menu.install =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.install,v retrieving revision 1.17 diff -u -F^[fc] -r1.17 menu.install --- modules/menu/menu.install 13 May 2009 19:42:15 -0000 1.17 +++ modules/menu/menu.install 17 May 2009 15:43:28 -0000 @@ -21,7 +21,7 @@ function menu_install() { 'secondary-menu' => 'The Secondary menu is the default source for the Secondary links which are often used for legal notices, contact details, and other navigation items that play a lesser role than the Main links.', ); $t = get_t(); - $query = db_insert('menu_custom')->fields(array('menu_name', 'title', 'description')); + $query = db_insert('menu_custom')->columns(array('menu_name', 'title', 'description')); foreach ($system_menus as $menu_name => $title) { $query->values(array('menu_name' => $menu_name, 'title' => $t($title), 'description' => $t($descriptions[$menu_name])))->execute(); } @@ -42,7 +42,7 @@ function menu_uninstall() { function menu_schema() { $schema['menu_custom'] = array( 'description' => 'Holds definitions for top-level custom menus (for example, Main menu).', - 'fields' => array( + 'columns' => array( 'menu_name' => array( 'type' => 'varchar', 'length' => 32, Index: modules/menu/menu.module =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v retrieving revision 1.187 diff -u -F^[fc] -r1.187 menu.module --- modules/menu/menu.module 14 May 2009 08:23:15 -0000 1.187 +++ modules/menu/menu.module 17 May 2009 15:43:28 -0000 @@ -170,7 +170,7 @@ function menu_enable() { ':path' => $link['link_path'], ':plid' => $link['plid'] )) - ->fetchField(); + ->fetchColumn(); if (!$menu_link) { menu_link_save($link); } @@ -358,13 +358,13 @@ function menu_node_prepare($node) { ':path' => 'node/'. $node->nid, ':menu_name' => $menu_name, ), 0, 1) - ->fetchField(); + ->fetchColumn(); // Check all menus if a link does not exist in the default menu. if (!$mlid) { $mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = :path AND module = 'menu' ORDER BY mlid ASC", array( ':path' => 'node/'. $node->nid, ), 0, 1) - ->fetchField(); + ->fetchColumn(); } if ($mlid) { $item = menu_link_load($mlid); @@ -476,8 +476,8 @@ function menu_node_form_submit($form, &$ function menu_get_menus($all = TRUE) { $system_menus = array_keys(menu_list_system_menus()); $query = db_select('menu_custom'); - $query->addField('menu_custom', 'menu_name', 'menu_name'); - $query->addField('menu_custom', 'title', 'title'); + $query->addColumn('menu_custom', 'menu_name', 'menu_name'); + $query->addColumn('menu_custom', 'title', 'title'); if (!$all) { $query->condition('menu_name', $system_menus, 'NOT IN'); } Index: modules/menu/menu.test =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.test,v retrieving revision 1.14 diff -u -F^[fc] -r1.14 menu.test --- modules/menu/menu.test 15 May 2009 04:07:20 -0000 1.14 +++ modules/menu/menu.test 17 May 2009 15:43:28 -0000 @@ -184,7 +184,7 @@ class MenuTestCase extends DrupalWebTest $this->drupalPost('admin/build/menu-customize/'. $item1['menu_name'], $edit, t('Save configuration')); // Verify in the database. - $hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $item1['mlid']))->fetchField(); + $hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $item1['mlid']))->fetchColumn(); $this->assertEqual($hidden, 0, t('Link is not hidden in the database table when enabled via the overview form')); // Save menu links for later tests. @@ -392,7 +392,7 @@ class MenuTestCase extends DrupalWebTest // Unlike most other modules, there is no confirmation message displayed. // Verify in the database. - $hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $mlid))->fetchField(); + $hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $mlid))->fetchColumn(); $this->assertEqual($hidden, 1, t('Link is hidden in the database table')); } @@ -408,7 +408,7 @@ class MenuTestCase extends DrupalWebTest $this->drupalPost("admin/build/menu/item/$mlid/edit", $edit, t('Save')); // Verify in the database. - $hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $mlid))->fetchField(); + $hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $mlid))->fetchColumn(); $this->assertEqual($hidden, 0, t('Link is not hidden in the database table')); } @@ -417,7 +417,7 @@ class MenuTestCase extends DrupalWebTest */ private function getStandardMenuLink() { // Retrieve menu link id of the Log out menu link, which will always be on the front page. - $mlid = db_query("SELECT mlid FROM {menu_links} WHERE module = 'system' AND router_path = 'user/logout'")->fetchField(); + $mlid = db_query("SELECT mlid FROM {menu_links} WHERE module = 'system' AND router_path = 'user/logout'")->fetchColumn(); $this->assertTrue($mlid > 0, 'Standard menu link id was found'); // Load menu link. // Use api function so that link is translated for rendering. Index: modules/node/content_types.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v retrieving revision 1.68 diff -u -F^[fc] -r1.68 content_types.inc --- modules/node/content_types.inc 7 May 2009 15:15:43 -0000 1.68 +++ modules/node/content_types.inc 17 May 2009 15:43:28 -0000 @@ -390,7 +390,7 @@ function node_type_delete_confirm(&$form $message = t('Are you sure you want to delete the content type %type?', array('%type' => $type->name)); $caption = ''; - $num_nodes = db_query("SELECT COUNT(*) FROM {node} WHERE type = :type", array(':type' => $type->type))->fetchField(); + $num_nodes = db_query("SELECT COUNT(*) FROM {node} WHERE type = :type", array(':type' => $type->type))->fetchColumn(); if ($num_nodes) { $caption .= '

' . format_plural($num_nodes, 'Warning: there is currently 1 %type post on your site. It may not be able to be displayed or edited correctly, once you have removed this content type.', 'Warning: there are currently @count %type posts on your site. They may not be able to be displayed or edited correctly, once you have removed this content type.', array('%type' => $type->name)) . '

'; } Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.46 diff -u -F^[fc] -r1.46 node.admin.inc --- modules/node/node.admin.inc 15 May 2009 03:58:35 -0000 1.46 +++ modules/node/node.admin.inc 17 May 2009 15:43:28 -0000 @@ -13,7 +13,7 @@ function node_configure() { // Only show rebuild button if there are either 0, or 2 or more, rows // in the {node_access} table, or if there are modules that // implement hook_node_grants(). - if (db_query('SELECT COUNT(*) FROM {node_access}')->fetchField() != 1 || count(module_implements('node_grants')) > 0) { + if (db_query('SELECT COUNT(*) FROM {node_access}')->fetchColumn() != 1 || count(module_implements('node_grants')) > 0) { $status = '

' . t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Possible causes for permission problems are disabling modules or configuration changes to permissions. Rebuilding will remove all privileges to posts, and replace them with permissions based on the current modules and settings.') . '

'; $status .= '

' . t('Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed posts will automatically use the new permissions.') . '

'; @@ -457,7 +457,7 @@ function node_admin_content($form_state) function node_admin_nodes() { // Enable language column if translation module is enabled // or if we have any node with language. - $multilanguage = (module_exists('translation') || db_query("SELECT COUNT(*) FROM {node} WHERE language != ''")->fetchField()); + $multilanguage = (module_exists('translation') || db_query("SELECT COUNT(*) FROM {node} WHERE language != ''")->fetchColumn()); // Build the sortable table header. $header = array(); @@ -624,7 +624,7 @@ function node_multiple_delete_confirm(&$ $form['nodes'] = array('#prefix' => '
    ', '#suffix' => '
', '#tree' => TRUE); // array_filter returns only elements with TRUE values foreach ($nodes as $nid => $value) { - $title = db_query('SELECT title FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchField(); + $title = db_query('SELECT title FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchColumn(); $form['nodes'][$nid] = array( '#type' => 'hidden', '#value' => $nid, Index: modules/node/node.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.api.php,v retrieving revision 1.20 diff -u -F^[fc] -r1.20 node.api.php --- modules/node/node.api.php 12 May 2009 23:19:13 -0000 1.20 +++ modules/node/node.api.php 17 May 2009 15:43:28 -0000 @@ -200,7 +200,7 @@ function hook_node_delete_revision($node */ function hook_node_insert($node) { db_insert('mytable') - ->fields(array( + ->columns(array( 'nid' => $node->nid, 'extra' => $node->extra, )) @@ -279,7 +279,7 @@ function hook_node_prepare_translation($ * Extra information to be displayed with search result. */ function hook_node_search_result($node) { - $comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField(); + $comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchColumn(); return format_plural($comments, '1 comment', '@count comments'); } @@ -312,7 +312,7 @@ function hook_node_presave($node) { */ function hook_node_update($node) { db_update('mytable') - ->fields(array('extra' => $node->extra)) + ->columns(array('extra' => $node->extra)) ->condition('nid', $node->nid) ->execute(); } Index: modules/node/node.install =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.install,v retrieving revision 1.17 diff -u -F^[fc] -r1.17 node.install --- modules/node/node.install 13 May 2009 19:42:15 -0000 1.17 +++ modules/node/node.install 17 May 2009 15:43:28 -0000 @@ -12,7 +12,7 @@ function node_schema() { $schema['node'] = array( 'description' => 'The base table for nodes.', - 'fields' => array( + 'columns' => array( 'nid' => array( 'description' => 'The primary identifier for a node.', 'type' => 'serial', @@ -129,7 +129,7 @@ function node_schema() { $schema['node_access'] = array( 'description' => 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.', - 'fields' => array( + 'columns' => array( 'nid' => array( 'description' => 'The {node}.nid this record affects.', 'type' => 'int', @@ -181,7 +181,7 @@ function node_schema() { $schema['node_revision'] = array( 'description' => 'Stores information about each saved version of a {node}.', - 'fields' => array( + 'columns' => array( 'nid' => array( 'description' => 'The {node} this version belongs to.', 'type' => 'int', @@ -248,7 +248,7 @@ function node_schema() { $schema['node_type'] = array( 'description' => 'Stores information about all defined {node} types.', - 'fields' => array( + 'columns' => array( 'type' => array( 'description' => 'The machine-readable name of this type.', 'type' => 'varchar', @@ -362,7 +362,7 @@ function node_update_7000() { $ret = array(); $ret[] = update_sql("UPDATE {node_type} SET module = 'node_content' WHERE module = 'node'"); - db_change_field($ret, 'node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE)); + db_change_column($ret, 'node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE)); return $ret; } Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1048 diff -u -F^[fc] -r1.1048 node.module --- modules/node/node.module 16 May 2009 15:23:16 -0000 1.1048 +++ modules/node/node.module 17 May 2009 15:43:28 -0000 @@ -237,7 +237,7 @@ function node_tag_new($nid) { 'uid' => $user->uid, 'nid' => $nid, )) - ->fields(array('timestamp' => REQUEST_TIME)) + ->columns(array('timestamp' => REQUEST_TIME)) ->execute(); } } @@ -555,7 +555,7 @@ function node_types_rebuild() { function node_type_save($info) { $is_existing = FALSE; $existing_type = !empty($info->old_type) ? $info->old_type : $info->type; - $is_existing = (bool) db_query_range('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $existing_type), 0, 1)->fetchField(); + $is_existing = (bool) db_query_range('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $existing_type), 0, 1)->fetchColumn(); $type = node_type_set_defaults($info); $fields = array( @@ -576,7 +576,7 @@ function node_type_save($info) { if ($is_existing) { db_update('node_type') - ->fields($fields) + ->columns($fields) ->condition('type', $existing_type) ->execute(); @@ -589,7 +589,7 @@ function node_type_save($info) { else { $fields['orig_type'] = (string) $type->orig_type; db_insert('node_type') - ->fields($fields) + ->columns($fields) ->execute(); field_attach_create_bundle($type->type); @@ -626,7 +626,7 @@ function node_type_delete($type) { */ function node_type_update_nodes($old_type, $type) { db_update('node') - ->fields(array('type' => $type)) + ->columns(array('type' => $type)) ->condition('type', $old_type) ->execute(); return db_affected_rows(); @@ -650,7 +650,7 @@ function _node_types_build() { $_node_names[$type] = $info['name']; } $type_result = db_select('node_type', 'nt') - ->fields('nt') + ->columns('nt') ->orderBy('nt.type', 'ASC') ->addTag('node_type_access') ->execute(); @@ -845,7 +845,7 @@ function node_load_multiple($nids = arra // vid and title are provided by node_revision, so remove them. unset($node_fields['vid']); unset($node_fields['title']); - $query->fields('n', $node_fields); + $query->columns('n', $node_fields); // Add all fields from the {node_revision} table. $node_revision_fields = drupal_schema_fields_sql('node_revision'); @@ -855,12 +855,12 @@ function node_load_multiple($nids = arra // Change timestamp to revision_timestamp before adding it to the query. unset($node_revision_fields['timestamp']); - $query->addField('r', 'timestamp', 'revision_timestamp'); - $query->fields('r', $node_revision_fields); + $query->addColumn('r', 'timestamp', 'revision_timestamp'); + $query->columns('r', $node_revision_fields); // Add fields from the {users} table. $user_fields = array('name', 'picture', 'data'); - $query->fields('u', $user_fields); + $query->columns('u', $user_fields); if ($nids) { $query->condition('n.nid', $nids, 'IN'); @@ -1108,7 +1108,7 @@ function node_save($node) { } if ($update_node) { db_update('node') - ->fields(array('vid' => $node->vid)) + ->columns(array('vid' => $node->vid)) ->condition('nid', $node->nid) ->execute(); } @@ -1399,14 +1399,14 @@ function node_search($op = 'search', $ke case 'reset': db_update('search_dataset') - ->fields(array('reindex' => REQUEST_TIME)) + ->columns(array('reindex' => REQUEST_TIME)) ->condition('type', 'node') ->execute(); return; case 'status': - $total = db_query('SELECT COUNT(*) FROM {node} WHERE status = 1')->fetchField(); - $remaining = db_query("SELECT COUNT(*) FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE n.status = 1 AND d.sid IS NULL OR d.reindex <> 0")->fetchField(); + $total = db_query('SELECT COUNT(*) FROM {node} WHERE status = 1')->fetchColumn(); + $remaining = db_query("SELECT COUNT(*) FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE n.status = 1 AND d.sid IS NULL OR d.reindex <> 0")->fetchColumn(); return array('remaining' => $remaining, 'total' => $total); case 'admin': @@ -1567,7 +1567,7 @@ function node_user_cancel($edit, $accoun // Unpublish nodes (current revisions). module_load_include('inc', 'node', 'node.admin'); $nodes = db_select('node', 'n') - ->fields('n', array('nid')) + ->columns('n', array('nid')) ->condition('uid', $account->uid) ->execute() ->fetchCol(); @@ -1578,14 +1578,14 @@ function node_user_cancel($edit, $accoun // Anonymize nodes (current revisions). module_load_include('inc', 'node', 'node.admin'); $nodes = db_select('node', 'n') - ->fields('n', array('nid')) + ->columns('n', array('nid')) ->condition('uid', $account->uid) ->execute() ->fetchCol(); node_mass_update($nodes, array('uid' => 0)); // Anonymize old revisions. db_update('node_revision') - ->fields(array('uid' => 0)) + ->columns(array('uid' => 0)) ->condition('uid', $account->uid) ->execute(); // Clean history. @@ -1598,7 +1598,7 @@ function node_user_cancel($edit, $accoun // Delete nodes (current revisions). // @todo Introduce node_mass_delete() or make node_mass_update() more flexible. $nodes = db_select('node', 'n') - ->fields('n', array('nid')) + ->columns('n', array('nid')) ->condition('uid', $account->uid) ->execute() ->fetchCol(); @@ -1670,7 +1670,7 @@ function _node_revision_access($node, $o // different revisions so there is no need for a separate database check. // Also, if you try to revert to or delete the current revision, that's // not good. - if ($is_current_revision && (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() == 1 || $op == 'update' || $op == 'delete')) { + if ($is_current_revision && (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node->nid))->fetchColumn() == 1 || $op == 'update' || $op == 'delete')) { $access[$node->vid] = FALSE; } elseif (user_access('administer nodes')) { @@ -1932,7 +1932,7 @@ function node_feed($nids = FALSE, $chann if ($nids === FALSE) { $nids = db_select('node', 'n') - ->fields('n', array('nid', 'created')) + ->columns('n', array('nid', 'created')) ->condition('n.promote', 1) ->condition('status', 1) ->orderBy('n.created', 'DESC') @@ -2024,7 +2024,7 @@ function node_build_multiple($nodes, $te */ function node_page_default() { $select = db_select('node', 'n') - ->fields('n', array('nid')) + ->columns('n', array('nid')) ->condition('promote', 1) ->condition('status', 1) ->orderBy('sticky', 'DESC') @@ -2355,7 +2355,7 @@ function node_access($op, $node, $accoun } return $query ->execute() - ->fetchField(); + ->fetchColumn(); } // Let authors view their own nodes. @@ -2478,7 +2478,7 @@ function node_access_view_all_nodes() { } $access = $query ->execute() - ->fetchField(); + ->fetchColumn(); } } @@ -2596,7 +2596,7 @@ function node_access_write_grants($node, // Only perform work when node_access modules are active. if (count(module_implements('node_grants'))) { - $query = db_insert('node_access')->fields(array('nid', 'realm', 'gid', 'grant_view', 'grant_update', 'grant_delete')); + $query = db_insert('node_access')->columns(array('nid', 'realm', 'gid', 'grant_view', 'grant_update', 'grant_delete')); foreach ($grants as $grant) { if ($realm && $realm != $grant['realm']) { continue; @@ -2695,7 +2695,7 @@ function node_access_rebuild($batch_mode else { // Not using any node_access modules. Add the default grant. db_insert('node_accesss') - ->fields(array( + ->columns(array( 'nid' => 0, 'realm' => 'all', 'gid' => 0, @@ -2725,7 +2725,7 @@ function _node_access_rebuild_batch_oper // Initiate multistep processing. $context['sandbox']['progress'] = 0; $context['sandbox']['current_node'] = 0; - $context['sandbox']['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchField(); + $context['sandbox']['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchColumn(); } // Process the next 20 nodes. @@ -3043,16 +3043,16 @@ function node_save_action($node) { */ function node_assign_owner_action($node, $context) { $node->uid = $context['owner_uid']; - $owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(':uid' => $context['owner_uid']))->fetchField(); + $owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(':uid' => $context['owner_uid']))->fetchColumn(); watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_get_types('type', $node), '%title' => $node->title, '%name' => $owner_name)); } function node_assign_owner_action_form($context) { $description = t('The username of the user to which you would like to assign ownership.'); - $count = db_query("SELECT COUNT(*) FROM {users}")->fetchField(); + $count = db_query("SELECT COUNT(*) FROM {users}")->fetchColumn(); $owner_name = ''; if (isset($context['owner_uid'])) { - $owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(':uid' => $context['owner_uid']))->fetchField(); + $owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(':uid' => $context['owner_uid']))->fetchColumn(); } // Use dropdown for fewer than 200 users; textbox for more than that. @@ -3085,7 +3085,7 @@ function node_assign_owner_action_form($ } function node_assign_owner_action_validate($form, $form_state) { - $exists = (bool) db_query_range('SELECT 1 FROM {users} WHERE name = :name', array(':name' => $form_state['values']['owner_name']), 0, 1)->fetchField(); + $exists = (bool) db_query_range('SELECT 1 FROM {users} WHERE name = :name', array(':name' => $form_state['values']['owner_name']), 0, 1)->fetchColumn(); if (!$exists) { form_set_error('owner_name', t('Please enter a valid username.')); } @@ -3093,7 +3093,7 @@ function node_assign_owner_action_valida function node_assign_owner_action_submit($form, $form_state) { // Username can change, so we need to store the ID, not the username. - $uid = db_query('SELECT uid from {users} WHERE name = :name', array(':name' => $form_state['values']['owner_name']))->fetchField(); + $uid = db_query('SELECT uid from {users} WHERE name = :name', array(':name' => $form_state['values']['owner_name']))->fetchColumn(); return array('owner_uid' => $uid); } Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.64 diff -u -F^[fc] -r1.64 node.pages.inc --- modules/node/node.pages.inc 9 May 2009 18:28:12 -0000 1.64 +++ modules/node/node.pages.inc 17 May 2009 15:43:28 -0000 @@ -610,7 +610,7 @@ function node_revision_delete_confirm_su watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid)); drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_get_types('name', $node_revision), '%title' => $node_revision->title))); $form_state['redirect'] = 'node/' . $node_revision->nid; - if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchField() > 1) { + if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchColumn() > 1) { $form_state['redirect'] .= '/revisions'; } } Index: modules/node/node.test =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.test,v retrieving revision 1.24 diff -u -F^[fc] -r1.24 node.test --- modules/node/node.test 6 May 2009 19:56:21 -0000 1.24 +++ modules/node/node.test 17 May 2009 15:43:28 -0000 @@ -162,7 +162,7 @@ class NodeRevisionsTestCase extends Drup $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($nodes[1]->revision_timestamp), '@type' => 'Page', '%title' => $nodes[1]->title)), t('Revision deleted.')); - $this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchField() == 0, t('Revision not found.')); + $this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchColumn() == 0, t('Revision not found.')); } } Index: modules/openid/openid.install =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.install,v retrieving revision 1.5 diff -u -F^[fc] -r1.5 openid.install --- modules/openid/openid.install 13 May 2009 19:42:16 -0000 1.5 +++ modules/openid/openid.install 17 May 2009 15:43:28 -0000 @@ -28,7 +28,7 @@ function openid_uninstall() { function openid_schema() { $schema['openid_association'] = array( 'description' => 'Stores temporary shared key association information for OpenID authentication.', - 'fields' => array( + 'columns' => array( 'idp_endpoint_uri' => array( 'type' => 'varchar', 'length' => 255, Index: modules/openid/openid.module =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v retrieving revision 1.45 diff -u -F^[fc] -r1.45 openid.module --- modules/openid/openid.module 29 Apr 2009 07:29:59 -0000 1.45 +++ modules/openid/openid.module 17 May 2009 15:43:28 -0000 @@ -351,7 +351,7 @@ function openid_association($op_endpoint ->execute(); // Check to see if we have an association for this IdP already - $assoc_handle = db_query("SELECT assoc_handle FROM {openid_association} WHERE idp_endpoint_uri = :endpoint", array(':endpoint' => $op_endpoint))->fetchField(); + $assoc_handle = db_query("SELECT assoc_handle FROM {openid_association} WHERE idp_endpoint_uri = :endpoint", array(':endpoint' => $op_endpoint))->fetchColumn(); if (empty($assoc_handle)) { $mod = OPENID_DH_DEFAULT_MOD; $gen = OPENID_DH_DEFAULT_GEN; @@ -384,7 +384,7 @@ function openid_association($op_endpoint $assoc_response['mac_key'] = base64_encode(_openid_dh_xorsecret($shared, $enc_mac_key)); } db_insert('openid_association') - ->fields(array( + ->columns(array( 'idp_endpoint_uri' => $op_endpoint, 'session_type' => $assoc_response['session_type'], 'assoc_handle' => $assoc_response['assoc_handle'], Index: modules/openid/openid.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.pages.inc,v retrieving revision 1.16 diff -u -F^[fc] -r1.16 openid.pages.inc --- modules/openid/openid.pages.inc 12 May 2009 08:37:44 -0000 1.16 +++ modules/openid/openid.pages.inc 17 May 2009 15:43:28 -0000 @@ -36,7 +36,7 @@ function openid_user_identities($account if ($result['status'] == 'success') { $identity = $result['openid.claimed_id']; $query = db_insert('authmap') - ->fields(array( + ->columns(array( 'uid' => $account->uid, 'authname' => $identity, 'module' => 'openid', @@ -76,7 +76,7 @@ function openid_user_add() { function openid_user_add_validate($form, &$form_state) { // Check for existing entries. $claimed_id = _openid_normalize($form_state['values']['openid_identifier']); - if (db_query("SELECT authname FROM {authmap} WHERE authname = :authname", (array(':authname' => $claimed_id)))->fetchField()) { + if (db_query("SELECT authname FROM {authmap} WHERE authname = :authname", (array(':authname' => $claimed_id)))->fetchColumn()) { form_set_error('openid_identifier', t('That OpenID is already in use on this site.')); } else { @@ -93,7 +93,7 @@ function openid_user_delete_form($form_s ':uid' => $account->uid, ':aid' => $aid, )) - ->fetchField(); + ->fetchColumn(); return confirm_form(array(), t('Are you sure you want to delete the OpenID %authname for %user?', array('%authname' => $authname, '%user' => $account->name)), 'user/'. $account->uid .'/openid'); } Index: modules/path/path.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v retrieving revision 1.21 diff -u -F^[fc] -r1.21 path.admin.inc --- modules/path/path.admin.inc 16 May 2009 15:23:16 -0000 1.21 +++ modules/path/path.admin.inc 17 May 2009 15:43:28 -0000 @@ -15,7 +15,7 @@ function path_admin_overview($keys = NUL // Add the filter form above the overview table. $output = drupal_get_form('path_admin_filter_form', $keys); // Enable language column if locale is enabled or if we have any alias with language - $alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE language <> :language', array(':language' => ''), 0, 1)->fetchField(); + $alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE language <> :language', array(':language' => ''), 0, 1)->fetchColumn(); $multilanguage = (module_exists('locale') || $alias_exists); $header = array( @@ -33,7 +33,7 @@ function path_admin_overview($keys = NUL $query->condition('dst', '%' . preg_replace('!\*+!', '%', $keys) . '%', 'LIKE'); } $result = $query - ->fields('url_alias') + ->columns('url_alias') ->setHeader($header) ->limit(50) ->execute(); @@ -148,7 +148,7 @@ function path_admin_form_validate($form, ':dst' => $dst, ':language' => $language, )) - ->fetchField(); + ->fetchColumn(); if ($has_alias) { form_set_error('dst', t('The alias %alias is already in use in this language.', array('%alias' => $dst))); Index: modules/path/path.module =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.module,v retrieving revision 1.157 diff -u -F^[fc] -r1.157 path.module --- modules/path/path.module 10 May 2009 16:50:19 -0000 1.157 +++ modules/path/path.module 17 May 2009 15:43:28 -0000 @@ -95,7 +95,7 @@ function path_set_alias($path = NULL, $a else { // Update the existing alias. db_update('url_alias') - ->fields(array( + ->columns(array( 'src' => $path, 'dst' => $alias, 'language' => $language)) @@ -109,7 +109,7 @@ function path_set_alias($path = NULL, $a // There is already such an alias, neutral or in this language. // Update the alias based on alias; setting the language if not yet done. db_update('url_alias') - ->fields(array( + ->columns(array( 'src' => $path, 'dst' => $alias, 'language' => $language @@ -120,7 +120,7 @@ function path_set_alias($path = NULL, $a else { // A new alias. Add it to the database. db_insert('url_alias') - ->fields(array( + ->columns(array( 'src' => $path, 'dst' => $alias, 'language' => $language, @@ -157,7 +157,7 @@ function path_node_validate($node, $form ':dst' => $node->path, ':language' => $language, )) - ->fetchField(); + ->fetchColumn(); if ($has_alias) { form_set_error('path', t('The path is already in use.')); @@ -249,7 +249,7 @@ function path_form_alter(&$form, $form_s ':dst' => $path, ':language' => $form['#node']->language )) - ->fetchField(), + ->fetchColumn(), ); } } Index: modules/path/path.test =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.test,v retrieving revision 1.12 diff -u -F^[fc] -r1.12 path.test --- modules/path/path.test 16 May 2009 19:07:02 -0000 1.12 +++ modules/path/path.test 17 May 2009 15:43:28 -0000 @@ -152,7 +152,7 @@ class PathTestCase extends DrupalWebTest } function getPID($dst) { - return db_query("SELECT pid FROM {url_alias} WHERE dst = :dst", array(':dst' => $dst))->fetchField(); + return db_query("SELECT pid FROM {url_alias} WHERE dst = :dst", array(':dst' => $dst))->fetchColumn(); } } Index: modules/php/php.install =================================================================== RCS file: /cvs/drupal/drupal/modules/php/php.install,v retrieving revision 1.7 diff -u -F^[fc] -r1.7 php.install --- modules/php/php.install 16 May 2009 15:23:16 -0000 1.7 +++ modules/php/php.install 17 May 2009 15:43:28 -0000 @@ -10,14 +10,14 @@ * Implementation of hook_install(). */ function php_install() { - $format_exists = (bool) db_query_range('SELECT 1 FROM {filter_format} WHERE name = :name', array(':name' => 'PHP code'), 0, 1)->fetchField(); + $format_exists = (bool) db_query_range('SELECT 1 FROM {filter_format} WHERE name = :name', array(':name' => 'PHP code'), 0, 1)->fetchColumn(); // Add a PHP code text format, if it does not exist. Do this only for the // first install (or if the format has been manually deleted) as there is no // reliable method to identify the format in an uninstall hook or in // subsequent clean installs. if (!$format_exists) { $format = db_insert('filter_format') - ->fields(array( + ->columns(array( 'name' => 'PHP code', 'roles' => '', 'cache' => 0, @@ -26,7 +26,7 @@ function php_install() { // Enable the PHP evaluator filter. db_insert('filter') - ->fields(array( + ->columns(array( 'format' => $format, 'module' => 'php', 'delta' => 0, Index: modules/poll/poll.install =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.install,v retrieving revision 1.22 diff -u -F^[fc] -r1.22 poll.install --- modules/poll/poll.install 13 May 2009 19:42:16 -0000 1.22 +++ modules/poll/poll.install 17 May 2009 15:43:28 -0000 @@ -28,7 +28,7 @@ function poll_uninstall() { function poll_schema() { $schema['poll'] = array( 'description' => 'Stores poll-specific information for poll nodes.', - 'fields' => array( + 'columns' => array( 'nid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -55,7 +55,7 @@ function poll_schema() { $schema['poll_choice'] = array( 'description' => 'Stores information about all choices for all {poll}s.', - 'fields' => array( + 'columns' => array( 'chid' => array( 'type' => 'serial', 'unsigned' => TRUE, @@ -98,7 +98,7 @@ function poll_schema() { $schema['poll_vote'] = array( 'description' => 'Stores per-{users} votes for each {poll}.', - 'fields' => array( + 'columns' => array( 'chid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -163,6 +163,6 @@ function poll_update_7002() { 'not null' => TRUE, 'default' => 0, ); - db_add_field($ret, 'poll_votes', 'timestamp', $field); + db_add_column($ret, 'poll_votes', 'timestamp', $field); return $ret; } Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.294 diff -u -F^[fc] -r1.294 poll.module --- modules/poll/poll.module 12 May 2009 08:37:45 -0000 1.294 +++ modules/poll/poll.module 17 May 2009 15:43:28 -0000 @@ -148,7 +148,7 @@ function poll_block_view($delta = '') { // Retrieve the latest poll. $select = db_select('node', 'n'); $select->join('poll', 'p', 'p.nid = n.nid'); - $select->fields('n', array('nid')) + $select->columns('n', array('nid')) ->condition('n.status', 1) ->condition('p.active', 1) ->orderBy('n.created', 'DESC') @@ -177,7 +177,7 @@ function poll_cron() { $nids = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < :request_time AND p.active = :active AND p.runtime <> :runtime', array(':request_time' => REQUEST_TIME, ':active' => 1, ':runtime' => 0))->fetchCol(); if (!empty($nids)) { db_update('poll') - ->fields(array('active' => 0)) + ->columns(array('active' => 0)) ->condition('nid', $nids, 'IN') ->execute(); } @@ -467,7 +467,7 @@ function poll_insert($node) { } db_insert('poll') - ->fields(array( + ->columns(array( 'nid' => $node->nid, 'runtime' => $node->runtime, 'active' => $node->active, @@ -477,7 +477,7 @@ function poll_insert($node) { foreach ($node->choice as $choice) { if ($choice['chtext'] != '') { db_insert('poll_choice') - ->fields(array( + ->columns(array( 'nid' => $node->nid, 'chtext' => $choice['chtext'], 'chvotes' => $choice['chvotes'], @@ -494,7 +494,7 @@ function poll_insert($node) { function poll_update($node) { // Update poll settings. db_update('poll') - ->fields(array( + ->columns(array( 'runtime' => $node->runtime, 'active' => $node->active, )) @@ -507,7 +507,7 @@ function poll_update($node) { if (!empty($choice['chtext'])) { db_merge('poll_choice') ->key(array('chid' => $choice['chid'])) - ->fields(array( + ->columns(array( 'nid' => $node->nid, 'chtext' => $choice['chtext'], 'chvotes' => (int) $choice['chvotes'], @@ -649,7 +649,7 @@ function poll_vote($form, &$form_state) global $user; db_insert('poll_vote') - ->fields(array( + ->columns(array( 'nid' => $node->nid, 'chid' => $choice, 'uid' => $user->uid, @@ -847,7 +847,7 @@ function poll_user_cancel($edit, $accoun switch ($method) { case 'user_cancel_reassign': db_update('poll_vote') - ->fields(array('uid' => 0)) + ->columns(array('uid' => 0)) ->condition('uid', $account->uid) ->execute(); break; Index: modules/poll/poll.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.pages.inc,v retrieving revision 1.16 diff -u -F^[fc] -r1.16 poll.pages.inc --- modules/poll/poll.pages.inc 26 Apr 2009 19:44:39 -0000 1.16 +++ modules/poll/poll.pages.inc 17 May 2009 15:43:28 -0000 @@ -22,8 +22,8 @@ function poll_page() { $select->join('poll', 'p', 'p.nid = n.nid'); $select->join('poll_choice', 'c', 'c.nid = n.nid'); $select->addExpression('SUM(c.chvotes)', 'votes'); - $select = $select->fields('n', array('nid', 'title', 'created')) - ->fields('p', array('active')) + $select = $select->columns('n', array('nid', 'title', 'created')) + ->columns('p', array('active')) ->condition('n.status', 1) ->orderBy('n.created', 'DESC') ->groupBy('n.nid') @@ -61,9 +61,9 @@ function poll_votes($node) { $select = db_select('poll_vote', 'pv'); $select->join('poll_choice', 'pc', 'pv.chid = pc.chid'); $select->join('users', 'u', 'pv.uid = u.uid'); - $queried_votes = $select->fields('pv', array('chid', 'uid', 'hostname', 'timestamp', 'nid')) - ->fields('pc', array('chtext')) - ->fields('u', array('name')) + $queried_votes = $select->columns('pv', array('chid', 'uid', 'hostname', 'timestamp', 'nid')) + ->columns('pc', array('chtext')) + ->columns('u', array('name')) ->condition('pv.nid', $node->nid) ->extend('PagerDefault') ->limit($votes_per_page) Index: modules/profile/profile.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.admin.inc,v retrieving revision 1.23 diff -u -F^[fc] -r1.23 profile.admin.inc --- modules/profile/profile.admin.inc 26 Feb 2009 07:30:27 -0000 1.23 +++ modules/profile/profile.admin.inc 17 May 2009 15:43:28 -0000 @@ -207,75 +207,75 @@ function profile_field_form(&$form_state 'required' => '', 'register' => '', ); - $form['fields'] = array('#type' => 'fieldset', + $form['columns'] = array('#type' => 'fieldset', '#title' => t('Field settings'), ); - $form['fields']['category'] = array('#type' => 'textfield', + $form['columns']['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#default_value' => $edit['category'], '#autocomplete_path' => 'admin/user/profile/autocomplete', '#description' => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'), '#required' => TRUE, ); - $form['fields']['title'] = array('#type' => 'textfield', + $form['columns']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#description' => t('The title of the new field. The title will be shown to the user. An example title is "Favorite color".'), '#required' => TRUE, ); - $form['fields']['name'] = array('#type' => 'textfield', + $form['columns']['name'] = array('#type' => 'textfield', '#title' => t('Form name'), '#default_value' => $edit['name'], '#description' => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs. Unless you know what you are doing, it is highly recommended that you prefix the form name with profile_ to avoid name clashes with other fields. Spaces or any other special characters except dash (-) and underscore (_) are not allowed. An example name is "profile_favorite_color" or perhaps just "profile_color".'), '#required' => TRUE, ); - $form['fields']['explanation'] = array('#type' => 'textarea', + $form['columns']['explanation'] = array('#type' => 'textarea', '#title' => t('Explanation'), '#default_value' => $edit['explanation'], '#description' => t('An optional explanation to go with the new field. The explanation will be shown to the user.'), ); if ($type == 'selection') { - $form['fields']['options'] = array('#type' => 'textarea', + $form['columns']['options'] = array('#type' => 'textarea', '#title' => t('Selection options'), '#default_value' => isset($edit['options']) ? $edit['options'] : '', '#description' => t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.'), ); } - $form['fields']['visibility'] = array('#type' => 'radios', + $form['columns']['visibility'] = array('#type' => 'radios', '#title' => t('Visibility'), '#default_value' => isset($edit['visibility']) ? $edit['visibility'] : PROFILE_PUBLIC, '#options' => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')), ); if ($type == 'selection' || $type == 'list' || $type == 'textfield') { - $form['fields']['page'] = array('#type' => 'textfield', + $form['columns']['page'] = array('#type' => 'textfield', '#title' => t('Page title'), '#default_value' => $edit['page'], '#description' => t('To enable browsing this field by value, enter a title for the resulting page. The word %value will be substituted with the corresponding value. An example page title is "People whose favorite color is %value" . This is only applicable for a public field.'), ); } elseif ($type == 'checkbox') { - $form['fields']['page'] = array('#type' => 'textfield', + $form['columns']['page'] = array('#type' => 'textfield', '#title' => t('Page title'), '#default_value' => $edit['page'], '#description' => t('To enable browsing this field by value, enter a title for the resulting page. An example page title is "People who are employed" . This is only applicable for a public field.'), ); } - $form['fields']['weight'] = array('#type' => 'weight', + $form['columns']['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#description' => t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.'), ); - $form['fields']['autocomplete'] = array('#type' => 'checkbox', + $form['columns']['autocomplete'] = array('#type' => 'checkbox', '#title' => t('Form will auto-complete while user is typing.'), '#default_value' => $edit['autocomplete'], '#description' => t('For security, auto-complete will be disabled if the user does not have access to user profiles.'), ); - $form['fields']['required'] = array('#type' => 'checkbox', + $form['columns']['required'] = array('#type' => 'checkbox', '#title' => t('The user must enter a value.'), '#default_value' => $edit['required'], ); - $form['fields']['register'] = array('#type' => 'checkbox', + $form['columns']['register'] = array('#type' => 'checkbox', '#title' => t('Visible in user registration form.'), '#default_value' => $edit['register'], ); @@ -295,7 +295,7 @@ function profile_field_form_validate($fo } $users_table = drupal_get_schema('users'); - if (!empty($users_table['fields'][$form_state['values']['name']])) { + if (!empty($users_table['columns'][$form_state['values']['name']])) { form_set_error('name', t('The specified form name is reserved for use by Drupal.')); } // Validate the category: Index: modules/profile/profile.install =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.install,v retrieving revision 1.18 diff -u -F^[fc] -r1.18 profile.install --- modules/profile/profile.install 13 May 2009 19:42:16 -0000 1.18 +++ modules/profile/profile.install 17 May 2009 15:43:28 -0000 @@ -30,7 +30,7 @@ function profile_uninstall() { function profile_schema() { $schema['profile_field'] = array( 'description' => 'Stores profile field information.', - 'fields' => array( + 'columns' => array( 'fid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -124,7 +124,7 @@ function profile_schema() { $schema['profile_value'] = array( 'description' => 'Stores values for profile fields.', - 'fields' => array( + 'columns' => array( 'fid' => array( 'type' => 'int', 'unsigned' => TRUE, Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.254 diff -u -F^[fc] -r1.254 profile.module --- modules/profile/profile.module 16 May 2009 15:23:16 -0000 1.254 +++ modules/profile/profile.module 17 May 2009 15:43:28 -0000 @@ -54,11 +54,11 @@ function profile_help($path, $arg) { function profile_theme() { return array( 'profile_block' => array( - 'arguments' => array('account' => NULL, 'fields' => array()), + 'arguments' => array('account' => NULL, 'columns' => array()), 'template' => 'profile-block', ), 'profile_listing' => array( - 'arguments' => array('account' => NULL, 'fields' => array()), + 'arguments' => array('account' => NULL, 'columns' => array()), 'template' => 'profile-listing', ), 'profile_wrapper' => array( @@ -511,7 +511,7 @@ function profile_category_access($accoun return TRUE; } else { - $category_visible = (bool) db_query_range('SELECT 1 FROM {profile_field} WHERE category = :category AND visibility <> :visibility', array(':category' => $category, ':visibility' => PROFILE_HIDDEN), 0, 1)->fetchField(); + $category_visible = (bool) db_query_range('SELECT 1 FROM {profile_field} WHERE category = :category AND visibility <> :visibility', array(':category' => $category, ':visibility' => PROFILE_HIDDEN), 0, 1)->fetchColumn(); return user_edit_access($account) && $category_visible; } } @@ -530,7 +530,7 @@ function template_preprocess_profile_blo $variables['picture'] = theme('user_picture', $variables['account']); $variables['profile'] = array(); // Supply filtered version of $fields that have values. - foreach ($variables['fields'] as $field) { + foreach ($variables['columns'] as $field) { if ($field->value) { $variables['profile'][$field->name]->title = check_plain($field->title); $variables['profile'][$field->name]->value = $field->value; @@ -555,7 +555,7 @@ function template_preprocess_profile_lis $variables['name'] = theme('username', $variables['account']); $variables['profile'] = array(); // Supply filtered version of $fields that have values. - foreach ($variables['fields'] as $field) { + foreach ($variables['columns'] as $field) { if ($field->value) { $variables['profile'][$field->name]->title = $field->title; $variables['profile'][$field->name]->value = $field->value; Index: modules/profile/profile.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.pages.inc,v retrieving revision 1.15 diff -u -F^[fc] -r1.15 profile.pages.inc --- modules/profile/profile.pages.inc 16 May 2009 15:23:16 -0000 1.15 +++ modules/profile/profile.pages.inc 17 May 2009 15:43:28 -0000 @@ -110,7 +110,7 @@ function profile_browse() { */ function profile_autocomplete($field, $string) { $matches = array(); - $autocomplete_field = (bool) db_query_range("SELECT 1 FROM {profile_field} WHERE fid = :fid AND autocomplete = 1", array(':fid' => $field), 0, 1)->fetchField(); + $autocomplete_field = (bool) db_query_range("SELECT 1 FROM {profile_field} WHERE fid = :fid AND autocomplete = 1", array(':fid' => $field), 0, 1)->fetchColumn(); if ($autocomplete_field) { $result = db_query_range("SELECT value FROM {profile_value} WHERE fid = :fid AND LOWER(value) LIKE LOWER(:value) GROUP BY value ORDER BY value ASC", array( ':fid' => $field, Index: modules/search/search.install =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.install,v retrieving revision 1.20 diff -u -F^[fc] -r1.20 search.install --- modules/search/search.install 13 May 2009 19:42:16 -0000 1.20 +++ modules/search/search.install 17 May 2009 15:43:28 -0000 @@ -32,7 +32,7 @@ function search_uninstall() { function search_schema() { $schema['search_dataset'] = array( 'description' => 'Stores items that will be searched.', - 'fields' => array( + 'columns' => array( 'sid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -65,7 +65,7 @@ function search_schema() { $schema['search_index'] = array( 'description' => 'Stores the search index, associating words, items and scores.', - 'fields' => array( + 'columns' => array( 'word' => array( 'type' => 'varchar', 'length' => 50, @@ -100,7 +100,7 @@ function search_schema() { $schema['search_total'] = array( 'description' => 'Stores search totals for words.', - 'fields' => array( + 'columns' => array( 'word' => array( 'description' => 'Primary Key: Unique word in the search index.', 'type' => 'varchar', @@ -119,7 +119,7 @@ function search_schema() { $schema['search_node_links'] = array( 'description' => 'Stores items (like nodes) that link to other nodes, used to improve search scores for nodes that are frequently linked to.', - 'fields' => array( + 'columns' => array( 'sid' => array( 'type' => 'int', 'unsigned' => TRUE, Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.292 diff -u -F^[fc] -r1.292 search.module --- modules/search/search.module 16 May 2009 16:06:04 -0000 1.292 +++ modules/search/search.module 17 May 2009 15:43:28 -0000 @@ -296,7 +296,7 @@ function search_update_totals() { $total = db_result(db_query("SELECT SUM(score) FROM {search_index} WHERE word = '%s'", $word)); // Apply Zipf's law to equalize the probability distribution $total = log10(1 + 1/(max(1, $total))); - db_merge('search_total')->key(array('word' => $word))->fields(array('count' => $total))->execute(); + db_merge('search_total')->key(array('word' => $word))->columns(array('count' => $total))->execute(); } // Find words that were deleted from search_index, but are still in // search_total. We use a LEFT JOIN between the two tables and keep only the @@ -589,7 +589,7 @@ function search_index($sid, $type, $text 'word' => $word, 'sid' => $sid, 'type' => $type, - ))->fields(array('score' => $score))->expression('score', 'score + :score', array(':score' => $score)) + ))->columns(array('score' => $score))->expression('score', 'score + :score', array(':score' => $score)) ->execute(); search_dirty($word); } Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.103 diff -u -F^[fc] -r1.103 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 3 May 2009 20:01:11 -0000 1.103 +++ modules/simpletest/drupal_web_test_case.php 17 May 2009 15:43:29 -0000 @@ -187,7 +187,7 @@ class DrupalWebTestCase { ); // Store assertion for display after the test has completed. - db_insert('simpletest')->fields($assertion)->execute(); + db_insert('simpletest')->columns($assertion)->execute(); // Return to testing prefix. $db_prefix = $current_db_prefix; Index: modules/simpletest/simpletest.install =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.install,v retrieving revision 1.18 diff -u -F^[fc] -r1.18 simpletest.install --- modules/simpletest/simpletest.install 13 May 2009 19:42:16 -0000 1.18 +++ modules/simpletest/simpletest.install 17 May 2009 15:43:29 -0000 @@ -140,7 +140,7 @@ function simpletest_requirements($phase) function simpletest_schema() { $schema['simpletest'] = array( 'description' => 'Stores simpletest messages', - 'fields' => array( + 'columns' => array( 'message_id' => array( 'type' => 'serial', 'not null' => TRUE, @@ -206,7 +206,7 @@ function simpletest_schema() { ); $schema['simpletest_test_id'] = array( 'description' => 'Stores simpletest test IDs, used to auto-incrament the test ID so that a fresh test ID is used.', - 'fields' => array( + 'columns' => array( 'test_id' => array( 'type' => 'serial', 'not null' => TRUE, Index: modules/simpletest/simpletest.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.pages.inc,v retrieving revision 1.1 diff -u -F^[fc] -r1.1 simpletest.pages.inc --- modules/simpletest/simpletest.pages.inc 1 May 2009 13:40:56 -0000 1.1 +++ modules/simpletest/simpletest.pages.inc 17 May 2009 15:43:29 -0000 @@ -357,7 +357,7 @@ function theme_simpletest_result_summary */ function simpletest_result_get($test_id) { $results = db_select('simpletest') - ->fields('simpletest') + ->columns('simpletest') ->condition('test_id', $test_id) ->orderBy('test_class') ->orderBy('message_id') Index: modules/simpletest/tests/bootstrap.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/bootstrap.test,v retrieving revision 1.15 diff -u -F^[fc] -r1.15 bootstrap.test --- modules/simpletest/tests/bootstrap.test 22 Apr 2009 09:45:03 -0000 1.15 +++ modules/simpletest/tests/bootstrap.test 17 May 2009 15:43:29 -0000 @@ -251,31 +251,31 @@ class HookBootExitTestCase extends Drupa variable_set('cache', CACHE_DISABLED); $this->drupalGet(''); $calls = 1; - $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_boot'")->fetchField(), $calls, t('hook_boot called with disabled cache.')); - $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_exit'")->fetchField(), $calls, t('hook_exit called with disabled cache.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_boot'")->fetchColumn(), $calls, t('hook_boot called with disabled cache.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_exit'")->fetchColumn(), $calls, t('hook_exit called with disabled cache.')); // Test with normal cache. Boot and exit should be called. variable_set('cache', CACHE_NORMAL); $this->drupalGet(''); $calls++; - $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_boot'")->fetchField(), $calls, t('hook_boot called with normal cache.')); - $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_exit'")->fetchField(), $calls, t('hook_exit called with normal cache.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_boot'")->fetchColumn(), $calls, t('hook_boot called with normal cache.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_exit'")->fetchColumn(), $calls, t('hook_exit called with normal cache.')); // Test with aggressive cache. Boot and exit should not fire since the // page is cached. variable_set('cache', CACHE_AGGRESSIVE); $this->assertTrue(cache_get(url('', array('absolute' => TRUE)), 'cache_page'), t('Page has been cached.')); $this->drupalGet(''); - $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_boot'")->fetchField(), $calls, t('hook_boot not called with agressive cache and a cached page.')); - $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_exit'")->fetchField(), $calls, t('hook_exit not called with agressive cache and a cached page.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_boot'")->fetchColumn(), $calls, t('hook_boot not called with agressive cache and a cached page.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_exit'")->fetchColumn(), $calls, t('hook_exit not called with agressive cache and a cached page.')); // Test with aggressive cache and page cache cleared. Boot and exit should // be called. $this->assertTrue(db_delete('cache_page')->execute(), t('Page cache cleared.')); $this->drupalGet(''); $calls++; - $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_boot'")->fetchField(), $calls, t('hook_boot called with agressive cache and no cached page.')); - $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_exit'")->fetchField(), $calls, t('hook_exit called with agressive cache and no cached page.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_boot'")->fetchColumn(), $calls, t('hook_boot called with agressive cache and no cached page.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {watchdog} WHERE type = 'system_test' AND message = 'hook_exit'")->fetchColumn(), $calls, t('hook_exit called with agressive cache and no cached page.')); } } Index: modules/simpletest/tests/database_test.install =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.install,v retrieving revision 1.6 diff -u -F^[fc] -r1.6 database_test.install --- modules/simpletest/tests/database_test.install 13 May 2009 19:42:17 -0000 1.6 +++ modules/simpletest/tests/database_test.install 17 May 2009 15:43:29 -0000 @@ -17,7 +17,7 @@ function database_test_schema() { $schema['test'] = array( 'description' => 'Basic test table for the database unit tests.', - 'fields' => array( + 'columns' => array( 'id' => array( 'type' => 'serial', 'unsigned' => TRUE, @@ -57,7 +57,7 @@ function database_test_schema() { // but has a non-serial Primary Key. $schema['test_people'] = array( 'description' => 'A duplicate version of the test table, used for additional tests.', - 'fields' => array( + 'columns' => array( 'name' => array( 'description' => "A person's name", 'type' => 'varchar', @@ -88,7 +88,7 @@ function database_test_schema() { $schema['test_one_blob'] = array( 'description' => 'A simple table including a BLOB field for testing BLOB behavior.', - 'fields' => array( + 'columns' => array( 'id' => array( 'description' => 'Simple unique ID.', 'type' => 'serial', @@ -104,7 +104,7 @@ function database_test_schema() { $schema['test_two_blobs'] = array( 'description' => 'A simple test table with two BLOB fields.', - 'fields' => array( + 'columns' => array( 'id' => array( 'description' => 'Simple unique ID.', 'type' => 'serial', @@ -124,7 +124,7 @@ function database_test_schema() { $schema['test_task'] = array( 'description' => 'A task list for people in the test table.', - 'fields' => array( + 'columns' => array( 'tid' => array( 'description' => 'Task ID, primary key.', 'type' => 'serial', @@ -157,7 +157,7 @@ function database_test_schema() { $schema['test_date'] = array( 'description' => 'A simple table including a datetime field for testing datetime behavior.', - 'fields' => array( + 'columns' => array( 'id' => array( 'description' => 'Simple unique ID.', 'type' => 'serial', @@ -173,7 +173,7 @@ function database_test_schema() { $schema['test_null'] = array( 'description' => 'Basic test table for NULL value handling.', - 'fields' => array( + 'columns' => array( 'id' => array( 'type' => 'serial', 'unsigned' => TRUE, Index: modules/simpletest/tests/database_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.module,v retrieving revision 1.7 diff -u -F^[fc] -r1.7 database_test.module --- modules/simpletest/tests/database_test.module 22 Feb 2009 16:53:41 -0000 1.7 +++ modules/simpletest/tests/database_test.module 17 May 2009 15:43:29 -0000 @@ -12,7 +12,7 @@ function database_test_query_alter(Query if ($query->hasTag('database_test_alter_add_join')) { $people_alias = $query->join('test', 'people', "test_task.pid=people.id"); - $name_field = $query->addField('people', 'name', 'name'); + $name_field = $query->addColumn('people', 'name', 'name'); $query->condition($people_alias . '.id', 2); } @@ -22,7 +22,7 @@ function database_test_query_alter(Query } if ($query->hasTag('database_test_alter_change_fields')) { - $fields =& $query->getFields(); + $fields =& $query->getColumns(); unset($fields['age']); } @@ -75,7 +75,7 @@ function database_test_db_query_temporar $table_name = db_query_temporary('SELECT status FROM {system}', array()); drupal_json(array( 'table_name' => $table_name, - 'row_count' => db_select($table_name)->countQuery()->execute()->fetchField(), + 'row_count' => db_select($table_name)->countQuery()->execute()->fetchColumn(), )); exit; } @@ -90,7 +90,7 @@ function database_test_even_pager_query( $query = db_select('test', 't'); $query - ->fields('t', array('name')) + ->columns('t', array('name')) ->orderBy('age'); // This should result in 2 pages of results. @@ -114,7 +114,7 @@ function database_test_odd_pager_query($ $query = db_select('test_task', 't'); $query - ->fields('t', array('task')) + ->columns('t', array('task')) ->orderBy('pid'); // This should result in 4 pages of results. @@ -144,7 +144,7 @@ function database_test_tablesort() { $query = db_select('test_task', 't'); $query - ->fields('t', array('tid', 'pid', 'task', 'priority')); + ->columns('t', array('tid', 'pid', 'task', 'priority')); $query = $query->extend('TableSort')->setHeader($header); Index: modules/simpletest/tests/database_test.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.test,v retrieving revision 1.50 diff -u -F^[fc] -r1.50 database_test.test --- modules/simpletest/tests/database_test.test 3 May 2009 08:56:19 -0000 1.50 +++ modules/simpletest/tests/database_test.test 17 May 2009 15:43:29 -0000 @@ -61,7 +61,7 @@ class DatabaseTestCase extends DrupalWeb $this->installTables($schema); db_insert('test_null') - ->fields(array('name', 'age')) + ->columns(array('name', 'age')) ->values(array( 'name' => 'Kermit', 'age' => 25, @@ -86,7 +86,7 @@ class DatabaseTestCase extends DrupalWeb function addSampleData() { // We need the IDs, so we can't use a multi-insert here. $john = db_insert('test') - ->fields(array( + ->columns(array( 'name' => 'John', 'age' => 25, 'job' => 'Singer', @@ -94,7 +94,7 @@ class DatabaseTestCase extends DrupalWeb ->execute(); $george = db_insert('test') - ->fields(array( + ->columns(array( 'name' => 'George', 'age' => 27, 'job' => 'Singer', @@ -102,7 +102,7 @@ class DatabaseTestCase extends DrupalWeb ->execute(); $ringo = db_insert('test') - ->fields(array( + ->columns(array( 'name' => 'Ringo', 'age' => 28, 'job' => 'Drummer', @@ -110,7 +110,7 @@ class DatabaseTestCase extends DrupalWeb ->execute(); $paul = db_insert('test') - ->fields(array( + ->columns(array( 'name' => 'Paul', 'age' => 26, 'job' => 'Songwriter', @@ -118,7 +118,7 @@ class DatabaseTestCase extends DrupalWeb ->execute(); db_insert('test_people') - ->fields(array( + ->columns(array( 'name' => 'Meredith', 'age' => 30, 'job' => 'Speaker', @@ -126,7 +126,7 @@ class DatabaseTestCase extends DrupalWeb ->execute(); db_insert('test_task') - ->fields(array('pid', 'task', 'priority')) + ->columns(array('pid', 'task', 'priority')) ->values(array( 'pid' => $john, 'task' => 'eat', @@ -397,18 +397,18 @@ class DatabaseInsertTestCase extends Dat * Test the very basic insert functionality. */ function testSimpleInsert() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $query = db_insert('test'); - $query->fields(array( + $query->columns(array( 'name' => 'Yoko', 'age' => '29', )); $query->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $this->assertIdentical($num_records_before + 1, (int)$num_records_after, t('Record inserts correctly.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Yoko'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Yoko'))->fetchColumn(); $this->assertIdentical($saved_age, '29', t('Can retrieve after inserting.')); } @@ -416,10 +416,10 @@ class DatabaseInsertTestCase extends Dat * Test that we can insert multiple records in one query object. */ function testMultiInsert() { - $num_records_before = (int) db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_before = (int) db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $query = db_insert('test'); - $query->fields(array( + $query->columns(array( 'name' => 'Larry', 'age' => '30', )); @@ -435,13 +435,13 @@ class DatabaseInsertTestCase extends Dat $query->values(array('Moe', '32')); $query->execute(); - $num_records_after = (int) db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_after = (int) db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $this->assertIdentical($num_records_before + 3, $num_records_after, t('Record inserts correctly.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Larry'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Larry'))->fetchColumn(); $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Curly'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Curly'))->fetchColumn(); $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Moe'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Moe'))->fetchColumn(); $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.')); } @@ -449,11 +449,11 @@ class DatabaseInsertTestCase extends Dat * Test that an insert object can be reused with new data after it executes. */ function testRepeatedInsert() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $query = db_insert('test'); - $query->fields(array( + $query->columns(array( 'name' => 'Larry', 'age' => '30', )); @@ -470,13 +470,13 @@ class DatabaseInsertTestCase extends Dat $query->values(array('Moe', '32')); $query->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $this->assertIdentical((int) $num_records_before + 3, (int) $num_records_after, t('Record inserts correctly.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Larry'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Larry'))->fetchColumn(); $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Curly'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Curly'))->fetchColumn(); $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Moe'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Moe'))->fetchColumn(); $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.')); } @@ -487,16 +487,16 @@ class DatabaseInsertTestCase extends Dat // This is useful for importers, when we want to create a query and define // its fields once, then loop over a multi-insert execution. db_insert('test') - ->fields(array('name', 'age')) + ->columns(array('name', 'age')) ->values(array('Larry', '30')) ->values(array('Curly', '31')) ->values(array('Moe', '32')) ->execute(); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Larry'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Larry'))->fetchColumn(); $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Curly'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Curly'))->fetchColumn(); $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Moe'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'Moe'))->fetchColumn(); $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.')); } @@ -504,7 +504,7 @@ class DatabaseInsertTestCase extends Dat * Test that inserts return the proper auto-increment ID. */ function testInsertLastInsertID() { - $id = db_insert('test')->fields(array( + $id = db_insert('test')->columns(array( 'name' => 'Larry', 'age' => '30', )) @@ -533,7 +533,7 @@ class DatabaseInsertLOBTestCase extends function testInsertOneBlob() { $data = "This is\000a test."; $this->assertTrue(strlen($data) === 15, t('Test data contains a NULL.')); - $id = db_insert('test_one_blob')->fields(array('blob1' => $data))->execute(); + $id = db_insert('test_one_blob')->columns(array('blob1' => $data))->execute(); $res = db_query('SELECT * FROM {test_one_blob} WHERE id = :id', array(':id' => $id)); $r = db_fetch_array($res); $this->assertTrue($r['blob1'] === $data, t('Can insert a blob: id @id, @data.', array('@id' => $id, '@data' => serialize($r)))); @@ -543,7 +543,7 @@ class DatabaseInsertLOBTestCase extends * Test that we can insert multiple blob fields in the same query. */ function testInsertMultipleBlob() { - $id = db_insert('test_two_blobs')->fields(array( + $id = db_insert('test_two_blobs')->columns(array( 'blob1' => 'This is', 'blob2' => 'a test', )) @@ -576,20 +576,20 @@ class DatabaseInsertDefaultsTestCase ext $schema = drupal_get_schema('test'); - $job = db_query("SELECT job FROM {test} WHERE id = :id", array(':id' => $id))->fetchField(); - $this->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.')); + $job = db_query("SELECT job FROM {test} WHERE id = :id", array(':id' => $id))->fetchColumn(); + $this->assertEqual($job, $schema['columns']['job']['default'], t('Default field value is set.')); } /** * Test that no action will be preformed if no fields are specified. */ function testDefaultEmptyInsert() { - $num_records_before = (int) db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_before = (int) db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $result = db_insert('test')->execute(); $this->assertNull($result, t('Return NULL as no fields are specified.')); - $num_records_after = (int) db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_after = (int) db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $this->assertIdentical($num_records_before, $num_records_after, t('Do nothing as no fields are specified.')); } @@ -597,13 +597,13 @@ class DatabaseInsertDefaultsTestCase ext * Test that we can insert fields with values and defaults in the same query. */ function testDefaultInsertWithFields() { - $query = db_insert('test')->fields(array('name' => 'Bob'))->useDefaults(array('job')); + $query = db_insert('test')->columns(array('name' => 'Bob'))->useDefaults(array('job')); $id = $query->execute(); $schema = drupal_get_schema('test'); - $job = db_query("SELECT job FROM {test} WHERE id = :id", array(':id' => $id))->fetchField(); - $this->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.')); + $job = db_query("SELECT job FROM {test} WHERE id = :id", array(':id' => $id))->fetchColumn(); + $this->assertEqual($job, $schema['columns']['job']['default'], t('Default field value is set.')); } } @@ -624,10 +624,10 @@ class DatabaseUpdateTestCase extends Dat * Confirm that we can update a single record successfully. */ function testSimpleUpdate() { - $num_updated = db_update('test')->fields(array('name' => 'Tiffany'))->condition('id', 1)->execute(); + $num_updated = db_update('test')->columns(array('name' => 'Tiffany'))->condition('id', 1)->execute(); $this->assertIdentical($num_updated, 1, t('Updated 1 record.')); - $saved_name = db_query("SELECT name FROM {test} WHERE id = :id", array(':id' => 1))->fetchField(); + $saved_name = db_query("SELECT name FROM {test} WHERE id = :id", array(':id' => 1))->fetchColumn(); $this->assertIdentical($saved_name, 'Tiffany', t('Updated name successfully.')); } @@ -635,10 +635,10 @@ class DatabaseUpdateTestCase extends Dat * Confirm that we can update a multiple records successfully. */ function testMultiUpdate() { - $num_updated = db_update('test')->fields(array('job' => 'Musician'))->condition('job', 'Singer')->execute(); + $num_updated = db_update('test')->columns(array('job' => 'Musician'))->condition('job', 'Singer')->execute(); $this->assertIdentical($num_updated, 2, t('Updated 2 records.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '2', t('Updated fields successfully.')); } @@ -646,10 +646,10 @@ class DatabaseUpdateTestCase extends Dat * Confirm that we can update a multiple records with a non-equality condition. */ function testMultiGTUpdate() { - $num_updated = db_update('test')->fields(array('job' => 'Musician'))->condition('age', 26, '>')->execute(); + $num_updated = db_update('test')->columns(array('job' => 'Musician'))->condition('age', 26, '>')->execute(); $this->assertIdentical($num_updated, 2, t('Updated 2 records.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '2', t('Updated fields successfully.')); } @@ -657,10 +657,10 @@ class DatabaseUpdateTestCase extends Dat * Confirm that we can update a multiple records with a where call. */ function testWhereUpdate() { - $num_updated = db_update('test')->fields(array('job' => 'Musician'))->where('age > :age', array(':age' => 26))->execute(); + $num_updated = db_update('test')->columns(array('job' => 'Musician'))->where('age > :age', array(':age' => 26))->execute(); $this->assertIdentical($num_updated, 2, t('Updated 2 records.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '2', t('Updated fields successfully.')); } @@ -668,11 +668,11 @@ class DatabaseUpdateTestCase extends Dat * Confirm that we can stack condition and where calls. */ function testWhereAndConditionUpdate() { - $update = db_update('test')->fields(array('job' => 'Musician'))->where('age > :age', array(':age' => 26))->condition('name', 'Ringo'); + $update = db_update('test')->columns(array('job' => 'Musician'))->where('age > :age', array(':age' => 26))->condition('name', 'Ringo'); $num_updated = $update->execute(); $this->assertIdentical($num_updated, 1, t('Updated 1 record.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '1', t('Updated fields successfully.')); } @@ -696,7 +696,7 @@ class DatabaseUpdateComplexTestCase exte */ function testOrConditionUpdate() { $update = db_update('test') - ->fields(array('job' => 'Musician')) + ->columns(array('job' => 'Musician')) ->condition(db_or() ->condition('name', 'John') ->condition('name', 'Paul') @@ -704,7 +704,7 @@ class DatabaseUpdateComplexTestCase exte $num_updated = $update->execute(); $this->assertIdentical($num_updated, 2, t('Updated 2 records.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '2', t('Updated fields successfully.')); } @@ -712,12 +712,12 @@ class DatabaseUpdateComplexTestCase exte * Test WHERE IN clauses. */ function testInConditionUpdate() { - $num_updated = db_update('test')->fields(array('job' => 'Musician')) + $num_updated = db_update('test')->columns(array('job' => 'Musician')) ->condition('name', array('John', 'Paul'), 'IN') ->execute(); $this->assertIdentical($num_updated, 2, t('Updated 2 records.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '2', t('Updated fields successfully.')); } @@ -725,12 +725,12 @@ class DatabaseUpdateComplexTestCase exte * Test WHERE NOT IN clauses. */ function testNotInConditionUpdate() { - $num_updated = db_update('test')->fields(array('job' => 'Musician')) + $num_updated = db_update('test')->columns(array('job' => 'Musician')) ->condition('name', array('John', 'Paul', 'George'), 'NOT IN') ->execute(); $this->assertIdentical($num_updated, 1, t('Updated 1 record.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '1', t('Updated fields successfully.')); } @@ -738,12 +738,12 @@ class DatabaseUpdateComplexTestCase exte * Test BETWEEN conditional clauses. */ function testBetweenConditionUpdate() { - $num_updated = db_update('test')->fields(array('job' => 'Musician')) + $num_updated = db_update('test')->columns(array('job' => 'Musician')) ->condition('age', array(25, 26), 'BETWEEN') ->execute(); $this->assertIdentical($num_updated, 2, t('Updated 2 records.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '2', t('Updated fields successfully.')); } @@ -751,12 +751,12 @@ class DatabaseUpdateComplexTestCase exte * Test LIKE conditionals. */ function testLikeConditionUpdate() { - $num_updated = db_update('test')->fields(array('job' => 'Musician')) + $num_updated = db_update('test')->columns(array('job' => 'Musician')) ->condition('name', '%ge%', 'LIKE') ->execute(); $this->assertIdentical($num_updated, 1, t('Updated 1 record.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '1', t('Updated fields successfully.')); } @@ -764,16 +764,16 @@ class DatabaseUpdateComplexTestCase exte * Test update with expression values. */ function testUpdateExpression() { - $before_age = db_query("SELECT age FROM {test} WHERE name = 'Ringo'")->fetchField(); + $before_age = db_query("SELECT age FROM {test} WHERE name = 'Ringo'")->fetchColumn(); $GLOBALS['larry_test'] = 1; $num_updated = db_update('test') ->condition('name', 'Ringo') - ->fields(array('job' => 'Musician')) + ->columns(array('job' => 'Musician')) ->expression('age', 'age + :age',array(':age' => 4)) ->execute(); $this->assertIdentical($num_updated, 1, t('Updated 1 record.')); - $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchField(); + $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE job = :job", array(':job' => 'Musician'))->fetchColumn(); $this->assertIdentical($num_matches, '1', t('Updated fields successfully.')); $person = db_query("SELECT * FROM {test} WHERE name = :name", array(':name' => 'Ringo'))->fetch(); @@ -787,14 +787,14 @@ class DatabaseUpdateComplexTestCase exte * Test update with only expression values. */ function testUpdateOnlyExpression() { - $before_age = db_query("SELECT age FROM {test} WHERE name = 'Ringo'")->fetchField(); + $before_age = db_query("SELECT age FROM {test} WHERE name = 'Ringo'")->fetchColumn(); $num_updated = db_update('test') ->condition('name', 'Ringo') ->expression('age', 'age + :age',array(':age' => 4)) ->execute(); $this->assertIdentical($num_updated, 1, t('Updated 1 record.')); - $after_age = db_query("SELECT age FROM {test} WHERE name = 'Ringo'")->fetchField(); + $after_age = db_query("SELECT age FROM {test} WHERE name = 'Ringo'")->fetchColumn(); $this->assertEqual($before_age + 4, $after_age, t('Age updated correctly')); } } @@ -818,10 +818,10 @@ class DatabaseUpdateLOBTestCase extends function testUpdateOneBlob() { $data = "This is\000a test."; $this->assertTrue(strlen($data) === 15, t('Test data contains a NULL.')); - $id = db_insert('test_one_blob')->fields(array('blob1' => $data))->execute(); + $id = db_insert('test_one_blob')->columns(array('blob1' => $data))->execute(); $data .= $data; - db_update('test_one_blob')->condition('id', $id)->fields(array('blob1' => $data))->execute(); + db_update('test_one_blob')->condition('id', $id)->columns(array('blob1' => $data))->execute(); $res = db_query('SELECT * FROM {test_one_blob} WHERE id = %d', $id); $r = db_fetch_array($res); @@ -832,13 +832,13 @@ class DatabaseUpdateLOBTestCase extends * Confirm that we can update two blob columns in the same table. */ function testUpdateMultipleBlob() { - $id = db_insert('test_two_blobs')->fields(array( + $id = db_insert('test_two_blobs')->columns(array( 'blob1' => 'This is', 'blob2' => 'a test') ) ->execute(); - db_update('test_two_blobs')->condition('id', $id)->fields(array('blob1' => 'and so', 'blob2' => 'is this'))->execute(); + db_update('test_two_blobs')->condition('id', $id)->columns(array('blob1' => 'and so', 'blob2' => 'is this'))->execute(); $res = db_query('SELECT * FROM {test_two_blobs} WHERE id = %d', $id); $r = db_fetch_array($res); @@ -871,12 +871,12 @@ class DatabaseDeleteTruncateTestCase ext * Confirm that we can delete a single record successfully. */ function testSimpleDelete() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $num_deleted = db_delete('test')->condition('id', 1)->execute(); $this->assertIdentical($num_deleted, 1, t('Deleted 1 record.')); - $num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $this->assertEqual($num_records_before, $num_records_after + $num_deleted, t('Deletion adds up.')); } @@ -885,11 +885,11 @@ class DatabaseDeleteTruncateTestCase ext * Confirm that we can truncate a whole table successfully. */ function testTruncate() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); db_truncate('test')->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $this->assertEqual(0, $num_records_after, t('Truncate really deletes everything.')); } } @@ -911,17 +911,17 @@ class DatabaseMergeTestCase extends Data * Confirm that we can merge-insert a record successfully. */ function testMergeInsert() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); db_merge('test_people') ->key(array('job' => 'Presenter')) - ->fields(array( + ->columns(array( 'age' => 31, 'name' => 'Tiffany', )) ->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); $this->assertEqual($num_records_before + 1, $num_records_after, t('Merge inserted properly.')); $person = db_query("SELECT * FROM {test_people} WHERE job = :job", array(':job' => 'Presenter'))->fetch(); @@ -934,11 +934,11 @@ class DatabaseMergeTestCase extends Data * Confirm that we can merge-update a record successfully. */ function testMergeUpdate() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); - db_merge('test_people')->key(array('job' => 'Speaker'))->fields(array('age' => 31, 'name' => 'Tiffany'))->execute(); + db_merge('test_people')->key(array('job' => 'Speaker'))->columns(array('age' => 31, 'name' => 'Tiffany'))->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.')); $person = db_query("SELECT * FROM {test_people} WHERE job = :job", array(':job' => 'Speaker'))->fetch(); @@ -951,11 +951,11 @@ class DatabaseMergeTestCase extends Data * Confirm that we can merge-update a record successfully, with exclusion. */ function testMergeUpdateExcept() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); - db_merge('test_people')->key(array('job' => 'Speaker'))->fields(array('age' => 31, 'name' => 'Tiffany'))->updateExcept('age')->execute(); + db_merge('test_people')->key(array('job' => 'Speaker'))->columns(array('age' => 31, 'name' => 'Tiffany'))->updateExcept('age')->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.')); $person = db_query("SELECT * FROM {test_people} WHERE job = :job", array(':job' => 'Speaker'))->fetch(); @@ -968,11 +968,11 @@ class DatabaseMergeTestCase extends Data * Confirm that we can merge-update a record successfully, with alternate replacement. */ function testMergeUpdateExplicit() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); - db_merge('test_people')->key(array('job' => 'Speaker'))->fields(array('age' => 31, 'name' => 'Tiffany'))->update(array('name' => 'Joe'))->execute(); + db_merge('test_people')->key(array('job' => 'Speaker'))->columns(array('age' => 31, 'name' => 'Tiffany'))->update(array('name' => 'Joe'))->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.')); $person = db_query("SELECT * FROM {test_people} WHERE job = :job", array(':job' => 'Speaker'))->fetch(); @@ -985,9 +985,9 @@ class DatabaseMergeTestCase extends Data * Confirm that we can merge-update a record successfully, with expressions. */ function testMergeUpdateExpression() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); - $age_before = db_query("SELECT age FROM {test_people} WHERE job = 'Speaker'")->fetchField(); + $age_before = db_query("SELECT age FROM {test_people} WHERE job = 'Speaker'")->fetchColumn(); // This is a very contrived example, as I have no idea why you'd want to // change age this way, but that's beside the point. @@ -996,11 +996,11 @@ class DatabaseMergeTestCase extends Data // which is what is supposed to happen. db_merge('test_people') ->key(array('job' => 'Speaker')) - ->fields(array('age' => 31, 'name' => 'Tiffany')) + ->columns(array('age' => 31, 'name' => 'Tiffany')) ->expression('age', 'age + :age', array(':age' => 4)) ->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.')); $person = db_query("SELECT * FROM {test_people} WHERE job = :job", array(':job' => 'Speaker'))->fetch(); @@ -1013,13 +1013,13 @@ class DatabaseMergeTestCase extends Data * Test that we can merge-insert without any update fields. */ function testMergeInsertWithoutUpdate() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); db_merge('test_people') ->key(array('job' => 'Presenter')) ->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); $this->assertEqual($num_records_before + 1, $num_records_after, t('Merge inserted properly.')); $person = db_query("SELECT * FROM {test_people} WHERE job = :job", array(':job' => 'Presenter'))->fetch(); @@ -1032,13 +1032,13 @@ class DatabaseMergeTestCase extends Data * Confirm that we can merge-update without any update fields. */ function testMergeUpdateWithoutUpdate() { - $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_before = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); db_merge('test_people') ->key(array('job' => 'Speaker')) ->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); $this->assertEqual($num_records_before, $num_records_after, t('Merge skipped properly.')); $person = db_query("SELECT * FROM {test_people} WHERE job = :job", array(':job' => 'Speaker'))->fetch(); @@ -1048,11 +1048,11 @@ class DatabaseMergeTestCase extends Data db_merge('test_people') ->key(array('job' => 'Speaker')) - ->fields(array('age' => 31)) + ->columns(array('age' => 31)) ->updateExcept(array('age')) ->execute(); - $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchField(); + $num_records_after = db_query("SELECT COUNT(*) FROM {test_people}")->fetchColumn(); $this->assertEqual($num_records_before, $num_records_after, t('Merge skipped properly.')); $person = db_query("SELECT * FROM {test_people} WHERE job = :job", array(':job' => 'Speaker'))->fetch(); @@ -1068,7 +1068,7 @@ class DatabaseMergeTestCase extends Data try { // This query should die because there is no key field specified. db_merge('test_people') - ->fields(array( + ->columns(array( 'age' => 31, 'name' => 'Tiffany', )) @@ -1100,8 +1100,8 @@ class DatabaseSelectTestCase extends Dat */ function testSimpleSelect() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); - $age_field = $query->addField('test', 'age', 'age'); + $name_field = $query->addColumn('test', 'name'); + $age_field = $query->addColumn('test', 'age', 'age'); $result = $query->execute(); $num_records = 0; @@ -1117,8 +1117,8 @@ class DatabaseSelectTestCase extends Dat */ function testSimpleSelectConditional() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); - $age_field = $query->addField('test', 'age', 'age'); + $name_field = $query->addColumn('test', 'name'); + $age_field = $query->addColumn('test', 'age', 'age'); $query->condition('age', 27); $result = $query->execute(); @@ -1137,7 +1137,7 @@ class DatabaseSelectTestCase extends Dat */ function testSimpleSelectExpression() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); + $name_field = $query->addColumn('test', 'name'); $age_field = $query->addExpression("age*2", 'double_age'); $query->condition('age', 27); $result = $query->execute(); @@ -1157,7 +1157,7 @@ class DatabaseSelectTestCase extends Dat */ function testSimpleSelectExpressionMultiple() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); + $name_field = $query->addColumn('test', 'name'); $age_double_field = $query->addExpression("age*2"); $age_triple_field = $query->addExpression("age*3"); $query->condition('age', 27); @@ -1179,7 +1179,7 @@ class DatabaseSelectTestCase extends Dat */ function testSimpleSelectMultipleFields() { $record = db_select('test') - ->fields('test', array('id', 'name', 'age', 'job')) + ->columns('test', array('id', 'name', 'age', 'job')) ->condition('age', 27) ->execute()->fetchObject(); @@ -1202,7 +1202,7 @@ class DatabaseSelectTestCase extends Dat */ function testSimpleSelectAllFields() { $record = db_select('test') - ->fields('test') + ->columns('test') ->condition('age', 27) ->execute()->fetchObject(); @@ -1227,7 +1227,7 @@ class DatabaseSelectTestCase extends Dat $this->ensureSampleDataNull(); $names = db_select('test_null', 'tn') - ->fields('tn', array('name')) + ->columns('tn', array('name')) ->isNull('age') ->execute()->fetchCol(); @@ -1242,7 +1242,7 @@ class DatabaseSelectTestCase extends Dat $this->ensureSampleDataNull(); $names = db_select('test_null', 'tn') - ->fields('tn', array('name')) + ->columns('tn', array('name')) ->isNotNull('tn.age') ->orderBy('name') ->execute()->fetchCol(); @@ -1272,15 +1272,15 @@ class DatabaseSelectSubqueryTestCase ext function testFromSubquerySelect() { // Create a subquery, which is just a normal query object. $subquery = db_select('test_task', 'tt'); - $subquery->addField('tt', 'pid', 'pid'); - $subquery->addField('tt', 'task', 'task'); + $subquery->addColumn('tt', 'pid', 'pid'); + $subquery->addColumn('tt', 'task', 'task'); $subquery->condition('priority', 1); // Create another query that joins against the virtual table resulting // from the subquery. $select = db_select($subquery, 'tt2'); $select->join('test', 't', 't.id=tt2.pid'); - $select->addField('t', 'name'); + $select->addColumn('t', 'name'); $select->condition('task', 'code'); @@ -1300,14 +1300,14 @@ class DatabaseSelectSubqueryTestCase ext function testJoinSubquerySelect() { // Create a subquery, which is just a normal query object. $subquery = db_select('test_task', 'tt'); - $subquery->addField('tt', 'pid', 'pid'); + $subquery->addColumn('tt', 'pid', 'pid'); $subquery->condition('priority', 1); // Create another query that joins against the virtual table resulting // from the subquery. $select = db_select('test', 't'); $select->join($subquery, 'tt', 't.id=tt.pid'); - $select->addField('t', 'name'); + $select->addColumn('t', 'name'); // The resulting query should be equivalent to: // SELECT t.name @@ -1337,8 +1337,8 @@ class DatabaseSelectOrderedTestCase exte */ function testSimpleSelectOrdered() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); - $age_field = $query->addField('test', 'age', 'age'); + $name_field = $query->addColumn('test', 'name'); + $age_field = $query->addColumn('test', 'age', 'age'); $query->orderBy($age_field); $result = $query->execute(); @@ -1358,9 +1358,9 @@ class DatabaseSelectOrderedTestCase exte */ function testSimpleSelectMultiOrdered() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); - $age_field = $query->addField('test', 'age', 'age'); - $job_field = $query->addField('test', 'job'); + $name_field = $query->addColumn('test', 'name'); + $age_field = $query->addColumn('test', 'age', 'age'); + $job_field = $query->addColumn('test', 'job'); $query->orderBy($job_field); $query->orderBy($age_field); $result = $query->execute(); @@ -1389,8 +1389,8 @@ class DatabaseSelectOrderedTestCase exte */ function testSimpleSelectOrderedDesc() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); - $age_field = $query->addField('test', 'age', 'age'); + $name_field = $query->addColumn('test', 'name'); + $age_field = $query->addColumn('test', 'age', 'age'); $query->orderBy($age_field, 'DESC'); $result = $query->execute(); @@ -1425,9 +1425,9 @@ class DatabaseSelectComplexTestCase exte function testDefaultJoin() { $query = db_select('test_task', 't'); $people_alias = $query->join('test', 'p', 't.pid = p.id'); - $name_field = $query->addField($people_alias, 'name', 'name'); - $task_field = $query->addField('t', 'task', 'task'); - $priority_field = $query->addField('t', 'priority', 'priority'); + $name_field = $query->addColumn($people_alias, 'name', 'name'); + $task_field = $query->addColumn('t', 'task', 'task'); + $priority_field = $query->addColumn('t', 'priority', 'priority'); $query->orderBy($priority_field); $result = $query->execute(); @@ -1450,9 +1450,9 @@ class DatabaseSelectComplexTestCase exte function testLeftOuterJoin() { $query = db_select('test', 'p'); $people_alias = $query->leftJoin('test_task', 't', 't.pid = p.id'); - $name_field = $query->addField('p', 'name', 'name'); - $task_field = $query->addField($people_alias, 'task', 'task'); - $priority_field = $query->addField($people_alias, 'priority', 'priority'); + $name_field = $query->addColumn('p', 'name', 'name'); + $task_field = $query->addColumn($people_alias, 'task', 'task'); + $priority_field = $query->addColumn($people_alias, 'priority', 'priority'); $query->orderBy($name_field); $result = $query->execute(); @@ -1475,7 +1475,7 @@ class DatabaseSelectComplexTestCase exte function testGroupBy() { $query = db_select('test_task', 't'); $count_field = $query->addExpression('COUNT(task)', 'num'); - $task_field = $query->addField('t', 'task'); + $task_field = $query->addColumn('t', 'task'); $query->orderBy($count_field); $query->groupBy($task_field); $result = $query->execute(); @@ -1511,7 +1511,7 @@ class DatabaseSelectComplexTestCase exte function testGroupByAndHaving() { $query = db_select('test_task', 't'); $count_field = $query->addExpression('COUNT(task)', 'num'); - $task_field = $query->addField('t', 'task'); + $task_field = $query->addColumn('t', 'task'); $query->orderBy($count_field); $query->groupBy($task_field); $query->havingCondition('COUNT(task)', 2, '>='); @@ -1544,8 +1544,8 @@ class DatabaseSelectComplexTestCase exte */ function testRange() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); - $age_field = $query->addField('test', 'age', 'age'); + $name_field = $query->addColumn('test', 'name'); + $age_field = $query->addColumn('test', 'age', 'age'); $query->range(0, 2); $result = $query->execute(); @@ -1562,7 +1562,7 @@ class DatabaseSelectComplexTestCase exte */ function testDistinct() { $query = db_select('test_task'); - $task_field = $query->addField('test_task', 'task'); + $task_field = $query->addColumn('test_task', 'task'); $query->distinct(); $result = $query->execute(); @@ -1579,11 +1579,11 @@ class DatabaseSelectComplexTestCase exte */ function testCountQuery() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); - $age_field = $query->addField('test', 'age', 'age'); + $name_field = $query->addColumn('test', 'name'); + $age_field = $query->addColumn('test', 'age', 'age'); $query->orderBy('name'); - $count = $query->countQuery()->execute()->fetchField(); + $count = $query->countQuery()->execute()->fetchColumn(); $this->assertEqual($count, 4, t('Counted the correct number of records.')); @@ -1603,11 +1603,11 @@ class DatabaseSelectComplexTestCase exte // That should find only one record. Yes it's a non-optimal way of writing // that query but that's not the point! $query = db_select('test'); - $query->addField('test', 'job'); + $query->addColumn('test', 'job'); $query->condition('name', 'Paul'); $query->condition(db_or()->condition('age', 26)->condition('age', 27)); - $job = $query->execute()->fetchField(); + $job = $query->execute()->fetchColumn(); $this->assertEqual($job, 'Songwriter', t('Correct data retrieved.')); } } @@ -1634,7 +1634,7 @@ class DatabaseSelectPagerDefaultTestCase // information forward to the actual query on the other side of the // HTTP request. $limit = 2; - $count = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); + $count = db_query("SELECT COUNT(*) FROM {test}")->fetchColumn(); $correct_number = $limit; $num_pages = floor($count / $limit); @@ -1668,7 +1668,7 @@ class DatabaseSelectPagerDefaultTestCase // information forward to the actual query on the other side of the // HTTP request. $limit = 2; - $count = db_query("SELECT COUNT(*) FROM {test_task}")->fetchField(); + $count = db_query("SELECT COUNT(*) FROM {test_task}")->fetchColumn(); $correct_number = $limit; $num_pages = floor($count / $limit); @@ -1752,8 +1752,8 @@ class DatabaseTaggingTestCase extends Da */ function testHasTag() { $query = db_select('test'); - $query->addField('test', 'name'); - $query->addField('test', 'age', 'age'); + $query->addColumn('test', 'name'); + $query->addColumn('test', 'age', 'age'); $query->addTag('test'); @@ -1766,8 +1766,8 @@ class DatabaseTaggingTestCase extends Da */ function testHasAllTags() { $query = db_select('test'); - $query->addField('test', 'name'); - $query->addField('test', 'age', 'age'); + $query->addColumn('test', 'name'); + $query->addColumn('test', 'age', 'age'); $query->addTag('test'); $query->addTag('other'); @@ -1781,8 +1781,8 @@ class DatabaseTaggingTestCase extends Da */ function testHasAnyTag() { $query = db_select('test'); - $query->addField('test', 'name'); - $query->addField('test', 'age', 'age'); + $query->addColumn('test', 'name'); + $query->addColumn('test', 'age', 'age'); $query->addTag('test'); @@ -1797,8 +1797,8 @@ class DatabaseTaggingTestCase extends Da */ function testMetaData() { $query = db_select('test'); - $query->addField('test', 'name'); - $query->addField('test', 'age', 'age'); + $query->addColumn('test', 'name'); + $query->addColumn('test', 'age', 'age'); $data = array( 'a' => 'A', @@ -1835,8 +1835,8 @@ class DatabaseAlterTestCase extends Data */ function testSimpleAlter() { $query = db_select('test'); - $query->addField('test', 'name'); - $query->addField('test', 'age', 'age'); + $query->addColumn('test', 'name'); + $query->addColumn('test', 'age', 'age'); $query->addTag('database_test_alter_add_range'); $result = $query->execute(); @@ -1854,8 +1854,8 @@ class DatabaseAlterTestCase extends Data */ function testAlterWithJoin() { $query = db_select('test_task'); - $tid_field = $query->addField('test_task', 'tid'); - $task_field = $query->addField('test_task', 'task'); + $tid_field = $query->addColumn('test_task', 'tid'); + $task_field = $query->addColumn('test_task', 'task'); $query->orderBy($task_field); $query->addTag('database_test_alter_add_join'); @@ -1878,11 +1878,11 @@ class DatabaseAlterTestCase extends Data */ function testAlterChangeConditional() { $query = db_select('test_task'); - $tid_field = $query->addField('test_task', 'tid'); - $pid_field = $query->addField('test_task', 'pid'); - $task_field = $query->addField('test_task', 'task'); + $tid_field = $query->addColumn('test_task', 'tid'); + $pid_field = $query->addColumn('test_task', 'pid'); + $task_field = $query->addColumn('test_task', 'task'); $people_alias = $query->join('test', 'people', "test_task.pid = people.id"); - $name_field = $query->addField($people_alias, 'name', 'name'); + $name_field = $query->addColumn($people_alias, 'name', 'name'); $query->condition('test_task.tid', '1'); $query->orderBy($tid_field); $query->addTag('database_test_alter_change_conditional'); @@ -1919,8 +1919,8 @@ class DatabaseAlter2TestCase extends Dat */ function testAlterChangeFields() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); - $age_field = $query->addField('test', 'age', 'age'); + $name_field = $query->addColumn('test', 'name'); + $age_field = $query->addColumn('test', 'age', 'age'); $query->orderBy('name'); $query->addTag('database_test_alter_change_fields'); @@ -1934,7 +1934,7 @@ class DatabaseAlter2TestCase extends Dat */ function testAlterExpression() { $query = db_select('test'); - $name_field = $query->addField('test', 'name'); + $name_field = $query->addColumn('test', 'name'); $age_field = $query->addExpression("age*2", 'double_age'); $query->condition('age', 27); $query->addTag('database_test_alter_change_expressions'); @@ -1952,8 +1952,8 @@ class DatabaseAlter2TestCase extends Dat */ function testAlterRemoveRange() { $query = db_select('test'); - $query->addField('test', 'name'); - $query->addField('test', 'age', 'age'); + $query->addColumn('test', 'name'); + $query->addColumn('test', 'age', 'age'); $query->range(0, 2); $query->addTag('database_test_alter_remove_range'); @@ -1986,13 +1986,13 @@ class DatabaseRegressionTestCase extends // That's a 255 character UTF-8 string. $name = str_repeat("é", 255); db_insert('test') - ->fields(array( + ->columns(array( 'name' => $name, 'age' => 20, 'job' => 'Dancer', ))->execute(); - $from_database = db_query("SELECT name FROM {test} WHERE name = :name", array(':name' => $name))->fetchField(); + $from_database = db_query("SELECT name FROM {test} WHERE name = :name", array(':name' => $name))->fetchColumn(); $this->assertIdentical($name, $from_database, t("The database handles UTF-8 characters cleanly.")); } @@ -2190,7 +2190,7 @@ class DatabaseTemporaryQueryTestCase ext * Return the number of rows of a table. */ function countTableRows($table_name) { - return db_select($table_name)->countQuery()->execute()->fetchField(); + return db_select($table_name)->countQuery()->execute()->fetchColumn(); } /** @@ -2241,7 +2241,7 @@ class DatabaseAnsiSyntaxTestCase extends */ function testBasicConcat() { $result = db_query("SELECT 'This' || ' ' || 'is' || ' a ' || 'test.'"); - $this->assertIdentical($result->fetchField(), 'This is a test.', t('Basic ANSI Concat works.')); + $this->assertIdentical($result->fetchColumn(), 'This is a test.', t('Basic ANSI Concat works.')); } /** @@ -2249,7 +2249,7 @@ class DatabaseAnsiSyntaxTestCase extends */ function testFieldConcat() { $result = db_query("SELECT 'The age of ' || name || ' is ' || age || '.' FROM {test} WHERE age = :age", array(':age' => 25)); - $this->assertIdentical($result->fetchField(), 'The age of John is 25.', t('Field ANSI Concat works.')); + $this->assertIdentical($result->fetchColumn(), 'The age of John is 25.', t('Field ANSI Concat works.')); } /** @@ -2257,7 +2257,7 @@ class DatabaseAnsiSyntaxTestCase extends */ function testQuotes() { $result = db_query('SELECT "name" FROM {test} WHERE age = :age', array(':age' => 25)); - $this->assertIdentical($result->fetchField(), 'John', t('ANSI field quoting works.')); + $this->assertIdentical($result->fetchColumn(), 'John', t('ANSI field quoting works.')); } } @@ -2284,7 +2284,7 @@ class DatabaseInvalidDataTestCase extend // Try to insert multiple records where at least one has bad data. try { db_insert('test') - ->fields(array('name', 'age', 'job')) + ->columns(array('name', 'age', 'job')) ->values(array( 'name' => 'Elvis', 'age' => 63, @@ -2304,7 +2304,7 @@ class DatabaseInvalidDataTestCase extend } catch (Exception $e) { // Check if the first record was inserted. - $name = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 63))->fetchField(); + $name = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 63))->fetchColumn(); if ($name == 'Elvis') { if (!Database::getConnection()->supportsTransactions()) { @@ -2324,7 +2324,7 @@ class DatabaseInvalidDataTestCase extend // Ensure the other values were not inserted. $record = db_select('test') - ->fields('test', array('name', 'age')) + ->columns('test', array('name', 'age')) ->condition('age', array(17, 75),'IN') ->execute()->fetchObject(); @@ -2415,7 +2415,7 @@ class DatabaseTransactionTestCase extend // Insert a single row into the testing table. db_insert('test') - ->fields(array( + ->columns(array( 'name' => 'David' . $suffix, 'age' => '24', )) @@ -2450,7 +2450,7 @@ class DatabaseTransactionTestCase extend // Insert a single row into the testing table. db_insert('test') - ->fields(array( + ->columns(array( 'name' => 'Daniel' . $suffix, 'age' => '19', )) @@ -2525,9 +2525,9 @@ class DatabaseTransactionTestCase extend // Neither of the rows we inserted in the two transaction layers // should be present in the tables post-rollback. - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DavidB'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DavidB'))->fetchColumn(); $this->assertNotIdentical($saved_age, '24', t('Cannot retrieve DavidB row after commit.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielB'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielB'))->fetchColumn(); $this->assertNotIdentical($saved_age, '19', t('Cannot retrieve DanielB row after commit.')); } catch(Exception $e) { @@ -2551,9 +2551,9 @@ class DatabaseTransactionTestCase extend // Because our current database claims to not support transactions, // the inserted rows should be present despite the attempt to roll back. - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DavidB'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DavidB'))->fetchColumn(); $this->assertIdentical($saved_age, '24', t('DavidB not rolled back, since transactions are not supported.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielB'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielB'))->fetchColumn(); $this->assertIdentical($saved_age, '19', t('DanielB not rolled back, since transactions are not supported.')); } catch(Exception $e) { @@ -2573,9 +2573,9 @@ class DatabaseTransactionTestCase extend $this->transactionOuterLayer('A'); // Because we committed, both of the inserted rows should be present. - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DavidA'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DavidA'))->fetchColumn(); $this->assertIdentical($saved_age, '24', t('Can retrieve DavidA row after commit.')); - $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielA'))->fetchField(); + $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielA'))->fetchColumn(); $this->assertIdentical($saved_age, '19', t('Can retrieve DanielA row after commit.')); } catch(Exception $e) { Index: modules/simpletest/tests/field_test.install =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/field_test.install,v retrieving revision 1.3 diff -u -F^[fc] -r1.3 field_test.install --- modules/simpletest/tests/field_test.install 13 May 2009 19:42:17 -0000 1.3 +++ modules/simpletest/tests/field_test.install 17 May 2009 15:43:29 -0000 @@ -12,7 +12,7 @@ function field_test_schema() { $schema['test_entity'] = array( 'description' => 'The base table for test_entities.', - 'fields' => array( + 'columns' => array( 'ftid' => array( 'description' => 'The primary identifier for a test_entity.', 'type' => 'serial', @@ -41,7 +41,7 @@ function field_test_schema() { ); $schema['test_entity_revision'] = array( 'description' => 'Stores information about each saved version of a {test_entity}.', - 'fields' => array( + 'columns' => array( 'ftid' => array( 'description' => 'The {test_entity} this version belongs to.', 'type' => 'int', Index: modules/simpletest/tests/field_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/field_test.module,v retrieving revision 1.7 diff -u -F^[fc] -r1.7 field_test.module --- modules/simpletest/tests/field_test.module 17 May 2009 00:49:18 -0000 1.7 +++ modules/simpletest/tests/field_test.module 17 May 2009 15:43:29 -0000 @@ -167,7 +167,7 @@ function field_test_create_stub_entity($ function field_test_entity_load($ftid, $ftvid = NULL) { // Load basic strucure. $query = db_select('test_entity', 'fte', array()) - ->fields('fte') + ->columns('fte') ->condition('ftid', $ftid); if ($ftvid) { $query->condition('ftvid', $ftvid); @@ -216,7 +216,7 @@ function field_test_entity_save(&$entity } if ($update_entity) { db_update('test_entity') - ->fields(array('ftvid' => $entity->ftvid)) + ->columns(array('ftvid' => $entity->ftvid)) ->condition('ftid', $entity->ftid) ->execute(); } Index: modules/simpletest/tests/file.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/file.test,v retrieving revision 1.29 diff -u -F^[fc] -r1.29 file.test --- modules/simpletest/tests/file.test 22 Apr 2009 09:45:03 -0000 1.29 +++ modules/simpletest/tests/file.test 17 May 2009 15:43:29 -0000 @@ -547,7 +547,7 @@ class FileSaveUploadTest extends FileHoo $this->image = current($this->drupalGetTestFiles('image')); $this->assertTrue(is_file($this->image->filepath), t("The file we're going to upload exists.")); - $this->maxFidBefore = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchField(); + $this->maxFidBefore = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchColumn(); // Upload with replace to gurantee there's something there. $edit = array( @@ -577,13 +577,13 @@ class FileSaveUploadTest extends FileHoo file_test_reset(); // Upload a second file. - $max_fid_before = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchField(); + $max_fid_before = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchColumn(); $image2 = current($this->drupalGetTestFiles('image')); $edit = array('files[file_test_upload]' => realpath($image2->filepath)); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); $this->assertRaw(t('You WIN!')); - $max_fid_after = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchField(); + $max_fid_after = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchColumn(); // Check that the correct hooks were called. $this->assertFileHooksCalled(array('validate', 'insert')); Index: modules/simpletest/tests/menu.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu.test,v retrieving revision 1.10 diff -u -F^[fc] -r1.10 menu.test --- modules/simpletest/tests/menu.test 17 May 2009 07:49:13 -0000 1.10 +++ modules/simpletest/tests/menu.test 17 May 2009 15:43:29 -0000 @@ -43,7 +43,7 @@ class MenuIncTestCase extends DrupalWebT // Move second link to the main-menu, to test caching later on. db_update('menu_links') - ->fields(array('menu_name' => 'main-menu')) + ->columns(array('menu_name' => 'main-menu')) ->condition('link_title', 'Menu link #1-1') ->condition('customized', 0) ->condition('module', 'menu_test') Index: modules/simpletest/tests/schema.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/schema.test,v retrieving revision 1.5 diff -u -F^[fc] -r1.5 schema.test --- modules/simpletest/tests/schema.test 31 Mar 2009 01:49:53 -0000 1.5 +++ modules/simpletest/tests/schema.test 17 May 2009 15:43:29 -0000 @@ -25,7 +25,7 @@ class SchemaTestCase extends DrupalWebTe // Try creating a table. $table_specification = array( 'description' => 'Schema table description.', - 'fields' => array( + 'columns' => array( 'id' => array( 'type' => 'int', 'default' => NULL, @@ -47,30 +47,30 @@ class SchemaTestCase extends DrupalWebTe $this->checkSchemaComment($table_specification['description'], 'test_table'); // Assert that the column comment has been set. - $this->checkSchemaComment($table_specification['fields']['test_field']['description'], 'test_table', 'test_field'); + $this->checkSchemaComment($table_specification['columns']['test_field']['description'], 'test_table', 'test_field'); // An insert without a value for the column 'test_table' should fail. $this->assertFalse($this->tryInsert(), t('Insert without a default failed.')); // Add a default value to the column. - db_field_set_default($ret, 'test_table', 'test_field', 0); + db_column_set_default($ret, 'test_table', 'test_field', 0); // The insert should now succeed. $this->assertTrue($this->tryInsert(), t('Insert with a default succeeded.')); // Remove the default. - db_field_set_no_default($ret, 'test_table', 'test_field'); + db_column_set_no_default($ret, 'test_table', 'test_field'); // The insert should fail again. $this->assertFalse($this->tryInsert(), t('Insert without a default failed.')); // Rename the table. db_rename_table($ret, 'test_table', 'test_table2'); // We need the default so that we can insert after the rename. - db_field_set_default($ret, 'test_table2', 'test_field', 0); + db_column_set_default($ret, 'test_table2', 'test_field', 0); $this->assertFalse($this->tryInsert(), t('Insert into the old table failed.')); $this->assertTrue($this->tryInsert('test_table2'), t('Insert into the new table succeeded.')); // We should have successfully inserted exactly two rows. - $count = db_query('SELECT COUNT(*) FROM {test_table2}')->fetchField(); + $count = db_query('SELECT COUNT(*) FROM {test_table2}')->fetchColumn(); $this->assertEqual($count, 2, t('Two fields were successfully inserted.')); // Try to drop the table. @@ -79,25 +79,25 @@ class SchemaTestCase extends DrupalWebTe // Recreate the table. db_create_table($ret, 'test_table', $table_specification); - db_field_set_default($ret, 'test_table', 'test_field', 0); - db_add_field($ret, 'test_table', 'test_serial', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => 'Added column description.')); + db_column_set_default($ret, 'test_table', 'test_field', 0); + db_add_column($ret, 'test_table', 'test_serial', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => 'Added column description.')); // Assert that the column comment has been set. $this->checkSchemaComment('Added column description.', 'test_table', 'test_serial'); // Change the new field to a serial column. - db_change_field($ret, 'test_table', 'test_serial', 'test_serial', array('type' => 'serial', 'not null' => TRUE, 'description' => 'Changed column description.'), array('primary key' => array('test_serial'))); + db_change_column($ret, 'test_table', 'test_serial', 'test_serial', array('type' => 'serial', 'not null' => TRUE, 'description' => 'Changed column description.'), array('primary key' => array('test_serial'))); // Assert that the column comment has been set. $this->checkSchemaComment('Changed column description.', 'test_table', 'test_serial'); $this->assertTrue($this->tryInsert(), t('Insert with a serial succeeded.')); - $max1 = db_query('SELECT MAX(test_serial) FROM {test_table}')->fetchField(); + $max1 = db_query('SELECT MAX(test_serial) FROM {test_table}')->fetchColumn(); $this->assertTrue($this->tryInsert(), t('Insert with a serial succeeded.')); - $max2 = db_query('SELECT MAX(test_serial) FROM {test_table}')->fetchField(); + $max2 = db_query('SELECT MAX(test_serial) FROM {test_table}')->fetchColumn(); $this->assertTrue($max2 > $max1, t('The serial is monotone.')); - $count = db_query('SELECT COUNT(*) FROM {test_table}')->fetchField(); + $count = db_query('SELECT COUNT(*) FROM {test_table}')->fetchColumn(); $this->assertEqual($count, 2, t('There were two rows.')); } Index: modules/simpletest/tests/session.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/session.test,v retrieving revision 1.13 diff -u -F^[fc] -r1.13 session.test --- modules/simpletest/tests/session.test 22 Apr 2009 09:45:03 -0000 1.13 +++ modules/simpletest/tests/session.test 17 May 2009 15:43:29 -0000 @@ -225,7 +225,7 @@ class SessionTestCase extends DrupalWebT ->condition('message', '$_SESSION is non-empty yet no code has called drupal_session_start().') ->countQuery() ->execute() - ->fetchField(); + ->fetchColumn(); } /** Index: modules/simpletest/tests/taxonomy_test.install =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/taxonomy_test.install,v retrieving revision 1.6 diff -u -F^[fc] -r1.6 taxonomy_test.install --- modules/simpletest/tests/taxonomy_test.install 13 May 2009 19:42:17 -0000 1.6 +++ modules/simpletest/tests/taxonomy_test.install 17 May 2009 15:43:29 -0000 @@ -12,7 +12,7 @@ function taxonomy_test_schema() { $schema['term_antonym'] = array( 'description' => 'Stores term antonyms.', - 'fields' => array( + 'columns' => array( 'taid' => array( 'type' => 'serial', 'not null' => TRUE, Index: modules/simpletest/tests/taxonomy_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/taxonomy_test.module,v retrieving revision 1.3 diff -u -F^[fc] -r1.3 taxonomy_test.module --- modules/simpletest/tests/taxonomy_test.module 5 Dec 2008 22:18:45 -0000 1.3 +++ modules/simpletest/tests/taxonomy_test.module 17 May 2009 15:43:29 -0000 @@ -22,7 +22,7 @@ function taxonomy_test_taxonomy_term_ins if (!empty($term->antonyms)) { foreach (explode ("\n", str_replace("\r", '', $term->antonyms)) as $antonym) { if ($antonym) { - db_insert('term_antonym')->fields(array('tid' => $term->tid, 'name' => rtrim($antonym)))->execute(); + db_insert('term_antonym')->columns(array('tid' => $term->tid, 'name' => rtrim($antonym)))->execute(); } } } @@ -36,7 +36,7 @@ function taxonomy_test_taxonomy_term_upd if (!empty($term->antonyms)) { foreach (explode ("\n", str_replace("\r", '', $term->antonyms)) as $antonym) { if ($antonym) { - db_insert('term_antonym')->fields(array('tid' => $term->tid, 'name' => rtrim($antonym)))->execute(); + db_insert('term_antonym')->columns(array('tid' => $term->tid, 'name' => rtrim($antonym)))->execute(); } } } Index: modules/statistics/statistics.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v retrieving revision 1.23 diff -u -F^[fc] -r1.23 statistics.admin.inc --- modules/statistics/statistics.admin.inc 27 Apr 2009 18:58:41 -0000 1.23 +++ modules/statistics/statistics.admin.inc 17 May 2009 15:43:29 -0000 @@ -20,8 +20,8 @@ function statistics_recent_hits() { $query = db_select('accesslog', 'a')->extend('PagerDefault')->extend('TableSort'); $query->join('users', 'u', 'a.uid = u.uid'); $query - ->fields('a', array('aid', 'timestamp', 'path', 'title', 'uid')) - ->fields('u', array('name')) + ->columns('a', array('aid', 'timestamp', 'path', 'title', 'uid')) + ->columns('u', array('name')) ->limit(30) ->setHeader($header); @@ -63,7 +63,7 @@ function statistics_top_pages() { $query->addExpression('SUM(timer)', 'total_time'); $query - ->fields('accesslog', array('path')) + ->columns('accesslog', array('path')) ->groupBy('path') ->limit(30) ->setHeader($header); @@ -106,9 +106,9 @@ function statistics_top_visitors() { $query->addExpression('COUNT(a.uid)', 'hits'); $query->addExpression('SUM(a.timer)', 'total'); $query - ->fields('a', array('uid', 'hostname')) - ->fields('u', array('name')) - ->fields('bl', array('iid')) + ->columns('a', array('uid', 'hostname')) + ->columns('u', array('name')) + ->columns('bl', array('iid')) ->groupBy('a.hostname') ->groupBy('a.uid') ->groupBy('u.name') @@ -154,7 +154,7 @@ function statistics_top_referrers() { $query->addExpression('COUNT(url)', 'hits'); $query->addExpression('MAX(timestamp)', 'last'); $query - ->fields('a', array('url')) + ->columns('a', array('url')) ->where('LOWER(url) NOT LIKE :host', array(':host' => '%'. $_SERVER['HTTP_HOST'] .'%')) ->condition('url', '', '<>') ->groupBy('url') Index: modules/statistics/statistics.install =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.install,v retrieving revision 1.19 diff -u -F^[fc] -r1.19 statistics.install --- modules/statistics/statistics.install 13 May 2009 19:42:17 -0000 1.19 +++ modules/statistics/statistics.install 17 May 2009 15:43:29 -0000 @@ -37,7 +37,7 @@ function statistics_uninstall() { function statistics_schema() { $schema['accesslog'] = array( 'description' => 'Stores site access information for statistics.', - 'fields' => array( + 'columns' => array( 'aid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -104,7 +104,7 @@ function statistics_schema() { $schema['node_counter'] = array( 'description' => 'Access statistics for {node}s.', - 'fields' => array( + 'columns' => array( 'nid' => array( 'description' => 'The {node}.nid for these statistics.', 'type' => 'int', @@ -151,7 +151,7 @@ function statistics_schema() { */ function statistics_update_7000() { $ret = array(); - db_change_field($ret, 'accesslog', 'url', 'url', array('type' => 'text', 'not null' => FALSE)); + db_change_column($ret, 'accesslog', 'url', 'url', array('type' => 'text', 'not null' => FALSE)); return $ret; } Index: modules/statistics/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v retrieving revision 1.303 diff -u -F^[fc] -r1.303 statistics.module --- modules/statistics/statistics.module 3 May 2009 10:11:35 -0000 1.303 +++ modules/statistics/statistics.module 17 May 2009 15:43:29 -0000 @@ -53,7 +53,7 @@ function statistics_exit() { // A node has been viewed, so update the node's counters. db_merge('node_counter') ->key(array('nid' => arg(1))) - ->fields(array( + ->columns(array( 'daycount' => 1, 'totalcount' => 1, 'timestamp' => REQUEST_TIME, @@ -66,7 +66,7 @@ function statistics_exit() { if (variable_get('statistics_enable_access_log', 0)) { // Log this page access. db_insert('accesslog') - ->fields(array( + ->columns(array( 'title' => strip_tags(drupal_get_title()), 'path' => $_GET['q'], 'url' => $_SERVER['HTTP_REFERER'], @@ -192,7 +192,7 @@ function statistics_user_cancel($edit, $ switch ($method) { case 'user_cancel_reassign': db_update('accesslog') - ->fields(array('uid' => 0)) + ->columns(array('uid' => 0)) ->condition('uid', $account->uid) ->execute(); break; @@ -214,7 +214,7 @@ function statistics_cron() { if ((REQUEST_TIME - $statistics_timestamp) >= 86400) { // Reset day counts. db_update('node_counter') - ->fields(array('daycount' => 0)) + ->columns(array('daycount' => 0)) ->execute(); variable_set('statistics_day_timestamp', REQUEST_TIME); } @@ -249,8 +249,8 @@ function statistics_title_list($dbfield, $query->join('users', 'u', 'n.uid = u.uid'); return $query - ->fields('n', array('nid', 'title')) - ->fields('u', array('uid', 'name')) + ->columns('n', array('nid', 'title')) + ->columns('u', array('uid', 'name')) ->condition($dbfield, 0, '<>') ->condition('n.status', 1) ->orderBy($dbfield, 'DESC') Index: modules/statistics/statistics.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.pages.inc,v retrieving revision 1.12 diff -u -F^[fc] -r1.12 statistics.pages.inc --- modules/statistics/statistics.pages.inc 26 Apr 2009 19:44:39 -0000 1.12 +++ modules/statistics/statistics.pages.inc 17 May 2009 15:43:29 -0000 @@ -19,8 +19,8 @@ function statistics_node_tracker() { $query->join('users', 'u', 'a.uid = u.uid'); $query - ->fields('a', array('aid', 'timestamp', 'url', 'uid')) - ->fields('u', array('name')) + ->columns('a', array('aid', 'timestamp', 'url', 'uid')) + ->columns('u', array('name')) ->condition(db_or() ->condition('a.path', 'node/' . $node->nid) ->condition('a.path', 'node/' . $node->nid . '/%', 'LIKE')) @@ -61,7 +61,7 @@ function statistics_user_tracker() { array('data' => t('Operations'))); $query = db_select('accesslog', 'a')->extend('PagerDefault')->extend('TableSort'); $query - ->fields('a', array('aid', 'timestamp', 'path', 'title')) + ->columns('a', array('aid', 'timestamp', 'path', 'title')) ->condition('uid', $account->uid) ->limit(30) ->setHeader($header); Index: modules/statistics/statistics.test =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.test,v retrieving revision 1.8 diff -u -F^[fc] -r1.8 statistics.test --- modules/statistics/statistics.test 13 Apr 2009 10:40:13 -0000 1.8 +++ modules/statistics/statistics.test 17 May 2009 15:43:29 -0000 @@ -18,7 +18,7 @@ class StatisticsBlockVisitorsTestCase ex // Insert dummy access by anonymous user into access log. db_insert('accesslog') - ->fields(array( + ->columns(array( 'title' => 'test', 'path' => 'node/1', 'url' => 'http://example.com', @@ -54,7 +54,7 @@ class StatisticsBlockVisitorsTestCase ex $edit = array(); $edit['ip'] = $test_ip_address; $this->drupalPost('admin/settings/ip-blocking', $edit, t('Save')); - $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField(); + $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchColumn(); $this->assertNotEqual($ip, FALSE, t('IP address found in database')); $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.')); Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.146 diff -u -F^[fc] -r1.146 system.admin.inc --- modules/system/system.admin.inc 16 May 2009 20:10:50 -0000 1.146 +++ modules/system/system.admin.inc 17 May 2009 15:43:29 -0000 @@ -247,7 +247,7 @@ function system_themes_form_submit($form } } db_update('system') - ->fields(array('status' => 0)) + ->columns(array('status' => 0)) ->condition('type', 'theme') ->execute(); @@ -258,7 +258,7 @@ function system_themes_form_submit($form if ($choice || $form_state['values']['theme_default'] == $key) { $new_theme_list[] = $key; db_update('system') - ->fields(array('status' => 1)) + ->columns(array('status' => 1)) ->condition('type', 'theme') ->condition('name', $key) ->execute(); @@ -284,7 +284,7 @@ function system_themes_form_submit($form variable_del('admin_theme'); variable_del('node_admin_theme'); db_update('system') - ->fields(array('status' => 1)) + ->columns(array('status' => 1)) ->condition('type', 'theme') ->condition('name', 'garland') ->execute(); @@ -1129,7 +1129,7 @@ function system_ip_blocking_form($form_s function system_ip_blocking_form_validate($form, &$form_state) { $ip = trim($form_state['values']['ip']); - if (db_query("SELECT * FROM {blocked_ips} WHERE ip = :ip", array(':ip' => $ip))->fetchField()) { + if (db_query("SELECT * FROM {blocked_ips} WHERE ip = :ip", array(':ip' => $ip))->fetchColumn()) { form_set_error('ip', t('This IP address is already blocked.')); } elseif ($ip == ip_address()) { @@ -1143,7 +1143,7 @@ function system_ip_blocking_form_validat function system_ip_blocking_form_submit($form, &$form_state) { $ip = trim($form_state['values']['ip']); db_insert('blocked_ips') - ->fields(array('ip' => $ip)) + ->columns(array('ip' => $ip)) ->execute(); drupal_set_message(t('The IP address %ip has been blocked.', array('%ip' => $ip))); $form_state['redirect'] = 'admin/settings/ip-blocking'; Index: modules/system/system.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v retrieving revision 1.35 diff -u -F^[fc] -r1.35 system.api.php --- modules/system/system.api.php 16 May 2009 18:34:22 -0000 1.35 +++ modules/system/system.api.php 17 May 2009 15:43:30 -0000 @@ -1202,7 +1202,7 @@ function hook_file_move($file, $source) */ function hook_file_references($file) { // If upload.module is still using a file, do not let other modules delete it. - $file_used = (bool) db_query_range('SELECT 1 FROM {upload} WHERE fid = :fid', array(':fid' => $file->fid), 0, 1)->fetchField(); + $file_used = (bool) db_query_range('SELECT 1 FROM {upload} WHERE fid = :fid', array(':fid' => $file->fid), 0, 1)->fetchColumn(); if ($file_used) { // Return the name of the module and how many references it has to the file. return array('upload' => $count); @@ -1383,7 +1383,7 @@ function hook_schema() { $schema['node'] = array( // example (partial) specification for table "node" 'description' => t('The base table for nodes.'), - 'fields' => array( + 'columns' => array( 'nid' => array( 'description' => t('The primary identifier for a node.'), 'type' => 'serial', @@ -1438,7 +1438,7 @@ function hook_schema() { */ function hook_schema_alter(&$schema) { // Add field to existing schema. - $schema['users']['fields']['timezone_id'] = array( + $schema['users']['columns']['timezone_id'] = array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, @@ -1605,7 +1605,7 @@ function hook_install() { function hook_update_N(&$sandbox = NULL) { // For most updates, the following is sufficient. $ret = array(); - db_add_field($ret, 'mytable1', 'newcol', array('type' => 'int', 'not null' => TRUE, 'description' => 'My new integer column.')); + db_add_column($ret, 'mytable1', 'newcol', array('type' => 'int', 'not null' => TRUE, 'description' => 'My new integer column.')); return $ret; // However, for more complex operations that may take a long time, @@ -1618,10 +1618,10 @@ function hook_update_N(&$sandbox = NULL) $sandbox['progress'] = 0; $sandbox['current_uid'] = 0; // We'll -1 to disregard the uid 0... - $sandbox['max'] = db_query('SELECT COUNT(DISTINCT uid) FROM {users}')->fetchField() - 1; + $sandbox['max'] = db_query('SELECT COUNT(DISTINCT uid) FROM {users}')->fetchColumn() - 1; } db_select('users', 'u') - ->fields('u', array('uid', 'name')) + ->columns('u', array('uid', 'name')) ->condition('uid', $sandbox['current_uid'], '>') ->range(0, 3) ->orderBy('uid', 'ASC') Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.327 diff -u -F^[fc] -r1.327 system.install --- modules/system/system.install 16 May 2009 20:25:20 -0000 1.327 +++ modules/system/system.install 17 May 2009 15:43:30 -0000 @@ -322,14 +322,14 @@ function system_install() { \'SELECT greatest($1, greatest($2, $3));\' LANGUAGE \'sql\'' ); - if (!db_query("SELECT COUNT(*) FROM pg_proc WHERE proname = 'rand'")->fetchField()) { + if (!db_query("SELECT COUNT(*) FROM pg_proc WHERE proname = 'rand'")->fetchColumn()) { db_query('CREATE OR REPLACE FUNCTION "rand"() RETURNS float AS \'SELECT random();\' LANGUAGE \'sql\'' ); } - if (!db_query("SELECT COUNT(*) FROM pg_proc WHERE proname = 'concat'")->fetchField()) { + if (!db_query("SELECT COUNT(*) FROM pg_proc WHERE proname = 'concat'")->fetchColumn()) { db_query('CREATE OR REPLACE FUNCTION "concat"(text, text) RETURNS text AS \'SELECT $1 || $2;\' LANGUAGE \'sql\'' @@ -430,7 +430,7 @@ function system_schema() { // and variable_set() for overcoming some database specific limitations. $schema['variable'] = array( 'description' => 'Named variable/value pairs created by Drupal core or any other module or theme. All variables are cached in memory at the start of every Drupal request so developers should not be careless about what is stored here.', - 'fields' => array( + 'columns' => array( 'name' => array( 'description' => 'The name of the variable.', 'type' => 'varchar', @@ -450,7 +450,7 @@ function system_schema() { $schema['actions'] = array( 'description' => 'Stores action information.', - 'fields' => array( + 'columns' => array( 'aid' => array( 'description' => 'Primary Key: Unique actions ID.', 'type' => 'varchar', @@ -491,7 +491,7 @@ function system_schema() { $schema['actions_aid'] = array( 'description' => 'Stores action IDs for non-default actions.', - 'fields' => array( + 'columns' => array( 'aid' => array( 'description' => 'Primary Key: Unique actions ID.', 'type' => 'serial', @@ -504,7 +504,7 @@ function system_schema() { $schema['batch'] = array( 'description' => 'Stores details about batches (processes that run in multiple HTTP requests).', - 'fields' => array( + 'columns' => array( 'bid' => array( 'description' => 'Primary Key: Unique batch ID.', 'type' => 'serial', @@ -537,7 +537,7 @@ function system_schema() { $schema['blocked_ips'] = array( 'description' => 'Stores blocked IP addresses.', - 'fields' => array( + 'columns' => array( 'iid' => array( 'description' => 'Primary Key: unique ID for IP addresses.', 'type' => 'serial', @@ -560,7 +560,7 @@ function system_schema() { $schema['cache'] = array( 'description' => 'Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.', - 'fields' => array( + 'columns' => array( 'cid' => array( 'description' => 'Primary Key: Unique cache ID.', 'type' => 'varchar', @@ -618,7 +618,7 @@ function system_schema() { $schema['files'] = array( 'description' => 'Stores information for uploaded files.', - 'fields' => array( + 'columns' => array( 'fid' => array( 'description' => 'File ID.', 'type' => 'serial', @@ -684,7 +684,7 @@ function system_schema() { $schema['flood'] = array( 'description' => 'Flood controls the threshold of events, such as the number of contact attempts.', - 'fields' => array( + 'columns' => array( 'fid' => array( 'description' => 'Unique flood event ID.', 'type' => 'serial', @@ -719,7 +719,7 @@ function system_schema() { $schema['history'] = array( 'description' => 'A record of which {users} have read which {node}s.', - 'fields' => array( + 'columns' => array( 'uid' => array( 'description' => 'The {users}.uid that read the {node} nid.', 'type' => 'int', @@ -746,7 +746,7 @@ function system_schema() { ); $schema['menu_router'] = array( 'description' => 'Maps paths to various callbacks (access, page and title)', - 'fields' => array( + 'columns' => array( 'path' => array( 'description' => 'Primary Key: the Drupal path this entry describes', 'type' => 'varchar', @@ -877,7 +877,7 @@ function system_schema() { $schema['menu_links'] = array( 'description' => 'Contains the individual links within a menu.', - 'fields' => array( + 'columns' => array( 'menu_name' => array( 'description' => "The menu name. All links with the same menu name (such as 'navigation') are part of the same menu.", 'type' => 'varchar', @@ -1061,7 +1061,7 @@ function system_schema() { $schema['queue'] = array( 'description' => 'Stores items in queues.', - 'fields' => array( + 'columns' => array( 'item_id' => array( 'type' => 'serial', 'unsigned' => TRUE, @@ -1110,7 +1110,7 @@ function system_schema() { $schema['queue_consumer_id'] = array( 'description' => 'Stores queue consumer IDs, used to auto-increment the consumer ID so that a unique consumer ID is used.', - 'fields' => array( + 'columns' => array( 'consumer_id' => array( 'type' => 'serial', 'not null' => TRUE, @@ -1122,7 +1122,7 @@ function system_schema() { $schema['registry'] = array( 'description' => "Each record is a function, class, or interface name and the file it is in.", - 'fields' => array( + 'columns' => array( 'name' => array( 'description' => 'The name of the function, class, or interface.', 'type' => 'varchar', @@ -1172,7 +1172,7 @@ function system_schema() { $schema['registry_file'] = array( 'description' => "Files parsed to build the registry.", - 'fields' => array( + 'columns' => array( 'filename' => array( 'description' => 'Path to the file.', 'type' => 'varchar', @@ -1191,7 +1191,7 @@ function system_schema() { $schema['sessions'] = array( 'description' => "Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.", - 'fields' => array( + 'columns' => array( 'uid' => array( 'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.', 'type' => 'int', @@ -1240,7 +1240,7 @@ function system_schema() { $schema['system'] = array( 'description' => "A list of all modules, themes, and theme engines that are or have been installed in Drupal's file system.", - 'fields' => array( + 'columns' => array( 'filename' => array( 'description' => 'The path of the primary file for this item, relative to the Drupal root; e.g. modules/node/node.module.', 'type' => 'varchar', @@ -1303,7 +1303,7 @@ function system_schema() { $schema['url_alias'] = array( 'description' => 'A list of URL aliases for Drupal paths; a user may visit either the source or destination path.', - 'fields' => array( + 'columns' => array( 'pid' => array( 'description' => 'A unique path alias identifier.', 'type' => 'serial', @@ -1399,7 +1399,7 @@ function system_update_6001() { $ret = array(); // Add vid to term-node relation. The schema says it is unsigned. - db_add_field($ret, 'term_node', 'vid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_add_column($ret, 'term_node', 'vid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); db_drop_primary_key($ret, 'term_node'); db_add_primary_key($ret, 'term_node', array('vid', 'tid', 'nid')); db_add_index($ret, 'term_node', 'vid', array('vid')); @@ -1414,7 +1414,7 @@ function system_update_6001() { function system_update_6002() { $ret = array(); db_drop_primary_key($ret, 'variable'); - db_change_field($ret, 'variable', 'name', 'name', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '')); + db_change_column($ret, 'variable', 'name', 'name', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '')); db_add_primary_key($ret, 'variable', array('name')); return $ret; } @@ -1450,7 +1450,7 @@ function system_update_6005() { $ret = array(); switch ($GLOBALS['db_type']) { case 'pgsql': - db_add_column($ret, 'url_alias', 'language', 'varchar(12)', array('default' => "''", 'not null' => TRUE)); + db_old_add_column($ret, 'url_alias', 'language', 'varchar(12)', array('default' => "''", 'not null' => TRUE)); // As of system.install:1.85 (before the new language // subsystem), new installs got a unique key named @@ -1532,7 +1532,7 @@ function system_update_6007() { function system_update_6008() { $ret = array(); $ret[] = update_sql('UPDATE {system} SET owner = description'); - db_drop_field($ret, 'system', 'description'); + db_drop_column($ret, 'system', 'description'); // Rebuild system table contents. module_rebuild_cache(); @@ -1573,7 +1573,7 @@ function system_update_6009() { */ function system_update_6010() { $ret = array(); - db_add_field($ret, 'watchdog', 'variables', array('type' => 'text', 'size' => 'big', 'not null' => TRUE, 'initial' => 'N;')); + db_add_column($ret, 'watchdog', 'variables', array('type' => 'text', 'size' => 'big', 'not null' => TRUE, 'initial' => 'N;')); return $ret; } @@ -1584,7 +1584,7 @@ function system_update_6011() { $ret = array(); switch ($GLOBALS['db_type']) { case 'pgsql': - db_add_column($ret, 'node', 'language', 'varchar(12)', array('default' => "''", 'not null' => TRUE)); + db_old_add_column($ret, 'node', 'language', 'varchar(12)', array('default' => "''", 'not null' => TRUE)); break; case 'mysql': case 'mysqli': @@ -1670,17 +1670,17 @@ function system_update_6016() { switch ($GLOBALS['db_type']) { case 'pgsql': $ret[] = update_sql("ALTER TABLE {node} ADD CONSTRAINT {node}_nid_vid_key UNIQUE (nid, vid)"); - db_add_column($ret, 'blocks', 'bid', 'serial'); + db_old_add_column($ret, 'blocks', 'bid', 'serial'); $ret[] = update_sql("ALTER TABLE {blocks} ADD PRIMARY KEY (bid)"); - db_add_column($ret, 'filters', 'fid', 'serial'); + db_old_add_column($ret, 'filters', 'fid', 'serial'); $ret[] = update_sql("ALTER TABLE {filters} ADD PRIMARY KEY (fid)"); - db_add_column($ret, 'flood', 'fid', 'serial'); + db_old_add_column($ret, 'flood', 'fid', 'serial'); $ret[] = update_sql("ALTER TABLE {flood} ADD PRIMARY KEY (fid)"); - db_add_column($ret, 'permission', 'pid', 'serial'); + db_old_add_column($ret, 'permission', 'pid', 'serial'); $ret[] = update_sql("ALTER TABLE {permission} ADD PRIMARY KEY (pid)"); - db_add_column($ret, 'term_relation', 'trid', 'serial'); + db_old_add_column($ret, 'term_relation', 'trid', 'serial'); $ret[] = update_sql("ALTER TABLE {term_relation} ADD PRIMARY KEY (trid)"); - db_add_column($ret, 'term_synonym', 'tsid', 'serial'); + db_old_add_column($ret, 'term_synonym', 'tsid', 'serial'); $ret[] = update_sql("ALTER TABLE {term_synonym} ADD PRIMARY KEY (tsid)"); break; case 'mysql': @@ -1774,26 +1774,26 @@ function system_update_6019() { case 'pgsql': // Remove default ''. if (db_table_exists('aggregator_feed')) { - db_field_set_no_default($ret, 'aggregator_feed', 'description'); - db_field_set_no_default($ret, 'aggregator_feed', 'image'); + db_column_set_no_default($ret, 'aggregator_feed', 'description'); + db_column_set_no_default($ret, 'aggregator_feed', 'image'); } - db_field_set_no_default($ret, 'blocks', 'pages'); + db_column_set_no_default($ret, 'blocks', 'pages'); if (db_table_exists('contact')) { - db_field_set_no_default($ret, 'contact', 'recipients'); - db_field_set_no_default($ret, 'contact', 'reply'); + db_column_set_no_default($ret, 'contact', 'recipients'); + db_column_set_no_default($ret, 'contact', 'reply'); } - db_field_set_no_default($ret, 'watchdog', 'location'); - db_field_set_no_default($ret, 'node_revisions', 'body'); - db_field_set_no_default($ret, 'node_revisions', 'teaser'); - db_field_set_no_default($ret, 'node_revisions', 'log'); + db_column_set_no_default($ret, 'watchdog', 'location'); + db_column_set_no_default($ret, 'node_revisions', 'body'); + db_column_set_no_default($ret, 'node_revisions', 'teaser'); + db_column_set_no_default($ret, 'node_revisions', 'log'); // Update from pgsql 'float' (which means 'double precision') to // schema 'float' (which in pgsql means 'real'). if (db_table_exists('search_index')) { - db_change_field($ret, 'search_index', 'score', 'score', array('type' => 'float')); + db_change_column($ret, 'search_index', 'score', 'score', array('type' => 'float')); } if (db_table_exists('search_total')) { - db_change_field($ret, 'search_total', 'count', 'count', array('type' => 'float')); + db_change_column($ret, 'search_total', 'count', 'count', array('type' => 'float')); } // Replace unique index dst_language with a unique constraint. The @@ -1815,7 +1815,7 @@ function system_update_6019() { // Make boxes.bid unsigned. db_drop_primary_key($ret, 'boxes'); - db_change_field($ret, 'boxes', 'bid', 'bid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('bid'))); + db_change_column($ret, 'boxes', 'bid', 'bid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('bid'))); // Fix primary key db_drop_primary_key($ret, 'node'); @@ -1833,28 +1833,28 @@ function system_update_6019() { // Change to size => small. if (db_table_exists('boxes')) { - db_change_field($ret, 'boxes', 'format', 'format', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'boxes', 'format', 'format', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); } // Change to size => small. // Rename index 'lid' to 'nid'. if (db_table_exists('comments')) { - db_change_field($ret, 'comments', 'format', 'format', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'comments', 'format', 'format', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); db_drop_index($ret, 'comments', 'lid'); db_add_index($ret, 'comments', 'nid', array('nid')); } // Change to size => small. - db_change_field($ret, 'cache', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); - db_change_field($ret, 'cache_filter', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); - db_change_field($ret, 'cache_page', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); - db_change_field($ret, 'cache_form', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'cache', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'cache_filter', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'cache_page', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'cache_form', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)); // Remove default => 0, set auto increment. $new_uid = 1 + db_result(db_query('SELECT MAX(uid) FROM {users}')); $ret[] = update_sql('UPDATE {users} SET uid = ' . $new_uid . ' WHERE uid = 0'); db_drop_primary_key($ret, 'users'); - db_change_field($ret, 'users', 'uid', 'uid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('uid'))); + db_change_column($ret, 'users', 'uid', 'uid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('uid'))); $ret[] = update_sql('UPDATE {users} SET uid = 0 WHERE uid = ' . $new_uid); // Special field names. @@ -1863,7 +1863,7 @@ function system_update_6019() { foreach (array('boxes', 'files', 'node', 'node_revisions') as $table) { $field = isset($map[$table]) ? $map[$table] : $table[0] . 'id'; db_drop_primary_key($ret, $table); - db_change_field($ret, $table, $field, $field, array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array($field))); + db_change_column($ret, $table, $field, $field, array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array($field))); } break; @@ -1879,7 +1879,7 @@ function system_update_6020() { $ret = array(); $schema['menu_router'] = array( - 'fields' => array( + 'columns' => array( 'path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'load_functions' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'to_arg_functions' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), @@ -1909,7 +1909,7 @@ function system_update_6020() { ); $schema['menu_links'] = array( - 'fields' => array( + 'columns' => array( 'menu_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), 'mlid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), 'plid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), @@ -1975,13 +1975,13 @@ function system_update_6021() { ); // Multi-part update if (!isset($_SESSION['system_update_6021'])) { - db_add_field($ret, 'menu', 'converted', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); + db_add_column($ret, 'menu', 'converted', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); drupal_set_session('system_update_6021_max', db_result(db_query('SELECT COUNT(*) FROM {menu}'))); drupal_set_session('menu_menu_map', array(1 => 'navigation')); // 0 => FALSE is for new menus, 1 => FALSE is for the navigation. drupal_set_session('menu_item_map', array(0 => FALSE, 1 => FALSE)); $table = array( - 'fields' => array( + 'columns' => array( 'menu_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'description' => array('type' => 'text', 'not null' => FALSE), @@ -2184,9 +2184,9 @@ function system_update_6022() { // Rename the nid field to vid, add status and timestamp fields, and indexes. db_drop_index($ret, 'files', 'nid'); - db_change_field($ret, 'files', 'nid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); - db_add_field($ret, 'files', 'status', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); - db_add_field($ret, 'files', 'timestamp', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'files', 'nid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_add_column($ret, 'files', 'status', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); + db_add_column($ret, 'files', 'timestamp', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); db_add_index($ret, 'files', 'uid', array('uid')); db_add_index($ret, 'files', 'status', array('status')); db_add_index($ret, 'files', 'timestamp', array('timestamp')); @@ -2198,7 +2198,7 @@ function system_update_6022() { db_drop_primary_key($ret, 'file_revisions'); db_drop_index($ret, 'file_revisions', 'vid'); db_rename_table($ret, 'file_revisions', 'upload'); - db_add_field($ret, 'upload', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_add_column($ret, 'upload', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); db_add_index($ret, 'upload', 'nid', array('nid')); db_add_primary_key($ret, 'upload', array('vid', 'fid')); db_add_index($ret, 'upload', 'fid', array('fid')); @@ -2218,7 +2218,7 @@ function system_update_6023() { // nid is DEFAULT 0 db_drop_index($ret, 'node_revisions', 'nid'); - db_change_field($ret, 'node_revisions', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'node_revisions', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); db_add_index($ret, 'node_revisions', 'nid', array('nid')); return $ret; } @@ -2228,8 +2228,8 @@ function system_update_6023() { */ function system_update_6024() { $ret = array(); - db_add_field($ret, 'node', 'tnid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); - db_add_field($ret, 'node', 'translate', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); + db_add_column($ret, 'node', 'tnid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_add_column($ret, 'node', 'translate', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); db_add_index($ret, 'node', 'tnid', array('tnid')); db_add_index($ret, 'node', 'translate', array('translate')); return $ret; @@ -2241,9 +2241,9 @@ function system_update_6024() { function system_update_6025() { $ret = array(); db_drop_index($ret, 'node', 'node_title_type'); - db_change_field($ret, 'node', 'title', 'title', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')); + db_change_column($ret, 'node', 'title', 'title', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')); db_add_index($ret, 'node', 'node_title_type', array('title', array('type', 4))); - db_change_field($ret, 'node_revisions', 'title', 'title', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')); + db_change_column($ret, 'node_revisions', 'title', 'title', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')); return $ret; } @@ -2266,7 +2266,7 @@ function system_update_6027() { $ret = array(); // Create the blocks.cache column. - db_add_field($ret, 'blocks', 'cache', array('type' => 'int', 'not null' => TRUE, 'default' => 1, 'size' => 'tiny')); + db_add_column($ret, 'blocks', 'cache', array('type' => 'int', 'not null' => TRUE, 'default' => 1, 'size' => 'tiny')); // The cache_block table is created in update_fix_d6_requirements() since // calls to cache_clear_all() would otherwise cause warnings. @@ -2328,7 +2328,7 @@ function system_update_6030() { } $schema['actions'] = array( - 'fields' => array( + 'columns' => array( 'aid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'), 'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), 'callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), @@ -2339,7 +2339,7 @@ function system_update_6030() { ); $schema['actions_aid'] = array( - 'fields' => array( + 'columns' => array( 'aid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), ), 'primary key' => array('aid'), @@ -2367,7 +2367,7 @@ function system_update_6032() { $ret = array(); if (db_table_exists('profile_fields')) { db_drop_unique_key($ret, 'profile_fields', 'name'); - db_change_field($ret, 'profile_fields', 'name', 'name', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '')); + db_change_column($ret, 'profile_fields', 'name', 'name', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '')); db_add_unique_key($ret, 'profile_fields', 'name', array('name')); } return $ret; @@ -2379,7 +2379,7 @@ function system_update_6032() { function system_update_6033() { $ret = array(); if (db_table_exists('node_comment_statistics')) { - // On pgsql but not mysql, db_change_field() drops all keys + // On pgsql but not mysql, db_change_column() drops all keys // involving the changed field, which in this case is the primary // key. The normal approach is explicitly drop the pkey, change the // field, and re-create the pkey. @@ -2388,11 +2388,11 @@ function system_update_6033() { // drop the pkey because on mysql auto-increment fields must be // included in at least one key or index. // - // Since we cannot drop the pkey before db_change_field(), after - // db_change_field() we may or may not still have a pkey. The + // Since we cannot drop the pkey before db_change_column(), after + // db_change_column() we may or may not still have a pkey. The // simple way out is to re-create the pkey only when using pgsql. // Realistic requirements trump idealistic purity. - db_change_field($ret, 'node_comment_statistics', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_change_column($ret, 'node_comment_statistics', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); if ($GLOBALS['db_type'] == 'pgsql') { db_add_primary_key($ret, 'node_comment_statistics', array('nid')); } @@ -2438,19 +2438,19 @@ function system_update_6036() { $ret = array(); if (db_table_exists('search_index')) { // Create the search_dataset.reindex column. - db_add_field($ret, 'search_dataset', 'reindex', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_add_column($ret, 'search_dataset', 'reindex', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); // Drop the search_index.from fields which are no longer used. db_drop_index($ret, 'search_index', 'from_sid_type'); - db_drop_field($ret, 'search_index', 'fromsid'); - db_drop_field($ret, 'search_index', 'fromtype'); + db_drop_column($ret, 'search_index', 'fromsid'); + db_drop_column($ret, 'search_index', 'fromtype'); // Drop the search_dataset.sid_type index, so that it can be made unique. db_drop_index($ret, 'search_dataset', 'sid_type'); // Create the search_node_links Table. $search_node_links_schema = array( - 'fields' => array( + 'columns' => array( 'sid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'type' => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''), 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), @@ -2501,7 +2501,7 @@ function system_update_6036() { */ function system_update_6037() { $ret = array(); - db_change_field($ret, 'blocks', 'region', 'region', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => '')); + db_change_column($ret, 'blocks', 'region', 'region', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => '')); $ret[] = update_sql("UPDATE {blocks} SET region = '' WHERE status = 0"); return $ret; } @@ -2544,7 +2544,7 @@ function system_update_6039() { function system_update_6040() { $ret = array(); if (db_table_exists('upload')) { - db_add_field($ret, 'upload', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); + db_add_column($ret, 'upload', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); } return $ret; } @@ -2588,7 +2588,7 @@ function system_update_6043() { db_add_index($ret, 'history', 'nid', array('nid')); // Change length of theme field in {blocks} to be consistent with module, and // to avoid a MySQL error regarding a too-long index. Also add new indices. - db_change_field($ret, 'blocks', 'theme', 'theme', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''),array( + db_change_column($ret, 'blocks', 'theme', 'theme', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''),array( 'unique keys' => array('tmd' => array('theme', 'module', 'delta'),), 'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'),),)); db_add_index($ret, 'blocks_roles', 'rid', array('rid')); @@ -2632,8 +2632,8 @@ function system_update_6043() { if (db_table_exists('profile_values')) { db_drop_index($ret, 'profile_values', 'uid'); db_drop_index($ret, 'profile_values', 'fid'); - db_change_field($ret,'profile_values' ,'fid', 'fid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,), array('indexes' => array('fid' => array('fid'),))); - db_change_field($ret,'profile_values' ,'uid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,)); + db_change_column($ret,'profile_values' ,'fid', 'fid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,), array('indexes' => array('fid' => array('fid'),))); + db_change_column($ret,'profile_values' ,'uid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,)); db_add_primary_key($ret, 'profile_values', array('uid', 'fid')); } // Alter a statistics module table to add an index. @@ -2779,8 +2779,8 @@ function system_update_6047() { */ function system_update_6048() { $ret = array(); - db_change_field($ret, 'menu_router', 'load_functions', 'load_functions', array('type' => 'text', 'not null' => TRUE)); - db_change_field($ret, 'menu_router', 'to_arg_functions', 'to_arg_functions', array('type' => 'text', 'not null' => TRUE)); + db_change_column($ret, 'menu_router', 'load_functions', 'load_functions', array('type' => 'text', 'not null' => TRUE)); + db_change_column($ret, 'menu_router', 'to_arg_functions', 'to_arg_functions', array('type' => 'text', 'not null' => TRUE)); return $ret; } @@ -2848,7 +2848,7 @@ function system_update_7002() { $ret = array(); $schema['blocked_ips'] = array( 'description' => 'Stores blocked IP addresses.', - 'fields' => array( + 'columns' => array( 'iid' => array( 'description' => 'Primary Key: unique ID for IP addresses.', 'type' => 'serial', @@ -2951,7 +2951,7 @@ function system_update_7004(&$sandbox) { ':module' => $module, ':delta' => $old_delta, )) - ->fetchField(); + ->fetchColumn(); if ($block_exists) { $ret[] = update_sql("UPDATE {" . $table . "} SET delta = '" . $new_delta . "' WHERE module = '" . $module . "' AND delta = '" . $old_delta . "'"); } @@ -2972,12 +2972,12 @@ function system_update_7004(&$sandbox) { // Initialize batch update information. $sandbox['progress'] = 0; $sandbox['last_user_processed'] = -1; - $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE data IS NOT NULL")->fetchField(); + $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE data IS NOT NULL")->fetchColumn(); } // Now do the batch update of the user-specific block visibility settings. $limit = 100; $result = db_select('users', 'u') - ->fields('u', array('uid', 'data')) + ->columns('u', array('uid', 'data')) ->condition('uid', $sandbox['last_user_processed'], '>') ->where('data IS NOT NULL') ->range(0, $limit) @@ -2999,7 +2999,7 @@ function system_update_7004(&$sandbox) { // Update the current user. if ($user_needs_update) { db_update('users') - ->fields(array('data' => serialize($data))) + ->columns(array('data' => serialize($data))) ->condition('uid', $row->uid) ->execute(); } @@ -3019,8 +3019,8 @@ function system_update_7004(&$sandbox) { */ function system_update_7005() { $ret = array(); - db_drop_field($ret, 'blocks', 'throttle'); - db_drop_field($ret, 'system', 'throttle'); + db_drop_column($ret, 'blocks', 'throttle'); + db_drop_column($ret, 'system', 'throttle'); variable_del('throttle_user'); variable_del('throttle_anonymous'); variable_del('throttle_level'); @@ -3035,9 +3035,9 @@ function system_update_7005() { */ function system_update_7006() { $ret = array(); - db_drop_field($ret, 'menu_router', 'file'); + db_drop_column($ret, 'menu_router', 'file'); $schema['registry'] = array( - 'fields' => array( + 'columns' => array( 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'type' => array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => ''), 'filename' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), @@ -3051,14 +3051,14 @@ function system_update_7006() { ), ); $schema['registry_file'] = array( - 'fields' => array( + 'columns' => array( 'filename' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'md5' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), ), 'primary key' => array('filename'), ); $schema['cache_registry'] = array( - 'fields' => array( + 'columns' => array( 'cid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'data' => array('type' => 'blob', 'not null' => FALSE, 'size' => 'big'), 'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), @@ -3086,7 +3086,7 @@ function system_update_7007() { $ret = array(); $schema['role_permission'] = array( - 'fields' => array( + 'columns' => array( 'rid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -3109,7 +3109,7 @@ function system_update_7007() { // Copy the permissions from the old {permission} table to the new {role_permission} table. $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid ASC"); - $query = db_insert('role_permission')->fields(array('rid', 'permission')); + $query = db_insert('role_permission')->columns(array('rid', 'permission')); foreach ($result as $role) { foreach (explode(', ', $role->perm) as $perm) { $query->values(array( @@ -3134,15 +3134,15 @@ function system_update_7008() { $ret = array(); if (db_table_exists('poll_votes')) { // Add chid column and convert existing votes. - db_add_field($ret, 'poll_votes', 'chid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); + db_add_column($ret, 'poll_votes', 'chid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); db_add_index($ret, 'poll_votes', 'chid', array('chid')); $ret[] = update_sql("UPDATE {poll_votes} SET chid = (SELECT chid FROM {poll_choices} c WHERE {poll_votes}.chorder = c.chorder AND {poll_votes}.nid = c.nid)"); // Remove old chorder column. - db_drop_field($ret, 'poll_votes', 'chorder'); + db_drop_column($ret, 'poll_votes', 'chorder'); } if (db_table_exists('poll_choices')) { // Change the chorder column to weight in poll_choices. - db_change_field($ret, 'poll_choices', 'chorder', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); + db_change_column($ret, 'poll_choices', 'chorder', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); } return $ret; } @@ -3177,7 +3177,7 @@ function system_update_7011() { if (empty($rids)) { return $ret; } - $insert = db_insert('role_permission')->fields(array('rid', 'permission')); + $insert = db_insert('role_permission')->columns(array('rid', 'permission')); foreach ($rids as $rid) { $insert->values(array( 'rid' => $rid, @@ -3216,7 +3216,7 @@ function system_update_7013() { // the time zone name and use it as the default time zone. if (!$timezone && ($timezone_id = variable_get('date_default_timezone_id', 0))) { try { - $timezone_name = db_query('SELECT name FROM {event_timezones} WHERE timezone = :timezone_id', array(':timezone_id' => $timezone_id))->fetchField(); + $timezone_name = db_query('SELECT name FROM {event_timezones} WHERE timezone = :timezone_id', array(':timezone_id' => $timezone_id))->fetchColumn(); if (($timezone_name = str_replace(' ', '_', $timezone_name)) && isset($timezones[$timezone_name])) { $timezone = $timezone_name; } @@ -3246,7 +3246,7 @@ function system_update_7013() { */ function system_update_7014() { $ret = array(); - db_drop_field($ret, 'system', 'bootstrap'); + db_drop_column($ret, 'system', 'bootstrap'); return $ret; } @@ -3329,7 +3329,7 @@ function system_update_7017() { function system_update_7018() { $ret = array(); db_drop_index($ret, 'system', 'modules'); - db_change_field($ret, 'system', 'type', 'type', array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => '')); + db_change_column($ret, 'system', 'type', 'type', array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => '')); db_add_index($ret, 'system', 'modules', array('type', 'status', 'weight', 'filename')); db_add_index($ret, 'system', 'type_name', array('type', 'name')); return $ret; @@ -3363,7 +3363,7 @@ function system_update_7021() { // Migrate contact form information. if ($contact_help = variable_get('contact_form_information', '')) { - $bid = db_insert('box')->fields(array('body' => $contact_help, 'info' => 'Contact page help', 'format' => FILTER_FORMAT_DEFAULT))->execute(); + $bid = db_insert('box')->columns(array('body' => $contact_help, 'info' => 'Contact page help', 'format' => FILTER_FORMAT_DEFAULT))->execute(); foreach ($themes_with_blocks as $theme) { // Add contact help block for themes, which had blocks. $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . $bid . "', '" . $theme . "', 1, 5, 'help', 1, 'contact', -1)"); @@ -3373,7 +3373,7 @@ function system_update_7021() { // Migrate user help setting. if ($user_help = variable_get('user_registration_help', '')) { - $bid = db_insert('box')->fields(array('body' => $user_help, 'info' => 'User registration guidelines', 'format' => FILTER_FORMAT_DEFAULT))->execute(); + $bid = db_insert('box')->columns(array('body' => $user_help, 'info' => 'User registration guidelines', 'format' => FILTER_FORMAT_DEFAULT))->execute(); foreach ($themes_with_blocks as $theme) { // Add user registration help block for themes, which had blocks. $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . $bid . "', '" . $theme . "', 1, 5, 'help', 1, 'user/register', -1)"); @@ -3383,7 +3383,7 @@ function system_update_7021() { // Migrate site mission setting. if ($mission = variable_get('site_mission')) { - $bid = db_insert('box')->fields(array('body' => $mission, 'info' => 'Site mission', 'format' => FILTER_FORMAT_DEFAULT))->execute(); + $bid = db_insert('box')->columns(array('body' => $mission, 'info' => 'Site mission', 'format' => FILTER_FORMAT_DEFAULT))->execute(); foreach ($themes_with_blocks as $theme) { // Add mission block for themes, which had blocks. $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . $bid . "', '" . $theme . "', 1, 0, 'highlight', 1, '', -1)"); @@ -3395,7 +3395,7 @@ function system_update_7021() { // Migrate site footer message to a custom block. if ($footer_message = variable_get('site_footer', '')) { - $bid = db_insert('box')->fields(array('body' => $footer_message, 'info' => 'Footer message', 'format' => FILTER_FORMAT_DEFAULT))->execute(); + $bid = db_insert('box')->columns(array('body' => $footer_message, 'info' => 'Footer message', 'format' => FILTER_FORMAT_DEFAULT))->execute(); foreach ($themes_with_blocks as $theme) { // Add site footer block for themes, which had blocks. // Set low weight, so the block comes early (it used to be @@ -3424,7 +3424,7 @@ function system_update_7021() { function system_update_7022() { $schema['queue'] = array( 'description' => 'Stores items in queues.', - 'fields' => array( + 'columns' => array( 'item_id' => array( 'type' => 'serial', 'unsigned' => TRUE, @@ -3473,7 +3473,7 @@ function system_update_7022() { $schema['queue_consumer_id'] = array( 'description' => 'Stores queue consumer IDs, used to auto-incrament the consumer ID so that a unique consumer ID is used.', - 'fields' => array( + 'columns' => array( 'consumer_id' => array( 'type' => 'serial', 'not null' => TRUE, Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.694 diff -u -F^[fc] -r1.694 system.module --- modules/system/system.module 16 May 2009 18:34:23 -0000 1.694 +++ modules/system/system.module 17 May 2009 15:43:30 -0000 @@ -1158,7 +1158,7 @@ function system_theme_data() { ->condition('type', 'theme') ->execute(); - $query = db_insert('system')->fields(array('name', 'owner', 'info', 'type', 'filename', 'status')); + $query = db_insert('system')->columns(array('name', 'owner', 'info', 'type', 'filename', 'status')); foreach ($themes as $theme) { if (!isset($theme->owner)) { $theme->owner = ''; @@ -1317,7 +1317,7 @@ function system_region_list($theme_key) static $list = array(); if (!array_key_exists($theme_key, $list)) { - $info = unserialize(db_query("SELECT info FROM {system} WHERE type = :type AND name = :name", array(':type' => 'theme', ':name' => $theme_key))->fetchField()); + $info = unserialize(db_query("SELECT info FROM {system} WHERE type = :type AND name = :name", array(':type' => 'theme', ':name' => $theme_key))->fetchColumn()); $list[$theme_key] = array_map('t', $info['regions']); } @@ -1599,7 +1599,7 @@ function system_cron() { // Reset expired items in the default queue implementation table. If that's // not used, this will simply be a no-op. db_update('queue') - ->fields(array( + ->columns(array( 'consumer_id' => 0, 'expire' => 0, )) @@ -1690,7 +1690,7 @@ function system_actions_manage() { } $row = array(); - $instances_present = db_query("SELECT aid FROM {actions} WHERE parameters <> ''")->fetchField(); + $instances_present = db_query("SELECT aid FROM {actions} WHERE parameters <> ''")->fetchColumn(); $header = array( array('data' => t('Action type'), 'field' => 'type'), array('data' => t('Description'), 'field' => 'description'), @@ -1698,7 +1698,7 @@ function system_actions_manage() { ); $query = db_select('actions')->extend('PagerDefault')->extend('TableSort'); $result = $query - ->fields('actions') + ->columns('actions') ->limit(50) ->setHeader($header) ->execute(); @@ -2223,7 +2223,7 @@ function system_goto_action($object, $co function system_block_ip_action() { $ip = ip_address(); db_insert('blocked_ips') - ->fields(array('ip' => $ip)) + ->columns(array('ip' => $ip)) ->execute(); watchdog('action', 'Banned IP address %ip', array('%ip' => $ip)); } Index: modules/system/system.queue.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.queue.inc,v retrieving revision 1.1 diff -u -F^[fc] -r1.1 system.queue.inc --- modules/system/system.queue.inc 6 May 2009 10:37:28 -0000 1.1 +++ modules/system/system.queue.inc 17 May 2009 15:43:30 -0000 @@ -190,7 +190,7 @@ class SystemQueue implements DrupalQueue } public function numberOfItems() { - return db_query('SELECT COUNT(item_id) FROM {queue} WHERE name = :name', array(':name' => $this->name))->fetchField(); + return db_query('SELECT COUNT(item_id) FROM {queue} WHERE name = :name', array(':name' => $this->name))->fetchColumn(); } public function claimItem($lease_time = 30) { @@ -212,7 +212,7 @@ class SystemQueue implements DrupalQueue // the current time(), we steal time from the lease, and will tend to // reset items before the lease should really expire. $update = db_update('queue') - ->fields(array( + ->columns(array( 'consumer_id' => $this->consumerId, 'expire' => time() + $lease_time, )) Index: modules/system/system.test =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.test,v retrieving revision 1.43 diff -u -F^[fc] -r1.43 system.test --- modules/system/system.test 16 May 2009 18:34:23 -0000 1.43 +++ modules/system/system.test 17 May 2009 15:43:30 -0000 @@ -83,7 +83,7 @@ class ModuleTestCase extends DrupalWebTe ->condition('link', $link) ->countQuery() ->execute() - ->fetchField(); + ->fetchColumn(); $this->assertTrue($count > 0, t('watchdog table contains @count rows for @message', array('@count' => $count, '@message' => $message))); } } @@ -250,7 +250,7 @@ class IPAddressBlockingTestCase extends $edit = array(); $edit['ip'] = '192.168.1.1'; $this->drupalPost('admin/settings/ip-blocking', $edit, t('Save')); - $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField(); + $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchColumn(); $this->assertNotNull($ip, t('IP address found in database')); $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.')); @@ -333,7 +333,7 @@ class CronRunTestCase extends DrupalWebT // Temporary file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $temp_old = file_save_data(''); db_update('files') - ->fields(array( + ->columns(array( 'status' => 0, 'timestamp' => 1, )) @@ -344,7 +344,7 @@ class CronRunTestCase extends DrupalWebT // Temporary file that is less than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $temp_new = file_save_data(''); db_update('files') - ->fields(array('status' => 0)) + ->columns(array('status' => 0)) ->condition('fid', $temp_new->fid) ->execute(); $this->assertTrue(file_exists($temp_new->filepath), t('New temp file was created correctly.')); @@ -352,7 +352,7 @@ class CronRunTestCase extends DrupalWebT // Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $perm_old = file_save_data(''); db_update('files') - ->fields(array('timestamp' => 1)) + ->columns(array('timestamp' => 1)) ->condition('fid', $temp_old->fid) ->execute(); $this->assertTrue(file_exists($perm_old->filepath), t('Old permanent file was created correctly.')); Index: modules/taxonomy/taxonomy.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v retrieving revision 1.51 diff -u -F^[fc] -r1.51 taxonomy.admin.inc --- modules/taxonomy/taxonomy.admin.inc 12 May 2009 08:37:45 -0000 1.51 +++ modules/taxonomy/taxonomy.admin.inc 17 May 2009 15:43:30 -0000 @@ -281,8 +281,8 @@ function taxonomy_overview_terms(&$form_ $query->setCountQuery($count_query); $result = $query - ->fields('t') - ->fields('h', array('parent')) + ->columns('t') + ->columns('h', array('parent')) ->orderBy('weight') ->orderBy('name') ->limit($page_increment) @@ -925,7 +925,7 @@ function taxonomy_vocabulary_confirm_res */ function taxonomy_vocabulary_confirm_reset_alphabetical_submit($form, &$form_state) { db_update('taxonomy_term_data') - ->fields(array('weight' => 0)) + ->columns(array('weight' => 0)) ->condition('vid', $form_state['values']['vid']) ->execute(); drupal_set_message(t('Reset vocabulary %name to alphabetical order.', array('%name' => $form_state['values']['name']))); Index: modules/taxonomy/taxonomy.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.api.php,v retrieving revision 1.7 diff -u -F^[fc] -r1.7 taxonomy.api.php --- modules/taxonomy/taxonomy.api.php 30 Mar 2009 05:18:49 -0000 1.7 +++ modules/taxonomy/taxonomy.api.php 17 May 2009 15:43:30 -0000 @@ -107,7 +107,7 @@ function hook_taxonomy_term_insert($term foreach (explode ("\n", str_replace("\r", '', $term->synonyms)) as $synonym) { if ($synonym) { db_insert('taxonomy_term_synonym') - ->fields(array( + ->columns(array( 'tid' => $term->tid, 'name' => rtrim($synonym), )) @@ -131,7 +131,7 @@ function hook_taxonomy_term_update($term foreach (explode ("\n", str_replace("\r", '', $term->synonyms)) as $synonym) { if ($synonym) { db_insert('taxonomy_term_synonym') - ->fields(array( + ->columns(array( 'tid' => $term->tid, 'name' => rtrim($synonym), )) Index: modules/taxonomy/taxonomy.install =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.install,v retrieving revision 1.16 diff -u -F^[fc] -r1.16 taxonomy.install --- modules/taxonomy/taxonomy.install 13 May 2009 19:42:17 -0000 1.16 +++ modules/taxonomy/taxonomy.install 17 May 2009 15:43:30 -0000 @@ -32,7 +32,7 @@ function taxonomy_uninstall() { function taxonomy_schema() { $schema['taxonomy_term_data'] = array( 'description' => 'Stores term information.', - 'fields' => array( + 'columns' => array( 'tid' => array( 'type' => 'serial', 'unsigned' => TRUE, @@ -76,7 +76,7 @@ function taxonomy_schema() { $schema['taxonomy_term_hierarchy'] = array( 'description' => 'Stores the hierarchical relationship between terms.', - 'fields' => array( + 'columns' => array( 'tid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -100,7 +100,7 @@ function taxonomy_schema() { $schema['taxonomy_term_node'] = array( 'description' => 'Stores the relationship of terms to nodes.', - 'fields' => array( + 'columns' => array( 'nid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -132,7 +132,7 @@ function taxonomy_schema() { $schema['taxonomy_term_relation'] = array( 'description' => 'Stores non-hierarchical relationships between terms.', - 'fields' => array( + 'columns' => array( 'trid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -164,7 +164,7 @@ function taxonomy_schema() { $schema['taxonomy_term_synonym'] = array( 'description' => 'Stores term synonyms.', - 'fields' => array( + 'columns' => array( 'tsid' => array( 'type' => 'serial', 'not null' => TRUE, @@ -194,7 +194,7 @@ function taxonomy_schema() { $schema['taxonomy_vocabulary'] = array( 'description' => 'Stores vocabulary information.', - 'fields' => array( + 'columns' => array( 'vid' => array( 'type' => 'serial', 'unsigned' => TRUE, @@ -284,7 +284,7 @@ function taxonomy_schema() { $schema['taxonomy_vocabulary_node_type'] = array( 'description' => 'Stores which node types vocabularies may be used with.', - 'fields' => array( + 'columns' => array( 'vid' => array( 'type' => 'int', 'unsigned' => TRUE, Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.472 diff -u -F^[fc] -r1.472 taxonomy.module --- modules/taxonomy/taxonomy.module 3 May 2009 10:44:04 -0000 1.472 +++ modules/taxonomy/taxonomy.module 17 May 2009 15:43:30 -0000 @@ -234,7 +234,7 @@ function taxonomy_vocabulary_save($vocab if (!empty($vocabulary->nodes)) { $query = db_insert('taxonomy_vocabulary_node_type') - ->fields(array('vid', 'type')); + ->columns(array('vid', 'type')); foreach ($vocabulary->nodes as $type => $selected) { $query->values(array( 'vid' => $vocabulary->vid, @@ -250,7 +250,7 @@ function taxonomy_vocabulary_save($vocab if (!empty($vocabulary->nodes)) { $query = db_insert('taxonomy_vocabulary_node_type') - ->fields(array('vid', 'type')); + ->columns(array('vid', 'type')); foreach ($vocabulary->nodes as $type => $selected) { $query->values(array( 'vid' => $vocabulary->vid, @@ -373,7 +373,7 @@ function taxonomy_term_save($term) { foreach ($term->relations as $related_id) { if ($related_id != 0) { db_insert('taxonomy_term_relation') - ->fields(array( + ->columns(array( 'tid1' => $term->tid, 'tid2' => $related_id )) @@ -389,7 +389,7 @@ function taxonomy_term_save($term) { $term->parent = array(0); } $query = db_insert('taxonomy_term_hierarchy') - ->fields(array('tid', 'parent')); + ->columns(array('tid', 'parent')); if (is_array($term->parent)) { foreach ($term->parent as $parent) { if (is_array($parent)) { @@ -421,7 +421,7 @@ function taxonomy_term_save($term) { ->execute(); if (!empty($term->synonyms)) { $query = db_insert('taxonomy_term_synonym') - ->fields(array('tid', 'name')); + ->columns(array('tid', 'name')); foreach (explode ("\n", str_replace("\r", '', $term->synonyms)) as $synonym) { if ($synonym) { $query->values(array( @@ -582,7 +582,7 @@ function taxonomy_form_alter(&$form, $fo $query->addTag('term_access'); $result = $query - ->fields('v') + ->columns('v') ->condition('n.type', $node->type) ->orderBy('v.weight') ->orderBy('v.name') @@ -689,7 +689,7 @@ function taxonomy_node_get_terms_by_voca $query->addTag('term_access'); $result = $query - ->fields('t') + ->columns('t') ->condition('t.vid', $vid) ->condition('r.vid', $node->vid) ->orderBy('weight') @@ -722,7 +722,7 @@ function taxonomy_get_tids_from_nodes($n $query->addTag('term_access'); return $query - ->fields('r', array('tid', 'nid', 'vid')) + ->columns('r', array('tid', 'nid', 'vid')) ->condition('r.vid', $node_vids, 'IN') ->orderBy('v.weight') ->orderBy('t.weight') @@ -744,7 +744,7 @@ function taxonomy_node_get_terms($node, $query->addTag('term_access'); $result = $query - ->fields('r', array('tid', 'nid', 'vid')) + ->columns('r', array('tid', 'nid', 'vid')) ->condition('r.vid', $node->vid) ->orderBy('v.weight') ->orderBy('t.weight') @@ -796,7 +796,7 @@ function taxonomy_node_save($node, $term // Defend against duplicate, differently cased tags if (!isset($inserted[$typed_term_tid])) { db_insert('taxonomy_term_node') - ->fields(array( + ->columns(array( 'nid' => $node->nid, 'vid' => $node->vid, 'tid' => $typed_term_tid @@ -810,7 +810,7 @@ function taxonomy_node_save($node, $term if (is_array($terms) && !empty($terms)) { $query = db_insert('taxonomy_term_node') - ->fields(array('nid', 'vid', 'tid')); + ->columns(array('nid', 'vid', 'tid')); foreach ($terms as $term) { if (is_array($term)) { @@ -849,7 +849,7 @@ function taxonomy_node_save($node, $term function taxonomy_node_type($op, $info) { if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) { db_update('taxonomy_vocabulary_node_type') - ->fields(array( + ->columns(array( 'type' => $info->type, )) ->condition('type', $info->old_type) @@ -890,7 +890,7 @@ function taxonomy_get_parents($tid, $key $query->addTag('term_access'); $result = $query - ->fields('t') + ->columns('t') ->condition('h.tid', $tid) ->orderBy('weight') ->orderBy('name') @@ -931,7 +931,7 @@ function taxonomy_get_children($tid, $vi $query->addTag('term_access'); $query - ->fields('t') + ->columns('t') ->condition('parent', $tid) ->orderBy('weight') ->orderBy('name'); @@ -984,8 +984,8 @@ function taxonomy_get_tree($vid, $parent $query->addTag('term_access'); $result = $query - ->fields('t') - ->fields('h', array('parent')) + ->columns('t') + ->columns('h', array('parent')) ->condition('t.vid', $vid) ->orderBy('weight') ->orderBy('name') @@ -1086,7 +1086,7 @@ function taxonomy_term_count_nodes($tid, $query->condition('n.type', $type); } $query->addTag('term_access'); - $count[$type][$tid] = $query->execute()->fetchField(); + $count[$type][$tid] = $query->execute()->fetchColumn(); } return $count[$type][$tid]; } @@ -1108,7 +1108,7 @@ function taxonomy_get_term_by_name($name $query->addTag('term_access'); return $query - ->fields('t') + ->columns('t') ->where("LOWER(t.name) = LOWER(:name)", array(':name' => trim($name))) ->execute()->fetchAll(); } @@ -1177,9 +1177,9 @@ function taxonomy_vocabulary_load_multip // we have $vids still to load, or if no $vids were passed. if ($vids || !$passed_vids) { $query = db_select('taxonomy_vocabulary', 'v'); - $query->addField('n', 'type'); + $query->addColumn('n', 'type'); $query - ->fields('v') + ->columns('v') ->orderBy('v.weight') ->orderBy('v.name'); @@ -1326,7 +1326,7 @@ function taxonomy_term_load_multiple($ti if ($tids || ($conditions && !$passed_tids)) { $query = db_select('taxonomy_term_data', 't'); $taxonomy_term_data = drupal_schema_fields_sql('taxonomy_term_data'); - $query->fields('t', $taxonomy_term_data); + $query->columns('t', $taxonomy_term_data); // If the $tids array is populated, add those to the query. if ($tids) { @@ -1505,12 +1505,12 @@ function taxonomy_select_nodes($tids = a } $query->distinct(TRUE); - $query->addField('n', 'nid'); + $query->addColumn('n', 'nid'); foreach ($order as $field => $direction) { $query->orderBy($field, $direction); // ORDER BY fields need to be loaded too, assume they are in the form table_alias.name list($table_alias, $name) = explode('.', $field); - $query->addField($table_alias, $name); + $query->addColumn($table_alias, $name); } return $query->execute()->fetchCol(); Index: modules/taxonomy/taxonomy.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v retrieving revision 1.26 diff -u -F^[fc] -r1.26 taxonomy.pages.inc --- modules/taxonomy/taxonomy.pages.inc 26 Apr 2009 19:44:40 -0000 1.26 +++ modules/taxonomy/taxonomy.pages.inc 17 May 2009 15:43:30 -0000 @@ -21,7 +21,7 @@ function taxonomy_term_page($terms, $dep // Load array with all tid's the user has access to in the format tid => name. $term_results = $query - ->fields('t', array('tid', 'name')) + ->columns('t', array('tid', 'name')) ->condition('tid', $terms['tids'], 'IN') ->execute() ->fetchAllKeyed(); @@ -132,7 +132,7 @@ function taxonomy_autocomplete($vid, $st $query->addTag('term_access'); $tags = $query - ->fields('t', array('tid', 'name')) + ->columns('t', array('tid', 'name')) ->condition('t.vid', $vid) ->where("LOWER(t.name) LIKE LOWER(:last_string)", array(':last_string' => '%'. $last_string .'%')) ->range(0, 10) Index: modules/taxonomy/taxonomy.test =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v retrieving revision 1.30 diff -u -F^[fc] -r1.30 taxonomy.test --- modules/taxonomy/taxonomy.test 13 Apr 2009 18:52:38 -0000 1.30 +++ modules/taxonomy/taxonomy.test 17 May 2009 15:43:30 -0000 @@ -680,7 +680,7 @@ class TaxonomyHooksTestCase extends Drup // Delete the term. taxonomy_term_delete($term->tid); - $antonyms = db_query('SELECT taid FROM {term_antonym} WHERE tid = :tid', array(':tid' => $term->tid))->fetchField(); + $antonyms = db_query('SELECT taid FROM {term_antonym} WHERE tid = :tid', array(':tid' => $term->tid))->fetchColumn(); $this->assertFalse($antonyms, t('The antonyms were deleted from the database.')); } } Index: modules/tracker/tracker.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v retrieving revision 1.18 diff -u -F^[fc] -r1.18 tracker.pages.inc --- modules/tracker/tracker.pages.inc 26 Apr 2009 19:44:40 -0000 1.18 +++ modules/tracker/tracker.pages.inc 17 May 2009 15:43:30 -0000 @@ -24,12 +24,12 @@ function tracker_page($account = NULL, $ // TODO: These queries are very expensive, see http://drupal.org/node/105639 $query = db_select('node', 'n', array('target' => 'slave')) - ->fields('n', array('nid', 'title', 'type', 'changed', 'uid')); + ->columns('n', array('nid', 'title', 'type', 'changed', 'uid')); $query->join('users', 'u', 'n.uid = u.uid'); - $query->addField('u', 'name'); + $query->addColumn('u', 'name'); $query->join('node_comment_statistics', 'l', 'n.nid = l.nid'); $query->addExpression('GREATEST(n.changed, l.last_comment_timestamp)', 'last_updated'); - $query->addField('l', 'comment_count'); + $query->addColumn('l', 'comment_count'); $query->orderBy('last_updated', 'DESC'); if ($account) { Index: modules/translation/translation.module =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v retrieving revision 1.44 diff -u -F^[fc] -r1.44 translation.module --- modules/translation/translation.module 9 May 2009 18:28:13 -0000 1.44 +++ modules/translation/translation.module 17 May 2009 15:43:30 -0000 @@ -235,7 +235,7 @@ function translation_node_insert($node) // Create new translation set, using nid from the source node. $tnid = $node->translation_source->nid; db_update('node') - ->fields(array( + ->columns(array( 'tnid' => $tnid, 'translate' => 0, )) @@ -243,7 +243,7 @@ function translation_node_insert($node) ->execute(); } db_update('node') - ->fields(array( + ->columns(array( 'tnid' => $tnid, 'translate' => 0, )) @@ -262,7 +262,7 @@ function translation_node_update($node) if (isset($node->translation) && $node->translation && !empty($node->language) && $node->tnid) { // Update translation information. db_update('node') - ->fields(array( + ->columns(array( 'tnid' => $node->tnid, 'translate' => $node->translation['status'], )) @@ -271,7 +271,7 @@ function translation_node_update($node) if (!empty($node->translation['retranslate'])) { // This is the source node, asking to mark all translations outdated. db_update('node') - ->fields(array('translate' => 1)) + ->columns(array('translate' => 1)) ->condition('nid', $node->nid, '<>') ->condition('tnid', $node->tnid) ->execute(); @@ -313,11 +313,11 @@ function translation_node_delete($node) function translation_remove_from_set($node) { if (isset($node->tnid)) { $query = db_update('node') - ->fields(array( + ->columns(array( 'tnid' => 0, 'translate' => 0, )); - if (db_query('SELECT COUNT(*) FROM {node} WHERE tnid = :tnid', array(':tnid' => $node->tnid))->fetchField() == 1) { + if (db_query('SELECT COUNT(*) FROM {node} WHERE tnid = :tnid', array(':tnid' => $node->tnid))->fetchColumn() == 1) { // There is only one node left in the set: remove the set altogether. $query ->condition('tnid', $node->tnid) @@ -331,9 +331,9 @@ function translation_remove_from_set($no // If the node being removed was the source of the translation set, // we pick a new source - preferably one that is up to date. if ($node->tnid == $node->nid) { - $new_tnid = db_query('SELECT nid FROM {node} WHERE tnid = :tnid ORDER BY translate ASC, nid ASC', array(':tnid' => $node->tnid))->fetchField(); + $new_tnid = db_query('SELECT nid FROM {node} WHERE tnid = :tnid ORDER BY translate ASC, nid ASC', array(':tnid' => $node->tnid))->fetchColumn(); db_update('node') - ->fields(array('tnid' => $new_tnid)) + ->columns(array('tnid' => $new_tnid)) ->condition('tnid', $node->tnid) ->execute(); } @@ -361,7 +361,7 @@ function translation_node_get_translatio if (!isset($translations[$tnid])) { $translations[$tnid] = array(); $result = db_select('node', 'n') - ->fields('n', array('nid', 'title', 'language')) + ->columns('n', array('nid', 'title', 'language')) ->condition('n.tnid', $tnid) ->addTag('node_access') ->execute(); Index: modules/trigger/trigger.install =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.install,v retrieving revision 1.9 diff -u -F^[fc] -r1.9 trigger.install --- modules/trigger/trigger.install 13 May 2009 19:42:17 -0000 1.9 +++ modules/trigger/trigger.install 17 May 2009 15:43:30 -0000 @@ -31,7 +31,7 @@ function trigger_uninstall() { function trigger_schema() { $schema['trigger_assignments'] = array( 'description' => 'Maps trigger to hook and operation assignments from trigger.module.', - 'fields' => array( + 'columns' => array( 'hook' => array( 'type' => 'varchar', 'length' => 32, Index: modules/update/update.module =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.module,v retrieving revision 1.33 diff -u -F^[fc] -r1.33 update.module --- modules/update/update.module 13 May 2009 18:21:42 -0000 1.33 +++ modules/update/update.module 17 May 2009 15:43:30 -0000 @@ -558,7 +558,7 @@ function _update_cache_set($cid, $data, } db_merge('cache_update') ->key(array('cid' => $cid)) - ->fields($fields) + ->columns($fields) ->execute(); } Index: modules/upload/upload.install =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.install,v retrieving revision 1.9 diff -u -F^[fc] -r1.9 upload.install --- modules/upload/upload.install 13 May 2009 19:42:17 -0000 1.9 +++ modules/upload/upload.install 17 May 2009 15:43:30 -0000 @@ -32,7 +32,7 @@ function upload_uninstall() { function upload_schema() { $schema['upload'] = array( 'description' => 'Stores uploaded file information and table associations.', - 'fields' => array( + 'columns' => array( 'fid' => array( 'type' => 'int', 'unsigned' => TRUE, Index: modules/upload/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v retrieving revision 1.238 diff -u -F^[fc] -r1.238 upload.module --- modules/upload/upload.module 16 May 2009 15:23:16 -0000 1.238 +++ modules/upload/upload.module 17 May 2009 15:43:30 -0000 @@ -282,7 +282,7 @@ function upload_file_load($files) { */ function upload_file_references($file) { // If upload.module is still using a file, do not let other modules delete it. - $file_used = (bool) db_query_range('SELECT 1 FROM {upload} WHERE fid = :fid', array(':fid' => $file->fid), 0, 1)->fetchField(); + $file_used = (bool) db_query_range('SELECT 1 FROM {upload} WHERE fid = :fid', array(':fid' => $file->fid), 0, 1)->fetchColumn(); if ($file_used) { // Return the name of the module and how many references it has to the file. return array('upload' => $count); @@ -472,7 +472,7 @@ function upload_space_used($uid) { * The amount of disk space used by uploaded files in bytes. */ function upload_total_space_used() { - return db_query('SELECT SUM(f.filesize) FROM {files} f INNER JOIN {upload} u ON f.fid = u.fid')->fetchField(); + return db_query('SELECT SUM(f.filesize) FROM {files} f INNER JOIN {upload} u ON f.fid = u.fid')->fetchColumn(); } function upload_save($node) { @@ -501,7 +501,7 @@ function upload_save($node) { // Create a new revision, or associate a new file needed. if (!empty($node->old_vid) || $file->new) { db_insert('upload') - ->fields(array( + ->columns(array( 'fid' => $file->fid, 'nid' => $node->nid, 'vid' => $node->vid, @@ -514,7 +514,7 @@ function upload_save($node) { // Update existing revision. else { db_update('upload') - ->fields(array( + ->columns(array( 'list' => $file->list, 'description' => $file->description, 'weight' => $file->weight, Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.49 diff -u -F^[fc] -r1.49 user.admin.inc --- modules/user/user.admin.inc 16 May 2009 20:10:50 -0000 1.49 +++ modules/user/user.admin.inc 17 May 2009 15:43:30 -0000 @@ -153,7 +153,7 @@ function user_admin_account() { $query = $query->extend('PagerDefault')->extend('TableSort'); $query - ->fields('u', array('uid', 'name', 'status', 'created', 'access')) + ->columns('u', array('uid', 'name', 'status', 'created', 'access')) ->limit(50) ->setHeader($header) ->setCountQuery($count_query); @@ -639,7 +639,7 @@ function user_admin_perm_submit($form, & db_delete('role_permission') ->condition('rid', $rid) ->execute(); - $query = db_insert('role_permission')->fields(array('rid', 'permission')); + $query = db_insert('role_permission')->columns(array('rid', 'permission')); foreach ($checked as $permission) { $query->values(array( 'rid' => $rid, @@ -754,13 +754,13 @@ function user_admin_role() { function user_admin_role_validate($form, &$form_state) { if ($form_state['values']['name']) { if ($form_state['values']['op'] == t('Save role')) { - $existing_role = (bool) db_query_range("SELECT 1 FROM {role} WHERE name = :name AND rid != :rid", array(':name' => $form_state['values']['name'], ':rid' => $form_state['values']['rid']), 0, 1)->fetchField(); + $existing_role = (bool) db_query_range("SELECT 1 FROM {role} WHERE name = :name AND rid != :rid", array(':name' => $form_state['values']['name'], ':rid' => $form_state['values']['rid']), 0, 1)->fetchColumn(); if ($existing_role) { form_set_error('name', t('The role name %name already exists. Please choose another role name.', array('%name' => $form_state['values']['name']))); } } elseif ($form_state['values']['op'] == t('Add role')) { - if ((bool) db_query_range('SELECT 1 FROM {role} WHERE name = :name', array(':name' => $form_state['values']['name']), 0, 1)->fetchField()) { + if ((bool) db_query_range('SELECT 1 FROM {role} WHERE name = :name', array(':name' => $form_state['values']['name']), 0, 1)->fetchColumn()) { form_set_error('name', t('The role name %name already exists. Please choose another role name.', array('%name' => $form_state['values']['name']))); } } @@ -773,7 +773,7 @@ function user_admin_role_validate($form, function user_admin_role_submit($form, &$form_state) { if ($form_state['values']['op'] == t('Save role')) { db_update('role') - ->fields(array('name' => $form_state['values']['name'])) + ->columns(array('name' => $form_state['values']['name'])) ->condition('rid', $form_state['values']['rid']) ->execute(); drupal_set_message(t('The role has been renamed.')); @@ -794,7 +794,7 @@ function user_admin_role_submit($form, & } elseif ($form_state['values']['op'] == t('Add role')) { db_insert('role') - ->fields(array('name' => $form_state['values']['name'])) + ->columns(array('name' => $form_state['values']['name'])) ->execute(); drupal_set_message(t('The role has been added.')); } Index: modules/user/user.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.api.php,v retrieving revision 1.5 diff -u -F^[fc] -r1.5 user.api.php --- modules/user/user.api.php 30 Apr 2009 16:10:10 -0000 1.5 +++ modules/user/user.api.php 17 May 2009 15:43:30 -0000 @@ -130,7 +130,7 @@ function hook_user_cancel($edit, $accoun // Unpublish nodes (current revisions). module_load_include('inc', 'node', 'node.admin'); $nodes = db_select('node', 'n') - ->fields('n', array('nid')) + ->columns('n', array('nid')) ->condition('uid', $account->uid) ->execute() ->fetchCol(); @@ -141,14 +141,14 @@ function hook_user_cancel($edit, $accoun // Anonymize nodes (current revisions). module_load_include('inc', 'node', 'node.admin'); $nodes = db_select('node', 'n') - ->fields('n', array('nid')) + ->columns('n', array('nid')) ->condition('uid', $account->uid) ->execute() ->fetchCol(); node_mass_update($nodes, array('uid' => 0)); // Anonymize old revisions. db_update('node_revision') - ->fields(array('uid' => 0)) + ->columns(array('uid' => 0)) ->condition('uid', $account->uid) ->execute(); // Clean history. @@ -160,7 +160,7 @@ function hook_user_cancel($edit, $accoun case 'user_cancel_delete': // Delete nodes (current revisions). $nodes = db_select('node', 'n') - ->fields('n', array('nid')) + ->columns('n', array('nid')) ->condition('uid', $account->uid) ->execute() ->fetchCol(); Index: modules/user/user.install =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.install,v retrieving revision 1.24 diff -u -F^[fc] -r1.24 user.install --- modules/user/user.install 13 May 2009 19:42:18 -0000 1.24 +++ modules/user/user.install 17 May 2009 15:43:30 -0000 @@ -12,7 +12,7 @@ function user_schema() { $schema['authmap'] = array( 'description' => 'Stores distributed authentication mapping.', - 'fields' => array( + 'columns' => array( 'aid' => array( 'description' => 'Primary Key: Unique authmap ID.', 'type' => 'serial', @@ -48,7 +48,7 @@ function user_schema() { $schema['role_permission'] = array( 'description' => 'Stores the permissions assigned to user roles.', - 'fields' => array( + 'columns' => array( 'rid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -71,7 +71,7 @@ function user_schema() { $schema['role'] = array( 'description' => 'Stores user roles.', - 'fields' => array( + 'columns' => array( 'rid' => array( 'type' => 'serial', 'unsigned' => TRUE, @@ -94,7 +94,7 @@ function user_schema() { $schema['users'] = array( 'description' => 'Stores user data.', - 'fields' => array( + 'columns' => array( 'uid' => array( 'type' => 'serial', 'unsigned' => TRUE, @@ -208,7 +208,7 @@ function user_schema() { $schema['users_roles'] = array( 'description' => 'Maps users to roles.', - 'fields' => array( + 'columns' => array( 'uid' => array( 'type' => 'int', 'unsigned' => TRUE, @@ -250,9 +250,9 @@ function user_update_7000(&$sandbox) { $hash_count_log2 = 11; // Multi-part update. if (!isset($sandbox['user_from'])) { - db_change_field($ret, 'users', 'pass', 'pass', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '')); + db_change_column($ret, 'users', 'pass', 'pass', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '')); $sandbox['user_from'] = 0; - $sandbox['user_count'] = db_query("SELECT COUNT(uid) FROM {users}")->fetchField(); + $sandbox['user_count'] = db_query("SELECT COUNT(uid) FROM {users}")->fetchColumn(); } else { require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc'); @@ -268,7 +268,7 @@ function user_update_7000(&$sandbox) { // Indicate an updated password. $new_hash = 'U' . $new_hash; db_update('users') - ->fields(array('pass' => $new_hash)) + ->columns(array('pass' => $new_hash)) ->condition('uid', $account->uid) ->execute(); } @@ -291,9 +291,9 @@ function user_update_7000(&$sandbox) { function user_update_7001() { $ret = array(); - db_drop_field($ret, 'users', 'threshold'); - db_drop_field($ret, 'users', 'mode'); - db_drop_field($ret, 'users', 'sort'); + db_drop_column($ret, 'users', 'threshold'); + db_drop_column($ret, 'users', 'mode'); + db_drop_column($ret, 'users', 'sort'); return $ret; } @@ -306,9 +306,9 @@ function user_update_7002(&$sandbox) { // Multi-part update. if (!isset($sandbox['user_from'])) { - db_change_field($ret, 'users', 'timezone', 'timezone', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE)); + db_change_column($ret, 'users', 'timezone', 'timezone', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE)); $sandbox['user_from'] = 0; - $sandbox['user_count'] = db_query("SELECT COUNT(uid) FROM {users}")->fetchField(); + $sandbox['user_count'] = db_query("SELECT COUNT(uid) FROM {users}")->fetchColumn(); $sandbox['user_not_migrated'] = 0; } else { @@ -324,7 +324,7 @@ function user_update_7002(&$sandbox) { // If the contributed Date module has created a users.timezone_name // column, use this data to set each user's time zone. if ($contributed_date_module) { - $date_timezone = db_query("SELECT timezone_name FROM {users} WHERE uid = :uid", array(':uid' => $account->uid))->fetchField(); + $date_timezone = db_query("SELECT timezone_name FROM {users} WHERE uid = :uid", array(':uid' => $account->uid))->fetchColumn(); if (isset($timezones[$date_timezone])) { $timezone = $date_timezone; } @@ -333,7 +333,7 @@ function user_update_7002(&$sandbox) { // use that information to update the user accounts. if (!$timezone && $contributed_event_module) { try { - $event_timezone = db_query("SELECT t.name FROM {users} u LEFT JOIN {event_timezones} t ON u.timezone_id = t.timezone WHERE u.uid = :uid", array(':uid' => $account->uid))->fetchField(); + $event_timezone = db_query("SELECT t.name FROM {users} u LEFT JOIN {event_timezones} t ON u.timezone_id = t.timezone WHERE u.uid = :uid", array(':uid' => $account->uid))->fetchColumn(); $event_timezone = str_replace(' ', '_', $event_timezone); if (isset($timezones[$event_timezone])) { $timezone = $event_timezone; @@ -412,13 +412,13 @@ function user_update_7004(&$sandbox) { // update. if (!db_column_exists('users', 'picture_fid')) { // Add a new field for the fid. - db_add_field($ret, 'users', 'picture_fid', $picture_field); + db_add_column($ret, 'users', 'picture_fid', $picture_field); } // Initialize batch update information. $sandbox['progress'] = 0; $sandbox['last_user_processed'] = -1; - $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE picture <> ''")->fetchField(); + $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE picture <> ''")->fetchColumn(); } // As a batch operation move the photos into the {files} table and update the @@ -448,7 +448,7 @@ function user_update_7004(&$sandbox) { } db_update('users') - ->fields(array('picture_fid' => $file->fid)) + ->columns(array('picture_fid' => $file->fid)) ->condition('uid', $user->uid) ->execute(); @@ -464,8 +464,8 @@ function user_update_7004(&$sandbox) { // When we're finished, drop the old picture field and rename the new one to // replace it. if (isset($ret['#finished']) && $ret['#finished'] == 1) { - db_drop_field($ret, 'users', 'picture'); - db_change_field($ret, 'users', 'picture_fid', 'picture', $picture_field); + db_drop_column($ret, 'users', 'picture'); + db_change_column($ret, 'users', 'picture_fid', 'picture', $picture_field); } return $ret; Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.987 diff -u -F^[fc] -r1.987 user.module --- modules/user/user.module 16 May 2009 15:23:16 -0000 1.987 +++ modules/user/user.module 17 May 2009 15:43:30 -0000 @@ -102,7 +102,7 @@ function user_field_build_modes($obj_typ } function user_external_load($authname) { - $uid = db_query("SELECT uid FROM {authmap} WHERE authname = :authname", array(':authname' => $authname))->fetchField(); + $uid = db_query("SELECT uid FROM {authmap} WHERE authname = :authname", array(':authname' => $authname))->fetchColumn(); if ($uid) { return user_load($uid); @@ -200,7 +200,7 @@ function user_load_multiple($uids = arra // Load any remaining users from the database, this is necessary if we have // $uids still to load, or if $conditions was passed without $uids. if ($uids || ($conditions && !$passed_uids)) { - $query = db_select('users', 'u')->fields('u'); + $query = db_select('users', 'u')->columns('u'); // If the $uids array is populated, add those to the query. if ($uids) { @@ -362,7 +362,7 @@ function user_load_by_name($name) { */ function user_save($account, $edit = array(), $category = 'account') { $table = drupal_get_schema('users'); - $user_fields = $table['fields']; + $user_fields = $table['columns']; if (!empty($edit['pass'])) { // Allow alternate password hashing schemes. @@ -395,7 +395,7 @@ function user_save($account, $edit = arr } if (is_object($account) && !$account->is_new) { user_module_invoke('update', $edit, $account, $category); - $data = unserialize(db_query('SELECT data FROM {users} WHERE uid = :uid', array(':uid' => $account->uid))->fetchField()); + $data = unserialize(db_query('SELECT data FROM {users} WHERE uid = :uid', array(':uid' => $account->uid))->fetchColumn()); // Consider users edited by an administrator as logged in, if they haven't // already, so anonymous users can view the profile (if allowed). if (empty($edit['access']) && empty($account->access) && user_access('administer users')) { @@ -460,7 +460,7 @@ function user_save($account, $edit = arr ->condition('uid', $account->uid) ->execute(); - $query = db_insert('users_roles')->fields(array('uid', 'rid')); + $query = db_insert('users_roles')->columns(array('uid', 'rid')); foreach (array_keys($edit['roles']) as $rid) { if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) { $query->values(array( @@ -549,7 +549,7 @@ function user_save($account, $edit = arr db_delete('users_roles') ->condition('uid', $edit['uid']) ->execute(); - $query = db_insert('users_roles')->fields(array('uid', 'rid')); + $query = db_insert('users_roles')->columns(array('uid', 'rid')); foreach (array_keys($edit['roles']) as $rid) { if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) { $query->values(array( @@ -822,7 +822,7 @@ function user_file_download($filepath) { */ function user_file_references($file) { // Determine if the file is used by this module. - $file_used = (bool) db_query_range('SELECT 1 FROM {users} WHERE picture = :fid', array(':fid' => $file->fid), 0, 1)->fetchField(); + $file_used = (bool) db_query_range('SELECT 1 FROM {users} WHERE picture = :fid', array(':fid' => $file->fid), 0, 1)->fetchColumn(); if ($file_used) { // Return the name of the module and how many references it has to the file. return array('user' => $count); @@ -835,7 +835,7 @@ function user_file_references($file) { function user_file_delete($file) { // Remove any references to the file. db_update('users') - ->fields(array('picture' => 0)) + ->columns(array('picture' => 0)) ->condition('picture', $file->fid) ->execute(); } @@ -855,7 +855,7 @@ function user_search($op = 'search', $ke // Replace wildcards with MySQL/PostgreSQL wildcards. $keys = preg_replace('!\*+!', '%', $keys); $query = db_select('users')->extend('PagerDefault'); - $query->fields('users', array('name', 'uid', 'mail')); + $query->columns('users', array('name', 'uid', 'mail')); if (user_access('administer users')) { // Administrators can also search in the otherwise private email field. $query->condition(db_or()-> @@ -935,7 +935,7 @@ function user_user_validate(&$edit, &$ac if ($error = user_validate_name($edit['name'])) { form_set_error('name', $error); } - elseif ((bool) db_query_range("SELECT 1 FROM {users} WHERE uid != :uid AND LOWER(name) = LOWER(:name)", array(':uid' => $uid, ':name' => $edit['name']), 0, 1)->fetchField()) { + elseif ((bool) db_query_range("SELECT 1 FROM {users} WHERE uid != :uid AND LOWER(name) = LOWER(:name)", array(':uid' => $uid, ':name' => $edit['name']), 0, 1)->fetchColumn()) { form_set_error('name', t('The name %name is already taken.', array('%name' => $edit['name']))); } } @@ -944,7 +944,7 @@ function user_user_validate(&$edit, &$ac if ($error = user_validate_mail($edit['mail'])) { form_set_error('mail', $error); } - elseif ((bool) db_query_range("SELECT 1 FROM {users} WHERE uid != :uid AND LOWER(mail) = LOWER(:mail)", array(':uid' => $uid, ':mail' => $edit['mail']), 0, 1)->fetchField()) { + elseif ((bool) db_query_range("SELECT 1 FROM {users} WHERE uid != :uid AND LOWER(mail) = LOWER(:mail)", array(':uid' => $uid, ':mail' => $edit['mail']), 0, 1)->fetchColumn()) { // Format error message dependent on whether the user is logged in or not. if ($GLOBALS['user']->uid) { form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => $edit['mail']))); @@ -958,8 +958,8 @@ function user_user_validate(&$edit, &$ac // Signatures are disabled by default, so make sure it exists first. if (isset($edit['signature'])) { $user_schema = drupal_get_schema('users'); - if (strlen($edit['signature']) > $user_schema['fields']['signature']['length']) { - form_set_error('signature', t('The signature is too long: it must be %max characters or less.', array('%max' => $user_schema['fields']['signature']['length']))); + if (strlen($edit['signature']) > $user_schema['columns']['signature']['length']) { + form_set_error('signature', t('The signature is too long: it must be %max characters or less.', array('%max' => $user_schema['columns']['signature']['length']))); } } } @@ -1122,7 +1122,7 @@ function user_block_view($delta = '') { // Perform database queries to gather online user lists. We use s.timestamp // rather than u.access because it is much faster. - $authenticated_count = db_query("SELECT COUNT(DISTINCT s.uid) FROM {sessions} s WHERE s.timestamp >= :timestamp AND s.uid > 0", array(':timestamp' => $interval))->fetchField(); + $authenticated_count = db_query("SELECT COUNT(DISTINCT s.uid) FROM {sessions} s WHERE s.timestamp >= :timestamp AND s.uid > 0", array(':timestamp' => $interval))->fetchColumn(); // When page caching is enabled, sessions are only created for // anonymous users when needed. @@ -1550,7 +1550,7 @@ function user_set_authmaps($account, $au 'uid' => $account->uid, 'module' => $module[1], )) - ->fields(array('authname' => $value)) + ->columns(array('authname' => $value)) ->execute(); } else { @@ -1671,7 +1671,7 @@ function user_authenticate($form_values $new_hash = user_hash_password($password); if ($new_hash) { db_update('users') - ->fields(array('pass' => $new_hash)) + ->columns(array('pass' => $new_hash)) ->condition('uid', $account->uid) ->execute(); } @@ -1701,7 +1701,7 @@ function user_authenticate_finalize(&$ed // This is also used to invalidate one-time login links. $user->login = REQUEST_TIME; db_update('users') - ->fields(array('login' => $user->login)) + ->columns(array('login' => $user->login)) ->condition('uid', $user->uid) ->execute(); // Regenerate the session ID to prevent against session fixation attacks. @@ -1975,7 +1975,7 @@ function _user_cancel($edit, $account, $ _user_mail_notify('status_blocked', $account); } db_update('users') - ->fields(array('status' => 0)) + ->columns(array('status' => 0)) ->condition('uid', $account->uid) ->execute(); drupal_set_message(t('%name has been disabled.', array('%name' => $account->name))); @@ -2271,7 +2271,7 @@ function user_user_operations_block($acc function user_multiple_role_edit($accounts, $operation, $rid) { // The role name is not necessary as user_save() will reload the user // object, but some modules' hook_user() may look at this first. - $role_name = db_query('SELECT name FROM {role} WHERE rid = :rid', array(':rid' => $rid))->fetchField(); + $role_name = db_query('SELECT name FROM {role} WHERE rid = :rid', array(':rid' => $rid))->fetchColumn(); switch ($operation) { case 'add_role': @@ -2303,7 +2303,7 @@ function user_multiple_cancel_confirm(&$ $form['accounts'] = array('#prefix' => '
    ', '#suffix' => '
', '#tree' => TRUE); // array_filter() returns only elements with TRUE values. foreach (array_filter($edit['accounts']) as $uid => $value) { - $user = db_query('SELECT name FROM {users} WHERE uid = :uid', array(':uid' => $uid))->fetchField(); + $user = db_query('SELECT name FROM {users} WHERE uid = :uid', array(':uid' => $uid))->fetchColumn(); $form['accounts'][$uid] = array('#type' => 'hidden', '#value' => $uid, '#prefix' => '
  • ', '#suffix' => check_plain($user) . "
  • \n"); } @@ -2723,7 +2723,7 @@ function user_block_user_action(&$object $uid = $user->uid; } db_update('users') - ->fields(array('status' => 0)) + ->columns(array('status' => 0)) ->condition('uid', $uid) ->execute(); drupal_session_destroy_uid($uid); Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.36 diff -u -F^[fc] -r1.36 user.test --- modules/user/user.test 13 May 2009 17:23:48 -0000 1.36 +++ modules/user/user.test 17 May 2009 15:43:30 -0000 @@ -954,12 +954,12 @@ class UserBlocksUnitTests extends Drupal $user1 = $this->drupalCreateUser(array()); $user2 = $this->drupalCreateUser(array()); $user3 = $this->drupalCreateUser(array()); - $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions}")->fetchField(), 0, t('Sessions table is empty.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions}")->fetchColumn(), 0, t('Sessions table is empty.')); // Insert a user with two sessions. $this->insertSession(array('uid' => $user1->uid)); $this->insertSession(array('uid' => $user1->uid)); - $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions} WHERE uid = :uid", array(':uid' => $user1->uid))->fetchField(), 2, t('Duplicate user session has been inserted.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions} WHERE uid = :uid", array(':uid' => $user1->uid))->fetchColumn(), 2, t('Duplicate user session has been inserted.')); // Insert a user with only one session. $this->insertSession(array('uid' => $user2->uid, 'timestamp' => REQUEST_TIME + 1)); @@ -992,9 +992,9 @@ class UserBlocksUnitTests extends Drupal 'timestamp' => REQUEST_TIME, ); db_insert('sessions') - ->fields($fields) + ->columns($fields) ->execute(); - $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions} WHERE uid = :uid AND sid = :sid AND timestamp = :timestamp", array(':uid' => $fields['uid'], ':sid' => $fields['sid'], ':timestamp' => $fields['timestamp']))->fetchField(), 1, t('Session record inserted.')); + $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions} WHERE uid = :uid AND sid = :sid AND timestamp = :timestamp", array(':uid' => $fields['uid'], ':sid' => $fields['sid'], ':timestamp' => $fields['timestamp']))->fetchColumn(), 1, t('Session record inserted.')); } } Index: profiles/default/default.profile =================================================================== RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v retrieving revision 1.41 diff -u -F^[fc] -r1.41 default.profile --- profiles/default/default.profile 30 Apr 2009 21:44:20 -0000 1.41 +++ profiles/default/default.profile 17 May 2009 15:43:30 -0000 @@ -144,7 +144,7 @@ function default_profile_tasks(&$task, $ 'cache' => -1, ), ); - $query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache')); + $query = db_insert('block')->columns(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache')); foreach ($values as $record) { $query->values($record); } @@ -190,7 +190,7 @@ function default_profile_tasks(&$task, $ $description = st('Use tags to group articles on similar topics into categories.'); $help = st('Enter a comma-separated list of words.'); - $vid = db_insert('taxonomy_vocabulary')->fields(array( + $vid = db_insert('taxonomy_vocabulary')->columns(array( 'name' => 'Tags', 'description' => $description, 'help' => $help, @@ -202,7 +202,7 @@ function default_profile_tasks(&$task, $ 'module' => 'taxonomy', 'weight' => 0, ))->execute(); - db_insert('taxonomy_vocabulary_node_type')->fields(array('vid' => $vid, 'type' => 'article'))->execute(); + db_insert('taxonomy_vocabulary_node_type')->columns(array('vid' => $vid, 'type' => 'article'))->execute(); // Update the menu router information. menu_rebuild(); Index: profiles/expert/expert.profile =================================================================== RCS file: /cvs/drupal/drupal/profiles/expert/expert.profile,v retrieving revision 1.7 diff -u -F^[fc] -r1.7 expert.profile --- profiles/expert/expert.profile 30 Apr 2009 21:44:20 -0000 1.7 +++ profiles/expert/expert.profile 17 May 2009 15:43:30 -0000 @@ -85,7 +85,7 @@ function expert_profile_tasks(&$task, $u 'cache' => -1, ), ); - $query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache')); + $query = db_insert('block')->columns(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache')); foreach ($values as $record) { $query->values($record); }