1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-03 20:57:36 +02:00

Implemented OracleDriver::getColumns() (#233)

This commit is contained in:
Aleš Culek
2016-08-09 22:37:45 +02:00
committed by David Grudl
parent 3a6dc07da8
commit be7c3f095d

View File

@@ -466,7 +466,20 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
*/
public function getColumns($table)
{
throw new Dibi\NotImplementedException;
$res = $this->query('SELECT * FROM "ALL_TAB_COLUMNS" WHERE "TABLE_NAME" = ' . $this->escapeText($table));
$columns = [];
while ($row = $res->fetch(TRUE)) {
$columns[] = [
'table' => $row['TABLE_NAME'],
'name' => $row['COLUMN_NAME'],
'nativetype' => $row['DATA_TYPE'],
'size' => isset($row['DATA_LENGTH']) ? $row['DATA_LENGTH'] : NULL,
'nullable' => $row['NULLABLE'] === 'Y',
'default' => $row['DATA_DEFAULT'],
'vendor' => $row,
];
}
return $columns;
}