驱动改进

This commit is contained in:
thinkphp
2016-05-09 12:01:41 +08:00
parent ae908199eb
commit e7839557c6
5 changed files with 15 additions and 11 deletions

View File

@@ -11,6 +11,7 @@
namespace think\db\connector;
use PDO;
use think\Db;
use think\db\Connection;
@@ -104,7 +105,7 @@ class Oracle extends Connection
list($tableName) = explode(' ', $tableName);
$sql = "select a.column_name,data_type,DECODE (nullable, 'Y', 0, 1) notnull,data_default, DECODE (A .column_name,b.column_name,1,0) pk from all_tab_columns a,(select column_name from all_constraints c, all_cons_columns col where c.constraint_name = col.constraint_name and c.constraint_type = 'P' and c.table_name = '" . strtoupper($tableName) . "' ) b where table_name = '" . strtoupper($tableName) . "' and a.column_name = b.column_name (+)";
$pdo = $this->linkID->query($sql);
$result = $pdo->fetchAll(\PDO::FETCH_ASSOC);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
if ($result) {
foreach ($result as $key => $val) {
@@ -131,7 +132,7 @@ class Oracle extends Connection
public function getTables()
{
$pdo = $this->linkID->query("select table_name from all_tables");
$result = $pdo->fetchAll(\PDO::FETCH_ASSOC);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);