Elgg  Version 3.0
Database.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Application;
4 
7 use Elgg\Database as ElggDb;
8 
16 class Database {
17 
23  private $db;
24 
30  public function __construct(ElggDb $db) {
31  $this->db = $db;
32  }
33 
51  public function getData($query, $callback = '', array $params = []) {
52  return $this->db->getData($query, $callback, $params);
53  }
54 
69  public function getDataRow($query, $callback = '', array $params = []) {
70  return $this->db->getDataRow($query, $callback, $params);
71  }
72 
85  public function insertData($query, array $params = []) {
86  return $this->db->insertData($query, $params);
87  }
88 
103  public function updateData($query, $getNumRows = false, array $params = []) {
104  return $this->db->updateData($query, $getNumRows, $params);
105  }
106 
118  public function deleteData($query, array $params = []) {
119  return $this->db->deleteData($query, $params);
120  }
121 
130  public function sanitizeInt($value, $signed = true) {
131  return $this->db->sanitizeInt($value, $signed);
132  }
133 
142  public function sanitizeString($value) {
143  return $this->db->sanitizeString($value);
144  }
145 
155  public function getConnection($type) {
156  return $this->db->getConnection($type);
157  }
158 
173  public function registerDelayedQuery($query, $type, $callback = null, array $params = []) {
174  return $this->db->registerDelayedQuery($query, $type, $callback, $params);
175  }
176 
183  public function __get($name) {
184  return $this->db->{$name};
185  }
186 
194  public function __set($name, $value) {
195  $this->db->{$name} = $value;
196  }
197 }
__construct(ElggDb $db)
Constructor.
Definition: Database.php:30
getConnection($type)
Gets (if required, also creates) a DB connection.
Definition: Database.php:155
$query
Definition: groups.php:8
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
$params
Saves global plugin settings.
Definition: save.php:13
registerDelayedQuery($query, $type, $callback=null, array $params=[])
Queue a query for execution upon shutdown.
Definition: Database.php:173
getDataRow($query, $callback= '', array $params=[])
Retrieve a single row from the database.
Definition: Database.php:69
insertData($query, array $params=[])
Insert a row into the database.
Definition: Database.php:85
$type
Definition: delete.php:21
sanitizeString($value)
Sanitizes a string for use in a query.
Definition: Database.php:142
sanitizeInt($value, $signed=true)
Sanitizes an integer value for use in a query.
Definition: Database.php:130
deleteData($query, array $params=[])
Delete data from the database.
Definition: Database.php:118
__set($name, $value)
Handle magic property writes.
Definition: Database.php:194
updateData($query, $getNumRows=false, array $params=[])
Update the database.
Definition: Database.php:103
$value
Definition: debugging.php:7
__get($name)
Handle magic property reads.
Definition: Database.php:183
getData($query, $callback= '', array $params=[])
Retrieve rows from the database.
Definition: Database.php:51