public function query($Sql, $Type = 'select')
{
$QueryOptions = array('Type' => $Type, 'Slave' => GetValue('Slave', $this->_Options, null));
switch ($Type) {
case 'insert':
$ReturnType = 'ID';
break;
case 'update':
$ReturnType = null;
break;
default:
$ReturnType = 'DataSet';
break;
}
$QueryOptions['ReturnType'] = $ReturnType;
if (!is_null($this->_CacheKey)) {
$QueryOptions['Cache'] = $this->_CacheKey;
}
if (!is_null($this->_CacheKey)) {
$QueryOptions['CacheOperation'] = $this->_CacheOperation;
}
if (!is_null($this->_CacheOptions)) {
$QueryOptions['CacheOptions'] = $this->_CacheOptions;
}
try {
if ($this->CaptureModifications && strtolower($Type) != 'select') {
if (!property_exists($this->Database, 'CapturedSql')) {
$this->Database->CapturedSql = array();
}
$Sql2 = $this->applyParameters($Sql, $this->_NamedParameters);
$this->Database->CapturedSql[] = $Sql2;
$this->reset();
return true;
}
$Result = $this->Database->query($Sql, $this->_NamedParameters, $QueryOptions);
} catch (Exception $Ex) {
$this->reset();
throw $Ex;
}
$this->reset();
return $Result;
}