summaryrefslogtreecommitdiff
path: root/framework/Data
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data')
-rw-r--r--framework/Data/ActiveRecord/TActiveRecord.php2
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordCriteria.php24
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordGateway.php2
-rw-r--r--framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php4
-rw-r--r--framework/Data/SqlMap/Statements/TCachingStatement.php6
5 files changed, 32 insertions, 6 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php
index 109ae9a6..54aef3f3 100644
--- a/framework/Data/ActiveRecord/TActiveRecord.php
+++ b/framework/Data/ActiveRecord/TActiveRecord.php
@@ -520,7 +520,7 @@ abstract class TActiveRecord extends TComponent
$search = implode('|', $meta->getColumnNames());
$regexp = '/('.$search.')(and|_and_|or|_or_)?/i';
$matches = array();
- if(!preg_match_all($regexp, strtolower($condition), $matches,PREG_SET_ORDER))
+ if(!preg_match_all($regexp, $condition, $matches,PREG_SET_ORDER))
{
throw new TActiveRecordException('ar_mismatch_column_names',
$method, implode(', ', $meta->getColumnNames()), $meta->getTableName());
diff --git a/framework/Data/ActiveRecord/TActiveRecordCriteria.php b/framework/Data/ActiveRecord/TActiveRecordCriteria.php
index 533ff50a..134632e8 100644
--- a/framework/Data/ActiveRecord/TActiveRecordCriteria.php
+++ b/framework/Data/ActiveRecord/TActiveRecordCriteria.php
@@ -150,6 +150,30 @@ class TActiveRecordCriteria extends TComponent
}
/**
+ * This method is invoked before the object is deleted from the database.
+ * The method raises 'OnDelete' event.
+ * If you override this method, be sure to call the parent implementation
+ * so that the event handlers can be invoked.
+ * @param TActiveRecordEventParameter event parameter to be passed to the event handlers
+ */
+ public function onDelete($param)
+ {
+ $this->raiseEvent('OnDelete', $this, $param);
+ }
+
+ /**
+ * This method is invoked before any select query is executed on the database.
+ * The method raises 'OnSelect' event.
+ * If you override this method, be sure to call the parent implementation
+ * so that the event handlers can be invoked.
+ * @param TActiveRecordEventParameter event parameter to be passed to the event handlers
+ */
+ public function onSelect($param)
+ {
+ $this->raiseEvent('OnSelect', $this, $param);
+ }
+
+ /**
* @return string string representation of the criteria. Useful for debugging.
*/
public function __toString()
diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php
index f9cc5bbd..be9731c5 100644
--- a/framework/Data/ActiveRecord/TActiveRecordGateway.php
+++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php
@@ -300,6 +300,8 @@ class TActiveRecordGateway extends TComponent
$param = new TActiveRecordGatewayEventParameter($type,$command,$record,$data);
$manager = $record->getRecordManager();
$event = 'on'.$type;
+ if($data instanceof TActiveRecordCriteria)
+ $data->{$event}($param);
$manager->{$event}($param);
}
}
diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php
index 1d4599a8..94f0bb72 100644
--- a/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php
+++ b/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php
@@ -55,7 +55,7 @@ class TSqliteMetaDataInspector extends TDbMetaDataInspector
$command->prepare();
$cols = array();
foreach($command->query() as $col)
- $cols[strtolower($col['name'])] = $this->getColumnMetaData($col);
+ $cols[$col['name']] = $this->getColumnMetaData($col);
return $cols;
}
@@ -73,7 +73,7 @@ class TSqliteMetaDataInspector extends TDbMetaDataInspector
$primary = $col['pk']==='1';
$autoIncrement = strtolower($type)==='integer' && $primary;
$default = $col['dflt_value'];
- return new TSqliteColumnMetaData(strtolower($col['name']),$name,$type,
+ return new TSqliteColumnMetaData($col['name'],$name,$type,
$notNull,$autoIncrement,$default,$primary);
}
diff --git a/framework/Data/SqlMap/Statements/TCachingStatement.php b/framework/Data/SqlMap/Statements/TCachingStatement.php
index 7d0c0824..051a8ec3 100644
--- a/framework/Data/SqlMap/Statements/TCachingStatement.php
+++ b/framework/Data/SqlMap/Statements/TCachingStatement.php
@@ -45,7 +45,7 @@ class TCachingStatement implements IMappedStatement
public function executeQueryForMap($connection, $parameter,$keyProperty, $valueProperty=null, $delegate=null)
{
$sql = $this->createCommand($connection, $parameter);
- $key = $this->getCacheKey(array($sql, $keyProperty, $valueProperty));
+ $key = $this->getCacheKey(array(clone($sql), $keyProperty, $valueProperty));
$map = $this->getStatement()->getCache()->get($key);
if(is_null($map))
{
@@ -69,7 +69,7 @@ class TCachingStatement implements IMappedStatement
public function executeQueryForList($connection, $parameter, $result=null, $skip=-1, $max=-1, $delegate=null)
{
$sql = $this->createCommand($connection, $parameter);
- $key = $this->getCacheKey(array($sql, $skip, $max));
+ $key = $this->getCacheKey(array(clone($sql), $parameter, $skip, $max));
$list = $this->getStatement()->getCache()->get($key);
if(is_null($list))
{
@@ -83,7 +83,7 @@ class TCachingStatement implements IMappedStatement
public function executeQueryForObject($connection, $parameter, $result=null)
{
$sql = $this->createCommand($connection, $parameter);
- $key = $this->getCacheKey($sql);
+ $key = $this->getCacheKey(array(clone($sql), $parameter));
$object = $this->getStatement()->getCache()->get($key);
if(is_null($object))
{