summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql
Commit message (Collapse)AuthorAgeFilesLines
* Add API to fetch bool value for PDO attribute valuesGeorge Peter Banyard2021-03-171-1/+7
| | | | Closes GH-6766
* php_pdo_register_driver() might failGeorge Peter Banyard2021-01-191-2/+1
| | | | Therefore correctly report failure in MINIT for the drivers which didn't.
* Refactor PDO's last inserted ID handler to use and return zend_stringGeorge Peter Banyard2021-01-191-5/+4
| | | | Closes GH-6617
* Refactor PDO doer handler to use zend_stringGeorge Peter Banyard2021-01-191-2/+2
|
* Replace zend_bool uses with boolNikita Popov2021-01-153-6/+6
| | | | | | | We're starting to see a mix between uses of zend_bool and bool. Replace all usages with the standard bool type everywhere. Of course, zend_bool is retained as an alias.
* Make convert_to_*_ex simple aliases of convert_to_*Nikita Popov2021-01-141-1/+1
| | | | | | | | | | | | | Historically, the _ex variants separated the zval first, if a conversion was necessary. This distinction no longer makes sense since PHP 7. The only difference that was still left is that _ex checked whether the type is the same first, but the usage of these macros did not actually distinguish on whether such an inlined check is valuable or not in a given context. Also drop the unused convert_to_explicit_type macros.
* Remove SEPARATE_ZVAL_IF_NOT_REF() macroNikita Popov2021-01-141-2/+0
| | | | | This macro hasn't made sense since PHP 7. The correct pattern to use is ZVAL_DEREF + SEPARATE_ZVAL_NOREF.
* Switch bound_param_map to zend_stringNikita Popov2021-01-071-2/+2
|
* Refactor PDO's quoter handler to return a zend_stringGeorge Peter Banyard2021-01-071-15/+21
| | | | Closes GH-6547
* Voidify PDO's fetch_error handlerGeorge Peter Banyard2021-01-061-3/+2
|
* Boolify PDO's preparer handlerGeorge Peter Banyard2021-01-061-3/+3
|
* Voidify PDO's closer handlerGeorge Peter Banyard2021-01-061-2/+1
|
* Boolify PDO's quoter handlerGeorge Peter Banyard2021-01-061-2/+2
|
* Boolify PDO's set_attribute driver functionGeorge Peter Banyard2021-01-061-4/+4
|
* Boolify PDO's transaction handlersGeorge Peter Banyard2021-01-061-8/+8
| | | | This includes begin(), commit(), rollBack(), and inTransaction()
* Formalize pdo_dbh_check_liveness_func() return type to zend_resultGeorge Peter Banyard2021-01-061-1/+1
|
* Rewrite PDO result bindingNikita Popov2020-12-224-115/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of requiring the type to be determined in advance by the describer function and then requiring get_col to return a buffer of appropriate type, allow get_col to return an arbitrary zval. See UPGRADING.INTERNALS for a more detailed description of the change. This makes the result fetching simpler, more efficient and more flexible. The general possibility already existed via the special PDO_PARAM_ZVAL type, but the usage was very inconvenient and/or inefficient. Now it's possible to easily implement behavior like "return int if it fits, otherwise string" and to avoid any kind of complex management of temporary buffers. This also fixes bug #40913 (our second highest voted bug of all time, for some reason). PARAM_LOB result bindings will now consistently return a stream resource, independently of the used database driver. I've tried my best to update all PDO drivers for this change, but some of the changes may be broken, as I cannot test or even build some of these drivers (in particular PDO dblib and PDO oci). Fixes are appreciated -- a working CI setup would be even more appreciated ;)
* PDO: Honor ATTR_STRINGIFY_FETCHES for booleansNikita Popov2020-12-214-7/+8
| | | | | Of the important PDO drivers, this affects only PDO PgSQL, as both MySQL and SQLite do not return native boolean types.
* Back memory stream by a zend_stringNikita Popov2020-12-181-1/+1
| | | | | | This allows reusing an existing zend_string inside a memory stream without reallocating. For non-readonly streams, the string will only get separated on write.
* Remove unused pdo_pgsql_column memberNikita Popov2020-12-181-1/+0
|
* PDO: Store/pass query_string as zend_stringNikita Popov2020-12-143-11/+10
| | | | | Rather than storing char* + size_t, use a zend_string*. Also avoid various copies of the query string.
* Merge branch 'PHP-8.0'Nikita Popov2020-12-101-5/+5
|\ | | | | | | | | * PHP-8.0: Fixed bug #72368
| * Fixed bug #72368Nikita Popov2020-12-101-5/+5
| | | | | | | | | | | | | | | | | | Generate a param count mismatch error even if the query contains no placeholders. Additionally we shouldn't HANDLE errors from pdo_parse_params, which are always reported via raise_impl_error. Doing so results in duplicate error messages.
* | Merge branch 'PHP-8.0'Nikita Popov2020-12-105-7/+9
|\ \ | |/ | | | | | | * PHP-8.0: Allow drivers to omit error code
| * Allow drivers to omit error codeNikita Popov2020-12-105-7/+9
| | | | | | | | | | | | | | And thus generate error messages that match what PDO emulation would generate. This fixes the error message regression from the previous commit.
* | Merge branch 'PHP-8.0'Nikita Popov2020-12-105-6/+9
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #79131
| * Fixed bug #79131Nikita Popov2020-12-105-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | When a driver reports an error during EVT_ALLOC (and some over EVTs), make sure we handle it as usual, i.e. warn or throw. This requires some adjustments in PDO PgSQL to stop manually doing this through an impl error. Unfortunately the PDO PgSQL error messages regress because of this, as they now include a completely arbitrary error code. There doesn't seem to be an ability to skip it right now.
* | Merge branch 'PHP-8.0'Nikita Popov2020-10-132-17/+17
|\ \ | |/ | | | | | | * PHP-8.0: Update ext/pdo_pgsql parameter names
| * Update ext/pdo_pgsql parameter namesNikita Popov2020-10-132-17/+17
| | | | | | | | Closes GH-6329.
* | Add GC support for PDO driver dataNikita Popov2020-10-121-0/+1
|/ | | | | | | | | Add a get_gc method that can be implemented by drivers, which can be used to add additional zvals to the GC buffer. Implement GC support for PDO SQLite callbacks in particular. Closes GH-6262.
* Run tidyNikita Popov2020-09-183-11/+11
| | | | | This should fix most of the remaining issues with tabs and spaces being mixed in tests.
* Fix UNKNOWN default values in ext/pdo_pgsqlMáté Kocsis2020-09-183-12/+12
| | | | Closes GH-6159
* Promote Warnings to Error in PostgreSQL PDO driverGeorge Peter Banyard2020-09-141-6/+6
| | | | Closes GH-6119
* Fix #80027 Terrible performance using $query->fetch on queries with many ↵Matteo Beccati2020-08-312-1/+6
| | | | | | | | | | bind parameters Added new flags that allow skipping param_evt(s) that are not used by drivers, in a backwards and forward compatible manner. Updated the pgsql, mysql, sqlite and oci drivers to properly use the new flags. I've left out pdo_dblib, which doesn't have a param_hook, and pdo_firebird, which seems to be using PARAM_EVT_NORMALIZE in a wrong context (param type vs event type).
* Merge branch 'PHP-7.4'Nikita Popov2020-08-112-2/+18
|\ | | | | | | | | * PHP-7.4: Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
| * Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-08-112-2/+18
| |\ | | | | | | | | | | | | * PHP-7.3: Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
| | * Fix #64705 errorInfo property of PDOException is null when ↵Ahmed Abdou2020-08-112-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | PDO::__construct() fails PDO driver constructors are throwing PdoException without setting errorInfo, so create a new reusable function that throws exceptions for PDO and will also set the errorInfo. Use this function in pdo_mysql, pdo_sqlite, and pdo_pgsql.
* | | Add many missing closing PHP tags to testsMáté Kocsis2020-08-093-0/+3
| | | | | | | | | | | | Closes GH-5958
* | | Get rid of empty function entriesMáté Kocsis2020-08-011-7/+1
| | | | | | | | | | | | Closes GH-5917
* | | Add stubs for PDO PGSql extension methodsNikita Popov2020-07-213-24/+115
| | |
* | | Remove proto comments from C filesMax Semenik2020-07-062-26/+13
| | | | | | | | | | | | Closes GH-5758
* | | Clean up calls to extension_loaded('json') in testsTyson Andre2020-05-282-2/+0
| | | | | | | | | | | | | | | | | | These are no longer needed after https://wiki.php.net/rfc/always_enable_json Closes GH-5637
* | | PGSQL and POD_SQL: don't include pg_config.hChristoph M. Becker2020-05-255-23/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even if that header file is available, we better consider it private, and don't include it. The information about whether SSL support is enabled is now missing (`USE_(OPEN)SSL`), and it seems there is no alternative way to get it (`PQinitSSL()` is always defined), so we remove it from the PHP info. Furthermore, the `PG_VERSION` and `PG_VERSION_STR` macros are no longer available, but as of libpq 9.1 there is `PQlibVersion()` which allows us to construct `PG_VERSION` in a most likely backwards compatible manner. The additional information available through `PG_VERSION_STR` is lost, though, so we define `PGSQL_LIBPQ_VERSION_STR` basically as alias of `PGSQL_LIBPQ_VERSION`, and deprecate it right away. Since we are now requiring at least libpq 9.1, we can remove some further compatibility code and additional checks. Regarding the raised requirements: official support for PostGreSQL 9.0 ended on 2015-10-08, and even CentOS 7 already has PostGreSQL 9.2, so this is not supposed to be too much of an issue.
* | | Fix [-Wundef] warning in PDO PostgreSQL extensionGeorge Peter Banyard2020-05-202-3/+3
| | |
* | | Merge branch 'PHP-7.4'Christoph M. Becker2020-04-292-0/+2
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #79532: sizeof off_t can be wrong
| * | Fix #79532: sizeof off_t can be wrongChristoph M. Becker2020-04-292-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We have to actually determine the proper `SIZEOF_OFF_T`. Interestingly, it is `4` on Windows x64. We also have to prevent the redefinition in pg_config.h. The clean solution would likely be to not include pg_config.h at all, but that's out of scope for BC reasons for now.
* | | Reindent phpt filesNikita Popov2020-02-0321-227/+227
| | |
* | | Make error messages more consistent by fixing capitalizationMáté Kocsis2020-01-171-1/+1
| | | | | | | | | | | | Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
* | | Fix #78880: Another bunch of spelling errorsMáté Kocsis2020-01-161-1/+1
| | |
* | | Use RETURN_THROWS() after try_convert_to_string()Máté Kocsis2020-01-031-1/+1
| | |