More file rearrangement, some scaffolding for query_builder class

This commit is contained in:
Timothy Warren 2012-03-07 16:52:51 -05:00
parent 7568afefa6
commit 7bc8bce9fa
15 changed files with 69 additions and 7 deletions

View File

@ -79,6 +79,7 @@ function do_include($path)
// Load everything so that we don't have to do requires later
{
array_map('do_include', glob(BASE_DIR . "/common/*.php"));
array_map('do_include', glob(BASE_DIR . "/db/*.php"));
array_map('do_include', glob(BASE_DIR . "/windows/widgets/*.php"));
array_map('do_include', glob(BASE_DIR . "/windows/*.php"));
}
@ -86,7 +87,7 @@ function do_include($path)
// --------------------------------------------------------------------------
// Load db classes based on capability
$path = BASE_DIR . "/databases/";
$path = BASE_DIR . "/db/drivers/";
foreach(pdo_drivers() as $d)
{

View File

@ -22,6 +22,9 @@ abstract class DB_PDO extends PDO {
public $manip;
protected $statement;
/**
* PDO constructor wrapper
*/
public function __construct($dsn, $username=NULL, $password=NULL, $driver_options=array())
{
parent::__construct($dsn, $username, $password, $driver_options);

View File

@ -95,11 +95,9 @@ class firebird extends DB_PDO {
}
// Throw the error as a exception
// if there is one
if ($this->statement === FALSE)
{
throw new PDOException(ibase_errmsg());
die();
}
return $this->statement;
@ -169,7 +167,6 @@ class firebird extends DB_PDO {
if ($this->statement === FALSE)
{
throw new PDOException(ibase_errmsg());
die();
}
return $this->statement;

View File

@ -127,4 +127,65 @@ class Query_Builder {
return $this->query('SELECT * FROM ' . $this->quote_ident($table));
}
}
// --------------------------------------------------------------------------
/**
* Specifies rows to select in a query
*
* @param string $fields
* @return $this
*/
public function select($fields)
{
// @todo Implement select method
return $this;
}
// --------------------------------------------------------------------------
/**
* Specify condition(s) in the where clause of a query
* Note: this function works with key / value, or a
* passed array with key / value pairs
*
* @param mixed $key
* @param mixed $val
* @return $this
*/
public function where($key, $val=array())
{
// @todo Implement where method
return $this;
}
// --------------------------------------------------------------------------
/**
* Creates a join phrase in a compiled query
*
* @param string $table
* @param string $condition
* @param string $type
* @return $this
*/
public function join($table, $condition, $type='inner')
{
// @todo Implement join method
return $this;
}
// --------------------------------------------------------------------------
/**
* Specify the database table to select from
*
* @param string $dbname
* @return $this
*/
public function from($dbname)
{
// @todo Implement from method
return $this;
}
}

View File

@ -32,13 +32,13 @@ function do_include($path)
// Include core tests
require_once("core.php");
require_once("../sys/common/db_pdo.php");
require_once("../sys/common/query_builder.php");
require_once("../sys/db/db_pdo.php");
require_once("../sys/db/query_builder.php");
// Include db tests
// Load db classes based on capability
$src_path = "../sys/databases/";
$src_path = "../sys/db/drivers/";
$test_path = "./databases/";
foreach(pdo_drivers() as $d)

Binary file not shown.