Db类增加RESULTSET_ARRAY RESULTSET_COLLECTION 和 RESULTSET_CLASS 常量

数据库Connection类增加resultSetType属性定义 支持设置数据集返回类型
This commit is contained in:
thinkphp
2016-05-09 11:45:00 +08:00
parent 6723257a4b
commit 144a6132e6
9 changed files with 89 additions and 35 deletions

View File

@@ -102,8 +102,9 @@ class Oracle extends Connection
public function getFields($tableName)
{
list($tableName) = explode(' ', $tableName);
$url = "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 (+)";
$result = $this->query($url);
$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);
$info = [];
if ($result) {
foreach ($result as $key => $val) {
@@ -129,7 +130,8 @@ class Oracle extends Connection
*/
public function getTables()
{
$result = $this->query("select table_name from all_tables");
$pdo = $this->linkID->query("select table_name from all_tables");
$result = $pdo->fetchAll(\PDO::FETCH_ASSOC);
$info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);