mirror of
https://github.com/php/php-src.git
synced 2024-11-23 01:44:06 +08:00
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:
commit
27a1d69504
@ -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;
|
||||
|
@ -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: ';
|
||||
|
Loading…
Reference in New Issue
Block a user