Function DatabaseConnector->query_update

Definitions

sources/database.php

  • Update (edit) a row in the database.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$table string No No required parameter N/A N/A The table name
$update_map array No No required parameter N/A N/A The UPDATE map
$where_map array No No [] N/A N/A The WHERE map [will all be ANDed together]
$end string No No Blank (empty string) N/A N/A Something to tack onto the end of the statement
$max ?integer No No Null N/A N/A The maximum number of rows to update (null: no limit)
$start integer No No 0 N/A N/A The starting row to update
$num_touched boolean No No False N/A N/A Whether to get the number of touched rows. WARNING: Do not use in core code as it does not work on all database drivers
$fail_ok boolean No No False N/A N/A Whether to allow failure (outputting a message instead of exiting completely)

Returns

  • The number of touched records (null: hasn't been asked / error / not supported)
  • Type: ?integer
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Update (edit) a row in the database.
 *
 * @param  string $table The table name
 * @param  array $update_map The UPDATE map
 * @param  array $where_map The WHERE map [will all be ANDed together]
 * @param  string $end Something to tack onto the end of the statement
 * @param  ?integer $max The maximum number of rows to update (null: no limit)
 * @param  integer $start The starting row to update
 * @param  boolean $num_touched Whether to get the number of touched rows. WARNING: Do not use in core code as it does not work on all database drivers
 * @param  boolean $fail_ok Whether to allow failure (outputting a message instead of exiting completely)
 * @return ?integer The number of touched records (null: hasn't been asked / error / not supported)
 */

public function query_update(string $table, array $update_map, array $where_map = [], string $end = '', ?int $max = null, int $start = 0, bool $num_touched = false, bool $fail_ok = false) : ?int