ext/pdo_sqlite: fix minimal version for EXPLAIN feature support. (#18854)

This commit is contained in:
David CARLIER 2025-06-18 21:06:03 +01:00 committed by GitHub
parent bc7d00ea6d
commit f129586459
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 58 additions and 58 deletions

View file

@ -39,7 +39,7 @@ class Sqlite extends \PDO
/** @cvalue PDO_SQLITE_ATTR_EXPLAIN_STATEMENT */
public const int ATTR_EXPLAIN_STATEMENT = UNKNOWN;
#if SQLITE_VERSION_NUMBER >= 3041000
#if SQLITE_VERSION_NUMBER >= 3043000
public const int EXPLAIN_MODE_PREPARED = 0;
public const int EXPLAIN_MODE_EXPLAIN = 1;
public const int EXPLAIN_MODE_EXPLAIN_QUERY_PLAN = 2;

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: fa489a46c586ae935036f76a992163aeb67246d3 */
* Stub hash: c1d4ef325ecb8c8cb312910e8091ca003dc2603a */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Sqlite_createAggregate, 0, 3, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
@ -121,7 +121,7 @@ static zend_class_entry *register_class_Pdo_Sqlite(zend_class_entry *class_entry
zend_string *const_ATTR_EXPLAIN_STATEMENT_name = zend_string_init_interned("ATTR_EXPLAIN_STATEMENT", sizeof("ATTR_EXPLAIN_STATEMENT") - 1, 1);
zend_declare_typed_class_constant(class_entry, const_ATTR_EXPLAIN_STATEMENT_name, &const_ATTR_EXPLAIN_STATEMENT_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
zend_string_release(const_ATTR_EXPLAIN_STATEMENT_name);
#if SQLITE_VERSION_NUMBER >= 3041000
#if SQLITE_VERSION_NUMBER >= 3043000
zval const_EXPLAIN_MODE_PREPARED_value;
ZVAL_LONG(&const_EXPLAIN_MODE_PREPARED_value, 0);
@ -129,7 +129,7 @@ static zend_class_entry *register_class_Pdo_Sqlite(zend_class_entry *class_entry
zend_declare_typed_class_constant(class_entry, const_EXPLAIN_MODE_PREPARED_name, &const_EXPLAIN_MODE_PREPARED_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
zend_string_release(const_EXPLAIN_MODE_PREPARED_name);
#endif
#if SQLITE_VERSION_NUMBER >= 3041000
#if SQLITE_VERSION_NUMBER >= 3043000
zval const_EXPLAIN_MODE_EXPLAIN_value;
ZVAL_LONG(&const_EXPLAIN_MODE_EXPLAIN_value, 1);
@ -137,7 +137,7 @@ static zend_class_entry *register_class_Pdo_Sqlite(zend_class_entry *class_entry
zend_declare_typed_class_constant(class_entry, const_EXPLAIN_MODE_EXPLAIN_name, &const_EXPLAIN_MODE_EXPLAIN_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
zend_string_release(const_EXPLAIN_MODE_EXPLAIN_name);
#endif
#if SQLITE_VERSION_NUMBER >= 3041000
#if SQLITE_VERSION_NUMBER >= 3043000
zval const_EXPLAIN_MODE_EXPLAIN_QUERY_PLAN_value;
ZVAL_LONG(&const_EXPLAIN_MODE_EXPLAIN_QUERY_PLAN_value, 2);

View file

@ -393,7 +393,7 @@ static int pdo_sqlite_stmt_get_attribute(pdo_stmt_t *stmt, zend_long attr, zval
}
break;
case PDO_SQLITE_ATTR_EXPLAIN_STATEMENT:
#if SQLITE_VERSION_NUMBER >= 3041000
#if SQLITE_VERSION_NUMBER >= 3043000
#if defined(__APPLE__)
if (__builtin_available(macOS 14.2, *)) {
#endif
@ -420,7 +420,7 @@ static int pdo_sqlite_stmt_set_attribute(pdo_stmt_t *stmt, zend_long attr, zval
{
switch (attr) {
case PDO_SQLITE_ATTR_EXPLAIN_STATEMENT:
#if SQLITE_VERSION_NUMBER >= 3041000
#if SQLITE_VERSION_NUMBER >= 3043000
#if defined(__APPLE__)
if (__builtin_available(macOS 14.2, *)) {
#endif

View file

@ -59,9 +59,9 @@ try {
var_dump($stmts->getAttribute(Pdo\Sqlite::ATTR_EXPLAIN_STATEMENT) == Pdo\Sqlite::EXPLAIN_MODE_PREPARED);
?>
--EXPECT--
--EXPECTF--
bool(true)
array(16) {
array(%d) {
[0]=>
array(8) {
["addr"]=>
@ -71,7 +71,7 @@ array(16) {
["p1"]=>
int(0)
["p2"]=>
int(14)
int(%d)
["p3"]=>
int(0)
["p4"]=>
@ -79,7 +79,7 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[1]=>
array(8) {
@ -90,7 +90,7 @@ array(16) {
["p1"]=>
int(3)
["p2"]=>
int(7)
int(%d)
["p3"]=>
int(2)
["p4"]=>
@ -98,12 +98,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[2]=>
%A
array(8) {
["addr"]=>
int(2)
int(%d)
["opcode"]=>
string(7) "String8"
["p1"]=>
@ -117,12 +117,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[3]=>
%A
array(8) {
["addr"]=>
int(3)
int(%d)
["opcode"]=>
string(5) "Yield"
["p1"]=>
@ -136,12 +136,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[4]=>
%A
array(8) {
["addr"]=>
int(4)
int(%d)
["opcode"]=>
string(7) "String8"
["p1"]=>
@ -155,12 +155,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[5]=>
[%d]=>
array(8) {
["addr"]=>
int(5)
int(%d)
["opcode"]=>
string(5) "Yield"
["p1"]=>
@ -174,12 +174,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[6]=>
[%d]=>
array(8) {
["addr"]=>
int(6)
int(%d)
["opcode"]=>
string(12) "EndCoroutine"
["p1"]=>
@ -193,12 +193,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[7]=>
[%d]=>
array(8) {
["addr"]=>
int(7)
int(%d)
["opcode"]=>
string(9) "OpenWrite"
["p1"]=>
@ -212,18 +212,18 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[8]=>
[%d]=>
array(8) {
["addr"]=>
int(8)
int(%d)
["opcode"]=>
string(5) "Yield"
["p1"]=>
int(3)
["p2"]=>
int(13)
int(%d)
["p3"]=>
int(0)
["p4"]=>
@ -231,12 +231,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[9]=>
[%d]=>
array(8) {
["addr"]=>
int(9)
int(%d)
["opcode"]=>
string(8) "NewRowid"
["p1"]=>
@ -250,12 +250,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[10]=>
[%d]=>
array(8) {
["addr"]=>
int(10)
int(%d)
["opcode"]=>
string(10) "MakeRecord"
["p1"]=>
@ -269,12 +269,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[11]=>
[%d]=>
array(8) {
["addr"]=>
int(11)
int(%d)
["opcode"]=>
string(6) "Insert"
["p1"]=>
@ -288,18 +288,18 @@ array(16) {
["p5"]=>
int(57)
["comment"]=>
NULL
%a
}
[12]=>
[%d]=>
array(8) {
["addr"]=>
int(12)
int(%d)
["opcode"]=>
string(4) "Goto"
["p1"]=>
int(0)
["p2"]=>
int(8)
int(%d)
["p3"]=>
int(0)
["p4"]=>
@ -307,12 +307,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[13]=>
[%d]=>
array(8) {
["addr"]=>
int(13)
int(%d)
["opcode"]=>
string(4) "Halt"
["p1"]=>
@ -326,12 +326,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[14]=>
[%d]=>
array(8) {
["addr"]=>
int(14)
int(%d)
["opcode"]=>
string(11) "Transaction"
["p1"]=>
@ -345,12 +345,12 @@ array(16) {
["p5"]=>
int(1)
["comment"]=>
NULL
%a
}
[15]=>
[%d]=>
array(8) {
["addr"]=>
int(15)
int(%d)
["opcode"]=>
string(4) "Goto"
["p1"]=>
@ -364,7 +364,7 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
}
bool(false)
@ -376,7 +376,7 @@ array(1) {
["parent"]=>
int(0)
["notused"]=>
int(0)
int(%d)
["detail"]=>
string(17) "SCAN test_explain"
}