File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -5390,6 +5390,8 @@ int sqlite3_finalize(sqlite3_stmt *pStmt);
53905390int sqlite3_reset(sqlite3_stmt *pStmt);
53915391
53925392
5393+ void libsql_stmt_interrupt(sqlite3_stmt *stmt);
5394+
53935395/*
53945396** CAPI3REF: Create Or Redefine SQL Functions
53955397** KEYWORDS: {function creation routines}
Original file line number Diff line number Diff line change @@ -528,6 +528,7 @@ struct Vdbe {
528528 int nScan ; /* Entries in aScan[] */
529529 ScanStatus * aScan ; /* Scan definitions for sqlite3_stmt_scanstatus() */
530530#endif
531+ u8 isInterrupted ; /* True if the statement has been interrupted */
531532};
532533
533534void libsql_inc_row_read (Vdbe * p , int count );
Original file line number Diff line number Diff line change @@ -888,6 +888,18 @@ static int sqlite3Step(Vdbe *p){
888888 return (rc & db -> errMask );
889889}
890890
891+ /*
892+ ** Interrupt the statement.
893+ */
894+ void libsql_stmt_interrupt (sqlite3_stmt * pStmt ){
895+ Vdbe * v = (Vdbe * )pStmt ; /* the prepared statement */
896+ if ( vdbeSafetyNotNull (v ) ){
897+ (void )SQLITE_MISUSE_BKPT ;
898+ return ;
899+ }
900+ v -> isInterrupted = 1 ;
901+ }
902+
891903/*
892904** This is the top-level implementation of sqlite3_step(). Call
893905** sqlite3Step() to do most of the work. If a schema error occurs,
@@ -902,6 +914,9 @@ int sqlite3_step(sqlite3_stmt *pStmt){
902914 if ( vdbeSafetyNotNull (v ) ){
903915 return SQLITE_MISUSE_BKPT ;
904916 }
917+ if ( v -> isInterrupted ){
918+ return SQLITE_INTERRUPT ;
919+ }
905920 db = v -> db ;
906921 sqlite3_mutex_enter (db -> mutex );
907922 while ( (rc = sqlite3Step (v ))== SQLITE_SCHEMA
You can’t perform that action at this time.
0 commit comments