2012-03-19 13:24:36 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Query
|
|
|
|
*
|
|
|
|
* Free Query Builder / Database Abstraction Layer
|
|
|
|
*
|
|
|
|
* @author Timothy J. Warren
|
|
|
|
* @copyright Copyright (c) 2012
|
|
|
|
* @link https://github.com/aviat4ion/Query
|
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Autoloader for loading available database classes
|
|
|
|
*/
|
|
|
|
|
2012-04-19 11:42:50 -04:00
|
|
|
/**
|
|
|
|
* Reference to root path
|
|
|
|
*/
|
2012-03-19 13:24:36 -04:00
|
|
|
define('BASE_PATH', dirname(__FILE__).'/');
|
2012-04-19 11:42:50 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Path to driver classes
|
|
|
|
*/
|
2012-03-19 13:24:36 -04:00
|
|
|
define('DRIVER_PATH', BASE_PATH.'drivers/');
|
|
|
|
|
2012-04-12 14:00:42 -04:00
|
|
|
if ( ! function_exists('do_include'))
|
2012-04-10 14:06:34 -04:00
|
|
|
{
|
2012-04-19 11:42:50 -04:00
|
|
|
/**
|
|
|
|
* Bulk directory loading workaround for use
|
|
|
|
* with array_map and glob
|
|
|
|
*
|
|
|
|
* @param string $path
|
|
|
|
* @return void
|
|
|
|
*/
|
2012-04-12 14:00:42 -04:00
|
|
|
function do_include($path)
|
|
|
|
{
|
|
|
|
require_once($path);
|
|
|
|
}
|
2012-04-10 14:06:34 -04:00
|
|
|
}
|
|
|
|
|
2012-03-19 13:24:36 -04:00
|
|
|
// Load base classes
|
2012-04-12 13:44:31 -04:00
|
|
|
array_map('do_include', glob(BASE_PATH.'classes/*.php'));
|
2012-03-19 13:24:36 -04:00
|
|
|
|
|
|
|
// Load PDO Drivers
|
|
|
|
foreach(pdo_drivers() as $d)
|
|
|
|
{
|
2012-04-10 14:06:34 -04:00
|
|
|
$dir = DRIVER_PATH.$d;
|
2012-03-19 13:24:36 -04:00
|
|
|
|
2012-04-10 14:06:34 -04:00
|
|
|
if(is_dir($dir))
|
2012-03-19 13:24:36 -04:00
|
|
|
{
|
2012-04-10 14:06:34 -04:00
|
|
|
array_map('do_include', glob($dir.'/*.php'));
|
2012-03-19 13:24:36 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Load Firebird driver, if applicable
|
|
|
|
if (function_exists('fbird_connect'))
|
|
|
|
{
|
2012-04-10 14:06:34 -04:00
|
|
|
array_map('do_include', glob(DRIVER_PATH.'/firebird/*.php'));
|
|
|
|
}
|
|
|
|
|
2012-04-17 16:57:28 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2012-04-10 14:06:34 -04:00
|
|
|
/**
|
|
|
|
* Filter out db rows into one array
|
|
|
|
*
|
|
|
|
* @param array $array
|
|
|
|
* @param mixed $index
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function db_filter($array, $index)
|
|
|
|
{
|
|
|
|
$new_array = array();
|
|
|
|
|
|
|
|
foreach($array as $a)
|
|
|
|
{
|
|
|
|
$new_array[] = $a[$index];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $new_array;
|
2012-03-19 13:24:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// End of autoload.php
|