summaryrefslogtreecommitdiff
path: root/lib/prado/framework/Data/Common/Mysql/TMysqlTableInfo.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prado/framework/Data/Common/Mysql/TMysqlTableInfo.php')
-rw-r--r--lib/prado/framework/Data/Common/Mysql/TMysqlTableInfo.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/prado/framework/Data/Common/Mysql/TMysqlTableInfo.php b/lib/prado/framework/Data/Common/Mysql/TMysqlTableInfo.php
new file mode 100644
index 0000000..bc5dc4e
--- /dev/null
+++ b/lib/prado/framework/Data/Common/Mysql/TMysqlTableInfo.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * TMysqlTableInfo class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link https://github.com/pradosoft/prado
+ * @copyright Copyright &copy; 2005-2015 The PRADO Group
+ * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
+ * @package System.Data.Common.Mysql
+ */
+
+/**
+ * Loads the base TDbTableInfo class and TMysqlTableColumn class.
+ */
+Prado::using('System.Data.Common.TDbTableInfo');
+Prado::using('System.Data.Common.Mysql.TMysqlTableColumn');
+
+/**
+ * TMysqlTableInfo class provides additional table information for MySQL database.
+ *
+ * @author Wei Zhuo <weizho[at]gmail[dot]com>
+ * @package System.Data.Common.Mysql
+ * @since 3.1
+ */
+class TMysqlTableInfo extends TDbTableInfo
+{
+ /**
+ * @return string name of the schema this column belongs to.
+ */
+ public function getSchemaName()
+ {
+ return $this->getInfo('SchemaName');
+ }
+
+ /**
+ * @return string full name of the table, database dependent.
+ */
+ public function getTableFullName()
+ {
+ if(($schema=$this->getSchemaName())!==null)
+ return '`'.$schema.'`.`'.$this->getTableName().'`';
+ else
+ return '`'.$this->getTableName().'`';
+ }
+
+ /**
+ * @param TDbConnection database connection.
+ * @return TDbCommandBuilder new command builder
+ */
+ public function createCommandBuilder($connection)
+ {
+ Prado::using('System.Data.Common.Mysql.TMysqlCommandBuilder');
+ return new TMysqlCommandBuilder($connection,$this);
+ }
+}
+