OLD | NEW |
1 /* | 1 /* |
2 ** 2001 September 15 | 2 ** 2001 September 15 |
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 ** Code for testing the pager.c module in SQLite. This code | 12 ** Code for testing the pager.c module in SQLite. This code |
13 ** is not included in the SQLite library. It is used for automated | 13 ** is not included in the SQLite library. It is used for automated |
14 ** testing of the SQLite library. | 14 ** testing of the SQLite library. |
15 ** | |
16 ** $Id: test2.c,v 1.74 2009/07/24 19:01:20 drh Exp $ | |
17 */ | 15 */ |
18 #include "sqliteInt.h" | 16 #include "sqliteInt.h" |
19 #include "tcl.h" | 17 #include "tcl.h" |
20 #include <stdlib.h> | 18 #include <stdlib.h> |
21 #include <string.h> | 19 #include <string.h> |
22 #include <ctype.h> | 20 #include <ctype.h> |
23 | 21 |
24 /* | 22 /* |
25 ** Interpret an SQLite error number | 23 ** Interpret an SQLite error number |
26 */ | 24 */ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 ** Usage: pager_open FILENAME N-PAGE | 65 ** Usage: pager_open FILENAME N-PAGE |
68 ** | 66 ** |
69 ** Open a new pager | 67 ** Open a new pager |
70 */ | 68 */ |
71 static int pager_open( | 69 static int pager_open( |
72 void *NotUsed, | 70 void *NotUsed, |
73 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ | 71 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ |
74 int argc, /* Number of arguments */ | 72 int argc, /* Number of arguments */ |
75 const char **argv /* Text of each argument */ | 73 const char **argv /* Text of each argument */ |
76 ){ | 74 ){ |
77 u16 pageSize; | 75 u32 pageSize; |
78 Pager *pPager; | 76 Pager *pPager; |
79 int nPage; | 77 int nPage; |
80 int rc; | 78 int rc; |
81 char zBuf[100]; | 79 char zBuf[100]; |
82 if( argc!=3 ){ | 80 if( argc!=3 ){ |
83 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], | 81 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], |
84 " FILENAME N-PAGE\"", 0); | 82 " FILENAME N-PAGE\"", 0); |
85 return TCL_ERROR; | 83 return TCL_ERROR; |
86 } | 84 } |
87 if( Tcl_GetInt(interp, argv[2], &nPage) ) return TCL_ERROR; | 85 if( Tcl_GetInt(interp, argv[2], &nPage) ) return TCL_ERROR; |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 void *NotUsed, | 574 void *NotUsed, |
577 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ | 575 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ |
578 int argc, /* Number of arguments */ | 576 int argc, /* Number of arguments */ |
579 const char **argv /* Text of each argument */ | 577 const char **argv /* Text of each argument */ |
580 ){ | 578 ){ |
581 int pbyte; | 579 int pbyte; |
582 int rc; | 580 int rc; |
583 if( argc!=2 ){ | 581 if( argc!=2 ){ |
584 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], | 582 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], |
585 " PENDING-BYTE\"", (void*)0); | 583 " PENDING-BYTE\"", (void*)0); |
| 584 return TCL_ERROR; |
586 } | 585 } |
587 if( Tcl_GetInt(interp, argv[1], &pbyte) ) return TCL_ERROR; | 586 if( Tcl_GetInt(interp, argv[1], &pbyte) ) return TCL_ERROR; |
588 rc = sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, pbyte); | 587 rc = sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, pbyte); |
589 Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); | 588 Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); |
590 return TCL_OK; | 589 return TCL_OK; |
591 } | 590 } |
592 | 591 |
593 /* | 592 /* |
594 ** sqlite3BitvecBuiltinTest SIZE PROGRAM | 593 ** sqlite3BitvecBuiltinTest SIZE PROGRAM |
595 ** | 594 ** |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 Tcl_LinkVar(interp, "sqlite_io_error_persist", | 668 Tcl_LinkVar(interp, "sqlite_io_error_persist", |
670 (char*)&sqlite3_io_error_persist, TCL_LINK_INT); | 669 (char*)&sqlite3_io_error_persist, TCL_LINK_INT); |
671 Tcl_LinkVar(interp, "sqlite_io_error_hit", | 670 Tcl_LinkVar(interp, "sqlite_io_error_hit", |
672 (char*)&sqlite3_io_error_hit, TCL_LINK_INT); | 671 (char*)&sqlite3_io_error_hit, TCL_LINK_INT); |
673 Tcl_LinkVar(interp, "sqlite_io_error_hardhit", | 672 Tcl_LinkVar(interp, "sqlite_io_error_hardhit", |
674 (char*)&sqlite3_io_error_hardhit, TCL_LINK_INT); | 673 (char*)&sqlite3_io_error_hardhit, TCL_LINK_INT); |
675 Tcl_LinkVar(interp, "sqlite_diskfull_pending", | 674 Tcl_LinkVar(interp, "sqlite_diskfull_pending", |
676 (char*)&sqlite3_diskfull_pending, TCL_LINK_INT); | 675 (char*)&sqlite3_diskfull_pending, TCL_LINK_INT); |
677 Tcl_LinkVar(interp, "sqlite_diskfull", | 676 Tcl_LinkVar(interp, "sqlite_diskfull", |
678 (char*)&sqlite3_diskfull, TCL_LINK_INT); | 677 (char*)&sqlite3_diskfull, TCL_LINK_INT); |
| 678 #ifndef SQLITE_OMIT_WSD |
679 Tcl_LinkVar(interp, "sqlite_pending_byte", | 679 Tcl_LinkVar(interp, "sqlite_pending_byte", |
680 (char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY); | 680 (char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY); |
| 681 #endif |
681 return TCL_OK; | 682 return TCL_OK; |
682 } | 683 } |
OLD | NEW |