Same name and namespace in other branches
  1. 8.9.x core/includes/database.inc \db_insert()

Returns a new InsertQuery object for the active database.

Parameters

$table: The table into which to insert.

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

Return value

InsertQuery A new InsertQuery object for this connection.

Related topics

83 calls to db_insert()
batch_process in includes/form.inc
Processes the batch.
CategorizeFeedItemTestCase::testCategorizeFeedItem in modules/aggregator/aggregator.test
Checks that children of a feed inherit a defined category.
comment_node_insert in modules/comment/comment.module
Implements hook_node_insert().
DatabaseBasicSyntaxTestCase::testLikeBackslash in modules/simpletest/tests/database_test.test
Test LIKE query containing a backslash.
DatabaseBasicSyntaxTestCase::testLikeEscape in modules/simpletest/tests/database_test.test
Test escaping of LIKE wildcards.

... See full list

File

includes/database/database.inc, line 2543
Core systems for the database layer.

Code

function db_insert($table, array $options = array()) {
  if (empty($options['target']) || $options['target'] == 'slave') {
    $options['target'] = 'default';
  }
  return Database::getConnection($options['target'])
    ->insert($table, $options);
}