summaryrefslogtreecommitdiff
path: root/framework/Data
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data')
-rw-r--r--framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php12
-rw-r--r--framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php2
-rw-r--r--framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php12
-rw-r--r--framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php2
-rw-r--r--framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php12
-rw-r--r--framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php2
6 files changed, 36 insertions, 6 deletions
diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php
index e7e7ceb8..d659851f 100644
--- a/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php
@@ -25,6 +25,7 @@ class TMysqlColumnMetaData extends TComponent
private $_autoIncrement;
private $_default;
private $_notNull=true;
+ private $_property;
private $_isPrimary=null;
@@ -38,8 +39,9 @@ class TMysqlColumnMetaData extends TComponent
* @param string serial name.
* @param string default value.
*/
- public function __construct($name,$type,$notNull,$autoIncrement,$default,$primary)
+ public function __construct($property, $name,$type,$notNull,$autoIncrement,$default,$primary)
{
+ $this->_property=$property;
$this->_name=$name;
$this->_type=$type;
$this->_notNull=$notNull;
@@ -56,6 +58,14 @@ class TMysqlColumnMetaData extends TComponent
return $this->_name;
}
+ /**
+ * @return string column name, used as active record property name
+ */
+ public function getProperty()
+ {
+ return $this->_property;
+ }
+
public function getPHPType()
{
switch(strtolower($this->_type))
diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php
index dcbf6ada..5e438e37 100644
--- a/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php
+++ b/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php
@@ -51,7 +51,7 @@ class TMysqlMetaDataInspector extends TDbMetaDataInspector
$autoIncrement=is_int(strpos(strtolower($col['Extra']), 'auto_increment'));
$default = $col['Default'];
$primaryKey = $col['Key']==='PRI';
- return new TMysqlColumnMetaData($name,$type,$notNull,$autoIncrement,$default,$primaryKey);
+ return new TMysqlColumnMetaData($col['Field'],$name,$type,$notNull,$autoIncrement,$default,$primaryKey);
}
/**
diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php
index 1e799aac..a51c435d 100644
--- a/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php
@@ -26,6 +26,7 @@ class TPgsqlColumnMetaData extends TComponent
private $_default;
private $_length;
private $_notNull=true;
+ private $_property;
private $_isPrimary=null;
@@ -39,8 +40,9 @@ class TPgsqlColumnMetaData extends TComponent
* @param string serial name.
* @param string default value.
*/
- public function __construct($name,$type,$length,$notNull,$serial,$default)
+ public function __construct($property,$name,$type,$length,$notNull,$serial,$default)
{
+ $this->_property=$property;
$this->_name=$name;
$this->_type=$type;
$this->_length=$length;
@@ -57,6 +59,14 @@ class TPgsqlColumnMetaData extends TComponent
return $this->_name;
}
+ /**
+ * @return string column name, used as active record property name
+ */
+ public function getProperty()
+ {
+ return $this->_property;
+ }
+
public function getPHPType()
{
switch(strtolower($this->_type))
diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php
index 910b826e..6f787942 100644
--- a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php
+++ b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php
@@ -150,7 +150,7 @@ EOD;
$notNull = $col['attnotnull'];
$serial = $col['attisserial'] ? $schema.'.'.$this->getSerialName($col['adsrc']) : null;
$default = $serial === null && $col['atthasdef'] ? $col['adsrc'] : null;
- return new TPgsqlColumnMetaData($name,$type,$length,$notNull,$serial,$default);
+ return new TPgsqlColumnMetaData($col['attname'],$name,$type,$length,$notNull,$serial,$default);
}
/**
diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php
index abb50caf..92315a1a 100644
--- a/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php
+++ b/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php
@@ -28,9 +28,11 @@ class TSqliteColumnMetaData extends TComponent
private $_autoIncrement;
private $_default;
private $_primary=false;
+ private $_property;
- public function __construct($name,$type,$notNull,$autoIncrement,$default,$primary)
+ public function __construct($property,$name,$type,$notNull,$autoIncrement,$default,$primary)
{
+ $this->_property=$property;
$this->_name=$name;
$this->_type=$type;
$this->_notNull=$notNull;
@@ -55,6 +57,14 @@ class TSqliteColumnMetaData extends TComponent
}
/**
+ * @return string column name, used as active record property name
+ */
+ public function getProperty()
+ {
+ return $this->_property;
+ }
+
+ /**
* @return string quoted column name.
*/
public function getName()
diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php
index 29bc3b8a..3621c666 100644
--- a/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php
+++ b/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php
@@ -73,7 +73,7 @@ class TSqliteMetaDataInspector extends TDbMetaDataInspector
$primary = $col['pk']==='1';
$autoIncrement = strtolower($type)==='integer' && $primary;
$default = $col['dflt_value'];
- return new TSqliteColumnMetaData($name,$type,$notNull,$autoIncrement,$default,$primary);
+ return new TSqliteColumnMetaData($col['name'],$name,$type,$notNull,$autoIncrement,$default,$primary);
}
/**