File tree 2 files changed +27
-6
lines changed
2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -567,7 +567,9 @@ PHP_METHOD(sqlite3, query)
567
567
break ;
568
568
}
569
569
default :
570
- php_sqlite3_error (db_obj , "Unable to execute statement: %s" , sqlite3_errmsg (db_obj -> db ));
570
+ if (!EG (exception )) {
571
+ php_sqlite3_error (db_obj , "Unable to execute statement: %s" , sqlite3_errmsg (db_obj -> db ));
572
+ }
571
573
sqlite3_finalize (stmt_obj -> stmt );
572
574
stmt_obj -> initialised = 0 ;
573
575
zval_dtor (return_value );
@@ -1626,7 +1628,9 @@ PHP_METHOD(sqlite3stmt, execute)
1626
1628
sqlite3_reset (stmt_obj -> stmt );
1627
1629
1628
1630
default :
1629
- php_sqlite3_error (stmt_obj -> db_obj , "Unable to execute statement: %s" , sqlite3_errmsg (sqlite3_db_handle (stmt_obj -> stmt )));
1631
+ if (!EG (exception )) {
1632
+ php_sqlite3_error (stmt_obj -> db_obj , "Unable to execute statement: %s" , sqlite3_errmsg (sqlite3_db_handle (stmt_obj -> stmt )));
1633
+ }
1630
1634
zval_dtor (return_value );
1631
1635
RETURN_FALSE ;
1632
1636
}
Original file line number Diff line number Diff line change @@ -6,19 +6,36 @@ if (!extension_loaded('sqlite3')) die('skip'); ?>
6
6
--FILE--
7
7
<?php
8
8
function my_udf_md5 ($ string ) {
9
- throw new \Exception ("test exception \n" );
9
+ throw new \Exception ("test exception \n" );
10
10
}
11
11
12
12
$ db = new SQLite3 (':memory: ' );
13
13
$ db ->createFunction ('my_udf_md5 ' , 'my_udf_md5 ' );
14
14
15
15
try {
16
- $ result = $ db ->querySingle ('SELECT my_udf_md5("test") ' );
17
- var_dump ($ result );
16
+ $ result = $ db ->query ('SELECT my_udf_md5("test") ' );
17
+ var_dump ($ result );
18
18
}
19
19
catch (\Exception $ e ) {
20
- echo "Exception: " .$ e ->getMessage ();
20
+ echo "Exception: " .$ e ->getMessage ();
21
+ }
22
+ try {
23
+ $ result = $ db ->querySingle ('SELECT my_udf_md5("test") ' );
24
+ var_dump ($ result );
25
+ }
26
+ catch (\Exception $ e ) {
27
+ echo "Exception: " .$ e ->getMessage ();
28
+ }
29
+ $ statement = $ db ->prepare ('SELECT my_udf_md5("test") ' );
30
+ try {
31
+ $ result = $ statement ->execute ();
32
+ var_dump ($ result );
33
+ }
34
+ catch (\Exception $ e ) {
35
+ echo "Exception: " .$ e ->getMessage ();
21
36
}
22
37
?>
23
38
--EXPECT--
24
39
Exception: test exception
40
+ Exception: test exception
41
+ Exception: test exception
You can’t perform that action at this time.
0 commit comments