| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2010 November 19 | 2 ** 2010 November 19 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| 11 ************************************************************************* | 11 ************************************************************************* |
| 12 ** Example code for obtaining an exclusive lock on an SQLite database | 12 ** Example code for obtaining an exclusive lock on an SQLite database |
| 13 ** file. This method is complicated, but works for both WAL and rollback | 13 ** file. This method is complicated, but works for both WAL and rollback |
| 14 ** mode database files. The interface to the example code in this file | 14 ** mode database files. The interface to the example code in this file |
| 15 ** consists of the following two functions: | 15 ** consists of the following two functions: |
| 16 ** | 16 ** |
| 17 ** sqlite3demo_superlock() | 17 ** sqlite3demo_superlock() |
| 18 ** sqlite3demo_superunlock() | 18 ** sqlite3demo_superunlock() |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #include <sqlite3.h> | 21 #include "sqlite3.h" |
| 22 #include <string.h> /* memset(), strlen() */ | 22 #include <string.h> /* memset(), strlen() */ |
| 23 #include <assert.h> /* assert() */ | 23 #include <assert.h> /* assert() */ |
| 24 | 24 |
| 25 /* | 25 /* |
| 26 ** A structure to collect a busy-handler callback and argument and a count | 26 ** A structure to collect a busy-handler callback and argument and a count |
| 27 ** of the number of times it has been invoked. | 27 ** of the number of times it has been invoked. |
| 28 */ | 28 */ |
| 29 struct SuperlockBusy { | 29 struct SuperlockBusy { |
| 30 int (*xBusy)(void*,int); /* Pointer to busy-handler function */ | 30 int (*xBusy)(void*,int); /* Pointer to busy-handler function */ |
| 31 void *pBusyArg; /* First arg to pass to xBusy */ | 31 void *pBusyArg; /* First arg to pass to xBusy */ |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 ); | 347 ); |
| 348 Tcl_SetObjResult(interp, objv[1]); | 348 Tcl_SetObjResult(interp, objv[1]); |
| 349 return TCL_OK; | 349 return TCL_OK; |
| 350 } | 350 } |
| 351 | 351 |
| 352 int SqliteSuperlock_Init(Tcl_Interp *interp){ | 352 int SqliteSuperlock_Init(Tcl_Interp *interp){ |
| 353 Tcl_CreateObjCommand(interp, "sqlite3demo_superlock", superlock_cmd, 0, 0); | 353 Tcl_CreateObjCommand(interp, "sqlite3demo_superlock", superlock_cmd, 0, 0); |
| 354 return TCL_OK; | 354 return TCL_OK; |
| 355 } | 355 } |
| 356 #endif | 356 #endif |
| OLD | NEW |