Elgg  Version 5.1
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 
49  public function getData(QueryBuilder $query, $callback = '') {
50  return $this->db->getData($query, $callback);
51  }
52 
65  public function getDataRow(QueryBuilder $query, $callback = '') {
66  return $this->db->getDataRow($query, $callback);
67  }
68 
79  public function insertData(QueryBuilder $query) {
80  return $this->db->insertData($query);
81  }
82 
93  public function updateData(QueryBuilder $query, bool $getNumRows = false) {
94  return $this->db->updateData($query, $getNumRows);
95  }
96 
106  public function deleteData(QueryBuilder $query): int {
107  return $this->db->deleteData($query);
108  }
109 
118  public function getConnection($type) {
119  return $this->db->getConnection($type);
120  }
121 
134  public function registerDelayedQuery(QueryBuilder $query, $callback = null): void {
135  $this->db->registerDelayedQuery($query, $callback);
136  }
137 
144  public function __get($name) {
145  return $this->db->{$name};
146  }
147 
155  public function __set($name, $value) {
156  $this->db->{$name} = $value;
157  }
158 }
__construct(ElggDb $db)
Constructor.
Definition: Database.php:30
getConnection($type)
Gets (if required, also creates) a DB connection.
Definition: Database.php:118
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
insertData(QueryBuilder $query)
Insert a row into the database.
Definition: Database.php:79
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
$type
Definition: delete.php:22
$value
Definition: generic.php:51
registerDelayedQuery(QueryBuilder $query, $callback=null)
Queue a query for execution upon shutdown.
Definition: Database.php:134
updateData(QueryBuilder $query, bool $getNumRows=false)
Update the database.
Definition: Database.php:93
deleteData(QueryBuilder $query)
Delete data from the database.
Definition: Database.php:106
__set($name, $value)
Handle magic property writes.
Definition: Database.php:155
$query
__get($name)
Handle magic property reads.
Definition: Database.php:144
getDataRow(QueryBuilder $query, $callback= '')
Retrieve a single row from the database.
Definition: Database.php:65
getData(QueryBuilder $query, $callback= '')
Retrieve rows from the database.
Definition: Database.php:49