diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-03-05 17:34:47 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-03-06 10:04:14 +0000 |
commit | eaf1da4d961fbbda9455f9af3b23d1af777f43fa (patch) | |
tree | 95970599ecee31c4f7f940bc97ac98c61a3d0cad /chromium/third_party/sqlite/src/src/test1.c | |
parent | 38a9a29f4f9436cace7f0e7abf9c586057df8a4e (diff) | |
download | qtwebengine-chromium-eaf1da4d961fbbda9455f9af3b23d1af777f43fa.tar.gz |
BASELINE: Update Chromium to 73.0.3683.64
Change-Id: I76517dc277ba4e16bfd7e098fda3d079656b3b9f
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/sqlite/src/src/test1.c')
-rw-r--r-- | chromium/third_party/sqlite/src/src/test1.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/chromium/third_party/sqlite/src/src/test1.c b/chromium/third_party/sqlite/src/src/test1.c index 5d6a01f319f..81d77d96d9b 100644 --- a/chromium/third_party/sqlite/src/src/test1.c +++ b/chromium/third_party/sqlite/src/src/test1.c @@ -7141,6 +7141,9 @@ static int SQLITE_TCLAPI tclLoadStaticExtensionCmd( extern int sqlite3_ieee_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_nextchar_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_percentile_init(sqlite3*,char**,const sqlite3_api_routines*); +#ifndef SQLITE_OMIT_VIRTUALTABLE + extern int sqlite3_prefixes_init(sqlite3*,char**,const sqlite3_api_routines*); +#endif extern int sqlite3_regexp_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_remember_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_series_init(sqlite3*,char**,const sqlite3_api_routines*); @@ -7166,6 +7169,9 @@ static int SQLITE_TCLAPI tclLoadStaticExtensionCmd( { "ieee754", sqlite3_ieee_init }, { "nextchar", sqlite3_nextchar_init }, { "percentile", sqlite3_percentile_init }, +#ifndef SQLITE_OMIT_VIRTUALTABLE + { "prefixes", sqlite3_prefixes_init }, +#endif { "regexp", sqlite3_regexp_init }, { "remember", sqlite3_remember_init }, { "series", sqlite3_series_init }, @@ -7642,6 +7648,79 @@ static int SQLITE_TCLAPI test_mmap_warm( } /* +** Usage: decode_hexdb TEXT +** +** Example: db deserialize [decode_hexdb $output_of_dbtotxt] +** +** This routine returns a byte-array for an SQLite database file that +** is constructed from a text input which is the output of the "dbtotxt" +** utility. +*/ +static int SQLITE_TCLAPI test_decode_hexdb( + void * clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + const char *zIn = 0; + unsigned char *a = 0; + int n = 0; + int lineno = 0; + int i, iNext; + int iOffset = 0; + int j, k; + int rc; + unsigned char x[16]; + if( objc!=2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "HEXDB"); + return TCL_ERROR; + } + zIn = Tcl_GetString(objv[1]); + for(i=0; zIn[i]; i=iNext){ + lineno++; + for(iNext=i; zIn[iNext] && zIn[iNext]!='\n'; iNext++){} + if( zIn[iNext]=='\n' ) iNext++; + while( zIn[i]==' ' || zIn[i]=='\t' ){ i++; } + if( a==0 ){ + int pgsz; + rc = sscanf(zIn+i, "| size %d pagesize %d", &n, &pgsz); + if( rc!=2 ) continue; + if( n<512 ){ + Tcl_AppendResult(interp, "bad 'size' field", (void*)0); + return TCL_ERROR; + } + a = malloc( n ); + if( a==0 ){ + Tcl_AppendResult(interp, "out of memory", (void*)0); + return TCL_ERROR; + } + memset(a, 0, n); + continue; + } + rc = sscanf(zIn+i, "| page %d offset %d", &j, &k); + if( rc==2 ){ + iOffset = k; + continue; + } + rc = sscanf(zIn+i,"| %d: %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx" + " %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx", + &j, &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7], + &x[8], &x[9], &x[10], &x[11], &x[12], &x[13], &x[14], &x[15]); + if( rc==17 ){ + k = iOffset+j; + if( k+16<=n ){ + memcpy(a+k, x, 16); + } + continue; + } + } + Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(a, n)); + free(a); + return TCL_OK; +} + + +/* ** Register commands with the TCL interpreter. */ int Sqlitetest1_Init(Tcl_Interp *interp){ @@ -7920,6 +7999,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ { "atomic_batch_write", test_atomic_batch_write, 0 }, { "sqlite3_mmap_warm", test_mmap_warm, 0 }, { "sqlite3_config_sorterref", test_config_sorterref, 0 }, + { "decode_hexdb", test_decode_hexdb, 0 }, }; static int bitmask_size = sizeof(Bitmask)*8; static int longdouble_size = sizeof(LONGDOUBLE_TYPE); |