Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(880)

Side by Side Diff: third_party/sqlite/src/src/test5.c

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/src/test4.c ('k') | third_party/sqlite/src/src/test6.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 utf.c module in SQLite. This code 12 ** Code for testing the utf.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. Specifically, the code in this file 14 ** testing of the SQLite library. Specifically, the code in this file
15 ** is used for testing the SQLite routines for converting between 15 ** is used for testing the SQLite routines for converting between
16 ** the various supported unicode encodings. 16 ** the various supported unicode encodings.
17 **
18 ** $Id: test5.c,v 1.22 2008/08/12 15:04:59 danielk1977 Exp $
19 */ 17 */
20 #include "sqliteInt.h" 18 #include "sqliteInt.h"
21 #include "vdbeInt.h" 19 #include "vdbeInt.h"
22 #include "tcl.h" 20 #include "tcl.h"
23 #include <stdlib.h> 21 #include <stdlib.h>
24 #include <string.h> 22 #include <string.h>
25 23
26 /* 24 /*
27 ** The first argument is a TCL UTF-8 string. Return the byte array 25 ** The first argument is a TCL UTF-8 string. Return the byte array
28 ** object with the encoded representation of the string, including 26 ** object with the encoded representation of the string, including
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 enc_from = name_to_enc(interp, objv[2]); 148 enc_from = name_to_enc(interp, objv[2]);
151 if( !enc_from ) return TCL_ERROR; 149 if( !enc_from ) return TCL_ERROR;
152 enc_to = name_to_enc(interp, objv[3]); 150 enc_to = name_to_enc(interp, objv[3]);
153 if( !enc_to ) return TCL_ERROR; 151 if( !enc_to ) return TCL_ERROR;
154 152
155 pVal = sqlite3ValueNew(0); 153 pVal = sqlite3ValueNew(0);
156 154
157 if( enc_from==SQLITE_UTF8 ){ 155 if( enc_from==SQLITE_UTF8 ){
158 z = Tcl_GetString(objv[1]); 156 z = Tcl_GetString(objv[1]);
159 if( objc==5 ){ 157 if( objc==5 ){
160 z = sqlite3DbStrDup(0, z); 158 z = sqlite3_mprintf("%s", z);
161 } 159 }
162 sqlite3ValueSetStr(pVal, -1, z, enc_from, xDel); 160 sqlite3ValueSetStr(pVal, -1, z, enc_from, xDel);
163 }else{ 161 }else{
164 z = (char*)Tcl_GetByteArrayFromObj(objv[1], &len); 162 z = (char*)Tcl_GetByteArrayFromObj(objv[1], &len);
165 if( objc==5 ){ 163 if( objc==5 ){
166 char *zTmp = z; 164 char *zTmp = z;
167 z = sqlite3_malloc(len); 165 z = sqlite3_malloc(len);
168 memcpy(z, zTmp, len); 166 memcpy(z, zTmp, len);
169 } 167 }
170 sqlite3ValueSetStr(pVal, -1, z, enc_from, xDel); 168 sqlite3ValueSetStr(pVal, -1, z, enc_from, xDel);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 { "test_value_overhead", (Tcl_ObjCmdProc*)test_value_overhead }, 209 { "test_value_overhead", (Tcl_ObjCmdProc*)test_value_overhead },
212 { "test_translate", (Tcl_ObjCmdProc*)test_translate }, 210 { "test_translate", (Tcl_ObjCmdProc*)test_translate },
213 { "translate_selftest", (Tcl_ObjCmdProc*)test_translate_selftest}, 211 { "translate_selftest", (Tcl_ObjCmdProc*)test_translate_selftest},
214 }; 212 };
215 int i; 213 int i;
216 for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){ 214 for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){
217 Tcl_CreateObjCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0); 215 Tcl_CreateObjCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0);
218 } 216 }
219 return SQLITE_OK; 217 return SQLITE_OK;
220 } 218 }
OLDNEW
« no previous file with comments | « third_party/sqlite/src/src/test4.c ('k') | third_party/sqlite/src/src/test6.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698