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
29
32
30
33
static int pdo_sqlite_stmt_dtor (pdo_stmt_t * stmt )
31
34
{
@@ -389,8 +392,17 @@ static int pdo_sqlite_stmt_get_attribute(pdo_stmt_t *stmt, zend_long attr, zval
389
392
break ;
390
393
case PDO_SQLITE_ATTR_EXPLAIN_STATEMENT :
391
394
#if SQLITE_VERSION_NUMBER >= 3041000
392
- ZVAL_LONG (val , (zend_long )sqlite3_stmt_isexplain (S -> stmt ));
393
- return 1 ;
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
394
406
#else
395
407
zend_value_error ("explain statement unsupported" );
396
408
return 0 ;
@@ -409,19 +421,28 @@ static int pdo_sqlite_stmt_set_attribute(pdo_stmt_t *stmt, zend_long attr, zval
409
421
switch (attr ) {
410
422
case PDO_SQLITE_ATTR_EXPLAIN_STATEMENT :
411
423
#if SQLITE_VERSION_NUMBER >= 3041000
412
- if (Z_TYPE_P (zval ) != IS_LONG ) {
413
- zend_type_error ("explain mode must be of type int" );
414
- return 0 ;
415
- }
416
- if (Z_TYPE_P (zval ) < 0 || Z_TYPE_P (zval ) > 2 ) {
417
- zend_value_error ("explain mode must be one of the EXPLAIN_MODE_* constants" );
418
- return 0 ;
419
- }
420
- if (sqlite3_stmt_explain (S -> stmt , (int )Z_LVAL_P (zval )) != SQLITE_OK ) {
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" );
421
443
return 0 ;
422
444
}
423
-
424
- return 1 ;
445
+ #endif
425
446
#else
426
447
zend_value_error ("explain statement unsupported" );
427
448
return 0 ;
0 commit comments