diff options
author | James Turner <jturner@cvs.openbsd.org> | 2015-04-04 23:25:02 +0000 |
---|---|---|
committer | James Turner <jturner@cvs.openbsd.org> | 2015-04-04 23:25:02 +0000 |
commit | cc128e46feed510d12b805108fc970da7c93e00c (patch) | |
tree | 852089cc8b31707015f16c6b1039025ea8f44698 /lib/libsqlite3/tool | |
parent | cf145dae4fb1af410acd1f9eda9ea3ab747cea5f (diff) |
Update sqlite3 to 3.8.8.3. Changes available here:
http://sqlite.org/releaselog/3_8_8_3.html
Tested in bulk and ok landry@
Diffstat (limited to 'lib/libsqlite3/tool')
-rw-r--r-- | lib/libsqlite3/tool/mkautoconfamal.sh | 5 | ||||
-rw-r--r-- | lib/libsqlite3/tool/mkpragmatab.tcl | 11 | ||||
-rw-r--r-- | lib/libsqlite3/tool/mksqlite3c-noext.tcl | 1 | ||||
-rw-r--r-- | lib/libsqlite3/tool/mksqlite3c.tcl | 3 | ||||
-rw-r--r-- | lib/libsqlite3/tool/mksqlite3internalh.tcl | 1 | ||||
-rw-r--r-- | lib/libsqlite3/tool/showstat4.c | 9 | ||||
-rw-r--r-- | lib/libsqlite3/tool/varint.c | 123 |
7 files changed, 145 insertions, 8 deletions
diff --git a/lib/libsqlite3/tool/mkautoconfamal.sh b/lib/libsqlite3/tool/mkautoconfamal.sh index 4829277234b..0c2668c8b7e 100644 --- a/lib/libsqlite3/tool/mkautoconfamal.sh +++ b/lib/libsqlite3/tool/mkautoconfamal.sh @@ -66,9 +66,9 @@ echo "#include \"sqlite3.c\"" >> tea/generic/tclsqlite3.c echo "#endif" >> tea/generic/tclsqlite3.c cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c -cat tea/configure.in | +cat tea/configure.ac | sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp -mv tmp tea/configure.in +mv tmp tea/configure.ac cd tea autoconf @@ -80,4 +80,3 @@ tar -xzf sqlite-$VERSION.tar.gz mv sqlite-$VERSION sqlite-autoconf-$ARTIFACT tar -czf sqlite-autoconf-$ARTIFACT.tar.gz sqlite-autoconf-$ARTIFACT mv sqlite-autoconf-$ARTIFACT.tar.gz .. - diff --git a/lib/libsqlite3/tool/mkpragmatab.tcl b/lib/libsqlite3/tool/mkpragmatab.tcl index aa7c8078c55..21503d16eec 100644 --- a/lib/libsqlite3/tool/mkpragmatab.tcl +++ b/lib/libsqlite3/tool/mkpragmatab.tcl @@ -246,18 +246,29 @@ set pragma_def { NAME: schema_version TYPE: HEADER_VALUE + ARG: BTREE_SCHEMA_VERSION IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) NAME: user_version TYPE: HEADER_VALUE + ARG: BTREE_USER_VERSION + IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) + + NAME: data_version + TYPE: HEADER_VALUE + ARG: BTREE_DATA_VERSION + FLAG: ReadOnly IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) NAME: freelist_count TYPE: HEADER_VALUE + ARG: BTREE_FREE_PAGE_COUNT + FLAG: ReadOnly IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) NAME: application_id TYPE: HEADER_VALUE + ARG: BTREE_APPLICATION_ID IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) NAME: compile_options diff --git a/lib/libsqlite3/tool/mksqlite3c-noext.tcl b/lib/libsqlite3/tool/mksqlite3c-noext.tcl index f54b347be14..27522265bb0 100644 --- a/lib/libsqlite3/tool/mksqlite3c-noext.tcl +++ b/lib/libsqlite3/tool/mksqlite3c-noext.tcl @@ -96,6 +96,7 @@ foreach hdr { hash.h hwtime.h keywordhash.h + msvc.h mutex.h opcodes.h os_common.h diff --git a/lib/libsqlite3/tool/mksqlite3c.tcl b/lib/libsqlite3/tool/mksqlite3c.tcl index 0e979234f32..1d597a51a09 100644 --- a/lib/libsqlite3/tool/mksqlite3c.tcl +++ b/lib/libsqlite3/tool/mksqlite3c.tcl @@ -100,6 +100,7 @@ foreach hdr { hash.h hwtime.h keywordhash.h + msvc.h mutex.h opcodes.h os_common.h @@ -212,7 +213,7 @@ proc copy_file {filename} { } } elseif {[regexp {^(SQLITE_EXTERN )?void \(\*sqlite3IoTrace\)} $line]} { regsub {^SQLITE_EXTERN } $line {} line - puts $out "SQLITE_PRIVATE $line" + puts $out $line } elseif {[regexp {^void \(\*sqlite3Os} $line]} { puts $out "SQLITE_PRIVATE $line" } else { diff --git a/lib/libsqlite3/tool/mksqlite3internalh.tcl b/lib/libsqlite3/tool/mksqlite3internalh.tcl index 7e92b3ad7dd..8db593fe756 100644 --- a/lib/libsqlite3/tool/mksqlite3internalh.tcl +++ b/lib/libsqlite3/tool/mksqlite3internalh.tcl @@ -58,6 +58,7 @@ foreach hdr { hash.h hwtime.h keywordhash.h + msvc.h opcodes.h os_common.h os_setup.h diff --git a/lib/libsqlite3/tool/showstat4.c b/lib/libsqlite3/tool/showstat4.c index 668d2106af2..215962919ed 100644 --- a/lib/libsqlite3/tool/showstat4.c +++ b/lib/libsqlite3/tool/showstat4.c @@ -39,6 +39,7 @@ int main(int argc, char **argv){ int nSample; i64 iVal; const char *zSep; + int iRow = 0; if( argc!=2 ){ fprintf(stderr, "Usage: %s DATABASE-FILE\n", argv[0]); @@ -60,13 +61,13 @@ int main(int argc, char **argv){ } while( SQLITE_ROW==sqlite3_step(pStmt) ){ if( zIdx==0 || strcmp(zIdx, (const char*)sqlite3_column_text(pStmt,0))!=0 ){ - if( zIdx ) printf("\n"); + if( zIdx ) printf("\n**************************************" + "**************\n\n"); sqlite3_free(zIdx); zIdx = sqlite3_mprintf("%s", sqlite3_column_text(pStmt,0)); - printf("%s:\n", zIdx); - }else{ - printf(" -----------------------------------------------------------\n"); + iRow = 0; } + printf("%s sample %d ------------------------------------\n", zIdx, ++iRow); printf(" nEq = %s\n", sqlite3_column_text(pStmt,1)); printf(" nLt = %s\n", sqlite3_column_text(pStmt,2)); printf(" nDLt = %s\n", sqlite3_column_text(pStmt,3)); diff --git a/lib/libsqlite3/tool/varint.c b/lib/libsqlite3/tool/varint.c new file mode 100644 index 00000000000..f4a51118b4d --- /dev/null +++ b/lib/libsqlite3/tool/varint.c @@ -0,0 +1,123 @@ +/* +** A utility program to translate SQLite varints into decimal and decimal +** integers into varints. +*/ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#if defined(_MSC_VER) || defined(__BORLANDC__) + typedef __int64 i64; + typedef unsigned __int64 u64; +#else + typedef long long int i64; + typedef unsigned long long int u64; +#endif + +static int hexValue(char c){ + if( c>='0' && c<='9' ) return c - '0'; + if( c>='a' && c<='f' ) return c - 'a' + 10; + if( c>='A' && c<='F' ) return c - 'A' + 10; + return -1; +} + +static char toHex(unsigned char c){ + return "0123456789abcdef"[c&0xf]; +} + +static int putVarint(unsigned char *p, u64 v){ + int i, j, n; + unsigned char buf[10]; + if( v & (((u64)0xff000000)<<32) ){ + p[8] = (unsigned char)v; + v >>= 8; + for(i=7; i>=0; i--){ + p[i] = (unsigned char)((v & 0x7f) | 0x80); + v >>= 7; + } + return 9; + } + n = 0; + do{ + buf[n++] = (unsigned char)((v & 0x7f) | 0x80); + v >>= 7; + }while( v!=0 ); + buf[0] &= 0x7f; + for(i=0, j=n-1; j>=0; j--, i++){ + p[i] = buf[j]; + } + return n; +} + + +int main(int argc, char **argv){ + int i; + u64 x; + u64 uX = 0; + i64 iX; + int n; + unsigned char zHex[20]; + + if( argc==1 ){ + fprintf(stderr, + "Usage:\n" + " %s HH HH HH ... Convert varint to decimal\n" + " %s DDDDD Convert decimal to varint\n" + " Add '+' or '-' before DDDDD to disambiguate.\n", + argv[0], argv[0]); + exit(1); + } + if( argc>2 + || (strlen(argv[1])==2 && hexValue(argv[1][0])>=0 && hexValue(argv[1][1])>=0) + ){ + /* Hex to decimal */ + for(i=1; i<argc && i<9; i++){ + if( strlen(argv[i])!=2 ){ + fprintf(stderr, "Not a hex byte: %s\n", argv[i]); + exit(1); + } + x = (hexValue(argv[i][0])<<4) + hexValue(argv[i][1]); + uX = (uX<<7) + (x&0x7f); + if( (x&0x80)==0 ) break; + } + if( i==9 && i<argc ){ + if( strlen(argv[i])!=2 ){ + fprintf(stderr, "Not a hex byte: %s\n", argv[i]); + exit(1); + } + x = (hexValue(argv[i][0])<<4) + hexValue(argv[i][1]); + uX = (uX<<8) + x; + } + i++; + if( i<argc ){ + fprintf(stderr, "Extra arguments: %s...\n", argv[i]); + exit(1); + } + }else{ + char *z = argv[1]; + int sign = 1; + if( z[0]=='+' ) z++; + else if( z[0]=='-' ){ z++; sign = -1; } + uX = 0; + while( z[0] ){ + if( z[0]<'0' || z[0]>'9' ){ + fprintf(stderr, "Not a decimal number: %s", argv[1]); + exit(1); + } + uX = uX*10 + z[0] - '0'; + z++; + } + if( sign<0 ){ + memcpy(&iX, &uX, 8); + iX = -iX; + memcpy(&uX, &iX, 8); + } + } + n = putVarint(zHex, uX); + printf("%lld =", (i64)uX); + for(i=0; i<n; i++){ + printf(" %c%c", toHex(zHex[i]>>4), toHex(zHex[i]&0x0f)); + } + printf("\n"); + return 0; +} |