2626#include "php_pdo_sqlite.h"
2727#include "php_pdo_sqlite_int.h"
2828
29- #if defined(__APPLE__ )
30- #include <Availability.h>
31- #endif
32-
3329static int pdo_sqlite_stmt_dtor (pdo_stmt_t * stmt )
3430{
3531 pdo_sqlite_stmt * S = (pdo_sqlite_stmt * )stmt -> driver_data ;
@@ -391,18 +387,9 @@ static int pdo_sqlite_stmt_get_attribute(pdo_stmt_t *stmt, zend_long attr, zval
391387 }
392388 break ;
393389 case PDO_SQLITE_ATTR_EXPLAIN_STATEMENT :
394- #if SQLITE_VERSION_NUMBER >= 3041000
395- #if defined(__APPLE__ )
396- if (__builtin_available (macOS 14.2 , * )) {
397- #endif
398- ZVAL_LONG (val , (zend_long )sqlite3_stmt_isexplain (S -> stmt ));
399- return 1 ;
400- #if defined(__APPLE__ )
401- } else {
402- zend_value_error ("explain statement unsupported" );
403- return 0 ;
404- }
405- #endif
390+ #if defined(HAVE_SQLITE3_STMT_EXPLAIN )
391+ ZVAL_LONG (val , (zend_long )sqlite3_stmt_isexplain (S -> stmt ));
392+ return 1 ;
406393#else
407394 zend_value_error ("explain statement unsupported" );
408395 return 0 ;
@@ -420,29 +407,20 @@ static int pdo_sqlite_stmt_set_attribute(pdo_stmt_t *stmt, zend_long attr, zval
420407
421408 switch (attr ) {
422409 case PDO_SQLITE_ATTR_EXPLAIN_STATEMENT :
423- #if SQLITE_VERSION_NUMBER >= 3041000
424- #if defined(__APPLE__ )
425- if (__builtin_available (macOS 14.2 , * )) {
426- #endif
427- if (Z_TYPE_P (zval ) != IS_LONG ) {
428- zend_type_error ("explain mode must be of type int" );
429- return 0 ;
430- }
431- if (Z_TYPE_P (zval ) < 0 || Z_TYPE_P (zval ) > 2 ) {
432- zend_value_error ("explain mode must be one of the EXPLAIN_MODE_* constants" );
433- return 0 ;
434- }
435- if (sqlite3_stmt_explain (S -> stmt , (int )Z_LVAL_P (zval )) != SQLITE_OK ) {
436- return 0 ;
437- }
438-
439- return 1 ;
440- #if defined(__APPLE__ )
441- } else {
442- zend_value_error ("explain statement unsupported" );
410+ #if defined(HAVE_SQLITE3_STMT_EXPLAIN )
411+ if (Z_TYPE_P (zval ) != IS_LONG ) {
412+ zend_type_error ("explain mode must be of type int" );
443413 return 0 ;
444414 }
445- #endif
415+ if (Z_TYPE_P (zval ) < 0 || Z_TYPE_P (zval ) > 2 ) {
416+ zend_value_error ("explain mode must be one of the EXPLAIN_MODE_* constants" );
417+ return 0 ;
418+ }
419+ if (sqlite3_stmt_explain (S -> stmt , (int )Z_LVAL_P (zval )) != SQLITE_OK ) {
420+ return 0 ;
421+ }
422+
423+ return 1 ;
446424#else
447425 zend_value_error ("explain statement unsupported" );
448426 return 0 ;
0 commit comments