2006-01-12 02:10:47 +00:00
|
|
|
<?php
|
|
|
|
/* SVN FILE: $Id$ */
|
|
|
|
|
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* DataSource base class
|
2006-01-12 02:10:47 +00:00
|
|
|
*
|
|
|
|
* Long description for file
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
2006-01-20 07:46:14 +00:00
|
|
|
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
2006-01-12 02:10:47 +00:00
|
|
|
* 1785 E. Sahara Avenue, Suite 490-204
|
|
|
|
* Las Vegas, Nevada 89104
|
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
|
|
|
* @filesource
|
2006-01-20 07:46:14 +00:00
|
|
|
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
2006-01-12 02:10:47 +00:00
|
|
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs.model.datasources
|
2006-01-17 17:52:23 +00:00
|
|
|
* @since CakePHP v 0.10.5.1790
|
2006-01-12 02:10:47 +00:00
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* DataSource base class
|
2006-01-12 02:10:47 +00:00
|
|
|
*
|
|
|
|
* Long description for file
|
|
|
|
*
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs.model.datasources
|
2006-01-17 17:52:23 +00:00
|
|
|
* @since CakePHP v 0.10.5.1790
|
2006-01-12 02:10:47 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
class DataSource extends Object
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Are we connected to the DataSource?
|
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $connected = false;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Print debug info?
|
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $debug = false;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Print full query debug info?
|
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $fullDebug = false;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Error description of last query
|
|
|
|
*
|
|
|
|
* @var unknown_type
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $error = null;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* String to hold how many rows were affected by the last SQL operation.
|
|
|
|
*
|
2006-02-01 13:26:23 +00:00
|
|
|
* @var string
|
2006-01-12 02:10:47 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $affected = null;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Number of rows in current resultset
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $numRows = null;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Time the last query took
|
|
|
|
*
|
2006-02-01 13:26:23 +00:00
|
|
|
* @var int
|
2006-01-12 02:10:47 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $took = null;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enter description here...
|
|
|
|
*
|
2006-02-01 13:26:23 +00:00
|
|
|
* @var array
|
2006-01-12 02:10:47 +00:00
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $_result = null;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries count.
|
|
|
|
*
|
2006-02-01 13:26:23 +00:00
|
|
|
* @var int
|
2006-01-12 02:10:47 +00:00
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $_queriesCnt = 0;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Total duration of all queries.
|
|
|
|
*
|
|
|
|
* @var unknown_type
|
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $_queriesTime = null;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Log of queries executed by this DataSource
|
|
|
|
*
|
|
|
|
* @var unknown_type
|
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $_queriesLog = array();
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maximum number of items in query log, to prevent query log taking over
|
|
|
|
* too much memory on large amounts of queries -- I we've had problems at
|
|
|
|
* >6000 queries on one system.
|
|
|
|
*
|
|
|
|
* @var int Maximum number of queries in the queries log.
|
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $_queriesLogMax = 200;
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The default configuration of a specific DataSource
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
var $_baseConfig = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Holds references to descriptions loaded by the DataSource
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access private
|
|
|
|
*/
|
|
|
|
var $__descriptions = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A reference to the physical connection of this DataSource
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
var $connection = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The DataSource configuration
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
var $config = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The DataSource configuration key name
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
var $configKeyName = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not this DataSource is in the middle of a transaction
|
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
var $__transactionStarted = false;
|
|
|
|
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* Constructor.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function __construct ()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
if(func_num_args() > 0)
|
|
|
|
{
|
2006-01-12 02:10:47 +00:00
|
|
|
$this->setConfig(func_get_arg(0));
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
2006-01-17 17:52:23 +00:00
|
|
|
* Returns true if the DataSource supports the given interface (method)
|
|
|
|
*
|
|
|
|
* @param string $interface The name of the interface (method)
|
|
|
|
* @return boolean True on success
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function isInterfaceSupported ($interface)
|
|
|
|
{
|
2006-01-12 02:10:47 +00:00
|
|
|
$methods = get_class_methods(get_class($this));
|
|
|
|
$methods = strtolower(implode('|', $methods));
|
|
|
|
$methods = explode('|', $methods);
|
|
|
|
return in_array(strtolower($interface), $methods);
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
2006-01-17 17:52:23 +00:00
|
|
|
* Sets the configuration for the DataSource
|
|
|
|
*
|
|
|
|
* @param array $config The configuration array
|
|
|
|
* @return void
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function setConfig ($config)
|
|
|
|
{
|
|
|
|
if(is_array($this->_baseConfig))
|
|
|
|
{
|
2006-01-12 02:10:47 +00:00
|
|
|
$this->config = $this->_baseConfig;
|
|
|
|
foreach($config as $key => $val)
|
|
|
|
{
|
|
|
|
$this->config[$key] = $val;
|
|
|
|
}
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-12 02:10:47 +00:00
|
|
|
|
|
|
|
/**
|
2006-01-17 17:52:23 +00:00
|
|
|
* Cache the DataSource description
|
|
|
|
*
|
|
|
|
* @param string $object The name of the object (model) to cache
|
|
|
|
* @param mixed $data The description of the model, usually a string or array
|
|
|
|
* @return void
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function __cacheDescription ($object, $data = null)
|
|
|
|
{
|
|
|
|
if (DEBUG > 0)
|
|
|
|
{
|
|
|
|
$expires = "+10 seconds";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-12 00:11:40 +00:00
|
|
|
$expires = "+999 days";
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($data !== null)
|
|
|
|
{
|
|
|
|
$this->__descriptions[$object] = &$data;
|
2006-01-27 03:24:40 +00:00
|
|
|
$cache = serialize($data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cache = null;
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
|
|
|
|
2006-01-27 03:24:40 +00:00
|
|
|
$new = cache('models'.DS.low(get_class($this)).'_'.$object, $cache, $expires);
|
2006-01-12 02:10:47 +00:00
|
|
|
if($new != null)
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
$new = unserialize($new);
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
|
|
|
return $new;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-02-02 11:48:29 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-12 02:10:47 +00:00
|
|
|
* @return string
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function conditions ($conditions)
|
|
|
|
{
|
|
|
|
return $conditions;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
* @param unknown_type $name
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function name ($name)
|
|
|
|
{
|
|
|
|
return $name;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
* @param unknown_type $value
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function value ($value)
|
|
|
|
{
|
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* Returns a Model description (metadata) or null if none found.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
2006-02-01 13:26:23 +00:00
|
|
|
* @param Model $model
|
|
|
|
* @return mixed
|
2006-01-17 17:52:23 +00:00
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function describe ($model)
|
|
|
|
{
|
2006-01-12 03:56:59 +00:00
|
|
|
if (isset($this->__descriptions[$model->table]))
|
2006-01-12 02:10:47 +00:00
|
|
|
{
|
2006-01-12 03:56:59 +00:00
|
|
|
return $this->__descriptions[$model->table];
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
|
|
|
|
2006-01-12 03:56:59 +00:00
|
|
|
$cache = $this->__cacheDescription($model->table);
|
2006-01-12 02:10:47 +00:00
|
|
|
if ($cache !== null)
|
|
|
|
{
|
2006-01-12 03:56:59 +00:00
|
|
|
$this->__descriptions[$model->table] = &$cache;
|
2006-01-12 02:10:47 +00:00
|
|
|
return $cache;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
* @param unknown_type $model
|
|
|
|
* @param unknown_type $fields
|
|
|
|
* @param unknown_type $values
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function create (&$model, $fields = null, $values = null)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
* @param unknown_type $model
|
|
|
|
* @param unknown_type $queryData
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function read (&$model, $queryData = array())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
* @param unknown_type $model
|
|
|
|
* @param unknown_type $fields
|
|
|
|
* @param unknown_type $values
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function update (&$model, $fields = null, $values = null)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
* @param unknown_type $model
|
|
|
|
* @param unknown_type $id
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function delete (&$model, $id = null)
|
|
|
|
{
|
|
|
|
if ($id == null)
|
|
|
|
{
|
|
|
|
$id = $model->id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
2006-02-01 13:26:23 +00:00
|
|
|
* @param mixed $fields
|
|
|
|
* @return mixed
|
2006-01-17 17:52:23 +00:00
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function fields ($fields)
|
|
|
|
{
|
|
|
|
return $fields;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
2006-02-07 02:19:53 +00:00
|
|
|
* @param Model $model
|
2006-01-17 17:52:23 +00:00
|
|
|
* @param unknown_type $fields
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function getColumnType (&$model, $fields)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
|
|
|
* Enter description here...
|
|
|
|
*
|
|
|
|
* @param unknown_type $query
|
|
|
|
* @param unknown_type $data
|
|
|
|
* @param unknown_type $association
|
|
|
|
* @param unknown_type $assocData
|
2006-02-01 13:26:23 +00:00
|
|
|
* @param Model $model
|
2006-02-07 02:19:53 +00:00
|
|
|
* @param Model $linkModel
|
2006-01-17 17:52:23 +00:00
|
|
|
* @param unknown_type $index
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function insertQueryData($query, $data, $association, $assocData, &$model, &$linkModel, $index)
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
$keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}');
|
2006-01-12 02:10:47 +00:00
|
|
|
foreach($keys as $key)
|
|
|
|
{
|
2006-03-08 03:13:32 +00:00
|
|
|
$val = null;
|
2006-01-12 02:10:47 +00:00
|
|
|
if (strpos($query, $key) !== false)
|
|
|
|
{
|
|
|
|
switch($key)
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
case '{$__cakeID__$}':
|
2006-01-17 05:13:38 +00:00
|
|
|
if (isset($data[$index][$model->name]))
|
|
|
|
{
|
|
|
|
if(isset($data[$index][$model->name][$model->primaryKey]))
|
|
|
|
{
|
|
|
|
$val = $data[$index][$model->name][$model->primaryKey];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$val = '';
|
|
|
|
}
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-03-08 03:13:32 +00:00
|
|
|
case '{$__cakeForeignKey__$}':
|
|
|
|
$foreignKey = Inflector::underscore($linkModel->name).'_id';
|
|
|
|
$val = $data[$index][$model->name][$foreignKey];
|
2006-01-12 02:10:47 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-03-01 19:13:48 +00:00
|
|
|
$query = r($key, $this->value($val, $model->getColumnType($model->primaryKey)), $query);
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* To-be-overridden in subclasses.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
* @param unknown_type $model
|
|
|
|
* @param unknown_type $key
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function resolveKey($model, $key)
|
|
|
|
{
|
2006-03-01 19:13:48 +00:00
|
|
|
return $model->name.$key;
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* Enter description here... The special {n}, as seen in the Model::generateList method, is taken care of here.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
2006-02-01 13:26:23 +00:00
|
|
|
* @param array $data
|
2006-02-07 02:19:53 +00:00
|
|
|
* @param mixed $path As an array, or as a dot-separated string.
|
|
|
|
* @return array
|
2006-01-17 17:52:23 +00:00
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function getFieldValue ($data, $path)
|
|
|
|
{
|
|
|
|
if (!is_array($path))
|
|
|
|
{
|
|
|
|
$path = explode('.', $path);
|
|
|
|
}
|
|
|
|
$tmp = array();
|
|
|
|
|
|
|
|
foreach ($path as $i => $key)
|
|
|
|
{
|
|
|
|
if (intval($key) > 0 || $key == '0')
|
|
|
|
{
|
|
|
|
if (isset($data[intval($key)]))
|
|
|
|
{
|
|
|
|
$data = $data[intval($key)];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif ($key == '{n}')
|
|
|
|
{
|
|
|
|
foreach ($data as $j => $val)
|
|
|
|
{
|
2006-02-02 11:48:29 +00:00
|
|
|
$tmp[] = DataSource::getFieldValue($val, array_slice($path, $i + 1));
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
|
|
|
return $tmp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isset($data[$key]))
|
|
|
|
{
|
|
|
|
$data = $data[$key];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
2006-02-01 13:26:23 +00:00
|
|
|
/**
|
|
|
|
* To-be-overridden in subclasses.
|
|
|
|
*
|
|
|
|
*/
|
2006-01-22 05:12:28 +00:00
|
|
|
function buildSchemaQuery($schema)
|
|
|
|
{
|
|
|
|
die("Implement in DBO");
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:52:23 +00:00
|
|
|
/**
|
2006-02-01 13:26:23 +00:00
|
|
|
* Closes the current datasource.
|
2006-01-17 17:52:23 +00:00
|
|
|
*
|
|
|
|
*/
|
2006-01-12 02:10:47 +00:00
|
|
|
function __destruct ()
|
|
|
|
{
|
|
|
|
if ($this->connected)
|
|
|
|
{
|
|
|
|
$this->close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|