1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-15 18:44:27 +02:00

MySQL drivers: getColumns() obtains comments

This commit is contained in:
David Grudl
2009-09-08 21:27:57 +02:00
parent 08e70fda61
commit 532ed3a316
2 changed files with 4 additions and 2 deletions

View File

@@ -467,7 +467,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
*/ */
public function getColumns($table) public function getColumns($table)
{ {
$this->query("SHOW COLUMNS FROM `$table`"); $this->query("SHOW FULL COLUMNS FROM `$table`");
$res = array(); $res = array();
while ($row = $this->fetch(TRUE)) { while ($row = $this->fetch(TRUE)) {
$type = explode('(', $row['Type']); $type = explode('(', $row['Type']);
@@ -479,6 +479,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
'nullable' => $row['Null'] === 'YES', 'nullable' => $row['Null'] === 'YES',
'default' => $row['Default'], 'default' => $row['Default'],
'autoincrement' => $row['Extra'] === 'auto_increment', 'autoincrement' => $row['Extra'] === 'auto_increment',
'vendor' => $row,
); );
} }
$this->free(); $this->free();

View File

@@ -470,7 +470,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
FROM INFORMATION_SCHEMA.COLUMNS FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = $table AND TABLE_SCHEMA = DATABASE() WHERE TABLE_NAME = $table AND TABLE_SCHEMA = DATABASE()
");*/ ");*/
$this->query("SHOW COLUMNS FROM `$table`"); $this->query("SHOW FULL COLUMNS FROM `$table`");
$res = array(); $res = array();
while ($row = $this->fetch(TRUE)) { while ($row = $this->fetch(TRUE)) {
$type = explode('(', $row['Type']); $type = explode('(', $row['Type']);
@@ -482,6 +482,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
'nullable' => $row['Null'] === 'YES', 'nullable' => $row['Null'] === 'YES',
'default' => $row['Default'], 'default' => $row['Default'],
'autoincrement' => $row['Extra'] === 'auto_increment', 'autoincrement' => $row['Extra'] === 'auto_increment',
'vendor' => $row,
); );
} }
$this->free(); $this->free();