From 3dc598bc7c2604e24b9e0be1189d9d78b43737ea Mon Sep 17 00:00:00 2001 From: wei <> Date: Wed, 17 Jan 2007 08:01:40 +0000 Subject: Add active record generator. --- .../Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php') 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. */ -- cgit v1.2.3