Elgg
Version 6.0
|
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 Elgg\Database::executeQuery()andresultsareretrievedwith@link\PDO::fetchObject().Ifacallbackfunction$callbackisdefined,eachrowwillbepassedasasingleargumentto$callback.Ifnocallbackfunctionisdefined,theentireresultsetisreturnedasanarray.@paramQueryBuilder$queryThequerybeingpassed.@paramcallable$callbackOptionally,thenameofafunctiontocallbacktooneachrow@returnarrayAnarrayofdatabaseresultobjectsorcallbackfunctionresults.Ifthequeryreturnednothing,anemptyarray.
Definition at line 41 of file Database.php.
Elgg\Application\Database::getDataRow | ( | QueryBuilder | $query, |
$callback = '' |
|||
) |
Retrieve a single row from the database.
Similar to Elgg\Database::getData()butreturnsonlythefirstrowmatched.Ifacallbackfunction$callbackisspecified,therowwillbepassedastheonlyargumentto$callback.@paramQueryBuilder$queryThequerytoexecute.@paramcallable$callbackAcallbackfunctiontoapplytotherow@returnmixedAsingledatabaseresultobjectortheresultofthecallbackfunction.
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 .
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.