Elgg  Version 2.3
Database.php
Go to the documentation of this file.
1 <?php
2 namespace Elgg\Application;
3 
8 
22 class Database extends ElggDb {
23 
29  private $db;
30 
37  public function __construct(ElggDb $db) {
38  $this->db = $db;
39  }
40 
44  public function getData($query, $callback = '', array $params = []) {
45  return $this->db->getData($query, $callback, $params);
46  }
47 
51  public function getDataRow($query, $callback = '', array $params = []) {
52  return $this->db->getDataRow($query, $callback, $params);
53  }
54 
58  public function insertData($query, array $params = []) {
59  return $this->db->insertData($query, $params);
60  }
61 
65  public function updateData($query, $getNumRows = false, array $params = []) {
66  return $this->db->updateData($query, $getNumRows, $params);
67  }
68 
72  public function deleteData($query, array $params = []) {
73  return $this->db->deleteData($query, $params);
74  }
75 
80  public function getTablePrefix() {
81  if (function_exists('elgg_deprecated_notice')) {
82  elgg_deprecated_notice(__METHOD__ . ' is deprecated. Read the "prefix" property', '2.3');
83  }
84  return $this->db->prefix;
85  }
86 
90  public function sanitizeInt($value, $signed = true) {
91  return $this->db->sanitizeInt($value, $signed);
92  }
93 
97  public function sanitizeString($value) {
98  return $this->db->sanitizeString($value);
99  }
100 
107  public function __get($name) {
108  if ($name === 'prefix') {
109  return $this->db->prefix;
110  }
111 
112  throw new \RuntimeException("Cannot read property '$name'");
113  }
114 
122  public function __set($name, $value) {
123  throw new \RuntimeException("Cannot write property '$name'");
124  }
125 
131  public function fingerprintCallback($callback) {
132  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
133  return $this->db->fingerprintCallback($callback);
134  }
135 
141  public function setTimer(Timer $timer) {
142  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
143  $this->db->setTimer($timer);
144  }
145 
151  public function setLogger(Logger $logger) {
152  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
153  $this->db->setLogger($logger);
154  }
155 
161  public function setupConnections() {
162  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
163  $this->db->setupConnections();
164  }
165 
171  public function connect($type = "readwrite") {
172  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
173  $this->db->connect($type);
174  }
175 
181  public function runSqlScript($scriptlocation) {
182  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
183  $this->db->runSqlScript($scriptlocation);
184  }
185 
191  public function registerDelayedQuery($query, $type, $handler = "", array $params = []) {
192  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
193  return $this->db->registerDelayedQuery($query, $type, $handler, $params);
194  }
195 
201  public function executeDelayedQueries() {
202  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
203  $this->db->executeDelayedQueries();
204  }
205 
211  public function enableQueryCache() {
212  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
213  $this->db->enableQueryCache();
214  }
215 
221  public function disableQueryCache() {
222  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
223  $this->db->disableQueryCache();
224  }
225 
231  public function assertInstalled() {
232  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
233  $this->db->assertInstalled();
234  }
235 
241  public function getQueryCount() {
242  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
243  return $this->db->getQueryCount();
244  }
245 
251  public function getServerVersion($type) {
252  elgg_deprecated_notice(__METHOD__ . " was deprecated and will be removed in 3.0", '2.1');
253  return $this->db->getServerVersion($type);
254  }
255 }
__construct(ElggDb $db)
Constructor.
Definition: Database.php:37
fingerprintCallback($callback)
{}
Definition: Database.php:131
setTimer(Timer $timer)
{}
Definition: Database.php:141
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
getDataRow($query, $callback= '', array $params=[])
{}
Definition: Database.php:51
setLogger(Logger $logger)
{}
Definition: Database.php:151
runSqlScript($scriptlocation)
{}
Definition: Database.php:181
$value
Definition: longtext.php:42
insertData($query, array $params=[])
{}
Definition: Database.php:58
Capture timing info for profiling.
Definition: Timer.php:9
sanitizeString($value)
{}
Definition: Database.php:97
$params
Definition: login.php:72
sanitizeInt($value, $signed=true)
{}
Definition: Database.php:90
registerDelayedQuery($query, $type, $handler="", array $params=[])
{}
Definition: Database.php:191
deleteData($query, array $params=[])
{}
Definition: Database.php:72
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:1098
__set($name, $value)
Handle magic property writes.
Definition: Database.php:122
updateData($query, $getNumRows=false, array $params=[])
{}
Definition: Database.php:65
__get($name)
Handle magic property reads.
Definition: Database.php:107
$handler
Definition: add.php:10
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:5
getData($query, $callback= '', array $params=[])
{}
Definition: Database.php:44
if(!$display_name) $type
Definition: delete.php:27
connect($type="readwrite")
{}
Definition: Database.php:171