| 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 ** |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 static int test_value_overhead( | 57 static int test_value_overhead( |
| 58 void * clientData, | 58 void * clientData, |
| 59 Tcl_Interp *interp, | 59 Tcl_Interp *interp, |
| 60 int objc, | 60 int objc, |
| 61 Tcl_Obj *CONST objv[] | 61 Tcl_Obj *CONST objv[] |
| 62 ){ | 62 ){ |
| 63 int do_calls; | 63 int do_calls; |
| 64 int repeat_count; | 64 int repeat_count; |
| 65 int i; | 65 int i; |
| 66 Mem val; | 66 Mem val; |
| 67 const char *zVal; | |
| 68 | 67 |
| 69 if( objc!=3 ){ | 68 if( objc!=3 ){ |
| 70 Tcl_AppendResult(interp, "wrong # args: should be \"", | 69 Tcl_AppendResult(interp, "wrong # args: should be \"", |
| 71 Tcl_GetStringFromObj(objv[0], 0), " <repeat-count> <do-calls>", 0); | 70 Tcl_GetStringFromObj(objv[0], 0), " <repeat-count> <do-calls>", 0); |
| 72 return TCL_ERROR; | 71 return TCL_ERROR; |
| 73 } | 72 } |
| 74 | 73 |
| 75 if( Tcl_GetIntFromObj(interp, objv[1], &repeat_count) ) return TCL_ERROR; | 74 if( Tcl_GetIntFromObj(interp, objv[1], &repeat_count) ) return TCL_ERROR; |
| 76 if( Tcl_GetIntFromObj(interp, objv[2], &do_calls) ) return TCL_ERROR; | 75 if( Tcl_GetIntFromObj(interp, objv[2], &do_calls) ) return TCL_ERROR; |
| 77 | 76 |
| 78 val.flags = MEM_Str|MEM_Term|MEM_Static; | 77 val.flags = MEM_Str|MEM_Term|MEM_Static; |
| 79 val.z = "hello world"; | 78 val.z = "hello world"; |
| 80 val.type = SQLITE_TEXT; | |
| 81 val.enc = SQLITE_UTF8; | 79 val.enc = SQLITE_UTF8; |
| 82 | 80 |
| 83 for(i=0; i<repeat_count; i++){ | 81 for(i=0; i<repeat_count; i++){ |
| 84 if( do_calls ){ | 82 if( do_calls ){ |
| 85 zVal = (char*)sqlite3_value_text(&val); | 83 sqlite3_value_text(&val); |
| 86 } | 84 } |
| 87 } | 85 } |
| 88 | 86 |
| 89 return TCL_OK; | 87 return TCL_OK; |
| 90 } | 88 } |
| 91 | 89 |
| 92 static u8 name_to_enc(Tcl_Interp *interp, Tcl_Obj *pObj){ | 90 static u8 name_to_enc(Tcl_Interp *interp, Tcl_Obj *pObj){ |
| 93 struct EncName { | 91 struct EncName { |
| 94 char *zName; | 92 char *zName; |
| 95 u8 enc; | 93 u8 enc; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 { "test_value_overhead", (Tcl_ObjCmdProc*)test_value_overhead }, | 207 { "test_value_overhead", (Tcl_ObjCmdProc*)test_value_overhead }, |
| 210 { "test_translate", (Tcl_ObjCmdProc*)test_translate }, | 208 { "test_translate", (Tcl_ObjCmdProc*)test_translate }, |
| 211 { "translate_selftest", (Tcl_ObjCmdProc*)test_translate_selftest}, | 209 { "translate_selftest", (Tcl_ObjCmdProc*)test_translate_selftest}, |
| 212 }; | 210 }; |
| 213 int i; | 211 int i; |
| 214 for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){ | 212 for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){ |
| 215 Tcl_CreateObjCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0); | 213 Tcl_CreateObjCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0); |
| 216 } | 214 } |
| 217 return SQLITE_OK; | 215 return SQLITE_OK; |
| 218 } | 216 } |
| OLD | NEW |