Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/pdo_sqlite/pdo_sqlite.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions ext/pdo_sqlite/pdo_sqlite_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ext/pdo_sqlite/sqlite_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]=>
Expand All @@ -79,7 +79,7 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[1]=>
array(8) {
Expand All @@ -98,9 +98,9 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[2]=>
%A
array(8) {
["addr"]=>
int(2)
Expand All @@ -117,12 +117,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[3]=>
[%d]=>
array(8) {
["addr"]=>
int(3)
int(%d)
["opcode"]=>
string(5) "Yield"
["p1"]=>
Expand All @@ -136,12 +136,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[4]=>
[%d]=>
array(8) {
["addr"]=>
int(4)
int(%d)
["opcode"]=>
string(7) "String8"
["p1"]=>
Expand All @@ -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"]=>
Expand All @@ -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"]=>
Expand All @@ -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"]=>
Expand All @@ -212,12 +212,12 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
[8]=>
[%d]=>
array(8) {
["addr"]=>
int(8)
int(%d)
["opcode"]=>
string(5) "Yield"
["p1"]=>
Expand All @@ -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"]=>
Expand All @@ -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"]=>
Expand All @@ -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"]=>
Expand All @@ -288,12 +288,12 @@ array(16) {
["p5"]=>
int(57)
["comment"]=>
NULL
%a
}
[12]=>
[%d]=>
array(8) {
["addr"]=>
int(12)
int(%d)
["opcode"]=>
string(4) "Goto"
["p1"]=>
Expand All @@ -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"]=>
Expand All @@ -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"]=>
Expand All @@ -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"]=>
Expand All @@ -364,7 +364,7 @@ array(16) {
["p5"]=>
int(0)
["comment"]=>
NULL
%a
}
}
bool(false)
Expand All @@ -376,7 +376,7 @@ array(1) {
["parent"]=>
int(0)
["notused"]=>
int(0)
int(%d)
["detail"]=>
string(17) "SCAN test_explain"
}
Expand Down