diff options
| author | Mark Newnham <mark@newnhams.com> | 2026-02-19 20:18:56 -0700 |
|---|---|---|
| committer | Mark Newnham <mark@newnhams.com> | 2026-02-19 20:18:56 -0700 |
| commit | 16a897a3d53eab910e4971b19bfb8cd22f1f9b14 (patch) | |
| tree | 1b77d9095f4f771da66f765a009a3fc13af2248f | |
| parent | ee16ebbf9316df5a25b9a80ee7371c9417ff379a (diff) | |
| download | adodb-16a897a3d53eab910e4971b19bfb8cd22f1f9b14.tar.gz adodb-16a897a3d53eab910e4971b19bfb8cd22f1f9b14.tar.bz2 adodb-16a897a3d53eab910e4971b19bfb8cd22f1f9b14.zip | |
Does not return correclty if multiple constraints exist on same table
Does not reset correct fetch mode if $db->setFetchMode mode not yet set
Does not return correct value if invalid table name passed to method
| -rw-r--r-- | drivers/adodb-oci8.inc.php | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/drivers/adodb-oci8.inc.php b/drivers/adodb-oci8.inc.php index 36230e66..0522b078 100644 --- a/drivers/adodb-oci8.inc.php +++ b/drivers/adodb-oci8.inc.php @@ -1556,7 +1556,22 @@ SELECT /*+ RULE */ distinct b.column_name { global $ADODB_FETCH_MODE; - $save = $ADODB_FETCH_MODE; + $tableName = $this->metaTables('T', $owner, $table); + if ($tableName == false) { + return false; + } + + $saveModes = [ + $ADODB_FETCH_MODE, + $this->fetchMode + ]; + + if ($saveModes[1] && $saveModes[1] <> ADODB_FETCH_NUM) { + $associative = true; + } else if (!$saveModes[1] && $saveModes[0] <> ADODB_FETCH_NUM ) { + $associative = true; + } + $ADODB_FETCH_MODE = ADODB_FETCH_NUM; $this->SetFetchMode(ADODB_FETCH_NUM); @@ -1576,7 +1591,7 @@ SELECT /*+ RULE */ distinct b.column_name AND table_name = $table $owner"; $constraints = $this->GetArray($sql); - $arr = false; + $arr = []; foreach($constraints as $constr) { $cons = $this->qstr($constr[0]); $rowner = $this->qstr($constr[1]); @@ -1596,7 +1611,7 @@ SELECT /*+ RULE */ distinct b.column_name $targetData = $this->GetArray($sql); if ($sourceData && $targetData) { - $arr = []; + $max = sizeof($sourceData); foreach ($targetData as $k => $v) { if ($upper) { @@ -1608,7 +1623,7 @@ SELECT /*+ RULE */ distinct b.column_name if (!array_key_exists($tableName, $arr)) { $arr[$tableName] = []; } - if ($save <> ADODB_FETCH_NUM || ($save == ADODB_FETCH_NUM && $associative)) { + if ($associative) { /* * Write ADODB_FETCH_ASSOC format */ @@ -1638,8 +1653,14 @@ SELECT /*+ RULE */ distinct b.column_name } } } - $ADODB_FETCH_MODE = $save; - $this->SetFetchMode($save); + + $ADODB_FETCH_MODE = $saveModes[0]; + $this->fetchMode = $saveModes[1]; + + if (!$arr || count($arr) == 0) { + return false; + } + return $arr; } |
