summaryrefslogtreecommitdiff
path: root/drivers/adodb-postgres64.inc.php
AgeCommit message (Collapse)AuthorFilesLines
2025-05-01Mark pg_insert_id() as deprecatedDamien Regad1-0/+1
This function does the same thing as ADODB_postgres8::_insertID(), in a more limited way. There is no reason to keep it around. Fixes #1069
2025-05-01PHPDocDamien Regad1-2/+10
2025-05-01Fix SQL injection in pg_insert_id()Damien Regad1-1/+2
Properly escape the $tablename and $fieldname parameters used to build the sequence name.
2025-01-25pgsql: fix serverInfo() version numberDamien Regad1-6/+5
In ADOdb versions < 5.21.0-beta.1, serverInfo()['version'] returned just the version number (e.g. `15.10`), which was extracted from the version string using ADOConnection::_findVers(). Commit f2b88e063d61b12a1df9090b8d0c68831ed0f447 removed the _findVers() call, so serverInfo() could potentially return additional information depending on the actual value returned by pg_version() (e.g. `15.10 (Debian 15.10-0+deb12u1)`. This could cause subsequent version comparisons to fail, e.g. in metaTables(). Fixes #1059
2023-04-30Define ADOConnection::_query() methodDamien Regad1-1/+0
- Update child classes to be consistent with this declaration. - Remove unnecessary, non-PHPDoc comments - Consistent parameter names Fixes #966
2023-04-16Fix deprecated warning in ADODB_postgres64::qStr()Damien Regad1-1/+3
pg_escape_string() will trigger a deprecation warning in PHP 8.1+ when there is no connection specified. This can occur when using setSessionVariables() in the load balancer, so we fall back to emulated escaping in this case. Fixes #956
2023-03-20Fix PHP warning in ADODB_postgres64::MetaIndexes()Damien Regad1-3/+5
When calling the function on a table having an index on an expression column, a PHP warning is thrown: Undefined array key 0 in ./drivers/adodb-postgres64.inc.php on line 666 Fixes #940
2023-03-17Revert "postgres: Noblob optimization"Damien Regad1-2/+1
This reverts commit 84a7122ae93b82238c6c37bd81d483c632e8b50c (PR #112) The ADOConnection object does not have a 'connection' property, and the 'noBlobs' flag is not documented or used anywhere else. The change's original contributor never provided any feedback [1], and usage of the undefined property is now throwing a deprecation warning on PHP 8.2. [1]: https://github.com/ADOdb/ADOdb/pull/112#issuecomment-902028719
2023-03-12Remove useless property overridesDamien Regad1-1/+0
ADOConnection::$adodbFetchMode is redeclared in Postgres and PDO drivers but this is not necessary. See #923 Signed-off-by: Damien Regad <dregad@mantisbt.org>
2023-01-19PHP 8.2 fixes for PostgreSQL driverReimuHakurei1-0/+4
Fixes #913 (PR #920) (cherry picked from commit 14a4a5a47805f152f56205c1ab4ae9ce98de5ad1)
2022-08-26pgsql: check for dummy query Id before closing recordsetDamien Regad1-1/+1
Fixes #848
2022-05-06pgsql: remove is_resource() checks (PHP 8.1 compat)ReimuHakurei1-7/+5
Affected_Rows() always returns false on PHP 8.1, because the 'pgsql result' resource has been replaced by the PgSql\Result class [1]. Changes to original contribution: * Adjust PHPDoc for ADODB_postgres64::$_resultid * Fix one more occurrence in the postgres7 driver Fixes #833 [1]: https://www.php.net/manual/en/class.pgsql-result.php Co-authored-by: Damien Regad <dregad@mantisbt.org> (cherry picked from commit e3287d6be5545634a6ccbf868919028991a68791)
2022-01-23Merge branch 'hotfix/5.21'Damien Regad1-31/+44
# Conflicts: # adodb.inc.php # docs/changelog.md
2022-01-16PHPDoc and coding guidelinesDamien Regad1-9/+19
Remove old, commented-out code
2022-01-16Prevent auth bypass with PostgreSQL connectionsDamien Regad1-22/+25
Thanks to Emmet Leahy of Sorcery Ltd for reporting this vulnerability (CVE-2021-3850). Refactoring ADODB_postgres64::_connect(): - Remove adodb_addslashes() function, which did not escape the connection parameters when they are wrapped in single quotes (root cause for the identified security issue). - Use addcslashes() instead of addslashes() to only escape `'` and `\`, to strictly follow pg_connect() documentation (addslashes() also escapes `"`) - Use an array and a foreach loop to build the connection string when given individual parameters for host:port, user, password and dbname Fixes #793
2022-01-02Add missing PostgreSQL standard datatypesMike1-0/+7
Adding UUID, NUMERIC, DECIMAL, FLOAT4 and FLOAT8. Fixes #782
2021-11-08Merge _fixblobs() into _prepFields()Damien Regad1-11/+13
Following up on #767, per @Unifex's suggestion [1], removing _fixblobs() and moving its code into new _prepFields() function. Additional changes: - add PHPDoc block - protected attribute - remove return type - not really useful as in most cases success is evaluated by checking $this->fields !== false - fixed a couple remaining occurrences of is_array() checks - coding guidelines [1]: https://github.com/ADOdb/ADOdb/pull/760#issuecomment-961564909
2021-11-08Refactored ADODB_postgres7::_fixblobs() Gold1-8/+14
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)
2021-11-07Add connection parameter to pg_lo_unlink() callDamien Regad1-1/+1
Fixes #769
2021-11-07Use pg_query() instead of pg_execute()Damien Regad1-5/+4
We are not executing prepared statements with parameters here, so using pg_execute() (which expects a 3rd parameter) is not necessary. In fact, these used to be pg_exec() calls, which were incorrectly replaced by pg_execute() instead of pg_query() in commit 2223c2a1fe8ecf5b2fc07f503a280d080596dd94. Fixes #768
2021-11-07Whitespace, coding guidelines, PHPdocDamien Regad1-6/+6
2021-08-19Merge branch 'hotfix/5.21'Damien Regad1-10/+10
2021-08-19Remove useless call to pg_version()Damien Regad1-5/+5
The function's return value is never used, since we get the client version from ServerInfo().
2021-08-19pgsql: fix fetchField() parameter namingDamien Regad1-5/+5
Regression from 9f6f327b9d5b29d14565fa0ab4308354bf050d2d. fetchField()'s parameter was renamed from $off to $fieldOffset, but the change was not reflected in the method's body. Fixes #752
2021-08-17Redo Merge tag 'v5.21.1'Damien Regad1-7/+7
# Conflicts: # adodb.inc.php # docs/changelog.md # drivers/adodb-mssqlnative.inc.php # drivers/adodb-mysqli.inc.php Fixes #751
2021-08-17Redo Merge branch 'hotfix/5.21' Standardized file headersDamien Regad1-44/+19
Try to do it right this time... # Conflicts: # adodb-memcache.lib.inc.php Fixes #751
2021-08-17Reset version to avoid merge conflictsDamien Regad1-1/+1
Fixes #751
2021-08-17Revert changes since Standardized file headers mergeDamien Regad1-27/+59
The conflicts resolution applied when merging the Standardized file headers (commit e9dcce3df24912ad869d0193f0b419f2309101fc) was seriously messed up, actually overwriting a number of changes in the master branch. Rather than trying to go and fix things one by one which has a high risk of messing things further, it's easier to redo the merge from a clean slate, so this commit reverts the following: - "Merge branch 'hotfix/5.21' Standardized file headers", e9dcce3df24912ad869d0193f0b419f2309101fc - "Merge tag 'v5.21.1'", 5f437df3104159d5d659f60e31bef8d33c34995f - "Reset version to 5.22.0-dev" af9234a525c3255af051a330164486d73be4c63a - "Fix incorrect resolution of merge conflicts" a6733f61b0165b366c8d2c70d9af82edc3881951. - "Fix syntax error in toexport.inc.php" 20b01e83cb61b6b2460f64c7d1277c5f4cc28574. Fixes #751
2021-08-15PHPDoc, code styleDamien Regad1-7/+7
2021-08-14Standard file header: /driversDamien Regad1-44/+19
2021-04-11WhitespaceDamien Regad1-1/+1
2021-04-11Add stub for ADOConnection::_insertID()Damien Regad1-1/+3
Update child classes so method signature matches the parent's.
2021-03-08Bump version to 5.21.1-devDamien Regad1-1/+1
2021-02-27Bump version to 5.21.0v5.21.0Damien Regad1-1/+1
2021-02-26pgsql: Fix param(0) returning invalid $0 placeholderDamien Regad1-6/+10
Allowing param(false) to reset the query parameter count (see #380, commit 46fa66c10dc50547167d0f8bbbcb6484edf30d1c) introduced a regression when a falsy value was used, like `param(0)` in adodb-session2.php. ADODB_postgres64::param() now differenciates betwen use of: - falsy value -> reset count and return the first placeholder ($1) - boolean `false` -> reset count, do not return placeholder (next call will return $1). Updated PHPDoc for parent ADOConnection::param() to reflect this. Fixes #682, #380
2021-02-02Bump version to 5.21.0-rc.1v5.21.0-rc.1Damien Regad1-1/+1
2021-01-25Remove all magic quotes related codeDamien Regad1-15/+20
The $magic_quote parameter for public methods was kept for backwards compatibility purposes, but is no longer used. Fixes #674
2021-01-24Merge branch 'hotfix/5.20' into release/5.21Damien Regad1-1/+6
# Conflicts: # adodb-xmlschema03.inc.php # adodb.inc.php # drivers/adodb-pdo.inc.php
2021-01-24pgsql: Fix Fatal error in _close() methodDamien Regad1-1/+6
On PHP 8, ADORecordSet_postgres64::_close() throws the following error: Uncaught TypeError: pg_free_result(): Argument #1 ($result) must be of type resource, bool given in drivers/adodb-postgres64.inc.php:1052. Adding a check to ensure _QueryID is a ressource of the expected type, before calling pg_free_result(). Fixes #666
2021-01-02Merge branch 'hotfix/5.20' into release/5.21Damien Regad1-3/+3
Conflicts: drivers/adodb-postgres64.inc.php
2021-01-02pgsql: fix deprecated function aliasesDamien Regad1-4/+4
Fixes #667
2020-12-20Replace adodb_str_replace() calls with str_replace()peterdd1-1/+1
Fixes #646
2020-12-20Bump version to 5.21.0-beta.1v5.21.0-beta.1Damien Regad1-1/+1
2020-12-14Bump version to 5.20.19Mark Newnham1-1/+1
2020-12-06Removed references to phplens.com, see #564Mark Newnham1-1/+1
2020-12-06Removed hotlinks to PHPlens see #564Mark Newnham1-1/+1
Site no longer active
2020-06-28Bump Versionv5.20.18Mark Newnham1-1/+1
2020-03-31Bump version to 5.20.17v5.20.17Damien Regad1-1/+1
2020-01-25pgsql: fix param number reset with param(false)Damien Regad1-3/+3
Prior to this, calling $db->param(false) would reset the parameter number to 1 instead of 0, causing the next param() call to return `$2` instead of the expected `$1`. Fixes #380
2020-01-24Removed php5/php4 based conditionalsMark Newnham1-19/+14