Merge branch 'PHP-8.4'

* PHP-8.4:
  ext/pdo_pgsql: Remove new PDO class constant specific to PGSQL driver
This commit is contained in:
Gina Peter Banyard 2024-11-16 16:30:55 +00:00
commit 27a1d69504
No known key found for this signature in database
GPG Key ID: 3306078E3194AEBD
2 changed files with 5 additions and 8 deletions

View File

@ -184,9 +184,6 @@ PHP_MINIT_FUNCTION(pdo_pgsql)
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (zend_long)PGSQL_TRANSACTION_INTRANS);
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (zend_long)PGSQL_TRANSACTION_INERROR);
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (zend_long)PGSQL_TRANSACTION_UNKNOWN);
#ifdef HAVE_PG_RESULT_MEMORY_SIZE
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_RESULT_MEMORY_SIZE", (zend_long)PDO_PGSQL_ATTR_RESULT_MEMORY_SIZE);
#endif
PdoPgsql_ce = register_class_Pdo_Pgsql(pdo_dbh_ce);
PdoPgsql_ce->create_object = pdo_dbh_new;

View File

@ -1,5 +1,5 @@
--TEST--
PDO PgSQL PDOStatement::getAttribute(PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE)
PDO PgSQL PDOStatement::getAttribute(Pgsql::ATTR_RESULT_MEMORY_SIZE)
--EXTENSIONS--
pdo_pgsql
--SKIPIF--
@ -7,7 +7,7 @@ pdo_pgsql
require __DIR__ . '/config.inc';
require dirname(__DIR__, 2) . '/pdo/tests/pdo_test.inc';
PDOTest::skip();
if (!defined('PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE')) die('skip constant PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE does not exist');
if (!defined('Pgsql::ATTR_RESULT_MEMORY_SIZE')) die('skip constant Pgsql::ATTR_RESULT_MEMORY_SIZE does not exist');
--FILE--
<?php
@ -18,12 +18,12 @@ $db = Pdo::connect($config['ENV']['PDOTEST_DSN']);
echo 'Result set with only 1 row: ';
$statement = $db->query('select 1');
$result_1 = $statement->getAttribute(PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE);
$result_1 = $statement->getAttribute(Pgsql::ATTR_RESULT_MEMORY_SIZE);
var_dump($result_1);
echo 'Result set with many rows: ';
$result = $db->query('select generate_series(1, 10000)');
$result_2 = $result->getAttribute(PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE);
$result_2 = $result->getAttribute(Pgsql::ATTR_RESULT_MEMORY_SIZE);
var_dump($result_2);
echo 'Large result sets should require more memory than small ones: ';
@ -31,7 +31,7 @@ var_dump($result_2 > $result_1);
echo 'Statements that are not executed should not consume memory: ';
$statement = $db->prepare('select 1');
$result_3 = $statement->getAttribute(PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE);
$result_3 = $statement->getAttribute(Pgsql::ATTR_RESULT_MEMORY_SIZE);
var_dump($result_3);
echo 'and should emit Error: ';