7 database.inc db_merge($table, array $options = array())
8 database.inc db_merge($table, array $options = array())

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

\Drupal\Core\Database\Query\Merge A new Merge object for this connection.

Related topics

19 calls to db_merge()
drupal-7.state.system.database.php in core/modules/system/tests/upgrade/drupal-7.state.system.database.php
Database additions for state system upgrade tests.
GarbageCollectionTest::testGarbageCollection in core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
Tests garbage collection.
history_write in core/modules/history/history.module
Updates 'last viewed' timestamp of the specified entity for the current user.
hook_entity_predelete in core/modules/system/entity.api.php
Act before entity deletion.
hook_ENTITY_TYPE_predelete in core/modules/system/entity.api.php
Act before entity deletion of a particular entity type.

... See full list

File

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

Code

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