Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Allow SQL statements to be executed from within a progress callback. Be warned, however, that the progress callback might be called recursively in this case. It is up to the program to disable the progress callback to prevent recursive invocations. Ticket #1827. (CVS 3193) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ffc4730c05ea64b8c32f64b323db9b96 |
User & Date: | drh 2006-05-26 19:57:20.000 |
Context
2006-05-27
| ||
11:15 | Clarify the operation of sqlite3_last_insert_rowid() in the documentation. (CVS 3194) (check-in: 9e0b83b81f user: drh tags: trunk) | |
2006-05-26
| ||
19:57 | Allow SQL statements to be executed from within a progress callback. Be warned, however, that the progress callback might be called recursively in this case. It is up to the program to disable the progress callback to prevent recursive invocations. Ticket #1827. (CVS 3193) (check-in: ffc4730c05 user: drh tags: trunk) | |
2006-05-25
| ||
12:17 | Syntax errors override errors from the code generator, not the other way around. (CVS 3192) (check-in: 5031ffc665 user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.549 2006/05/26 19:57:20 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | ** of VDBE ops have been executed (either since this invocation of ** sqlite3VdbeExec() or since last time the progress callback was called). ** If the progress callback returns non-zero, exit the virtual machine with ** a return code SQLITE_ABORT. */ if( db->xProgress ){ if( db->nProgressOps==nProgressOps ){ if( db->xProgress(db->pProgressArg)!=0 ){ rc = SQLITE_ABORT; continue; /* skip to the next iteration of the for loop */ } nProgressOps = 0; } nProgressOps++; } #endif #ifndef NDEBUG /* This is to check that the return value of static function | > > > > | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | ** of VDBE ops have been executed (either since this invocation of ** sqlite3VdbeExec() or since last time the progress callback was called). ** If the progress callback returns non-zero, exit the virtual machine with ** a return code SQLITE_ABORT. */ if( db->xProgress ){ if( db->nProgressOps==nProgressOps ){ int rc1, rc2; if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse; if( db->xProgress(db->pProgressArg)!=0 ){ sqlite3SafetyOn(db); rc = SQLITE_ABORT; continue; /* skip to the next iteration of the for loop */ } nProgressOps = 0; if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse; } nProgressOps++; } #endif #ifndef NDEBUG /* This is to check that the return value of static function |
︙ | ︙ |
Changes to test/progress.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the 'progress callback'. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the 'progress callback'. # # $Id: progress.test,v 1.6 2006/05/26 19:57:20 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # If the progress callback is not available in this build, skip this # whole file. ifcapable !progress { |
︙ | ︙ | |||
124 125 126 127 128 129 130 131 132 | execsql { SELECT * FROM t1; } set counter } 0 db progress 0 "" finish_test | > > > > > > > > > > > > > > > > > > > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | execsql { SELECT * FROM t1; } set counter } 0 db progress 0 "" # Make sure other queries can be run from within the progress # handler. Ticket #1827 # do_test progress-1.5 { set rx 0 proc set_rx {args} { db progress 0 {} set ::rx [db eval {SELECT count(*) FROM t1}] return [expr 0] } db progress 10 set_rx db eval { SELECT sum(a) FROM t1 } } {66} do_test progress-1.6 { set ::rx } {11} finish_test |