Function Database_Static_mysql_pdo->query
Definitions
sources/database/mysql_pdo.php
- This function is a raw query executor.This should rarely ever be used; other functions like query_select are available. Additionally, for complex queries, it is still better to use query_parameterised as it handles escaping.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
---|---|---|---|---|---|---|---|
$query | string | No | No | required parameter | N/A | N/A | The complete SQL query |
$connection | mixed | No | No | required parameter | N/A | N/A | The DB connection |
$max | ?integer | No | No | Null | N/A | N/A | The maximum number of rows to affect (null: no limit) |
$start | integer | No | No | 0 | N/A | N/A | The start row to affect |
$fail_ok | boolean | No | No | False | N/A | N/A | Whether to output an error on failure |
$get_insert_id | boolean | No | No | False | N/A | N/A | Whether to get the autoincrement ID created for an insert query |
$save_as_volatile | boolean | No | No | False | N/A | N/A | Whether we are saving as a 'volatile' file extension |
Returns
- The results (null: no results), or the insert ID
- Type: ?mixed
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* This function is a raw query executor.This should rarely ever be used; other functions like query_select are available. Additionally, for complex queries, it is still better to use query_parameterised as it handles escaping.
*
* @param string $query The complete SQL query
* @param mixed $connection The DB connection
* @param ?integer $max The maximum number of rows to affect (null: no limit)
* @param integer $start The start row to affect
* @param boolean $fail_ok Whether to output an error on failure
* @param boolean $get_insert_id Whether to get the autoincrement ID created for an insert query
* @param boolean $save_as_volatile Whether we are saving as a 'volatile' file extension
* @return ?mixed The results (null: no results), or the insert ID
*/
public function query(string $query, $connection, ?int $max = null, int $start = 0, bool $fail_ok = false, bool $get_insert_id = false, bool $save_as_volatile = false)
* This function is a raw query executor.This should rarely ever be used; other functions like query_select are available. Additionally, for complex queries, it is still better to use query_parameterised as it handles escaping.
*
* @param string $query The complete SQL query
* @param mixed $connection The DB connection
* @param ?integer $max The maximum number of rows to affect (null: no limit)
* @param integer $start The start row to affect
* @param boolean $fail_ok Whether to output an error on failure
* @param boolean $get_insert_id Whether to get the autoincrement ID created for an insert query
* @param boolean $save_as_volatile Whether we are saving as a 'volatile' file extension
* @return ?mixed The results (null: no results), or the insert ID
*/
public function query(string $query, $connection, ?int $max = null, int $start = 0, bool $fail_ok = false, bool $get_insert_id = false, bool $save_as_volatile = false)