summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/Vendor
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data/ActiveRecord/Vendor')
-rw-r--r--framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php4
-rw-r--r--framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php15
-rw-r--r--framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php3
-rw-r--r--framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php15
-rw-r--r--framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php3
-rw-r--r--framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php15
-rw-r--r--framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php3
7 files changed, 53 insertions, 5 deletions
diff --git a/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php b/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php
index 7f7dad8b..6e157785 100644
--- a/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php
+++ b/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php
@@ -67,7 +67,7 @@ abstract class TDbMetaDataCommon extends TDbMetaData
public function getFindByCriteriaCommand($conn, $criteria=null)
{
$columns = $this->getSelectionColumns();
- $conditions = $criteria!==null?$this->getSqlFromCriteria($conn,$criteria) : '';
+ $conditions = $this->getSqlFromCriteria($conn,$criteria);
$table = $this->getTableName();
$sql = "SELECT {$columns} FROM {$table} {$conditions}";
return $this->createCriteriaBindedCommand($conn,$sql, $criteria);
@@ -88,7 +88,7 @@ abstract class TDbMetaDataCommon extends TDbMetaData
return $this->createCriteriaBindedCommand($conn,$sql, $criteria);
}
- abstract protected function getSqlFromCriteria($conn,TActiveRecordCriteria $criteria);
+ abstract protected function getSqlFromCriteria($conn, $criteria);
/**
* Sql command with parameters binded.
diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php
index b5bd4050..e7e7ceb8 100644
--- a/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php
@@ -56,6 +56,21 @@ class TMysqlColumnMetaData extends TComponent
return $this->_name;
}
+ public function getPHPType()
+ {
+ switch(strtolower($this->_type))
+ {
+ case 'tinyint': case 'smallint': case 'mediumint': case 'int': case 'year':
+ return 'integer';
+ case 'bool':
+ return 'boolean';
+ case 'bigint': case 'float': case 'double': case 'decimal':
+ return 'float';
+ default:
+ return 'string';
+ }
+ }
+
/**
* @return boolean true if column is a sequence, false otherwise.
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php b/framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php
index b0b2ef87..0cbd0b7c 100644
--- a/framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php
@@ -28,8 +28,9 @@ class TMysqlMetaData extends TDbMetaDataCommon
* @param TActiveRecordCriteria search criteria.
* @return string SQL search.
*/
- protected function getSqlFromCriteria($conn, TActiveRecordCriteria $criteria)
+ protected function getSqlFromCriteria($conn, $criteria)
{
+ if($criteria===null) return '';
$sql = '';
if(($condition = $criteria->getCondition())!==null)
$sql .= ' WHERE '.$condition;
diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php
index d6ea8ca7..59a2d43e 100644
--- a/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php
@@ -57,6 +57,21 @@ class TPgsqlColumnMetaData extends TComponent
return $this->_name;
}
+ public function getPHPType()
+ {
+ switch(strtolower($this->_type))
+ {
+ case 'bit': case 'bit varying': case 'real': case 'serial':
+ return 'integer';
+ case 'boolean':
+ return 'boolean';
+ case 'bigint': case 'bigserial': case 'double precision': case 'money': case 'numeric':
+ return 'float';
+ default:
+ return 'string';
+ }
+ }
+
/**
* @return boolean true if column is a sequence, false otherwise.
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php
index ffb2fc31..d968267a 100644
--- a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php
@@ -30,8 +30,9 @@ class TPgsqlMetaData extends TDbMetaDataCommon
* @param TActiveRecordCriteria search criteria.
* @return string SQL search.
*/
- protected function getSqlFromCriteria($conn, TActiveRecordCriteria $criteria)
+ protected function getSqlFromCriteria($conn, $criteria)
{
+ if($criteria===null) return '';
$sql = '';
if(($condition = $criteria->getCondition())!==null)
$sql .= ' WHERE '.$condition;
diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php
index 366bfce2..abb50caf 100644
--- a/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php
@@ -39,6 +39,21 @@ class TSqliteColumnMetaData extends TComponent
$this->_primary=$primary;
}
+ public function getPHPType()
+ {
+ switch(strtolower($this->_type))
+ {
+ case 'int': case 'integer': case 'mediumint': case 'smallint': case 'tinyint': case 'year':
+ return 'integer';
+ case 'boolean':
+ return 'boolean';
+ case 'decimal': case 'double': case 'float': case 'bigint':
+ return 'float';
+ default:
+ return 'string';
+ }
+ }
+
/**
* @return string quoted column name.
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php b/framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php
index 129a0acf..c82a99ad 100644
--- a/framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php
@@ -28,8 +28,9 @@ class TSqliteMetaData extends TDbMetaDataCommon
* @param TActiveRecordCriteria search criteria.
* @return string SQL search.
*/
- protected function getSqlFromCriteria($conn, TActiveRecordCriteria $criteria)
+ protected function getSqlFromCriteria($conn, $criteria)
{
+ if($criteria===null) return '';
$sql = '';
if(($condition = $criteria->getCondition())!==null)
$sql .= ' WHERE '.$condition;