Skip to content

Commit cce0efd

Browse files
committed
Revert "ext/pdo_pgsql: Delete unused constants"
This reverts commit e549ccb.
1 parent 01abca9 commit cce0efd

File tree

6 files changed

+59
-5
lines changed

6 files changed

+59
-5
lines changed

NEWS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ PHP NEWS
137137
. Implement GH-15387 Pdo\Pgsql::setAttribute(PDO::ATTR_PREFETCH, 0) or
138138
Pdo\Pgsql::prepare(…, [ PDO::ATTR_PREFETCH => 0 ]) make fetch() lazy
139139
instead of storing the whole result set in memory (Guillaume Outters)
140-
. Removed unused constants Pdo\Pgsql::TRANSACTION_* (vrana).
141140

142141
- PDO_SQLITE:
143142
. throw on null bytes / resolve GH-13952 (divinity76).

UPGRADING

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ PHP 8.5 UPGRADE NOTES
101101
. A ValueError is now thrown when trying to set a cursor name that is too
102102
long on a PDOStatement resulting from the Firebird driver.
103103

104-
- PDO_PGSQL:
105-
. Removed unused constants Pdo\Pgsql::TRANSACTION_*.
106-
107104
- Session:
108105
. Attempting to write session data where $_SESSION has a key containing
109106
the pipe character will now emit a warning instead of silently failing.

ext/pdo_pgsql/pdo_pgsql.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ PHP_METHOD(Pdo_Pgsql, setNoticeCallback)
179179
PHP_MINIT_FUNCTION(pdo_pgsql)
180180
{
181181
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES);
182+
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_IDLE", (zend_long)PGSQL_TRANSACTION_IDLE);
183+
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_ACTIVE", (zend_long)PGSQL_TRANSACTION_ACTIVE);
184+
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (zend_long)PGSQL_TRANSACTION_INTRANS);
185+
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (zend_long)PGSQL_TRANSACTION_INERROR);
186+
REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (zend_long)PGSQL_TRANSACTION_UNKNOWN);
182187

183188
PdoPgsql_ce = register_class_Pdo_Pgsql(pdo_dbh_ce);
184189
PdoPgsql_ce->create_object = pdo_dbh_new;

ext/pdo_pgsql/pdo_pgsql.stub.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ class Pgsql extends \PDO
1818
public const int ATTR_RESULT_MEMORY_SIZE = UNKNOWN;
1919
#endif
2020

21+
/** @cvalue PGSQL_TRANSACTION_IDLE */
22+
public const int TRANSACTION_IDLE = UNKNOWN;
23+
24+
/** @cvalue PGSQL_TRANSACTION_ACTIVE */
25+
public const int TRANSACTION_ACTIVE = UNKNOWN;
26+
27+
/** @cvalue PGSQL_TRANSACTION_INTRANS */
28+
public const int TRANSACTION_INTRANS = UNKNOWN;
29+
30+
/** @cvalue PGSQL_TRANSACTION_INERROR */
31+
public const int TRANSACTION_INERROR = UNKNOWN;
32+
33+
/** @cvalue PGSQL_TRANSACTION_UNKNOWN */
34+
public const int TRANSACTION_UNKNOWN = UNKNOWN;
35+
2136
public function escapeIdentifier(string $input): string {}
2237

2338
public function copyFromArray(string $tableName, array $rows, string $separator = "\t", string $nullAs = "\\\\N", ?string $fields = null): bool {}

ext/pdo_pgsql/pdo_pgsql_arginfo.h

Lines changed: 31 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/pdo_pgsql/php_pdo_pgsql_int.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ struct pdo_pgsql_lob_self {
104104
Oid oid;
105105
};
106106

107+
enum pdo_pgsql_specific_constants {
108+
PGSQL_TRANSACTION_IDLE = PQTRANS_IDLE,
109+
PGSQL_TRANSACTION_ACTIVE = PQTRANS_ACTIVE,
110+
PGSQL_TRANSACTION_INTRANS = PQTRANS_INTRANS,
111+
PGSQL_TRANSACTION_INERROR = PQTRANS_INERROR,
112+
PGSQL_TRANSACTION_UNKNOWN = PQTRANS_UNKNOWN
113+
};
114+
107115
php_stream *pdo_pgsql_create_lob_stream(zend_object *pdh, int lfd, Oid oid);
108116
extern const php_stream_ops pdo_pgsql_lob_stream_ops;
109117

0 commit comments

Comments
 (0)