diff options
author | Malf Furious <m@lfurio.us> | 2016-10-23 17:21:16 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-10-23 17:21:16 -0400 |
commit | 2e4dbf98b96adc8731c3101385e47e1f00c21d31 (patch) | |
tree | a462923740c511ca1553dd1003a3c1bedef4e070 /app | |
parent | 205025e6f58fb7a870d401ae30f771c8d1b553bb (diff) | |
download | scrott-2e4dbf98b96adc8731c3101385e47e1f00c21d31.tar.gz scrott-2e4dbf98b96adc8731c3101385e47e1f00c21d31.zip |
Add database class
Diffstat (limited to 'app')
-rw-r--r-- | app/class/database.class.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/app/class/database.class.php b/app/class/database.class.php new file mode 100644 index 0000000..c791088 --- /dev/null +++ b/app/class/database.class.php @@ -0,0 +1,46 @@ +<?php + +/* + * SCROTT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to UNLICENSE + */ + +/* + * This class provides a common interface to a database. Scrott provides + * facilities for interacting with any DBMS that we can use in PHP. To + * provide support for a new DBMS, extend this class and implement the + * abstract functions. Additionally, update the getInstance() function + * in this class so that the new implementation is used under appropriate + * configuration. + */ +abstract class Database +{ + private static $instance = NULL; + + /* + * Return the database instance object, creating it if this is the + * first call to this function. This function will need maintained + * as new DBMSs are supported. + */ + public static function getInstance() : Database + { + // todo + } + + /* + * These functions are to be implemented by DBMS extensions, + * providing a uniform interface to database engines. + */ + public abstract function close(); + public abstract function query(string $query) : array; + public abstract function esc(string $str) : string; +} + +?> |