| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * DB helper file.
- *
- * Provides a helper to perform database operations.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- */
- require_once(PATH::HELPER . "HELPER.php");
- /**
- * Database helper.
- *
- * Contains database utilities to connect.
- *
- * @category Helper.
- */
- final class DB extends Helper{
- /**
- * Creates a database connection using the data in the config files.
- *
- * @return resource Connection to the database.
- */
- public static function start(){
- /*class SQLite extends SQLite3 {
- function __construct($file) {
- $this->open($file);
- }
- }*/
- $db = new SQLite3(":memory:");
- if(!$db) {
- error_log($db->lastErrorMsg());
- }
- else {
- $db->query("attach '" . PATH::DB_DATA . "' as data");
- $db->query("attach '" . PATH::DB_KEY . "' as key");
- return $db;
- }
- }
- }
|