function db_select

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

98 calls to db_select()
aggregator_load_feed_items in drupal/core/modules/aggregator/aggregator.pages.inc
Loads and optionally filters feed items.
AlterTest::testAlterChangeConditional in drupal/core/modules/system/lib/Drupal/system/Tests/Database/AlterTest.php
Tests that we can alter a query's conditionals.
AlterTest::testAlterChangeFields in drupal/core/modules/system/lib/Drupal/system/Tests/Database/AlterTest.php
Tests that we can alter the fields of a query.
AlterTest::testAlterExpression in drupal/core/modules/system/lib/Drupal/system/Tests/Database/AlterTest.php
Tests that we can alter expressions in the query.
AlterTest::testAlterRemoveRange in drupal/core/modules/system/lib/Drupal/system/Tests/Database/AlterTest.php
Tests that we can remove a range() value from a query.

... See full list

File

drupal/core/includes/database.inc, line 384
Core systems for the database layer.

Code

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);
}