Function DatabaseConnector->query_insert
Definitions
sources/database.php
- Insert a row.
- 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 |
$map | array | No | No | required parameter | N/A | N/A | The insertion map. The map values may be arrays for a multi-insert, but if so they must all have the same arity. You must not pass an array of maps. |
$ret | boolean | No | No | False | N/A | N/A | Whether to return the auto-insert-id |
$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
- The ID of the new row (null: no ID / batch insert)
- Type: ?integer
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Insert a row.
*
* @param string $table The table name
* @param array $map The insertion map. The map values may be arrays for a multi-insert, but if so they must all have the same arity. You must not pass an array of maps.
* @param boolean $ret Whether to return the auto-insert-id
* @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 ?integer The ID of the new row (null: no ID / batch insert)
*/
public function query_insert(string $table, array $map, bool $ret = false, bool $fail_ok = false, bool $save_as_volatile = false) : ?int
* Insert a row.
*
* @param string $table The table name
* @param array $map The insertion map. The map values may be arrays for a multi-insert, but if so they must all have the same arity. You must not pass an array of maps.
* @param boolean $ret Whether to return the auto-insert-id
* @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 ?integer The ID of the new row (null: no ID / batch insert)
*/
public function query_insert(string $table, array $map, bool $ret = false, bool $fail_ok = false, bool $save_as_volatile = false) : ?int