Function DatabaseConnector->query_insert_or_replace

Definitions

sources/database.php

  • Insert a update a row (depending on whether a row with the key exists already).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$table string No No required parameter N/A N/A The table name
$map array No No required parameter N/A N/A The INSERT/UPDATE map, minus anything in the key
$key_map array No No required parameter N/A N/A The WHERE map representing the key [will all be ANDed together] - must be the true key, otherwise rows will be duplicated
$fail_ok boolean No No False N/A N/A Whether to allow failure (outputting a message instead of exiting completely)
$save_as_volatile boolean No No False N/A N/A Whether we are saving as a 'volatile' file extension (used in the XML DB driver, to mark things as being non-syndicated to Git)

Returns

  • Whether a smart operation was performed by the DB backend (rather than just delete-then-add)
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Insert a update a row (depending on whether a row with the key exists already).
 *
 * @param  string $table The table name
 * @param  array $map The INSERT/UPDATE map, minus anything in the key
 * @param  array $key_map The WHERE map representing the key [will all be ANDed together] - must be the true key, otherwise rows will be duplicated
 * @param  boolean $fail_ok Whether to allow failure (outputting a message instead of exiting completely)
 * @param  boolean $save_as_volatile Whether we are saving as a 'volatile' file extension (used in the XML DB driver, to mark things as being non-syndicated to Git)
 * @return boolean Whether a smart operation was performed by the DB backend (rather than just delete-then-add)
 */

public function query_insert_or_replace(string $table, array $map, array $key_map, bool $fail_ok = false, bool $save_as_volatile = false) : bool