db_select

  1. drupal
    1. 7
Versions
7 db_select($table, $alias = NULL, array $options = array())

Returns a new SelectQuery object for the active database.

Parameters

$table The base table for this query. May be a string or another SelectQuery object. If a query object is passed, it will be used as a subselect.

$alias The alias for the base table of this query.

$options An array of options to control how the query operates.

Return value

SelectQuery A new SelectQuery object for this connection.

Related topics

▾ 162 functions call db_select()

actions_do in drupal/includes/actions.inc
Performs a given list of actions by executing their callback functions.
batch_example_lowest_nid in examples/batch_example/batch_example.module
Utility function - simply queries and loads the lowest nid.
batch_example_op_2 in examples/batch_example/batch_example.module
Batch operation for batch 2 : load all nodes, 5 by five After each group of 5 control is returned to the batch API for later continuation.
batch_example_update_7100 in examples/batch_example/batch_example.install
Example of batch-driven update function.
blog_block_view in drupal/modules/blog/blog.module
Implements hook_block_view().
blog_feed_last in drupal/modules/blog/blog.pages.inc
Menu callback; displays an RSS feed containing recent blog entries of all users.
blog_feed_user in drupal/modules/blog/blog.pages.inc
Menu callback; displays an RSS feed containing recent blog entries of a given user.
blog_page_last in drupal/modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of all users.
blog_page_user in drupal/modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of a given user.
book_block_view in drupal/modules/book/book.module
Implements hook_block_view().
book_get_books in drupal/modules/book/book.module
Returns an array of all books.
book_menu_subtree_data in drupal/modules/book/book.module
Get the data representing a subtree of the book hierarchy.
book_update_bid in drupal/modules/book/book.module
Update the bid for a page and its children when it is moved to a new book.
comment_admin_overview in drupal/modules/comment/comment.admin.inc
Form builder for the comment overview administration form.
comment_enable in drupal/modules/comment/comment.install
Implements hook_enable().
comment_form_validate in drupal/modules/comment/comment.module
Validate comment form submissions.
comment_get_display_ordinal in drupal/modules/comment/comment.module
Get the display ordinal for a comment, starting from 0.
comment_get_recent in drupal/modules/comment/comment.module
Find the most recent comments that are available to the current user.
comment_get_thread in drupal/modules/comment/comment.module
Retrieve comments for a thread.
comment_new_page_count in drupal/modules/comment/comment.module
Calculate page number for first new comment.
comment_update_7006 in drupal/modules/comment/comment.install
Migrate data from the comment field to field storage.
contact_category_edit_form_validate in drupal/modules/contact/contact.admin.inc
Validate the contact category edit page form submission.
contact_category_list in drupal/modules/contact/contact.admin.inc
Categories/list tab.
contact_load in drupal/modules/contact/contact.module
Load a contact category.
contact_site_form in drupal/modules/contact/contact.pages.inc
Form builder; the site-wide contact form.
dashboard_disable in drupal/modules/dashboard/dashboard.install
Implements hook_disable().
dashboard_page_build in drupal/modules/dashboard/dashboard.module
Implements hook_page_build().
database_test_db_query_temporary in drupal/modules/simpletest/tests/database_test.module
Run a db_query_temporary and output the table name and its number of rows.
database_test_even_pager_query in drupal/modules/simpletest/tests/database_test.module
Run a pager query and return the results.
database_test_odd_pager_query in drupal/modules/simpletest/tests/database_test.module
Run a pager query and return the results.
database_test_tablesort in drupal/modules/simpletest/tests/database_test.module
Run a tablesort query and return the results.
database_test_tablesort_first in drupal/modules/simpletest/tests/database_test.module
Run a tablesort query with a second order_by after and return the results.
database_test_theme_tablesort in drupal/modules/simpletest/tests/database_test.module
Output a form without setting a header sort.
dblog_cron in drupal/modules/dblog/dblog.module
Implements hook_cron().
dblog_overview in drupal/modules/dblog/dblog.admin.inc
Menu callback; displays a listing of log messages.
dblog_top in drupal/modules/dblog/dblog.admin.inc
Menu callback; generic function to display a page of the most frequent events.
dbtng_example_advanced_list in examples/dbtng_example/dbtng_example.module
Render a filtered list of entries in the database.
dbtng_example_entry_load in examples/dbtng_example/dbtng_example.module
Read from the database using a filter array.
DrupalDatabaseCache::isEmpty in drupal/includes/cache.inc
Check if a cache bin is empty.
DrupalDefaultEntityController::buildQuery in drupal/includes/entity.inc
Builds the query to load the entity.
drupal_uninstall_modules in drupal/includes/install.inc
Uninstalls a given list of modules.
EntityFieldQuery::propertyQuery in drupal/includes/entity.inc
Queries entity tables in SQL for property conditions and sorts.
field_read_fields in drupal/modules/field/field.crud.inc
Reads in fields that match an array of conditions.
field_read_instances in drupal/modules/field/field.crud.inc
Reads in field instances that match an array of conditions.
field_sql_storage_field_storage_load in drupal/modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_load().
field_sql_storage_field_storage_query in drupal/modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_query().
field_sql_storage_update_7001 in drupal/modules/field/modules/field_sql_storage/field_sql_storage.install
Remove the field_config_entity_type table and store 'entity_type' strings.
field_sql_storage_update_7002 in drupal/modules/field/modules/field_sql_storage/field_sql_storage.install
Fix primary keys in field revision data tables.
field_test_entity_test_load in drupal/modules/field/tests/field_test.entity.inc
Loads a test_entity.
file_space_used in drupal/includes/file.inc
Determine total disk space used by a single user or the whole filesystem.
file_usage_list in drupal/includes/file.inc
Determines where a file is used.
filter_formats in drupal/modules/filter/filter.module
Retrieve a list of text formats, ordered by weight.
filter_update_7003 in drupal/modules/filter/filter.install
Upgrade the {filter} table for core filters.
forum_block_view in drupal/modules/forum/forum.module
Implements hook_block_view().
forum_forum_load in drupal/modules/forum/forum.module
Returns a tree of all forums for a given taxonomy term ID.
forum_get_topics in drupal/modules/forum/forum.module
forum_node_load in drupal/modules/forum/forum.module
Implements hook_node_load().
forum_update_7001 in drupal/modules/forum/forum.install
Create new {forum_index} table.
hook_field_storage_load in drupal/modules/field/field.api.php
Load field data for a set of entities.
hook_field_storage_query in drupal/modules/field/field.api.php
Execute an EntityFieldQuery.
hook_search_execute in drupal/modules/search/search.api.php
Execute a search for a set of key words.
hook_update_N in drupal/modules/system/system.api.php
Perform a single update.
hook_user_cancel in drupal/modules/user/user.api.php
Act on user account cancellations.
image_effects in drupal/modules/image/image.module
Load all image effects from the database.
image_styles in drupal/modules/image/image.module
Get an array of all styles and their settings.
locale_batch_by_language in drupal/includes/locale.inc
Prepare a batch to import translations for all enabled modules in a given language.
menu_contextual_links in drupal/includes/menu.inc
Retrieve contextual links for a system object based on registered local tasks.
menu_get_names in drupal/includes/menu.inc
Build a list of named menus.
menu_link_children_relative_depth in drupal/includes/menu.inc
Find the depth of an item's children relative to its depth.
menu_link_get_preferred in drupal/includes/menu.inc
Lookup the preferred menu link for a given system path.
menu_link_load in drupal/includes/menu.inc
Get a menu link by its mlid, access checked and link translated for rendering.
menu_load_links in drupal/includes/menu.inc
Returns an array containing all links for a menu.
menu_local_tasks in drupal/includes/menu.inc
Collects the local tasks (tabs), action links, and the root path.
menu_tree_check_access in drupal/includes/menu.inc
Check access and perform other dynamic operations for each link in the tree.
menu_tree_page_data in drupal/includes/menu.inc
Get the data structure representing a named menu tree, based on the current page.
nodeapi_example_node_load in examples/nodeapi_example/nodeapi_example.module
Implements hook_node_load().
nodeapi_example_node_update in examples/nodeapi_example/nodeapi_example.module
Implements hook_node_update().
node_access in drupal/modules/node/node.module
Determine whether the current user may perform the given operation on the specified node.
node_access_example_private_node_listing in examples/node_access_example/node_access_example.module
Information for the user about what nodes are marked private on the system and which of those the user has access to.
node_access_test_page in drupal/modules/node/tests/node_access_test.module
Page callback for node access test page.
node_access_view_all_nodes in drupal/modules/node/node.module
Determines whether the user has a global viewing grant for all nodes.
node_admin_nodes in drupal/modules/node/node.admin.inc
Form builder: Builds the node administration overview.
node_feed in drupal/modules/node/node.module
A generic function for generating RSS feeds from a set of nodes.
node_get_recent in drupal/modules/node/node.module
Find the most recent nodes that are available to the current user.
node_page_default in drupal/modules/node/node.module
Menu callback; Generate a listing of promoted nodes.
node_search_execute in drupal/modules/node/node.module
Implements hook_search_execute().
node_update_7000 in drupal/modules/node/node.install
Upgrade the node type table and fix node type 'module' attribute to avoid name-space conflicts.
node_update_7006 in drupal/modules/node/node.install
Convert body and teaser from node properties to fields, and migrate status/comment/promote and sticky columns to the {node_revision} table.
node_user_cancel in drupal/modules/node/node.module
Implements hook_user_cancel().
node_user_delete in drupal/modules/node/node.module
Implements hook_user_delete().
path_admin_overview in drupal/modules/path/path.admin.inc
Return a listing of all defined URL aliases.
path_form_element_validate in drupal/modules/path/path.module
Form element validation handler for URL alias form element.
path_load in drupal/includes/path.inc
Fetch a specific URL alias from the database.
poll_block_view in drupal/modules/poll/poll.module
Implements hook_block_view().
poll_load in drupal/modules/poll/poll.module
Implements hook_load().
poll_page in drupal/modules/poll/poll.pages.inc
Menu callback to provide a simple list of all polls available.
poll_votes in drupal/modules/poll/poll.pages.inc
Callback for the 'votes' tab for polls you can see other votes on
profile_admin_settings_autocomplete in drupal/modules/profile/profile.admin.inc
Retrieve a pipe delimited string of autocomplete suggestions for profile categories
profile_autocomplete in drupal/modules/profile/profile.pages.inc
Callback to allow autocomplete of profile text fields.
profile_browse in drupal/modules/profile/profile.pages.inc
Menu callback; display a list of user information.
profile_field_form_validate in drupal/modules/profile/profile.admin.inc
Validate profile_field_form submissions.
SearchQuery::countQuery in drupal/modules/search/search.extender.inc
Builds the default count query for SearchQuery.
shortcut_current_displayed_set in drupal/modules/shortcut/shortcut.module
Returns the current displayed shortcut set for the provided user account.
shortcut_sets in drupal/modules/shortcut/shortcut.module
Returns an array of all shortcut sets, keyed by the set name.
shortcut_set_load in drupal/modules/shortcut/shortcut.module
Loads the data for a shortcut set.
simpletest_result_get in drupal/modules/simpletest/simpletest.pages.inc
Get test results for $test_id.
statistics_node_tracker in drupal/modules/statistics/statistics.pages.inc
statistics_recent_hits in drupal/modules/statistics/statistics.admin.inc
Menu callback; presents the "recent hits" page.
statistics_title_list in drupal/modules/statistics/statistics.module
Returns all time or today top or last viewed node(s).
statistics_top_pages in drupal/modules/statistics/statistics.admin.inc
Menu callback; presents the "top pages" page.
statistics_top_referrers in drupal/modules/statistics/statistics.admin.inc
Menu callback; presents the "referrer" page.
statistics_top_visitors in drupal/modules/statistics/statistics.admin.inc
Menu callback; presents the "top visitors" page.
statistics_user_tracker in drupal/modules/statistics/statistics.pages.inc
system_actions_manage in drupal/modules/system/system.admin.inc
Menu callback; Displays an overview of available and configured actions.
system_admin_menu_block in drupal/modules/system/system.module
Provide a single block on the administration overview page.
system_get_module_admin_tasks in drupal/modules/system/system.module
Generate a list of tasks offered by a specified module.
system_update_7061 in drupal/modules/system/system.install
Migrate upload.module data to the newly created file field.
taxonomy_autocomplete in drupal/modules/taxonomy/taxonomy.pages.inc
Helper function for autocompletion
taxonomy_get_children in drupal/modules/taxonomy/taxonomy.module
Finds all children of a term ID.
taxonomy_get_parents in drupal/modules/taxonomy/taxonomy.module
Finds all parents of a given term ID.
taxonomy_get_tree in drupal/modules/taxonomy/taxonomy.module
Create a hierarchical representation of a vocabulary.
taxonomy_select_nodes in drupal/modules/taxonomy/taxonomy.module
Return nodes attached to a term across all field instances.
taxonomy_test_get_antonym in drupal/modules/simpletest/tests/taxonomy_test.module
Return the antonym of the given term ID.
taxonomy_tokens in drupal/modules/taxonomy/taxonomy.tokens.inc
Implements hook_tokens().
taxonomy_update_7005 in drupal/modules/taxonomy/taxonomy.install
Migrate {taxonomy_term_node} table to field storage.
tracker_cron in drupal/modules/tracker/tracker.module
Implements hook_cron().
tracker_page in drupal/modules/tracker/tracker.pages.inc
Menu callback; prints a listing of active nodes on the site.
translation_node_get_translations in drupal/modules/translation/translation.module
Get all nodes in a translation set, represented by $tnid.
update_fix_d7_block_deltas in drupal/includes/update.inc
A helper function that modules can use to assist with the transformation from numeric block deltas to string block deltas during the 6.x -> 7.x upgrade.
update_fix_d7_install_profile in drupal/includes/update.inc
Register the currently installed profile in the system table.
user_account_form_validate in drupal/modules/user/user.module
Form validation handler for user_account_form().
user_admin_account in drupal/modules/user/user.admin.inc
Form builder; User administration page.
user_autocomplete in drupal/modules/user/user.pages.inc
Menu callback; Retrieve a JSON object containing autocomplete suggestions for existing users.
user_is_blocked in drupal/modules/user/user.module
Checks for usernames blocked by user administration.
user_roles in drupal/modules/user/user.module
Retrieve an array of roles matching specified conditions.
user_role_load in drupal/modules/user/user.module
Fetches a user role by role ID.
user_role_load_by_name in drupal/modules/user/user.module
Fetches a user role by role name.
user_role_save in drupal/modules/user/user.module
Save a user role to the database.
user_search_execute in drupal/modules/user/user.module
Implements hook_search_execute().
user_update_7011 in drupal/modules/user/user.install
Updates email templates to use new tokens.
_block_load_blocks in drupal/modules/block/block.module
Load blocks information from the database.
_block_rehash in drupal/modules/block/block.module
Update the 'block' DB table with the blocks currently exported by modules.
_blog_post_exists in drupal/modules/blog/blog.module
Helper function to determine if a user has blog posts already.
_forum_topics_unread in drupal/modules/forum/forum.module
Calculate the number of nodes the user has not yet read and are newer than NODE_NEW_LIMIT.
_locale_translate_seek in drupal/includes/locale.inc
Perform a string search and display results in a table
_menu_build_tree in drupal/includes/menu.inc
Build a menu tree.
_menu_find_router_path in drupal/includes/menu.inc
Find the router path which will serve this path.
_menu_link_find_parent in drupal/includes/menu.inc
Find a possible parent for a given menu link.
_menu_navigation_links_rebuild in drupal/includes/menu.inc
Helper function to build menu links for the items in the menu router.
_menu_update_parental_status in drupal/includes/menu.inc
Check and update the has_children status for the parent of a link.
_node_types_build in drupal/modules/node/node.module
Builds and returns the list of available node types.
_profile_get_fields in drupal/modules/profile/profile.module
_rdf_mapping_load in drupal/modules/rdf/rdf.module
Helper function to retrieve an RDF mapping from the database.
_search_get_module_names in drupal/modules/search/search.admin.inc
Helper function to get real module names.
_token_example_get_comment in examples/token_example/token_example.module
Build a list of available comments.
_token_example_get_file in examples/token_example/token_example.module
Build a list of available files.
_token_example_get_node in examples/token_example/token_example.module
Build a list of available content.
_token_example_get_taxonomy_term in examples/token_example/token_example.module
Build a list of available taxonomy terms.
_token_example_get_user in examples/token_example/token_example.module
Build a list of available user accounts.
_update_7000_field_delete_field in drupal/modules/field/field.install
Utility function: delete a field stored in SQL storage directly from the database.
_update_7000_field_read_fields in drupal/modules/field/field.install
Utility function: fetch all the field definitions from the database.
_update_get_cache_multiple in drupal/modules/update/update.module
Return an array of cache items with a given cache ID prefix.

Code

drupal/includes/database/database.inc, line 2387

<?php
function db_select($table, $alias = NULL, array $options = array()) {
  if (empty($options['target'])) {
    $options['target'] = 'default';
  }
  return Database::getConnection($options['target'])->select($table, $alias, $options);
}
?>