Stud.IP
6.0
|
Public Member Functions | |
quote ($string, $type=null) | |
exec (string $statement) | |
query ($statement, $fetch_mode=NULL,... $fetch_args) | |
prepare ($statement, $driver_options=[]) | |
prepareStatement ($statement, $driver_options=[]) | |
execute ($statement, $input_parameters=null) | |
fetchAll ($statement, $input_parameters=null, $callable=null) | |
fetchFirst ($statement, $input_parameters=null, $callable=null) | |
fetchGrouped ($statement, $input_parameters=null, $callable=null) | |
fetchGroupedPairs ($statement, $input_parameters=null, $callable=null) | |
fetchPairs ($statement, $input_parameters=null, $callable=null) | |
fetchOne ($statement, $input_parameters=null) | |
fetchColumn ($statement, $input_parameters=null, $column=0) | |
isMariaDB () | |
Data Fields | |
const | PARAM_ARRAY = 100 |
const | PARAM_COLUMN = 101 |
$query_count = 0 | |
Protected Member Functions | |
verify ($statement) | |
Static Protected Member Functions | |
static | replaceStrings ($statement) |
This is a special variant of the standard PDO class that does not allow multiple statement execution.
exec | ( | string | $statement | ) |
Executes an SQL statement and returns the number of affected rows.
string | $statement | SQL statement |
execute | ( | $statement, | |
$input_parameters = null |
|||
) |
Executes sql statement with given parameters, returns number of affected rows, use only for INSERT,UPDATE etc
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
fetchAll | ( | $statement, | |
$input_parameters = null , |
|||
$callable = null |
|||
) |
Executes sql statement with given parameters, and fetch results as sequential array, each row as associative array optionally apply given callable on each row, with current row and key as parameter
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
fetchColumn | ( | $statement, | |
$input_parameters = null , |
|||
$column = 0 |
|||
) |
Executes sql statement with given parameters, and fetch only the value of one column third param denotes the column, zero indexed
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
integer | $column | number of column to fetch |
fetchFirst | ( | $statement, | |
$input_parameters = null , |
|||
$callable = null |
|||
) |
Executes sql statement with given parameters, and fetch only the values from first column as sequential array optionally apply given callable on each row, with current value and key as parameter
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
fetchGrouped | ( | $statement, | |
$input_parameters = null , |
|||
$callable = null |
|||
) |
Executes sql statement with given parameters, and fetch results as associative array, first columns value is used as a key, the others are grouped optionally apply given callable on each grouped row, with current row and key as parameter if no callable is given, 'current' is used, to return the first entry of the grouped row
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
fetchGroupedPairs | ( | $statement, | |
$input_parameters = null , |
|||
$callable = null |
|||
) |
Executes sql statement with given parameters, and fetch results as associative array, first columns value is used as a key, the other one is grouped use only when selecting 2 columns optionally apply given callable on each grouped row, with current row and key as parameter
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
fetchOne | ( | $statement, | |
$input_parameters = null |
|||
) |
Executes sql statement with given parameters, and fetch only the first row as associative array
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
fetchPairs | ( | $statement, | |
$input_parameters = null , |
|||
$callable = null |
|||
) |
Executes sql statement with given parameters, and fetch results as associative array, first columns value is used as a key, the other one as the value use only when selecting 2 columns optionally apply given callable on each grouped row, with current row and key as parameter
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
isMariaDB | ( | ) |
Determine if the connected database is a MariaDB database.
prepare | ( | $statement, | |
$driver_options = [] |
|||
) |
Prepares a statement for execution and returns a statement object.
string | $statement | SQL statement |
array | $driver_options |
prepareStatement | ( | $statement, | |
$driver_options = [] |
|||
) |
This method is intended only for use by the StudipPDOStatement class.
string | SQL statement |
query | ( | $statement, | |
$fetch_mode = NULL , |
|||
$fetch_args | |||
) |
Executes an SQL statement, returning a result set as a statement object.
string | $statement | SQL statement |
int | $fetch_mode | fetch mode (optional) |
mixed | ...$fetch_args fetch mode parameters (see PDOStatement::setFetchMode) |
quote | ( | $string, | |
$type = null |
|||
) |
Quotes the given value in a form appropriate for the type. If no explicit type is given, the value's PHP type is used.
mixed | $string | PHP value to quote |
?int | $type parameter type (e.g. PDO::PARAM_STR) |
|
staticprotected |
Replaces all string literals in the statement with placeholders.
string | SQL statement |
|
protected |
Verifies that the given SQL query only contains a single statement.
string | SQL statement to check |
PDOException | when the query contains multiple statements |
$query_count = 0 |
const PARAM_ARRAY = 100 |
const PARAM_COLUMN = 101 |