26
26
#include "php_pdo_sqlite.h"
27
27
#include "php_pdo_sqlite_int.h"
28
28
29
- #if defined(__APPLE__ )
30
- #include <Availability.h>
31
- #endif
32
-
33
29
static int pdo_sqlite_stmt_dtor (pdo_stmt_t * stmt )
34
30
{
35
31
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
391
387
}
392
388
break ;
393
389
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 ;
406
393
#else
407
394
zend_value_error ("explain statement unsupported" );
408
395
return 0 ;
@@ -420,29 +407,20 @@ static int pdo_sqlite_stmt_set_attribute(pdo_stmt_t *stmt, zend_long attr, zval
420
407
421
408
switch (attr ) {
422
409
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" );
443
413
return 0 ;
444
414
}
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 ;
446
424
#else
447
425
zend_value_error ("explain statement unsupported" );
448
426
return 0 ;
0 commit comments