|
Elgg
Version master
|
Public Member Functions | |
| __construct (protected ElggDb $db) | |
| Constructor. More... | |
| getData (QueryBuilder $query, $callback='') | |
| Retrieve rows from the database. More... | |
| getDataRow (QueryBuilder $query, $callback='') | |
| Retrieve a single row from the database. More... | |
| insertData (QueryBuilder $query) | |
| Insert a row into the database. More... | |
| updateData (QueryBuilder $query, bool $getNumRows=false) | |
| Update the database. More... | |
| deleteData (QueryBuilder $query) | |
| Delete data from the database. More... | |
| getConnection ($type) | |
| Gets (if required, also creates) a DB connection. More... | |
| registerDelayedQuery (QueryBuilder $query, $callback=null) | |
| Queue a query for execution upon shutdown. More... | |
| __get ($name) | |
| Handle magic property reads. More... | |
| __set ($name, $value) | |
| Handle magic property writes. More... | |
Definition at line 16 of file Database.php.
| Elgg\Application\Database::__construct | ( | protected ElggDb | $db | ) |
| Elgg\Application\Database::__get | ( | $name | ) |
Handle magic property reads.
| string | $name | Property name |
Definition at line 136 of file Database.php.
| Elgg\Application\Database::__set | ( | $name, | |
| $value | |||
| ) |
Handle magic property writes.
| string | $name | Property name |
| mixed | $value | Value |
Definition at line 147 of file Database.php.
| Elgg\Application\Database::deleteData | ( | QueryBuilder | $query | ) |
Delete data from the database.
| QueryBuilder | $query | The SQL query to run |
Definition at line 98 of file Database.php.
| Elgg\Application\Database::getConnection | ( | $type | ) |
Gets (if required, also creates) a DB connection.
| string | $type | The type of link we want: "read", "write" or "readwrite". |
Definition at line 110 of file Database.php.
| Elgg\Application\Database::getData | ( | QueryBuilder | $query, |
$callback = '' |
|||
| ) |
Retrieve rows from the database.
Queries are executed with () and results are retrieved with (). If a callback function $callback is defined, each row will be passed as a single argument to $callback. If no callback function is defined, the entire result set is returned as an array.
| QueryBuilder | $query | The query being passed. |
| callable | $callback | Optionally, the name of a function to call back to on each row |
Definition at line 41 of file Database.php.
| Elgg\Application\Database::getDataRow | ( | QueryBuilder | $query, |
$callback = '' |
|||
| ) |
Retrieve a single row from the database.
Similar to () but returns only the first row matched. If a callback function $callback is specified, the row will be passed as the only argument to $callback.
| QueryBuilder | $query | The query to execute. |
| callable | $callback | A callback function to apply to the row |
Definition at line 57 of file Database.php.
| Elgg\Application\Database::insertData | ( | QueryBuilder | $query | ) |
Insert a row into the database.
| QueryBuilder | $query | The query to execute |
Definition at line 71 of file Database.php.
| Elgg\Application\Database::registerDelayedQuery | ( | QueryBuilder | $query, |
$callback = null |
|||
| ) |
Queue a query for execution upon shutdown.
You can specify a callback if you care about the result. This function will always be passed a \Doctrine\DBAL\Driver\Statement.
| QueryBuilder | $query | The query to execute |
| callable | $callback | A callback function to pass the results array to |
Definition at line 126 of file Database.php.
| Elgg\Application\Database::updateData | ( | QueryBuilder | $query, |
| bool | $getNumRows = false |
||
| ) |
Update the database.
| QueryBuilder | $query | The query to run. |
| bool | $getNumRows | Return the number of rows affected (default: false). |
Definition at line 85 of file Database.php.