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 @@ -555,7 +555,9 @@ PHP_METHOD(sqlite3, query)
555
555
break ;
556
556
}
557
557
default :
558
- php_sqlite3_error (db_obj , "Unable to execute statement: %s" , sqlite3_errmsg (db_obj -> db ));
558
+ if (!EG (exception )) {
559
+ php_sqlite3_error (db_obj , "Unable to execute statement: %s" , sqlite3_errmsg (db_obj -> db ));
560
+ }
559
561
sqlite3_finalize (stmt_obj -> stmt );
560
562
stmt_obj -> initialised = 0 ;
561
563
zval_dtor (return_value );
@@ -1611,7 +1613,9 @@ PHP_METHOD(sqlite3stmt, execute)
1611
1613
sqlite3_reset (stmt_obj -> stmt );
1612
1614
1613
1615
default :
1614
- php_sqlite3_error (stmt_obj -> db_obj , "Unable to execute statement: %s" , sqlite3_errmsg (sqlite3_db_handle (stmt_obj -> stmt )));
1616
+ if (!EG (exception )) {
1617
+ php_sqlite3_error (stmt_obj -> db_obj , "Unable to execute statement: %s" , sqlite3_errmsg (sqlite3_db_handle (stmt_obj -> stmt )));
1618
+ }
1615
1619
zval_dtor (return_value );
1616
1620
RETURN_FALSE ;
1617
1621
}
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