Split db_pdo and db_sql classes
This commit is contained in:
parent
9614482341
commit
6b722608b7
@ -295,52 +295,4 @@ abstract class DB_PDO extends PDO {
|
||||
*/
|
||||
abstract public function backup_data();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Abstract parent for database manipulation subclasses
|
||||
*/
|
||||
abstract class DB_SQL {
|
||||
|
||||
/**
|
||||
* Get database-specific sql to create a new table
|
||||
*
|
||||
* @abstract
|
||||
* @param string $name
|
||||
* @param array $columns
|
||||
* @param array $constraints
|
||||
* @param array $indexes
|
||||
* @return string
|
||||
*/
|
||||
abstract public function create_table($name, $columns, array $constraints=array(), array $indexes=array());
|
||||
|
||||
/**
|
||||
* Get database-specific sql to drop a table
|
||||
*
|
||||
* @abstract
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
abstract public function delete_table($name);
|
||||
|
||||
/**
|
||||
* Get database specific sql for limit clause
|
||||
*
|
||||
* @abstract
|
||||
* @param string $sql
|
||||
* @param int $limiit
|
||||
* @param int $offset
|
||||
* @return string
|
||||
*/
|
||||
abstract public function limit($sql, $limit, $offset=FALSE);
|
||||
|
||||
/**
|
||||
* Get the sql for random ordering
|
||||
*
|
||||
* @abstract
|
||||
* @return string
|
||||
*/
|
||||
abstract public function random();
|
||||
}
|
||||
// End of db_pdo.php
|
60
sys/db/db_sql.php
Normal file
60
sys/db/db_sql.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenSQLManager
|
||||
*
|
||||
* Free Database manager for Open Source Databases
|
||||
*
|
||||
* @author Timothy J. Warren
|
||||
* @copyright Copyright (c) 2012
|
||||
* @link https://github.com/aviat4ion/OpenSQLManager
|
||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||
*/
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Abstract parent for database manipulation subclasses
|
||||
*/
|
||||
abstract class DB_SQL {
|
||||
|
||||
/**
|
||||
* Get database-specific sql to create a new table
|
||||
*
|
||||
* @abstract
|
||||
* @param string $name
|
||||
* @param array $columns
|
||||
* @param array $constraints
|
||||
* @param array $indexes
|
||||
* @return string
|
||||
*/
|
||||
abstract public function create_table($name, $columns, array $constraints=array(), array $indexes=array());
|
||||
|
||||
/**
|
||||
* Get database-specific sql to drop a table
|
||||
*
|
||||
* @abstract
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
abstract public function delete_table($name);
|
||||
|
||||
/**
|
||||
* Get database specific sql for limit clause
|
||||
*
|
||||
* @abstract
|
||||
* @param string $sql
|
||||
* @param int $limiit
|
||||
* @param int $offset
|
||||
* @return string
|
||||
*/
|
||||
abstract public function limit($sql, $limit, $offset=FALSE);
|
||||
|
||||
/**
|
||||
* Get the sql for random ordering
|
||||
*
|
||||
* @abstract
|
||||
* @return string
|
||||
*/
|
||||
abstract public function random();
|
||||
}
|
||||
// End of db_sql.php
|
@ -55,19 +55,6 @@ class Data_Grid extends GtkTreeView {
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set the value of the cell at the provided coordinate array
|
||||
*
|
||||
* @param array $coord
|
||||
* @param mixed $val
|
||||
*/
|
||||
public function set(array $coord, $val)
|
||||
{
|
||||
// @todo implement
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Empty the model
|
||||
*/
|
||||
|
@ -19,6 +19,19 @@ define('TEST_DIR', dirname(__FILE__));
|
||||
define('BASE_DIR', str_replace(basename(TEST_DIR), '', TEST_DIR).'/sys/');
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Alias for require_once for array_map
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
function do_include($path)
|
||||
{
|
||||
require_once($path);
|
||||
}
|
||||
|
||||
|
||||
// Include simpletest
|
||||
// it has to be set in your php path, or put in the tests folder
|
||||
@ -26,7 +39,6 @@ require_once('simpletest/autorun.php');
|
||||
|
||||
// Require base testing classes
|
||||
require_once(TEST_DIR.'/parent.php');
|
||||
require_once(TEST_DIR.'/settings.php');
|
||||
|
||||
// Bulk loading wrapper workaround for PHP < 5.4
|
||||
function do_include($path)
|
||||
@ -38,10 +50,8 @@ function do_include($path)
|
||||
require_once("core.php");
|
||||
|
||||
// Include required methods
|
||||
require_once(BASE_DIR.'common/functions.php');
|
||||
require_once(BASE_DIR.'common/settings.php');
|
||||
require_once(BASE_DIR.'db/db_pdo.php');
|
||||
require_once(BASE_DIR.'db/query_builder.php');
|
||||
array_map('do_include', glob(BASE_DIR . 'common/*.php'));
|
||||
array_map('do_include', glob(BASE_DIR . 'db/*.php'));
|
||||
|
||||
|
||||
// Include db tests
|
||||
|
Loading…
Reference in New Issue
Block a user