2012-03-19 13:24:36 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Query
|
|
|
|
*
|
|
|
|
* Free Query Builder / Database Abstraction Layer
|
|
|
|
*
|
2012-04-20 13:17:39 -04:00
|
|
|
* @package Query
|
|
|
|
* @author Timothy J. Warren
|
2014-01-02 12:36:50 -05:00
|
|
|
* @copyright Copyright (c) 2012 - 2014
|
2012-03-19 13:24:36 -04:00
|
|
|
* @link https://github.com/aviat4ion/Query
|
2012-04-20 13:17:39 -04:00
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
2012-03-19 13:24:36 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Autoloader for loading available database classes
|
2014-03-31 16:01:58 -04:00
|
|
|
*
|
|
|
|
* @package Query
|
2012-03-19 13:24:36 -04:00
|
|
|
*/
|
|
|
|
|
2014-06-09 17:02:14 -04:00
|
|
|
namespace Query;
|
|
|
|
|
2012-04-19 11:42:50 -04:00
|
|
|
/**
|
|
|
|
* Reference to root path
|
2014-03-31 16:01:58 -04:00
|
|
|
* @subpackage Core
|
2012-04-19 11:42:50 -04:00
|
|
|
*/
|
2015-06-04 15:27:55 -04:00
|
|
|
if ( ! defined('QBASE_PATH')) define('QBASE_PATH', dirname(__FILE__).'/');
|
2012-04-19 11:42:50 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Path to driver classes
|
2014-03-31 16:01:58 -04:00
|
|
|
* @subpackage Core
|
2012-04-19 11:42:50 -04:00
|
|
|
*/
|
2015-06-04 15:27:55 -04:00
|
|
|
if ( ! defined('QDRIVER_PATH')) define('QDRIVER_PATH', QBASE_PATH.'drivers/');
|
2012-03-19 13:24:36 -04:00
|
|
|
|
2012-10-31 16:21:15 -04:00
|
|
|
// Require some common functions
|
|
|
|
require(QBASE_PATH.'common.php');
|
2012-08-22 21:17:27 -04:00
|
|
|
|
2014-06-09 17:02:14 -04:00
|
|
|
// Load Query Classes
|
|
|
|
spl_autoload_register(function ($class)
|
2012-03-19 13:24:36 -04:00
|
|
|
{
|
2015-07-16 16:56:13 -04:00
|
|
|
/*$class_segments = explode('\\', $class);
|
2014-08-08 13:48:20 -04:00
|
|
|
$driver_class = strtolower(array_pop($class_segments));
|
2014-04-03 13:28:30 -04:00
|
|
|
|
2014-04-02 22:40:54 -04:00
|
|
|
// Load DB Driver classes
|
2014-08-08 13:48:20 -04:00
|
|
|
$driver_path = QDRIVER_PATH . "{$driver_class}";
|
2014-04-03 13:28:30 -04:00
|
|
|
if ($class_segments == array('Query', 'Driver') && is_dir($driver_path))
|
2012-05-21 18:00:18 -04:00
|
|
|
{
|
2014-04-03 13:28:30 -04:00
|
|
|
|
|
|
|
// Firebird is a special case, since it's not a PDO driver
|
2014-06-09 17:02:14 -04:00
|
|
|
// @codeCoverageIgnoreStart
|
2015-07-16 16:56:13 -04:00
|
|
|
if (function_exists('\\fbird_connect') && $driver_class === 'firebird')
|
2014-04-02 22:40:54 -04:00
|
|
|
{
|
2014-06-09 17:02:14 -04:00
|
|
|
array_map('\\do_include', glob("{$driver_path}/*.php"));
|
2014-04-02 22:40:54 -04:00
|
|
|
}
|
2014-06-09 17:02:14 -04:00
|
|
|
// @codeCoverageIgnoreEnd
|
2015-07-16 16:56:13 -04:00
|
|
|
}*/
|
2015-06-04 15:27:55 -04:00
|
|
|
|
2014-04-02 22:40:54 -04:00
|
|
|
// Load other classes
|
2014-08-08 13:48:20 -04:00
|
|
|
$path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
|
|
|
|
$file = QBASE_PATH . "{$path}.php";
|
2015-06-04 15:27:55 -04:00
|
|
|
|
2014-08-08 13:48:20 -04:00
|
|
|
// @codeCoverageIgnoreStart
|
|
|
|
if (file_exists($file))
|
2012-05-21 15:18:06 -04:00
|
|
|
{
|
2014-08-08 13:48:20 -04:00
|
|
|
require_once($file);
|
2012-03-19 13:24:36 -04:00
|
|
|
}
|
2014-08-08 13:48:20 -04:00
|
|
|
// @codeCoverageIgnoreEnd
|
2014-06-09 17:02:14 -04:00
|
|
|
});
|
2012-05-21 15:18:06 -04:00
|
|
|
|
2014-02-07 16:53:01 -05:00
|
|
|
// End of autoload.php
|