summaryrefslogtreecommitdiffstats
path: root/app/class/mysql.class.php
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2017-02-06 00:47:55 -0500
committerMalf Furious <m@lfurio.us>2017-02-06 00:47:55 -0500
commit56a6dda13bb85b25f590fc8a64535bb53c3c2fd2 (patch)
tree8bbca1db84158e1234768ebd1edc325ec70f67d7 /app/class/mysql.class.php
parente0140672f1fb7c79e47aadad6fbee57e7262b1a2 (diff)
downloadscrott-56a6dda13bb85b25f590fc8a64535bb53c3c2fd2.tar.gz
scrott-56a6dda13bb85b25f590fc8a64535bb53c3c2fd2.zip
Update database API
The abstract functions of database have been made protected and their names prefixed with '_'. The database class has been given new static functions query() and esc(), which call the _query() and _esc() function from the database instance object. This change was made to address the use of db routines from static contexes. Calls like `database::get()->query()` which mix static and instance function access operators, can now be `database::query()`, and all singleton is abstracted away; the instance's destructor continues to close the db connection.
Diffstat (limited to 'app/class/mysql.class.php')
-rw-r--r--app/class/mysql.class.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/class/mysql.class.php b/app/class/mysql.class.php
index db0eb7d..57a9819 100644
--- a/app/class/mysql.class.php
+++ b/app/class/mysql.class.php
@@ -36,7 +36,7 @@ class mysql extends database
/*
* Close connection to DB
*/
- public function close() : void
+ protected function _close() : void
{
$this->db->close();
}
@@ -44,7 +44,7 @@ class mysql extends database
/*
* Make a query of the database. Return data as an array of arrays.
*/
- public function query(string $query) : array
+ protected function _query(string $query) : array
{
$arr = array();
$res = $this->db->query($query);
@@ -59,7 +59,7 @@ class mysql extends database
/*
* Escape a string for use in a query
*/
- public function esc(string $str) : string
+ protected function _esc(string $str) : string
{
return $this->db->real_escape_string($str);
}