Function __global->db_function
Definitions
sources/database.php
- Call a database function that may be different on different database drivers.We are using MySQL syntax as a de facto standard. SQL does not standardise this stuff well.Basic arithmetic and inequality operators are assumed supported without needing a function.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: string
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $function | string | No | No | required parameter | CONCAT REPLACE SUBSTR LENGTH RAND COALESCE LEAST GREATEST MOD GROUP_CONCAT | N/A | Function name |
| $args | array | No | No | [] | N/A | N/A | List of string arguments, assumed already quoted/escaped correctly for the particular database |
Returns
- SQL fragment
- Type: string
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Call a database function that may be different on different database drivers.We are using MySQL syntax as a de facto standard. SQL does not standardise this stuff well.Basic arithmetic and inequality operators are assumed supported without needing a function.
*
* @param string $function Function name
* @set CONCAT REPLACE SUBSTR LENGTH RAND COALESCE LEAST GREATEST MOD GROUP_CONCAT
* @param array $args List of string arguments, assumed already quoted/escaped correctly for the particular database
* @return string SQL fragment
*/
function db_function(string $function, array $args = []) : string
* Call a database function that may be different on different database drivers.We are using MySQL syntax as a de facto standard. SQL does not standardise this stuff well.Basic arithmetic and inequality operators are assumed supported without needing a function.
*
* @param string $function Function name
* @set CONCAT REPLACE SUBSTR LENGTH RAND COALESCE LEAST GREATEST MOD GROUP_CONCAT
* @param array $args List of string arguments, assumed already quoted/escaped correctly for the particular database
* @return string SQL fragment
*/
function db_function(string $function, array $args = []) : string
