summaryrefslogtreecommitdiff
path: root/drivers/adodb-postgres7.inc.php
diff options
context:
space:
mode:
authorGold <gold@catalyst.net.nz>2021-11-09 06:28:17 +1300
committerGitHub <noreply@github.com>2021-11-08 18:28:17 +0100
commit736d808ffb3aa4a4f09d2ba415caf2e2a39f8f14 (patch)
tree2b388136549b52702742239a4c3d52f1db414881 /drivers/adodb-postgres7.inc.php
parent27d12fe1e0721aba66bca05e4059b305fc0c8459 (diff)
downloadadodb-736d808ffb3aa4a4f09d2ba415caf2e2a39f8f14.tar.gz
adodb-736d808ffb3aa4a4f09d2ba415caf2e2a39f8f14.tar.bz2
adodb-736d808ffb3aa4a4f09d2ba415caf2e2a39f8f14.zip
Refactored ADODB_postgres7::_fixblobs()
The call to pg_fetch_array() returns false in all cases where we would not need or want to potentially _fixblobs() and return true. A straight up boolean check is all that is needed here, no need for in_array(). Tracking through _fixblobs() is called in a number of places and how its result is checked was repeated in every case. The checks were moved into the function, which was updated to return a boolean should we want to check that. It was also noted that in every case the setting of $this->fields was identical as well so new _prepfields() method was added which sets $this->fields and calls _fixblobs(). All instances of _fixblobs() were replaced with _prepfields() and the pg_fetch_array() call deleted. Fixes #767 (replacing #760)
Diffstat (limited to 'drivers/adodb-postgres7.inc.php')
-rw-r--r--drivers/adodb-postgres7.inc.php27
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/adodb-postgres7.inc.php b/drivers/adodb-postgres7.inc.php
index 08911033..52b59f71 100644
--- a/drivers/adodb-postgres7.inc.php
+++ b/drivers/adodb-postgres7.inc.php
@@ -299,12 +299,8 @@ class ADORecordSet_postgres7 extends ADORecordSet_postgres64{
if (!$this->EOF) {
$this->_currentRow++;
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
- $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
-
- if (is_array($this->fields)) {
- if ($this->fields && isset($this->_blobArr)) $this->_fixblobs();
- return true;
- }
+ $this->_prepfields();
+ if ($this->fields !== false) return true;
}
$this->fields = false;
$this->EOF = true;
@@ -325,12 +321,7 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
return false;
}
- $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
-
- if ($this->fields) {
- if (isset($this->_blobArr)) $this->_fixblobs();
- $this->_updatefields();
- }
+ if ($this->_prepfields()) $this->_updatefields();
return (is_array($this->fields));
}
@@ -340,19 +331,13 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
if (!$this->EOF) {
$this->_currentRow++;
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
- $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
-
- if (is_array($this->fields)) {
- if ($this->fields) {
- if (isset($this->_blobArr)) $this->_fixblobs();
-
- $this->_updatefields();
- }
+ $this->_prepfields();
+ if ($this->fields !== false) {
+ $this->_updatefields();
return true;
}
}
-
$this->fields = false;
$this->EOF = true;
}