메소드 | 설명 | |
---|---|---|
__construct ( Elgg\Database\Config $config, |
Constructor | |
__get ( string $name ) : mixed | Handle magic property reads | |
__set ( string $name, mixed $value ) : void | Handle magic property writes | |
assertInstalled ( ) : void | Test that the Elgg database is installed | |
connect ( string $type = "readwrite" ) : void | Establish a connection to the database server | |
deleteData ( string $query, array $params = [] ) : integer | Delete data from the database | |
disableQueryCache ( ) : void | Disable the query cache | |
enableQueryCache ( ) : void | Enable the query cache | |
executeDelayedQueries ( ) : void | Trigger all queries that were registered as "delayed" queries. This is called by the system automatically on shutdown. | |
fingerprintCallback ( callable $callback ) : string | Get a string that uniquely identifies a callback during the current request. | |
getData ( string $query, callable $callback = null, array $params = [] ) : array | Retrieve rows from the database. | |
getDataRow ( string $query, callable $callback = null, array $params = [] ) : mixed | Retrieve a single row from the database. | |
getQueryCount ( ) : integer | Get the number of queries made to the database | |
getServerVersion ( string $type ) : string | Get the server version number | |
insertData ( string $query, array $params = [] ) : integer | false | Insert a row into the database. | |
registerDelayedQuery ( string $query, string $type, callable $callback = null, array $params = [] ) : boolean | Queue a query for execution upon shutdown. | |
runSqlScript ( string $scriptlocation ) : void | Runs a full database script from disk. | |
sanitizeInt ( integer $value, boolean $signed = true ) : integer | Sanitizes an integer value for use in a query | |
sanitizeString ( string $value ) : string | Sanitizes a string for use in a query | |
setLogger ( |
Set the logger object | |
setupConnections ( ) : void | Establish database connections | |
updateData ( string $query, boolean $get_num_rows = false, array $params = [] ) : boolean | integer | Update the database. |
메소드 | 설명 | |
---|---|---|
executeQuery ( string $query, Doctrine\DBAL\Connection $connection, array $params = [] ) : Doctrine\DBAL\Driver\Statement | Execute a query. | |
getConnection ( string $type ) : Doctrine\DBAL\Connection | Gets (if required, also creates) a DB connection. | |
getResults ( string $query, string $callback = null, boolean $single = false, array $params = [] ) : array | Handles queries that return results, running the results through a an optional callback function. This is for R queries (from CRUD). | |
invalidateQueryCache ( ) : void | Invalidate the query cache |
public __construct ( Elgg\Database\Config $config, |
||
$config | Elgg\Database\Config | Database configuration |
$logger | The logger |
public assertInstalled ( ) : void | ||
리턴 | void |
public disableQueryCache ( ) : void | ||
리턴 | void |
public enableQueryCache ( ) : void | ||
리턴 | void |
public executeDelayedQueries ( ) : void | ||
리턴 | void |
protected executeQuery ( string $query, Doctrine\DBAL\Connection $connection, array $params = [] ) : Doctrine\DBAL\Driver\Statement | ||
$query | string | The query |
$connection | Doctrine\DBAL\Connection | The DB connection |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
리턴 | Doctrine\DBAL\Driver\Statement | The result of the query |
public fingerprintCallback ( callable $callback ) : string | ||
$callback | callable | The callable value to fingerprint |
리턴 | string | A string that is unique for each callable passed in |
protected getConnection ( string $type ) : Doctrine\DBAL\Connection | ||
$type | string | The type of link we want: "read", "write" or "readwrite". |
리턴 | Doctrine\DBAL\Connection |
public getData ( string $query, callable $callback = null, array $params = [] ) : array | ||
$query | string | The query being passed. |
$callback | callable | Optionally, the name of a function to call back to on each row |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
리턴 | array | An array of database result objects or callback function results. If the query returned nothing, an empty array. |
public getDataRow ( string $query, callable $callback = null, array $params = [] ) : mixed | ||
$query | string | The query to execute. |
$callback | callable | A callback function to apply to the row |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
리턴 | mixed | A single database result object or the result of the callback function. |
public getQueryCount ( ) : integer | ||
리턴 | integer |
protected getResults ( string $query, string $callback = null, boolean $single = false, array $params = [] ) : array | ||
$query | string | The select query to execute |
$callback | string | An optional callback function to run on each row |
$single | boolean | Return only a single result? |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
리턴 | array | An array of database result objects or callback function results. If the query returned nothing, an empty array. |
public getServerVersion ( string $type ) : string | ||
$type | string | Connection type (Config constants, e.g. Config::READ_WRITE) |
리턴 | string | Empty if version cannot be determined |
public insertData ( string $query, array $params = [] ) : integer | false | ||
$query | string | The query to execute. |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
리턴 | integer | false | The database id of the inserted row if a AUTO_INCREMENT field is defined, 0 if not, and false on failure. |
protected invalidateQueryCache ( ) : void | ||
리턴 | void |
public registerDelayedQuery ( string $query, string $type, callable $callback = null, array $params = [] ) : boolean | ||
$query | string | The query to execute |
$type | string | The query type ('read' or 'write') |
$callback | callable | A callback function to pass the results array to |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
리턴 | boolean | Whether registering was successful. |
public runSqlScript ( string $scriptlocation ) : void | ||
$scriptlocation | string | The full path to the script |
리턴 | void |
public sanitizeString ( string $value ) : string | ||
$value | string | Value to escape |
리턴 | string |
public setupConnections ( ) : void | ||
리턴 | void |
public updateData ( string $query, boolean $get_num_rows = false, array $params = [] ) : boolean | integer | ||
$query | string | The query to run. |
$get_num_rows | boolean | Return the number of rows affected (default: false). |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
리턴 | boolean | integer |