|
| quote ($value, $type=NULL) |
|
| exec ($statement) |
|
| query ($statement, $mode=NULL, $arg1=NULL, $arg2=NULL) |
|
| 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) |
|
This is a special variant of the standard PDO class that does not allow multiple statement execution.
◆ exec()
Executes an SQL statement and returns the number of affected rows.
- Parameters
-
- Returns
- int number of affected rows
◆ execute()
execute |
( |
|
$statement, |
|
|
|
$input_parameters = null |
|
) |
| |
Executes sql statement with given parameters, returns number of affected rows, use only for INSERT,UPDATE etc
- Parameters
-
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
- Returns
- integer number of affected rows
◆ fetchAll()
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
- Parameters
-
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
- Returns
- array result set as array of assoc arrays
◆ fetchColumn()
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
- Parameters
-
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
integer | $column | number of column to fetch |
- Returns
- string value of chosen column
◆ fetchFirst()
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
- See also
- StudipPDOStatement::fetchFirst()
- Parameters
-
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
- Returns
- array result set
◆ fetchGrouped()
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
- See also
- StudipPDOStatement::fetchGrouped()
- Parameters
-
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
- Returns
- array result set
◆ fetchGroupedPairs()
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
- See also
- StudipPDOStatement::fetchGroupedPairs()
- Parameters
-
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
- Returns
- array result set
◆ fetchOne()
fetchOne |
( |
|
$statement, |
|
|
|
$input_parameters = null |
|
) |
| |
Executes sql statement with given parameters, and fetch only the first row as associative array
- See also
- StudipPDOStatement::fetchOne()
- Parameters
-
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
- Returns
- array first row of result set
◆ fetchPairs()
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
- See also
- StudipPDOStatement::fetchGroupedPairs()
- Parameters
-
string | $statement | SQL statement to execute |
array | $input_parameters | parameters for statement |
callable | $callable | callable to be applied to each of the rows |
- Returns
- array result set
◆ prepare()
prepare |
( |
|
$statement, |
|
|
|
$driver_options = [] |
|
) |
| |
Prepares a statement for execution and returns a statement object.
- Parameters
-
- Returns
- object PDOStatement object
◆ prepareStatement()
prepareStatement |
( |
|
$statement, |
|
|
|
$driver_options = [] |
|
) |
| |
This method is intended only for use by the StudipPDOStatement class.
- Parameters
-
- Returns
- object PDOStatement object
◆ query()
query |
( |
|
$statement, |
|
|
|
$mode = NULL , |
|
|
|
$arg1 = NULL , |
|
|
|
$arg2 = NULL |
|
) |
| |
Executes an SQL statement, returning a result set as a statement object.
- Parameters
-
string | SQL statement |
int | fetch mode (optional) |
mixed | fetch mode parameter (see PDOStatement::setFetchMode) |
mixed | fetch mode parameter (see PDOStatement::setFetchMode) |
- Returns
- object PDOStatement object
◆ quote()
quote |
( |
|
$value, |
|
|
|
$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.
- Parameters
-
string | PHP value to quote |
int | parameter type (e.g. PDO::PARAM_STR) |
- Returns
- string quoted SQL string
◆ replaceStrings()
static replaceStrings |
( |
|
$statement | ) |
|
|
staticprotected |
Replaces all string literals in the statement with placeholders.
- Parameters
-
- Returns
- string modified SQL statement
◆ verify()
Verifies that the given SQL query only contains a single statement.
- Parameters
-
string | SQL statement to check |
- Exceptions
-
PDOException | when the query contains multiple statements |
◆ $queries
◆ $query_count
◆ PARAM_ARRAY
◆ PARAM_COLUMN
The documentation for this class was generated from the following file: