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

Returns a new MergeQuery object for the active database.

Parameters

$table: The table into which to merge.

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

Return value

MergeQuery A new MergeQuery object for this connection.

Related topics

22 calls to db_merge()
BlockInvalidRegionTestCase::testBlockInInvalidRegion in modules/block/block.test
Tests that blocks assigned to invalid regions work correctly.
DatabaseMergeTestCase::testInvalidMerge in modules/simpletest/tests/database_test.test
Test that an invalid merge query throws an exception like it is supposed to.
DatabaseMergeTestCase::testMergeInsert in modules/simpletest/tests/database_test.test
Confirm that we can merge-insert a record successfully.
DatabaseMergeTestCase::testMergeInsertWithoutUpdate in modules/simpletest/tests/database_test.test
Test that we can merge-insert without any update fields.
DatabaseMergeTestCase::testMergeUpdate in modules/simpletest/tests/database_test.test
Confirm that we can merge-update a record successfully.

... See full list

File

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

Code

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