OLD | NEW |
1 /* | 1 /* |
2 ** 2007 March 29 | 2 ** 2007 March 29 |
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 ** | 12 ** |
13 ** This file contains obscure tests of the C-interface required | 13 ** This file contains obscure tests of the C-interface required |
14 ** for completeness. Test code is written in C for these cases | 14 ** for completeness. Test code is written in C for these cases |
15 ** as there is not much point in binding to Tcl. | 15 ** as there is not much point in binding to Tcl. |
16 */ | 16 */ |
17 #include "sqliteInt.h" | 17 #include "sqliteInt.h" |
18 #include "tcl.h" | 18 #if defined(INCLUDE_SQLITE_TCL_H) |
| 19 # include "sqlite_tcl.h" |
| 20 #else |
| 21 # include "tcl.h" |
| 22 #endif |
19 #include <stdlib.h> | 23 #include <stdlib.h> |
20 #include <string.h> | 24 #include <string.h> |
21 | 25 |
22 /* | 26 /* |
23 ** c_collation_test | 27 ** c_collation_test |
24 */ | 28 */ |
25 static int c_collation_test( | 29 static int SQLITE_TCLAPI c_collation_test( |
26 ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ | 30 ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ |
27 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ | 31 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ |
28 int objc, /* Number of arguments */ | 32 int objc, /* Number of arguments */ |
29 Tcl_Obj *CONST objv[] /* Command arguments */ | 33 Tcl_Obj *CONST objv[] /* Command arguments */ |
30 ){ | 34 ){ |
31 const char *zErrFunction = "N/A"; | 35 const char *zErrFunction = "N/A"; |
32 sqlite3 *db; | 36 sqlite3 *db; |
33 | 37 |
34 int rc; | 38 int rc; |
35 if( objc!=1 ){ | 39 if( objc!=1 ){ |
(...skipping 20 matching lines...) Expand all Loading... |
56 | 60 |
57 error_out: | 61 error_out: |
58 Tcl_ResetResult(interp); | 62 Tcl_ResetResult(interp); |
59 Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0); | 63 Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0); |
60 return TCL_ERROR; | 64 return TCL_ERROR; |
61 } | 65 } |
62 | 66 |
63 /* | 67 /* |
64 ** c_realloc_test | 68 ** c_realloc_test |
65 */ | 69 */ |
66 static int c_realloc_test( | 70 static int SQLITE_TCLAPI c_realloc_test( |
67 ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ | 71 ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ |
68 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ | 72 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ |
69 int objc, /* Number of arguments */ | 73 int objc, /* Number of arguments */ |
70 Tcl_Obj *CONST objv[] /* Command arguments */ | 74 Tcl_Obj *CONST objv[] /* Command arguments */ |
71 ){ | 75 ){ |
72 void *p; | 76 void *p; |
73 const char *zErrFunction = "N/A"; | 77 const char *zErrFunction = "N/A"; |
74 | 78 |
75 if( objc!=1 ){ | 79 if( objc!=1 ){ |
76 Tcl_WrongNumArgs(interp, 1, objv, ""); | 80 Tcl_WrongNumArgs(interp, 1, objv, ""); |
(...skipping 20 matching lines...) Expand all Loading... |
97 error_out: | 101 error_out: |
98 Tcl_ResetResult(interp); | 102 Tcl_ResetResult(interp); |
99 Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0); | 103 Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0); |
100 return TCL_ERROR; | 104 return TCL_ERROR; |
101 } | 105 } |
102 | 106 |
103 | 107 |
104 /* | 108 /* |
105 ** c_misuse_test | 109 ** c_misuse_test |
106 */ | 110 */ |
107 static int c_misuse_test( | 111 static int SQLITE_TCLAPI c_misuse_test( |
108 ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ | 112 ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ |
109 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ | 113 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ |
110 int objc, /* Number of arguments */ | 114 int objc, /* Number of arguments */ |
111 Tcl_Obj *CONST objv[] /* Command arguments */ | 115 Tcl_Obj *CONST objv[] /* Command arguments */ |
112 ){ | 116 ){ |
113 const char *zErrFunction = "N/A"; | 117 const char *zErrFunction = "N/A"; |
114 sqlite3 *db = 0; | 118 sqlite3 *db = 0; |
115 sqlite3_stmt *pStmt; | 119 sqlite3_stmt *pStmt; |
116 int rc; | 120 int rc; |
117 | 121 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 { "c_realloc_test", c_realloc_test, 0 }, | 195 { "c_realloc_test", c_realloc_test, 0 }, |
192 { "c_collation_test", c_collation_test, 0 }, | 196 { "c_collation_test", c_collation_test, 0 }, |
193 }; | 197 }; |
194 int i; | 198 int i; |
195 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ | 199 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ |
196 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, | 200 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, |
197 aObjCmd[i].xProc, aObjCmd[i].clientData, 0); | 201 aObjCmd[i].xProc, aObjCmd[i].clientData, 0); |
198 } | 202 } |
199 return TCL_OK; | 203 return TCL_OK; |
200 } | 204 } |
OLD | NEW |