Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 78033af5b8 | |||
| 7afc8b0c3f | |||
| 70a0222f07 | |||
| e1a086e412 | |||
| f4e9cb065b | |||
| c1ba2e7a52 | |||
| 989578e139 | |||
| 0578248b08 | |||
| dd19783225 | |||
| 05684271c6 | |||
| 197bc20c48 | |||
| 8f8b231239 | |||
| 06d6efb661 | |||
| 2eebbf699e | |||
| f05fba3afa | |||
| b32652601c | |||
| 14285b7067 | |||
| 0353ed2136 | |||
| c216566ba5 | |||
| a4bbc8b119 | |||
| cfe111b1f7 | |||
| a703f50d7e | |||
| a2617433a9 | |||
| bc863b50ba | |||
| 0593516fcc | |||
| 5f8cdac620 | |||
| 362d21614e | |||
| 4398c9524f | |||
| 67896cef89 | |||
| 71d5338c5d | |||
| 0ae4f14e45 | |||
| a7f4bf3f88 | |||
| c0f1d0c697 | |||
| d5570119b7 | |||
| 3ef261567a | |||
| 5e87830fa3 | |||
| a8dbadacee | |||
| 5dbb7cc24f | |||
| bbff218016 | |||
| 9a5cbbc4a5 | |||
| 0157e01cc8 | |||
| 9a5b271908 | |||
| aeddf19e60 | |||
| 1c215c9fd4 | |||
| 05b1ba1e3f | |||
| a17713ff8d | |||
| 09dee52885 | |||
| 5db4f78ef5 | |||
| 60883e5401 | |||
| 312404ef76 | |||
| 98ab33a82f | |||
| db1c12b79f | |||
| 36df58e45f | |||
| 5805eedb87 | |||
| 749ced9923 | |||
| cf02d7cf0b | |||
| 626c25846c | |||
| 0057a74675 | |||
| f5fe3ae9e6 | |||
| 1654256ac8 | |||
| 46d269bc14 | |||
| bc3ec28b88 | |||
| ee1c64ed25 | |||
| 32be00a55b | |||
| 69f3d04810 |
@@ -396,6 +396,7 @@ TESTSRC += \
|
||||
$(TOP)/ext/misc/percentile.c \
|
||||
$(TOP)/ext/misc/regexp.c \
|
||||
$(TOP)/ext/misc/spellfix.c \
|
||||
$(TOP)/ext/misc/totype.c \
|
||||
$(TOP)/ext/misc/wholenumber.c
|
||||
|
||||
# Source code to the library files needed by the test fixture
|
||||
|
||||
+23
-1
@@ -32,6 +32,13 @@ USE_ICU = 0
|
||||
USE_CRT_DLL = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to generate assembly code listings for the source code
|
||||
# files.
|
||||
#
|
||||
!IFNDEF USE_LISTINGS
|
||||
USE_LISTINGS = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to attempt setting the native compiler automatically
|
||||
# for cross-compiling the command line tools needed during the compilation
|
||||
# process.
|
||||
@@ -188,6 +195,13 @@ NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
|
||||
#
|
||||
BCC = $(NCC) -W3
|
||||
|
||||
# Check if assembly code listings should be generated for the source
|
||||
# code files to be compiled.
|
||||
#
|
||||
!IF $(USE_LISTINGS)!=0
|
||||
BCC = $(BCC) -FAcs
|
||||
!ENDIF
|
||||
|
||||
# Check if the native library paths should be used when compiling
|
||||
# the command line tools used during the compilation process. If
|
||||
# so, set the necessary macro now.
|
||||
@@ -203,6 +217,13 @@ NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
|
||||
TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src -fp:precise
|
||||
RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src
|
||||
|
||||
# Check if assembly code listings should be generated for the source
|
||||
# code files to be compiled.
|
||||
#
|
||||
!IF $(USE_LISTINGS)!=0
|
||||
TCC = $(TCC) -FAcs
|
||||
!ENDIF
|
||||
|
||||
# When compiling the library for use in the WinRT environment,
|
||||
# the following compile-time options must be used as well to
|
||||
# disable use of Win32 APIs that are not available and to enable
|
||||
@@ -761,6 +782,7 @@ TESTEXT = \
|
||||
$(TOP)\ext\misc\percentile.c \
|
||||
$(TOP)\ext\misc\regexp.c \
|
||||
$(TOP)\ext\misc\spellfix.c \
|
||||
$(TOP)\ext\misc\totype.c \
|
||||
$(TOP)\ext\misc\wholenumber.c
|
||||
|
||||
|
||||
@@ -1312,7 +1334,7 @@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS)
|
||||
|
||||
clean:
|
||||
del /Q *.lo *.ilk *.lib *.obj *.pdb sqlite3.exe libsqlite3.lib
|
||||
del /Q *.da *.bb *.bbg gmon.out
|
||||
del /Q *.cod *.da *.bb *.bbg gmon.out
|
||||
del /Q sqlite3.h opcodes.c opcodes.h
|
||||
del /Q lemon.exe lempar.c parse.*
|
||||
del /Q mkkeywordhash.exe keywordhash.h
|
||||
|
||||
+1
-1
@@ -4331,7 +4331,7 @@ static int fts3EvalIncrPhraseNext(
|
||||
int i; /* Used to iterate through tokens */
|
||||
|
||||
/* Advance the iterator for each token in the phrase once. */
|
||||
for(i=0; rc==SQLITE_OK && i<p->nToken; i++){
|
||||
for(i=0; rc==SQLITE_OK && i<p->nToken && bEof==0; i++){
|
||||
rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof);
|
||||
if( a[i].bIgnore==0 && (bMaxSet==0 || DOCID_CMP(iMax, a[i].iDocid)<0) ){
|
||||
iMax = a[i].iDocid;
|
||||
|
||||
+96
-33
@@ -31,6 +31,7 @@ struct Fts3auxCursor {
|
||||
Fts3SegFilter filter;
|
||||
char *zStop;
|
||||
int nStop; /* Byte-length of string zStop */
|
||||
int iLangid; /* Language id to query */
|
||||
int isEof; /* True if cursor is at EOF */
|
||||
sqlite3_int64 iRowid; /* Current rowid */
|
||||
|
||||
@@ -45,7 +46,8 @@ struct Fts3auxCursor {
|
||||
/*
|
||||
** Schema of the terms table.
|
||||
*/
|
||||
#define FTS3_TERMS_SCHEMA "CREATE TABLE x(term, col, documents, occurrences)"
|
||||
#define FTS3_AUX_SCHEMA \
|
||||
"CREATE TABLE x(term, col, documents, occurrences, languageid HIDDEN)"
|
||||
|
||||
/*
|
||||
** This function does all the work for both the xConnect and xCreate methods.
|
||||
@@ -92,7 +94,7 @@ static int fts3auxConnectMethod(
|
||||
}
|
||||
nFts3 = (int)strlen(zFts3);
|
||||
|
||||
rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA);
|
||||
rc = sqlite3_declare_vtab(db, FTS3_AUX_SCHEMA);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
|
||||
nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2;
|
||||
@@ -152,6 +154,8 @@ static int fts3auxBestIndexMethod(
|
||||
int iEq = -1;
|
||||
int iGe = -1;
|
||||
int iLe = -1;
|
||||
int iLangid = -1;
|
||||
int iNext = 1; /* Next free argvIndex value */
|
||||
|
||||
UNUSED_PARAMETER(pVTab);
|
||||
|
||||
@@ -163,36 +167,48 @@ static int fts3auxBestIndexMethod(
|
||||
pInfo->orderByConsumed = 1;
|
||||
}
|
||||
|
||||
/* Search for equality and range constraints on the "term" column. */
|
||||
/* Search for equality and range constraints on the "term" column.
|
||||
** And equality constraints on the hidden "languageid" column. */
|
||||
for(i=0; i<pInfo->nConstraint; i++){
|
||||
if( pInfo->aConstraint[i].usable && pInfo->aConstraint[i].iColumn==0 ){
|
||||
if( pInfo->aConstraint[i].usable ){
|
||||
int op = pInfo->aConstraint[i].op;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;
|
||||
int iCol = pInfo->aConstraint[i].iColumn;
|
||||
|
||||
if( iCol==0 ){
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;
|
||||
}
|
||||
if( iCol==4 ){
|
||||
if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iLangid = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( iEq>=0 ){
|
||||
pInfo->idxNum = FTS4AUX_EQ_CONSTRAINT;
|
||||
pInfo->aConstraintUsage[iEq].argvIndex = 1;
|
||||
pInfo->aConstraintUsage[iEq].argvIndex = iNext++;
|
||||
pInfo->estimatedCost = 5;
|
||||
}else{
|
||||
pInfo->idxNum = 0;
|
||||
pInfo->estimatedCost = 20000;
|
||||
if( iGe>=0 ){
|
||||
pInfo->idxNum += FTS4AUX_GE_CONSTRAINT;
|
||||
pInfo->aConstraintUsage[iGe].argvIndex = 1;
|
||||
pInfo->aConstraintUsage[iGe].argvIndex = iNext++;
|
||||
pInfo->estimatedCost /= 2;
|
||||
}
|
||||
if( iLe>=0 ){
|
||||
pInfo->idxNum += FTS4AUX_LE_CONSTRAINT;
|
||||
pInfo->aConstraintUsage[iLe].argvIndex = 1 + (iGe>=0);
|
||||
pInfo->aConstraintUsage[iLe].argvIndex = iNext++;
|
||||
pInfo->estimatedCost /= 2;
|
||||
}
|
||||
}
|
||||
if( iLangid>=0 ){
|
||||
pInfo->aConstraintUsage[iLangid].argvIndex = iNext++;
|
||||
pInfo->estimatedCost--;
|
||||
}
|
||||
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@@ -352,7 +368,14 @@ static int fts3auxFilterMethod(
|
||||
Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;
|
||||
Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;
|
||||
int rc;
|
||||
int isScan;
|
||||
int isScan = 0;
|
||||
int iLangVal = 0; /* Language id to query */
|
||||
|
||||
int iEq = -1; /* Index of term=? value in apVal */
|
||||
int iGe = -1; /* Index of term>=? value in apVal */
|
||||
int iLe = -1; /* Index of term<=? value in apVal */
|
||||
int iLangid = -1; /* Index of languageid=? value in apVal */
|
||||
int iNext = 0;
|
||||
|
||||
UNUSED_PARAMETER(nVal);
|
||||
UNUSED_PARAMETER(idxStr);
|
||||
@@ -362,7 +385,21 @@ static int fts3auxFilterMethod(
|
||||
|| idxNum==FTS4AUX_LE_CONSTRAINT || idxNum==FTS4AUX_GE_CONSTRAINT
|
||||
|| idxNum==(FTS4AUX_LE_CONSTRAINT|FTS4AUX_GE_CONSTRAINT)
|
||||
);
|
||||
isScan = (idxNum!=FTS4AUX_EQ_CONSTRAINT);
|
||||
|
||||
if( idxNum==FTS4AUX_EQ_CONSTRAINT ){
|
||||
iEq = iNext++;
|
||||
}else{
|
||||
isScan = 1;
|
||||
if( idxNum & FTS4AUX_GE_CONSTRAINT ){
|
||||
iGe = iNext++;
|
||||
}
|
||||
if( idxNum & FTS4AUX_LE_CONSTRAINT ){
|
||||
iLe = iNext++;
|
||||
}
|
||||
}
|
||||
if( iNext<nVal ){
|
||||
iLangid = iNext++;
|
||||
}
|
||||
|
||||
/* In case this cursor is being reused, close and zero it. */
|
||||
testcase(pCsr->filter.zTerm);
|
||||
@@ -374,22 +411,35 @@ static int fts3auxFilterMethod(
|
||||
pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;
|
||||
if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN;
|
||||
|
||||
if( idxNum&(FTS4AUX_EQ_CONSTRAINT|FTS4AUX_GE_CONSTRAINT) ){
|
||||
if( iEq>=0 || iGe>=0 ){
|
||||
const unsigned char *zStr = sqlite3_value_text(apVal[0]);
|
||||
assert( (iEq==0 && iGe==-1) || (iEq==-1 && iGe==0) );
|
||||
if( zStr ){
|
||||
pCsr->filter.zTerm = sqlite3_mprintf("%s", zStr);
|
||||
pCsr->filter.nTerm = sqlite3_value_bytes(apVal[0]);
|
||||
if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
if( idxNum&FTS4AUX_LE_CONSTRAINT ){
|
||||
int iIdx = (idxNum&FTS4AUX_GE_CONSTRAINT) ? 1 : 0;
|
||||
pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iIdx]));
|
||||
pCsr->nStop = sqlite3_value_bytes(apVal[iIdx]);
|
||||
|
||||
if( iLe>=0 ){
|
||||
pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iLe]));
|
||||
pCsr->nStop = sqlite3_value_bytes(apVal[iLe]);
|
||||
if( pCsr->zStop==0 ) return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
if( iLangid>=0 ){
|
||||
iLangVal = sqlite3_value_int(apVal[iLangid]);
|
||||
|
||||
rc = sqlite3Fts3SegReaderCursor(pFts3, 0, 0, FTS3_SEGCURSOR_ALL,
|
||||
/* If the user specified a negative value for the languageid, use zero
|
||||
** instead. This works, as the "languageid=?" constraint will also
|
||||
** be tested by the VDBE layer. The test will always be false (since
|
||||
** this module will not return a row with a negative languageid), and
|
||||
** so the overall query will return zero rows. */
|
||||
if( iLangVal<0 ) iLangVal = 0;
|
||||
}
|
||||
pCsr->iLangid = iLangVal;
|
||||
|
||||
rc = sqlite3Fts3SegReaderCursor(pFts3, iLangVal, 0, FTS3_SEGCURSOR_ALL,
|
||||
pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr
|
||||
);
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -413,24 +463,37 @@ static int fts3auxEofMethod(sqlite3_vtab_cursor *pCursor){
|
||||
*/
|
||||
static int fts3auxColumnMethod(
|
||||
sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
|
||||
sqlite3_context *pContext, /* Context for sqlite3_result_xxx() calls */
|
||||
sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */
|
||||
int iCol /* Index of column to read value from */
|
||||
){
|
||||
Fts3auxCursor *p = (Fts3auxCursor *)pCursor;
|
||||
|
||||
assert( p->isEof==0 );
|
||||
if( iCol==0 ){ /* Column "term" */
|
||||
sqlite3_result_text(pContext, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT);
|
||||
}else if( iCol==1 ){ /* Column "col" */
|
||||
if( p->iCol ){
|
||||
sqlite3_result_int(pContext, p->iCol-1);
|
||||
}else{
|
||||
sqlite3_result_text(pContext, "*", -1, SQLITE_STATIC);
|
||||
}
|
||||
}else if( iCol==2 ){ /* Column "documents" */
|
||||
sqlite3_result_int64(pContext, p->aStat[p->iCol].nDoc);
|
||||
}else{ /* Column "occurrences" */
|
||||
sqlite3_result_int64(pContext, p->aStat[p->iCol].nOcc);
|
||||
switch( iCol ){
|
||||
case 0: /* term */
|
||||
sqlite3_result_text(pCtx, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT);
|
||||
break;
|
||||
|
||||
case 1: /* col */
|
||||
if( p->iCol ){
|
||||
sqlite3_result_int(pCtx, p->iCol-1);
|
||||
}else{
|
||||
sqlite3_result_text(pCtx, "*", -1, SQLITE_STATIC);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* documents */
|
||||
sqlite3_result_int64(pCtx, p->aStat[p->iCol].nDoc);
|
||||
break;
|
||||
|
||||
case 3: /* occurrences */
|
||||
sqlite3_result_int64(pCtx, p->aStat[p->iCol].nOcc);
|
||||
break;
|
||||
|
||||
default: /* languageid */
|
||||
assert( iCol==4 );
|
||||
sqlite3_result_int(pCtx, p->iLangid);
|
||||
break;
|
||||
}
|
||||
|
||||
return SQLITE_OK;
|
||||
|
||||
@@ -0,0 +1,512 @@
|
||||
/*
|
||||
** 2013-10-14
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
******************************************************************************
|
||||
**
|
||||
** This SQLite extension implements functions tointeger(X) and toreal(X).
|
||||
**
|
||||
** If X is an integer, real, or string value that can be
|
||||
** losslessly represented as an integer, then tointeger(X)
|
||||
** returns the corresponding integer value.
|
||||
** If X is an 8-byte BLOB then that blob is interpreted as
|
||||
** a signed two-compliment little-endian encoding of an integer
|
||||
** and tointeger(X) returns the corresponding integer value.
|
||||
** Otherwise tointeger(X) return NULL.
|
||||
**
|
||||
** If X is an integer, real, or string value that can be
|
||||
** convert into a real number, preserving at least 15 digits
|
||||
** of precision, then toreal(X) returns the corresponding real value.
|
||||
** If X is an 8-byte BLOB then that blob is interpreted as
|
||||
** a 64-bit IEEE754 big-endian floating point value
|
||||
** and toreal(X) returns the corresponding real value.
|
||||
** Otherwise toreal(X) return NULL.
|
||||
**
|
||||
** Note that tointeger(X) of an 8-byte BLOB assumes a little-endian
|
||||
** encoding whereas toreal(X) of an 8-byte BLOB assumes a big-endian
|
||||
** encoding.
|
||||
*/
|
||||
#include "sqlite3ext.h"
|
||||
SQLITE_EXTENSION_INIT1
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
** Determine if this is running on a big-endian or little-endian
|
||||
** processor
|
||||
*/
|
||||
#if defined(i386) || defined(__i386__) || defined(_M_IX86)\
|
||||
|| defined(__x86_64) || defined(__x86_64__)
|
||||
# define TOTYPE_BIGENDIAN 0
|
||||
# define TOTYPE_LITTLEENDIAN 1
|
||||
#else
|
||||
const int totype_one = 1;
|
||||
# define TOTYPE_BIGENDIAN (*(char *)(&totype_one)==0)
|
||||
# define TOTYPE_LITTLEENDIAN (*(char *)(&totype_one)==1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Constants for the largest and smallest possible 64-bit signed integers.
|
||||
** These macros are designed to work correctly on both 32-bit and 64-bit
|
||||
** compilers.
|
||||
*/
|
||||
#ifndef LARGEST_INT64
|
||||
# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))
|
||||
#endif
|
||||
|
||||
#ifndef SMALLEST_INT64
|
||||
# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Return TRUE if character c is a whitespace character
|
||||
*/
|
||||
static int totypeIsspace(unsigned char c){
|
||||
return c==' ' || c=='\t' || c=='\n' || c=='\v' || c=='\f' || c=='\r';
|
||||
}
|
||||
|
||||
/*
|
||||
** Return TRUE if character c is a digit
|
||||
*/
|
||||
static int totypeIsdigit(unsigned char c){
|
||||
return c>='0' && c<='9';
|
||||
}
|
||||
|
||||
/*
|
||||
** Compare the 19-character string zNum against the text representation
|
||||
** value 2^63: 9223372036854775808. Return negative, zero, or positive
|
||||
** if zNum is less than, equal to, or greater than the string.
|
||||
** Note that zNum must contain exactly 19 characters.
|
||||
**
|
||||
** Unlike memcmp() this routine is guaranteed to return the difference
|
||||
** in the values of the last digit if the only difference is in the
|
||||
** last digit. So, for example,
|
||||
**
|
||||
** totypeCompare2pow63("9223372036854775800")
|
||||
**
|
||||
** will return -8.
|
||||
*/
|
||||
static int totypeCompare2pow63(const char *zNum){
|
||||
int c = 0;
|
||||
int i;
|
||||
/* 012345678901234567 */
|
||||
const char *pow63 = "922337203685477580";
|
||||
for(i=0; c==0 && i<18; i++){
|
||||
c = (zNum[i]-pow63[i])*10;
|
||||
}
|
||||
if( c==0 ){
|
||||
c = zNum[18] - '8';
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
** Convert zNum to a 64-bit signed integer.
|
||||
**
|
||||
** If the zNum value is representable as a 64-bit twos-complement
|
||||
** integer, then write that value into *pNum and return 0.
|
||||
**
|
||||
** If zNum is exactly 9223372036854665808, return 2. This special
|
||||
** case is broken out because while 9223372036854665808 cannot be a
|
||||
** signed 64-bit integer, its negative -9223372036854665808 can be.
|
||||
**
|
||||
** If zNum is too big for a 64-bit integer and is not
|
||||
** 9223372036854665808 or if zNum contains any non-numeric text,
|
||||
** then return 1.
|
||||
**
|
||||
** The string is not necessarily zero-terminated.
|
||||
*/
|
||||
static int totypeAtoi64(const char *zNum, sqlite3_int64 *pNum, int length){
|
||||
sqlite3_uint64 u = 0;
|
||||
int neg = 0; /* assume positive */
|
||||
int i;
|
||||
int c = 0;
|
||||
int nonNum = 0;
|
||||
const char *zStart;
|
||||
const char *zEnd = zNum + length;
|
||||
|
||||
while( zNum<zEnd && totypeIsspace(*zNum) ) zNum++;
|
||||
if( zNum<zEnd ){
|
||||
if( *zNum=='-' ){
|
||||
neg = 1;
|
||||
zNum++;
|
||||
}else if( *zNum=='+' ){
|
||||
zNum++;
|
||||
}
|
||||
}
|
||||
zStart = zNum;
|
||||
while( zNum<zEnd && zNum[0]=='0' ){ zNum++; } /* Skip leading zeros. */
|
||||
for(i=0; &zNum[i]<zEnd && (c=zNum[i])>='0' && c<='9'; i++){
|
||||
u = u*10 + c - '0';
|
||||
}
|
||||
if( u>LARGEST_INT64 ){
|
||||
*pNum = SMALLEST_INT64;
|
||||
}else if( neg ){
|
||||
*pNum = -(sqlite3_int64)u;
|
||||
}else{
|
||||
*pNum = (sqlite3_int64)u;
|
||||
}
|
||||
if( (c!=0 && &zNum[i]<zEnd) || (i==0 && zStart==zNum) || i>19 || nonNum ){
|
||||
/* zNum is empty or contains non-numeric text or is longer
|
||||
** than 19 digits (thus guaranteeing that it is too large) */
|
||||
return 1;
|
||||
}else if( i<19 ){
|
||||
/* Less than 19 digits, so we know that it fits in 64 bits */
|
||||
assert( u<=LARGEST_INT64 );
|
||||
return 0;
|
||||
}else{
|
||||
/* zNum is a 19-digit numbers. Compare it against 9223372036854775808. */
|
||||
c = totypeCompare2pow63(zNum);
|
||||
if( c<0 ){
|
||||
/* zNum is less than 9223372036854775808 so it fits */
|
||||
assert( u<=LARGEST_INT64 );
|
||||
return 0;
|
||||
}else if( c>0 ){
|
||||
/* zNum is greater than 9223372036854775808 so it overflows */
|
||||
return 1;
|
||||
}else{
|
||||
/* zNum is exactly 9223372036854775808. Fits if negative. The
|
||||
** special case 2 overflow if positive */
|
||||
assert( u-1==LARGEST_INT64 );
|
||||
assert( (*pNum)==SMALLEST_INT64 );
|
||||
return neg ? 0 : 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** The string z[] is an text representation of a real number.
|
||||
** Convert this string to a double and write it into *pResult.
|
||||
**
|
||||
** The string is not necessarily zero-terminated.
|
||||
**
|
||||
** Return TRUE if the result is a valid real number (or integer) and FALSE
|
||||
** if the string is empty or contains extraneous text. Valid numbers
|
||||
** are in one of these formats:
|
||||
**
|
||||
** [+-]digits[E[+-]digits]
|
||||
** [+-]digits.[digits][E[+-]digits]
|
||||
** [+-].digits[E[+-]digits]
|
||||
**
|
||||
** Leading and trailing whitespace is ignored for the purpose of determining
|
||||
** validity.
|
||||
**
|
||||
** If some prefix of the input string is a valid number, this routine
|
||||
** returns FALSE but it still converts the prefix and writes the result
|
||||
** into *pResult.
|
||||
*/
|
||||
static int totypeAtoF(const char *z, double *pResult, int length){
|
||||
const char *zEnd = z + length;
|
||||
/* sign * significand * (10 ^ (esign * exponent)) */
|
||||
int sign = 1; /* sign of significand */
|
||||
sqlite3_int64 s = 0; /* significand */
|
||||
int d = 0; /* adjust exponent for shifting decimal point */
|
||||
int esign = 1; /* sign of exponent */
|
||||
int e = 0; /* exponent */
|
||||
int eValid = 1; /* True exponent is either not used or is well-formed */
|
||||
double result;
|
||||
int nDigits = 0;
|
||||
int nonNum = 0;
|
||||
|
||||
*pResult = 0.0; /* Default return value, in case of an error */
|
||||
|
||||
/* skip leading spaces */
|
||||
while( z<zEnd && totypeIsspace(*z) ) z++;
|
||||
if( z>=zEnd ) return 0;
|
||||
|
||||
/* get sign of significand */
|
||||
if( *z=='-' ){
|
||||
sign = -1;
|
||||
z++;
|
||||
}else if( *z=='+' ){
|
||||
z++;
|
||||
}
|
||||
|
||||
/* skip leading zeroes */
|
||||
while( z<zEnd && z[0]=='0' ) z++, nDigits++;
|
||||
|
||||
/* copy max significant digits to significand */
|
||||
while( z<zEnd && totypeIsdigit(*z) && s<((LARGEST_INT64-9)/10) ){
|
||||
s = s*10 + (*z - '0');
|
||||
z++, nDigits++;
|
||||
}
|
||||
|
||||
/* skip non-significant significand digits
|
||||
** (increase exponent by d to shift decimal left) */
|
||||
while( z<zEnd && totypeIsdigit(*z) ) z++, nDigits++, d++;
|
||||
if( z>=zEnd ) goto totype_atof_calc;
|
||||
|
||||
/* if decimal point is present */
|
||||
if( *z=='.' ){
|
||||
z++;
|
||||
/* copy digits from after decimal to significand
|
||||
** (decrease exponent by d to shift decimal right) */
|
||||
while( z<zEnd && totypeIsdigit(*z) && s<((LARGEST_INT64-9)/10) ){
|
||||
s = s*10 + (*z - '0');
|
||||
z++, nDigits++, d--;
|
||||
}
|
||||
/* skip non-significant digits */
|
||||
while( z<zEnd && totypeIsdigit(*z) ) z++, nDigits++;
|
||||
}
|
||||
if( z>=zEnd ) goto totype_atof_calc;
|
||||
|
||||
/* if exponent is present */
|
||||
if( *z=='e' || *z=='E' ){
|
||||
z++;
|
||||
eValid = 0;
|
||||
if( z>=zEnd ) goto totype_atof_calc;
|
||||
/* get sign of exponent */
|
||||
if( *z=='-' ){
|
||||
esign = -1;
|
||||
z++;
|
||||
}else if( *z=='+' ){
|
||||
z++;
|
||||
}
|
||||
/* copy digits to exponent */
|
||||
while( z<zEnd && totypeIsdigit(*z) ){
|
||||
e = e<10000 ? (e*10 + (*z - '0')) : 10000;
|
||||
z++;
|
||||
eValid = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* skip trailing spaces */
|
||||
if( nDigits && eValid ){
|
||||
while( z<zEnd && totypeIsspace(*z) ) z++;
|
||||
}
|
||||
|
||||
totype_atof_calc:
|
||||
/* adjust exponent by d, and update sign */
|
||||
e = (e*esign) + d;
|
||||
if( e<0 ) {
|
||||
esign = -1;
|
||||
e *= -1;
|
||||
} else {
|
||||
esign = 1;
|
||||
}
|
||||
|
||||
/* if 0 significand */
|
||||
if( !s ) {
|
||||
/* In the IEEE 754 standard, zero is signed.
|
||||
** Add the sign if we've seen at least one digit */
|
||||
result = (sign<0 && nDigits) ? -(double)0 : (double)0;
|
||||
} else {
|
||||
/* attempt to reduce exponent */
|
||||
if( esign>0 ){
|
||||
while( s<(LARGEST_INT64/10) && e>0 ) e--,s*=10;
|
||||
}else{
|
||||
while( !(s%10) && e>0 ) e--,s/=10;
|
||||
}
|
||||
|
||||
/* adjust the sign of significand */
|
||||
s = sign<0 ? -s : s;
|
||||
|
||||
/* if exponent, scale significand as appropriate
|
||||
** and store in result. */
|
||||
if( e ){
|
||||
double scale = 1.0;
|
||||
/* attempt to handle extremely small/large numbers better */
|
||||
if( e>307 && e<342 ){
|
||||
while( e%308 ) { scale *= 1.0e+1; e -= 1; }
|
||||
if( esign<0 ){
|
||||
result = s / scale;
|
||||
result /= 1.0e+308;
|
||||
}else{
|
||||
result = s * scale;
|
||||
result *= 1.0e+308;
|
||||
}
|
||||
}else if( e>=342 ){
|
||||
if( esign<0 ){
|
||||
result = 0.0*s;
|
||||
}else{
|
||||
result = 1e308*1e308*s; /* Infinity */
|
||||
}
|
||||
}else{
|
||||
/* 1.0e+22 is the largest power of 10 than can be
|
||||
** represented exactly. */
|
||||
while( e%22 ) { scale *= 1.0e+1; e -= 1; }
|
||||
while( e>0 ) { scale *= 1.0e+22; e -= 22; }
|
||||
if( esign<0 ){
|
||||
result = s / scale;
|
||||
}else{
|
||||
result = s * scale;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = (double)s;
|
||||
}
|
||||
}
|
||||
|
||||
/* store the result */
|
||||
*pResult = result;
|
||||
|
||||
/* return true if number and no extra non-whitespace chracters after */
|
||||
return z>=zEnd && nDigits>0 && eValid && nonNum==0;
|
||||
}
|
||||
|
||||
/*
|
||||
** tointeger(X): If X is any value (integer, double, blob, or string) that
|
||||
** can be losslessly converted into an integer, then make the conversion and
|
||||
** return the result. Otherwise, return NULL.
|
||||
*/
|
||||
static void tointegerFunc(
|
||||
sqlite3_context *context,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
){
|
||||
assert( argc==1 );
|
||||
(void)argc;
|
||||
switch( sqlite3_value_type(argv[0]) ){
|
||||
case SQLITE_FLOAT: {
|
||||
double rVal = sqlite3_value_double(argv[0]);
|
||||
sqlite3_int64 iVal = (sqlite3_int64)rVal;
|
||||
if( rVal==(double)iVal ){
|
||||
sqlite3_result_int64(context, iVal);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLITE_INTEGER: {
|
||||
sqlite3_result_int64(context, sqlite3_value_int64(argv[0]));
|
||||
break;
|
||||
}
|
||||
case SQLITE_BLOB: {
|
||||
const unsigned char *zBlob = sqlite3_value_blob(argv[0]);
|
||||
if( zBlob ){
|
||||
int nBlob = sqlite3_value_bytes(argv[0]);
|
||||
if( nBlob==sizeof(sqlite3_int64) ){
|
||||
sqlite3_int64 iVal;
|
||||
if( TOTYPE_BIGENDIAN ){
|
||||
int i;
|
||||
unsigned char zBlobRev[sizeof(sqlite3_int64)];
|
||||
for(i=0; i<sizeof(sqlite3_int64); i++){
|
||||
zBlobRev[i] = zBlob[sizeof(sqlite3_int64)-1-i];
|
||||
}
|
||||
memcpy(&iVal, zBlobRev, sizeof(sqlite3_int64));
|
||||
}else{
|
||||
memcpy(&iVal, zBlob, sizeof(sqlite3_int64));
|
||||
}
|
||||
sqlite3_result_int64(context, iVal);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLITE_TEXT: {
|
||||
const unsigned char *zStr = sqlite3_value_text(argv[0]);
|
||||
if( zStr ){
|
||||
int nStr = sqlite3_value_bytes(argv[0]);
|
||||
if( nStr && !totypeIsspace(zStr[0]) ){
|
||||
sqlite3_int64 iVal;
|
||||
if( !totypeAtoi64((const char*)zStr, &iVal, nStr) ){
|
||||
sqlite3_result_int64(context, iVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
assert( sqlite3_value_type(argv[0])==SQLITE_NULL );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** toreal(X): If X is any value (integer, double, blob, or string) that can
|
||||
** be losslessly converted into a real number, then do so and return that
|
||||
** real number. Otherwise return NULL.
|
||||
*/
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4748)
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
static void torealFunc(
|
||||
sqlite3_context *context,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
){
|
||||
assert( argc==1 );
|
||||
(void)argc;
|
||||
switch( sqlite3_value_type(argv[0]) ){
|
||||
case SQLITE_FLOAT: {
|
||||
sqlite3_result_double(context, sqlite3_value_double(argv[0]));
|
||||
break;
|
||||
}
|
||||
case SQLITE_INTEGER: {
|
||||
sqlite3_int64 iVal = sqlite3_value_int64(argv[0]);
|
||||
double rVal = (double)iVal;
|
||||
if( iVal==(sqlite3_int64)rVal ){
|
||||
sqlite3_result_double(context, rVal);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLITE_BLOB: {
|
||||
const unsigned char *zBlob = sqlite3_value_blob(argv[0]);
|
||||
if( zBlob ){
|
||||
int nBlob = sqlite3_value_bytes(argv[0]);
|
||||
if( nBlob==sizeof(double) ){
|
||||
double rVal;
|
||||
if( TOTYPE_LITTLEENDIAN ){
|
||||
int i;
|
||||
unsigned char zBlobRev[sizeof(double)];
|
||||
for(i=0; i<sizeof(double); i++){
|
||||
zBlobRev[i] = zBlob[sizeof(double)-1-i];
|
||||
}
|
||||
memcpy(&rVal, zBlobRev, sizeof(double));
|
||||
}else{
|
||||
memcpy(&rVal, zBlob, sizeof(double));
|
||||
}
|
||||
sqlite3_result_double(context, rVal);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLITE_TEXT: {
|
||||
const unsigned char *zStr = sqlite3_value_text(argv[0]);
|
||||
if( zStr ){
|
||||
int nStr = sqlite3_value_bytes(argv[0]);
|
||||
if( nStr && !totypeIsspace(zStr[0]) && !totypeIsspace(zStr[nStr-1]) ){
|
||||
double rVal;
|
||||
if( totypeAtoF((const char*)zStr, &rVal, nStr) ){
|
||||
sqlite3_result_double(context, rVal);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
assert( sqlite3_value_type(argv[0])==SQLITE_NULL );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(_MSC_VER)
|
||||
#pragma optimize("", on)
|
||||
#pragma warning(default: 4748)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int sqlite3_totype_init(
|
||||
sqlite3 *db,
|
||||
char **pzErrMsg,
|
||||
const sqlite3_api_routines *pApi
|
||||
){
|
||||
int rc = SQLITE_OK;
|
||||
SQLITE_EXTENSION_INIT2(pApi);
|
||||
(void)pzErrMsg; /* Unused parameter */
|
||||
rc = sqlite3_create_function(db, "tointeger", 1, SQLITE_UTF8, 0,
|
||||
tointegerFunc, 0, 0);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3_create_function(db, "toreal", 1, SQLITE_UTF8, 0,
|
||||
torealFunc, 0, 0);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
+72
-19
@@ -16,14 +16,37 @@
|
||||
|
||||
/*
|
||||
** This module contains code for a wrapper VFS that causes a log of
|
||||
** most VFS calls to be written into a file on disk. The log
|
||||
** is stored as comma-separated variables.
|
||||
** most VFS calls to be written into a file on disk.
|
||||
**
|
||||
** All calls on sqlite3_file objects are logged.
|
||||
** Additionally, calls to the xAccess(), xOpen(), and xDelete()
|
||||
** methods are logged. The other sqlite3_vfs object methods (xDlXXX,
|
||||
** xRandomness, xSleep, xCurrentTime, xGetLastError and xCurrentTimeInt64)
|
||||
** are not logged.
|
||||
** Each database connection creates a separate log file in the same
|
||||
** directory as the original database and named after the original
|
||||
** database. A unique suffix is added to avoid name collisions.
|
||||
** Separate log files are used so that concurrent processes do not
|
||||
** try to write log operations to the same file at the same instant,
|
||||
** resulting in overwritten or comingled log text.
|
||||
**
|
||||
** Each individual log file records operations by a single database
|
||||
** connection on both the original database and its associated rollback
|
||||
** journal.
|
||||
**
|
||||
** The log files are in the comma-separated-value (CSV) format. The
|
||||
** log files can be imported into an SQLite database using the ".import"
|
||||
** command of the SQLite command-line shell for analysis.
|
||||
**
|
||||
** One technique for using this module is to append the text of this
|
||||
** module to the end of a standard "sqlite3.c" amalgamation file then
|
||||
** add the following compile-time options:
|
||||
**
|
||||
** -DSQLITE_EXTRA_INIT=sqlite3_register_vfslog
|
||||
** -DSQLITE_USE_FCNTL_TRACE
|
||||
**
|
||||
** The first compile-time option causes the sqlite3_register_vfslog()
|
||||
** function, defined below, to be invoked when SQLite is initialized.
|
||||
** That causes this custom VFS to become the default VFS for all
|
||||
** subsequent connections. The SQLITE_USE_FCNTL_TRACE option causes
|
||||
** the SQLite core to issue extra sqlite3_file_control() operations
|
||||
** with SQLITE_FCNTL_TRACE to give some indication of what is going
|
||||
** on in the core.
|
||||
*/
|
||||
|
||||
#include "sqlite3.h"
|
||||
@@ -190,7 +213,7 @@ static void vlogLogPrint(
|
||||
const char *zArg3, /* Third argument */
|
||||
int iRes /* Result */
|
||||
){
|
||||
char z1[40], z2[40], z3[70];
|
||||
char z1[40], z2[40], z3[2000];
|
||||
if( pLog==0 ) return;
|
||||
if( iArg1>=0 ){
|
||||
sqlite3_snprintf(sizeof(z1), z1, "%lld", iArg1);
|
||||
@@ -203,7 +226,7 @@ static void vlogLogPrint(
|
||||
z2[0] = 0;
|
||||
}
|
||||
if( zArg3 ){
|
||||
sqlite3_snprintf(sizeof(z3), z3, "\"%s\"", zArg3);
|
||||
sqlite3_snprintf(sizeof(z3), z3, "\"%.*w\"", sizeof(z3)-4, zArg3);
|
||||
}else{
|
||||
z3[0] = 0;
|
||||
}
|
||||
@@ -346,6 +369,13 @@ static void vlogSignature(unsigned char *p, int n, char *zCksum){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Convert a big-endian 32-bit integer into a native integer
|
||||
*/
|
||||
static int bigToNative(const unsigned char *x){
|
||||
return (x[0]<<24) + (x[1]<<16) + (x[2]<<8) + x[3];
|
||||
}
|
||||
|
||||
/*
|
||||
** Read data from an vlog-file.
|
||||
*/
|
||||
@@ -376,9 +406,16 @@ static int vlogRead(
|
||||
&& iOfst+iAmt>=28
|
||||
){
|
||||
unsigned char *x = ((unsigned char*)zBuf)+(24-iOfst);
|
||||
unsigned iCtr;
|
||||
iCtr = (x[0]<<24) + (x[1]<<16) + (x[2]<<8) + x[3];
|
||||
vlogLogPrint(p->pLog, tStart, 0, "CHNGCTR-READ", iCtr, -1, 0, 0);
|
||||
unsigned iCtr, nFree = -1;
|
||||
char *zFree = 0;
|
||||
char zStr[12];
|
||||
iCtr = bigToNative(x);
|
||||
if( iOfst+iAmt>=40 ){
|
||||
zFree = zStr;
|
||||
sqlite3_snprintf(sizeof(zStr), zStr, "%d", bigToNative(x+8));
|
||||
nFree = bigToNative(x+12);
|
||||
}
|
||||
vlogLogPrint(p->pLog, tStart, 0, "CHNGCTR-READ", iCtr, nFree, zFree, 0);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -409,9 +446,16 @@ static int vlogWrite(
|
||||
&& iOfst+iAmt>=28
|
||||
){
|
||||
unsigned char *x = ((unsigned char*)z)+(24-iOfst);
|
||||
unsigned iCtr;
|
||||
iCtr = (x[0]<<24) + (x[1]<<16) + (x[2]<<8) + x[3];
|
||||
vlogLogPrint(p->pLog, tStart, 0, "CHNGCTR-WRITE", iCtr, -1, 0, 0);
|
||||
unsigned iCtr, nFree = -1;
|
||||
char *zFree = 0;
|
||||
char zStr[12];
|
||||
iCtr = bigToNative(x);
|
||||
if( iOfst+iAmt>=40 ){
|
||||
zFree = zStr;
|
||||
sqlite3_snprintf(sizeof(zStr), zStr, "%d", bigToNative(x+8));
|
||||
nFree = bigToNative(x+12);
|
||||
}
|
||||
vlogLogPrint(p->pLog, tStart, 0, "CHNGCTR-WRITE", iCtr, nFree, zFree, 0);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -477,12 +521,11 @@ static int vlogLock(sqlite3_file *pFile, int eLock){
|
||||
*/
|
||||
static int vlogUnlock(sqlite3_file *pFile, int eLock){
|
||||
int rc;
|
||||
sqlite3_uint64 tStart, tElapse;
|
||||
sqlite3_uint64 tStart;
|
||||
VLogFile *p = (VLogFile *)pFile;
|
||||
tStart = vlog_time();
|
||||
vlogLogPrint(p->pLog, tStart, 0, "UNLOCK", eLock, -1, 0, 0);
|
||||
rc = p->pReal->pMethods->xUnlock(p->pReal, eLock);
|
||||
tElapse = vlog_time() - tStart;
|
||||
vlogLogPrint(p->pLog, tStart, tElapse, "UNLOCK", eLock, -1, 0, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -514,7 +557,17 @@ static int vlogFileControl(sqlite3_file *pFile, int op, void *pArg){
|
||||
*(char**)pArg = sqlite3_mprintf("vlog/%z", *(char**)pArg);
|
||||
}
|
||||
tElapse = vlog_time() - tStart;
|
||||
vlogLogPrint(p->pLog, tStart, tElapse, "FILECONTROL", op, -1, 0, rc);
|
||||
if( op==SQLITE_FCNTL_TRACE ){
|
||||
vlogLogPrint(p->pLog, tStart, tElapse, "TRACE", op, -1, pArg, rc);
|
||||
}else if( op==SQLITE_FCNTL_PRAGMA ){
|
||||
const char **azArg = (const char **)pArg;
|
||||
vlogLogPrint(p->pLog, tStart, tElapse, "FILECONTROL", op, -1, azArg[1], rc);
|
||||
}else if( op==SQLITE_FCNTL_SIZE_HINT ){
|
||||
sqlite3_int64 sz = *(sqlite3_int64*)pArg;
|
||||
vlogLogPrint(p->pLog, tStart, tElapse, "FILECONTROL", op, sz, 0, rc);
|
||||
}else{
|
||||
vlogLogPrint(p->pLog, tStart, tElapse, "FILECONTROL", op, -1, 0, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,4 +26,5 @@
|
||||
>68 belong =0x42654c6e Bentley Systems Localization File -
|
||||
>60 belong =0x5f4d544e Monotone source repository -
|
||||
>68 belong =0x47504b47 OGC GeoPackage file -
|
||||
>68 belong =0x47503130 OGC GeoPackage version 1.0 file -
|
||||
>0 string =SQLite SQLite3 database
|
||||
|
||||
@@ -279,6 +279,7 @@ TESTSRC += \
|
||||
$(TOP)/ext/misc/percentile.c \
|
||||
$(TOP)/ext/misc/regexp.c \
|
||||
$(TOP)/ext/misc/spellfix.c \
|
||||
$(TOP)/ext/misc/totype.c \
|
||||
$(TOP)/ext/misc/wholenumber.c \
|
||||
$(TOP)/ext/misc/vfslog.c
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
C Changes\sto\sthe\snew\sinitial\srow\sof\sPRAGMA\sindex_list\sresults.
|
||||
D 2013-10-12T09:32:05.784
|
||||
C Have\sthe\sshell\s".timer\son"\scommand\scause\sthe\sshell\sto\sreport\swall-clock\stime\sfor\seach\squery\s(as\swell\sas\suser\sand\ssystem\sCPU\stime).
|
||||
D 2013-10-30T12:30:05.137
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in e2d28ec95bd17ab4f3b6ee40b7102e9d7a0857b9
|
||||
F Makefile.in 0522b53cdc1fcfc18f3a98e0246add129136c654
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
F Makefile.msc a08b5f4ed4f760bae4eae4e723371487c5378983
|
||||
F Makefile.msc ec5d662ed5a15ff819928c0495017af13910d7b6
|
||||
F Makefile.vxworks db21ed42a01d5740e656b16f92cb5d8d5e5dd315
|
||||
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
|
||||
F VERSION a8d1f6839521130dc73c5408cdd24bcfd791df34
|
||||
@@ -78,10 +78,10 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
|
||||
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
|
||||
F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314
|
||||
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
||||
F ext/fts3/fts3.c dcb90d12ff4a0ccfceaefb3bae2199b6536e0dfc
|
||||
F ext/fts3/fts3.c f25ae5729d40cc4e661c0a552685038f27e72bc9
|
||||
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
||||
F ext/fts3/fts3Int.h 8689f7cf85020e7f88d1e761eeac480c3b0ea7ad
|
||||
F ext/fts3/fts3_aux.c b02632f6dd0e375ce97870206d914ea6d8df5ccd
|
||||
F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365
|
||||
F ext/fts3/fts3_expr.c f8eb1046063ba342c7114eba175cabb31c4a64e7
|
||||
F ext/fts3/fts3_hash.c 8dd2d06b66c72c628c2732555a32bc0943114914
|
||||
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
|
||||
@@ -115,7 +115,8 @@ F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
|
||||
F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
|
||||
F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
|
||||
F ext/misc/spellfix.c 5e1d547e9a2aed13897fa91bac924333f62fd2d9
|
||||
F ext/misc/vfslog.c 1abb192d8d4bd323adbddec0c024580496b51b7a
|
||||
F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
|
||||
F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
|
||||
F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
|
||||
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
|
||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||
@@ -139,8 +140,8 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
|
||||
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt f2b23a6bde8f1c6e86b957e4d94eab0add520b0d
|
||||
F main.mk 2e01504061f618db804812143a9e9ec45a66ae70
|
||||
F magic.txt 814d3de5ec227817ff2ad26cbc73159c968a2a58
|
||||
F main.mk c6a433cb334bbb019625c137ab5d5e7568b47cff
|
||||
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
|
||||
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
|
||||
F mkextw.sh d2a981497b404d6498f5ff3e3b1f3816bdfcb338
|
||||
@@ -158,16 +159,16 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F src/alter.c 2af0330bb1b601af7a7789bf7229675fd772a083
|
||||
F src/analyze.c f9e4eec962f2d81d775d8d5c2efb27b84acb0be0
|
||||
F src/analyze.c f1c5ed1fe128c3f106dcd95e97ee9ef94db7a3fa
|
||||
F src/attach.c 0a17c9364895316ca4f52d06a97a72c0af1ae8b3
|
||||
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
||||
F src/backup.c 2f1987981139bd2f6d8c728d64bf09fb387443c3
|
||||
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
||||
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
||||
F src/btree.c d5720cbb21ae56e7e5b07847e05e5b203818acac
|
||||
F src/btree.c 509722ce305471b626d3401c0631a808fd33237b
|
||||
F src/btree.h bfe0e8c5759b4ec77b0d18390064a6ef3cdffaaf
|
||||
F src/btreeInt.h f038e818bfadf75afbd09819ed93c26a333d39e0
|
||||
F src/build.c 8ae900bf021a66ac110f5eb2dcf994d24d1c2061
|
||||
F src/build.c 6d9a545d726956fdc0c63d7076291fc9e7207484
|
||||
F src/callback.c f99a8957ba2adf369645fac0db09ad8adcf1caa2
|
||||
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
||||
F src/ctime.c ea4b7f3623a0fcb1146e7f245d7410033e86859c
|
||||
@@ -175,7 +176,7 @@ F src/date.c 593c744b2623971e45affd0bde347631bdfa4625
|
||||
F src/delete.c 45788c5e48734f2af4acd75a876466e5b9838e34
|
||||
F src/expr.c e7338ccffdc391c53ba2d51c5eb6a2f5299e040e
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c be866cd8c4fa6cae98ba33109578fd1a3311ee5b
|
||||
F src/fkey.c 5dc10cbaa355753903cd2a64da040f948997ebf8
|
||||
F src/func.c 2c47b65e6e00e3e9374942f28254faf8adafe398
|
||||
F src/global.c 5caf4deab621abb45b4c607aad1bd21c20aac759
|
||||
F src/hash.c ac3470bbf1ca4ae4e306a8ecb0fdf1731810ffe4
|
||||
@@ -204,36 +205,36 @@ F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be
|
||||
F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
|
||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||
F src/os_unix.c 243fb37f47dc072fc59839ea241ff0a17c8d76e6
|
||||
F src/os_win.c 0fea05bc7b75eccb01d8a8a10aaeaf4147b8e0cd
|
||||
F src/os_win.c b159b5249d9f70607d961bbdd1dbba789c75812c
|
||||
F src/pager.c 2aa4444ffe86e9282d03bc349a4a5e49bd77c0e8
|
||||
F src/pager.h f094af9f6ececfaa8a1e93876905a4f34233fb0c
|
||||
F src/parse.y a97566d6da75075589a7c716d1bda14b586cf8da
|
||||
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
|
||||
F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
|
||||
F src/pcache1.c a467393909a4ed7ca9de066d85ba5c5b04a5be63
|
||||
F src/pragma.c 393efaa787ec5535cf30f6e435b94ec436776745
|
||||
F src/pragma.c 6fb3125fff078cd81db0039ac778948df4e8cb6f
|
||||
F src/prepare.c fa6988589f39af8504a61731614cd4f6ae71554f
|
||||
F src/printf.c da9119eb31a187a4b99f60aa4a225141c0ebb74b
|
||||
F src/random.c 0b2dbc37fdfbfa6bd455b091dfcef5bdb32dba68
|
||||
F src/resolve.c 5f15b00644c36a1610b87857abf42db38c07519c
|
||||
F src/resolve.c 572585a96bf282bb9c3d9e08785ec3cae21dc488
|
||||
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
||||
F src/select.c 15127b54cc11defb2cddef6914e1f384501a61c4
|
||||
F src/shell.c 6f11f0e9ded63d48e306f2c6858c521e568a47bb
|
||||
F src/sqlite.h.in 4c6eb96fded1d56a27cec04b6b6803789eb28f54
|
||||
F src/shell.c 43647b08b6114823fe2e39b1e14934fa39dd22f3
|
||||
F src/sqlite.h.in 547a44dd4ff4d975e92a645ea2d609e543a83d0f
|
||||
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
|
||||
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
|
||||
F src/sqliteInt.h eeebd2522bbd5ac7e3024be64113e8366caa66c8
|
||||
F src/sqliteInt.h 4dd81a25a919509ce94b1f8f120bbef14458d4b9
|
||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
|
||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||
F src/tclsqlite.c 3b5f3716e320480659239abe887164521c575d83
|
||||
F src/test1.c 26226cfd2b6dc3f77d2eb27f07ffcf236b4e728b
|
||||
F src/test1.c 5757066e503a8ed51313cb3a5d9bcdcced2991a9
|
||||
F src/test2.c 7355101c085304b90024f2261e056cdff13c6c35
|
||||
F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c
|
||||
F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df
|
||||
F src/test5.c a6d1ac55ac054d0b2b8f37b5e655b6c92645a013
|
||||
F src/test6.c a437f76f9874d2563352a7e6cd0d43217663c220
|
||||
F src/test7.c 126b886b53f0358b92aba9b81d3fcbfbe9a93cd6
|
||||
F src/test6.c 00af0fe1947305222b8ed488a69c76c5a2b632e2
|
||||
F src/test7.c 72b732baa5642f795655ba1126ea032af46ecfd2
|
||||
F src/test8.c c7aab1d9fbbf54fc33d43b73aa24aa55f9eaf534
|
||||
F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
|
||||
F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8
|
||||
@@ -262,7 +263,7 @@ F src/test_quota.c 30c64f0ef84734f2231a686df41ed882b0c59bc0
|
||||
F src/test_quota.h 8761e463b25e75ebc078bd67d70e39b9c817a0cb
|
||||
F src/test_rtree.c f3d1d12538dccb75fd916e3fa58f250edbdd3b47
|
||||
F src/test_schema.c cd12a2223c3a394f4d07bb93bdf6d344c5c121b6
|
||||
F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
|
||||
F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe
|
||||
F src/test_sqllog.c c1c1bbedbcaf82b93d83e4f9dd990e62476a680e
|
||||
F src/test_stat.c d1569c7a4839f13e80187e2c26b2ab4da2d03935
|
||||
F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
|
||||
@@ -278,20 +279,20 @@ F src/update.c f5182157f5d0d0a97bc5f5e3c9bdba0dfbe08f08
|
||||
F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269
|
||||
F src/util.c 2fa6c821d28bbdbeec1b2a7b091a281c9ef8f918
|
||||
F src/vacuum.c f313bc97123a4dd4bfd3f50a00c4d44c08a5b1b7
|
||||
F src/vdbe.c 56e648f5ba9a91810caf216857adfed9039cd174
|
||||
F src/vdbe.c 3d960c844cee53830f33717b4f5d23d7ee56685f
|
||||
F src/vdbe.h 4f554b5627f26710c4c36d919110a3fc611ca5c4
|
||||
F src/vdbeInt.h ff57f67aee1ba26a3a47e786533dab155ab6dad6
|
||||
F src/vdbeapi.c 93a22a9ba2abe292d5c2cf304d7eb2e894dde0ed
|
||||
F src/vdbeaux.c 55f4858fe6abd84bd7311acbf30a75a28903ec25
|
||||
F src/vdbeblob.c 5dc79627775bd9a9b494dd956e26297946417d69
|
||||
F src/vdbemem.c 28730af78c730cf230b64d62757a009668e76444
|
||||
F src/vdbemem.c 649933bad3e922465b726eaf85c72a75acba2ab7
|
||||
F src/vdbesort.c 3937e06b2a0e354500e17dc206ef4c35770a5017
|
||||
F src/vdbetrace.c e7ec40e1999ff3c6414424365d5941178966dcbc
|
||||
F src/vtab.c 5a423b042eb1402ef77697d03d6a67378d97bc8d
|
||||
F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4
|
||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||
F src/walker.c e9e593d5bb798c3e67fc3893dfe7055c9e7d8d74
|
||||
F src/where.c dd2d0d69280d6653d8ef8cf3b6b4b848b9058197
|
||||
F src/where.c f18400f121fd27385f41cdff7aa8a811feca842e
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
||||
@@ -325,7 +326,7 @@ F test/attach3.test d89ccfe4fe6e2b5e368d480fcdfe4b496c54cf4e
|
||||
F test/attach4.test 53bf502f17647c6d6c5add46dda6bac8b6f4665c
|
||||
F test/attachmalloc.test 3a4bfca9545bfe906a8d2e622de10fbac5b711b0
|
||||
F test/auth.test 9bea29041871807d9f289ee679d05d3ed103642f
|
||||
F test/auth2.test a2a371aa6df15f8b0c8109b33d3d7f0f73e4c9aa
|
||||
F test/auth2.test c3b415b76c033bedb81292118fb7c01f5f10cbcd
|
||||
F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5
|
||||
F test/autoinc.test bd30d372d00045252f6c2e41b5f41455e1975acf
|
||||
F test/autoindex1.test d4dfe14001dfcb74cfbd7107f45a79fc1ab6183e
|
||||
@@ -462,8 +463,8 @@ F test/fkey1.test e1d1fa84cde579185ea01358436839703e415a5b
|
||||
F test/fkey2.test 06e0b4cc9e1b3271ae2ae6feeb19755468432111
|
||||
F test/fkey3.test 5ec899d12b13bcf1e9ef40eff7fb692fdb91392e
|
||||
F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
|
||||
F test/fkey5.test 2b8c761ad23bb6a95b9cf8366c9a982a80a439c2
|
||||
F test/fkey6.test c1d7cb176648e0e1e9f971f5f9bde4dd5bcd046d
|
||||
F test/fkey5.test 8a1fde4e7721ae00b05b3178888833726ca2df8d
|
||||
F test/fkey6.test 18e8c024d39f68f8d4bb1177c992bcffdc273464
|
||||
F test/fkey7.test e31d0e71a41c1d29349a16448d6c420e2c53a8fc
|
||||
F test/fkey_malloc.test bb74c9cb8f8fceed03b58f8a7ef2df98520bbd51
|
||||
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
|
||||
@@ -522,6 +523,7 @@ F test/fts3ao.test 71b0675e3df5c512a5a03daaa95ee1916de23dda
|
||||
F test/fts3atoken.test fca30fd86db9241d571c637751e9a8a2f50f1451
|
||||
F test/fts3auto.test b981fea19b132b4e6878f50d7c1f369b28f68eb9
|
||||
F test/fts3aux1.test f8f287a4a73f381f8fa15b6a70f36245f903d221
|
||||
F test/fts3aux2.test 7ae2b2c13aefdf4169279a27a5f51780ce57f6ba
|
||||
F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
|
||||
F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
|
||||
F test/fts3comp1.test a0f5b16a2df44dd0b15751787130af2183167c0c
|
||||
@@ -557,7 +559,7 @@ F test/fts4aa.test 0c3152322c7f0b548cc942ad763eaba0da87ccca
|
||||
F test/fts4check.test 66fa274cab2b615f2fb338b257713aba8fad88a8
|
||||
F test/fts4content.test 2e7252557d6d24afa101d9ba1de710d6140e6d06
|
||||
F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01
|
||||
F test/fts4incr.test 2fae04582c2329a038b2b1f985e702478fb94888
|
||||
F test/fts4incr.test 361960ed3550e781f3f313e17e2182ef9cefc0e9
|
||||
F test/fts4langid.test 24a6e41063b416bbdf371ff6b4476fa41c194aa7
|
||||
F test/fts4merge.test c424309743fdd203f8e56a1f1cd7872cd66cc0ee
|
||||
F test/fts4merge2.test 5faa558d1b672f82b847d2a337465fa745e46891
|
||||
@@ -569,6 +571,7 @@ F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d
|
||||
F test/func.test c7e80a44eebac8604397eb2ad83d0d5d9d541237
|
||||
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
|
||||
F test/func3.test dbccee9133cfef1473c59ec07b5f0262b9d72f9a
|
||||
F test/func4.test cb3f888a1cafad195a1f8d396875bdb11dc4faf9
|
||||
F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74
|
||||
F test/fuzz.test 77fd50afc12847af50fcf1941679d90adebadde6
|
||||
F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167
|
||||
@@ -725,7 +728,7 @@ F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d
|
||||
F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
|
||||
F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54
|
||||
F test/permutations.test e154f5ed66d4d4913a99a110e870c9407f75b055
|
||||
F test/pragma.test 75990a4a9f2b492d715c4ec89c8ced72dd20639b
|
||||
F test/pragma.test 5e7de6c32a5d764f09437d2025f07e4917b9e178
|
||||
F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13
|
||||
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
|
||||
F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d
|
||||
@@ -824,7 +827,7 @@ F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
|
||||
F test/tclsqlite.test 37a61c2da7e3bfe3b8c1a2867199f6b860df5d43
|
||||
F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c
|
||||
F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
|
||||
F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d
|
||||
F test/temptrigger.test 0a48d94222d50e6e50d72ac103606c4f8e7cbb81
|
||||
F test/tester.tcl 5e97d1fe08f45fa3cc2320cee437e315c75ce995
|
||||
F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5
|
||||
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
|
||||
@@ -976,7 +979,7 @@ F test/trace2.test e7a988fdd982cdec62f1f1f34b0360e6476d01a0
|
||||
F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
|
||||
F test/trans2.test d5337e61de45e66b1fcbf9db833fa8c82e624b22
|
||||
F test/trans3.test 373ac5183cc56be69f48ae44090e7f672939f732
|
||||
F test/transitive1.test 0ee69546d6fa20e577a4a706d7daa01c7eba9239
|
||||
F test/transitive1.test 03f532954f46cdf5608f7766bff0b0c52bf2a7cd
|
||||
F test/trigger1.test dc47573ac79ffe0ee3eecaa517d70d8dacbccd03
|
||||
F test/trigger2.test 834187beafd1db383af0c659cfa49b0576832816
|
||||
F test/trigger3.test aa640bb2bbb03edd5ff69c055117ea088f121945
|
||||
@@ -1090,7 +1093,7 @@ F tool/logest.c 7ad625cac3d54012b27d468b7af6612f78b9ba75
|
||||
F tool/mkautoconfamal.sh f8d8dbf7d62f409ebed5134998bf5b51d7266383
|
||||
F tool/mkkeywordhash.c bb52064aa614e1426445e4b2b9b00eeecd23cc79
|
||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
||||
F tool/mkpragmatab.tcl ceaaeebcd882864caefe4176592ca6fa4648fab1
|
||||
F tool/mkpragmatab.tcl 17d40faae6c4b865633bfc5763821402a1cbefc3
|
||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||
F tool/mksqlite3c-noext.tcl 8bce31074e4cbe631bb7676526a048335f4c9f02
|
||||
F tool/mksqlite3c.tcl d8dc444d403019167260e5578f5c362741f03696
|
||||
@@ -1123,10 +1126,10 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||
P 4b130f88fba216e088f61252bbcdde57ec7ee6a9
|
||||
R 9bf7835789baab295617af1cddd33ae8
|
||||
T *branch * indexList
|
||||
T *sym-indexList *
|
||||
P 3a9e3ed94bf617f00c48009b1a6d348a8f23a3cf
|
||||
R 057f871d4d3691cf245ceb2d9e03344d
|
||||
T *branch * shell-wall-clock
|
||||
T *sym-shell-wall-clock *
|
||||
T -sym-trunk *
|
||||
U mistachkin
|
||||
Z d185d392a7046e387236f5f2d221e822
|
||||
U dan
|
||||
Z 19a81cac8d9e008c0c4c0cd627a27a59
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
0c4dd9fff0c78c3519bfd5b59100183b97fd1863
|
||||
5530cdc4857f7410ce6ddf53ae94c75426e19eee
|
||||
+8
-8
@@ -31,7 +31,7 @@
|
||||
** SQLITE_ENABLE_STAT3 defined. The functionality of sqlite_stat3
|
||||
** is a superset of sqlite_stat2. The sqlite_stat4 is an enhanced
|
||||
** version of sqlite_stat3 and is only available when compiled with
|
||||
** SQLITE_ENABLE_STAT4 and in SQLite versions 3.8.0 and later. It is
|
||||
** SQLITE_ENABLE_STAT4 and in SQLite versions 3.8.1 and later. It is
|
||||
** not possible to enable both STAT3 and STAT4 at the same time. If they
|
||||
** are both enabled, then STAT4 takes precedence.
|
||||
**
|
||||
@@ -107,12 +107,12 @@
|
||||
** The idx column names the index and the tbl column is the table of the
|
||||
** index. If the idx and tbl columns are the same, then the sample is
|
||||
** of the INTEGER PRIMARY KEY. The sample column is a blob which is the
|
||||
** binary encoding of a key from the index, with the trailing rowid
|
||||
** omitted. The nEq column is a list of integers. The first integer
|
||||
** is the approximate number of entries in the index whose left-most
|
||||
** column exactly matches the left-most column of the sample. The second
|
||||
** integer in nEq is the approximate number of entries in the index where
|
||||
** the first two columns match the first two columns of the sample.
|
||||
** binary encoding of a key from the index. The nEq column is a
|
||||
** list of integers. The first integer is the approximate number
|
||||
** of entries in the index whose left-most column exactly matches
|
||||
** the left-most column of the sample. The second integer in nEq
|
||||
** is the approximate number of entries in the index where the
|
||||
** first two columns match the first two columns of the sample.
|
||||
** And so forth. nLt is another list of integers that show the approximate
|
||||
** number of entries that are strictly less than the sample. The first
|
||||
** integer in nLt contains the number of entries in the index where the
|
||||
@@ -444,7 +444,7 @@ static int sampleIsBetter(
|
||||
/*
|
||||
** Copy the contents of object (*pFrom) into (*pTo).
|
||||
*/
|
||||
void sampleCopy(Stat4Accum *p, Stat4Sample *pTo, Stat4Sample *pFrom){
|
||||
static void sampleCopy(Stat4Accum *p, Stat4Sample *pTo, Stat4Sample *pFrom){
|
||||
pTo->iRowid = pFrom->iRowid;
|
||||
pTo->isPSample = pFrom->isPSample;
|
||||
pTo->iCol = pFrom->iCol;
|
||||
|
||||
+12
@@ -2052,6 +2052,18 @@ static int removeFromSharingList(BtShared *pBt){
|
||||
static void allocateTempSpace(BtShared *pBt){
|
||||
if( !pBt->pTmpSpace ){
|
||||
pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
|
||||
|
||||
/* One of the uses of pBt->pTmpSpace is to format cells before
|
||||
** inserting them into a leaf page (function fillInCell()). If
|
||||
** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
|
||||
** by the various routines that manipulate binary cells. Which
|
||||
** can mean that fillInCell() only initializes the first 2 or 3
|
||||
** bytes of pTmpSpace, but that the first 4 bytes are copied from
|
||||
** it into a database page. This is not actually a problem, but it
|
||||
** does cause a valgrind error when the 1 or 2 bytes of unitialized
|
||||
** data is passed to system call write(). So to avoid this error,
|
||||
** zero the first 4 bytes of temp space here. */
|
||||
if( pBt->pTmpSpace ) memset(pBt->pTmpSpace, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1714,7 +1714,7 @@ void sqlite3EndTable(
|
||||
|
||||
/* Reparse everything to update our internal data structures */
|
||||
sqlite3VdbeAddParseSchemaOp(v, iDb,
|
||||
sqlite3MPrintf(db, "tbl_name='%q'", p->zName));
|
||||
sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+13
-6
@@ -656,7 +656,7 @@ void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){
|
||||
** when this statement is run. */
|
||||
FKey *p;
|
||||
for(p=pTab->pFKey; p; p=p->pNextFrom){
|
||||
if( p->isDeferred ) break;
|
||||
if( p->isDeferred || (db->flags & SQLITE_DeferFKs) ) break;
|
||||
}
|
||||
if( !p ) return;
|
||||
iSkip = sqlite3VdbeMakeLabel(v);
|
||||
@@ -670,11 +670,18 @@ void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){
|
||||
/* If the DELETE has generated immediate foreign key constraint
|
||||
** violations, halt the VDBE and return an error at this point, before
|
||||
** any modifications to the schema are made. This is because statement
|
||||
** transactions are not able to rollback schema changes. */
|
||||
sqlite3VdbeAddOp2(v, OP_FkIfZero, 0, sqlite3VdbeCurrentAddr(v)+2);
|
||||
sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY,
|
||||
OE_Abort, "foreign key constraint failed", P4_STATIC
|
||||
);
|
||||
** transactions are not able to rollback schema changes.
|
||||
**
|
||||
** If the SQLITE_DeferFKs flag is set, then this is not required, as
|
||||
** the statement transaction will not be rolled back even if FK
|
||||
** constraints are violated.
|
||||
*/
|
||||
if( (db->flags & SQLITE_DeferFKs)==0 ){
|
||||
sqlite3VdbeAddOp2(v, OP_FkIfZero, 0, sqlite3VdbeCurrentAddr(v)+2);
|
||||
sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY,
|
||||
OE_Abort, "foreign key constraint failed", P4_STATIC
|
||||
);
|
||||
}
|
||||
|
||||
if( iSkip ){
|
||||
sqlite3VdbeResolveLabel(v, iSkip);
|
||||
|
||||
+8
-6
@@ -2196,8 +2196,7 @@ static int winClose(sqlite3_file *id){
|
||||
OSTRACE(("CLOSE file=%p\n", pFile->h));
|
||||
|
||||
#if SQLITE_MAX_MMAP_SIZE>0
|
||||
rc = winUnmapfile(pFile);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
winUnmapfile(pFile);
|
||||
#endif
|
||||
|
||||
do{
|
||||
@@ -3003,7 +3002,7 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
|
||||
pFile->mmapSizeMax = newLimit;
|
||||
if( pFile->mmapSize>0 ){
|
||||
(void)winUnmapfile(pFile);
|
||||
winUnmapfile(pFile);
|
||||
rc = winMapfile(pFile, -1);
|
||||
}
|
||||
}
|
||||
@@ -3220,7 +3219,7 @@ static void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){
|
||||
while( (p = *pp)!=0 ){
|
||||
if( p->nRef==0 ){
|
||||
int i;
|
||||
if( p->mutex ) sqlite3_mutex_free(p->mutex);
|
||||
if( p->mutex ){ sqlite3_mutex_free(p->mutex); }
|
||||
for(i=0; i<p->nRegion; i++){
|
||||
BOOL bRc = osUnmapViewOfFile(p->aRegion[i].pMap);
|
||||
OSTRACE(("SHM-PURGE-UNMAP pid=%lu, region=%d, rc=%s\n",
|
||||
@@ -4073,6 +4072,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
if( winIsDriveLetterAndColon(zDir) ){
|
||||
zConverted = winConvertFromUtf8Filename(zDir);
|
||||
if( !zConverted ){
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
@@ -4085,6 +4085,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
}else{
|
||||
zConverted = sqlite3MallocZero( nBuf+1 );
|
||||
if( !zConverted ){
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
@@ -4092,6 +4093,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir,
|
||||
zConverted, nBuf+1)<0 ){
|
||||
sqlite3_free(zConverted);
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_CONVPATH\n"));
|
||||
return winLogError(SQLITE_IOERR_CONVPATH, (DWORD)errno,
|
||||
"winGetTempname1", zDir);
|
||||
@@ -4105,6 +4107,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
char *zUtf8 = winUnicodeToUtf8(zConverted);
|
||||
if( !zUtf8 ){
|
||||
sqlite3_free(zConverted);
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
@@ -4120,7 +4123,6 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
}
|
||||
sqlite3_free(zConverted);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#elif !SQLITE_OS_WINRT && !defined(__CYGWIN__)
|
||||
@@ -4490,9 +4492,9 @@ static int winOpen(
|
||||
#endif
|
||||
{
|
||||
sqlite3_free(zConverted);
|
||||
sqlite3_free(zTmpname);
|
||||
}
|
||||
|
||||
sqlite3_free(zTmpname);
|
||||
pFile->pMethod = &winIoMethod;
|
||||
pFile->pVfs = pVfs;
|
||||
pFile->h = h;
|
||||
|
||||
+104
-40
@@ -56,18 +56,19 @@
|
||||
#define PragTyp_SECURE_DELETE 25
|
||||
#define PragTyp_SHRINK_MEMORY 26
|
||||
#define PragTyp_SOFT_HEAP_LIMIT 27
|
||||
#define PragTyp_SYNCHRONOUS 28
|
||||
#define PragTyp_TABLE_INFO 29
|
||||
#define PragTyp_TEMP_STORE 30
|
||||
#define PragTyp_TEMP_STORE_DIRECTORY 31
|
||||
#define PragTyp_WAL_AUTOCHECKPOINT 32
|
||||
#define PragTyp_WAL_CHECKPOINT 33
|
||||
#define PragTyp_ACTIVATE_EXTENSIONS 34
|
||||
#define PragTyp_HEXKEY 35
|
||||
#define PragTyp_KEY 36
|
||||
#define PragTyp_REKEY 37
|
||||
#define PragTyp_LOCK_STATUS 38
|
||||
#define PragTyp_PARSER_TRACE 39
|
||||
#define PragTyp_STATS 28
|
||||
#define PragTyp_SYNCHRONOUS 29
|
||||
#define PragTyp_TABLE_INFO 30
|
||||
#define PragTyp_TEMP_STORE 31
|
||||
#define PragTyp_TEMP_STORE_DIRECTORY 32
|
||||
#define PragTyp_WAL_AUTOCHECKPOINT 33
|
||||
#define PragTyp_WAL_CHECKPOINT 34
|
||||
#define PragTyp_ACTIVATE_EXTENSIONS 35
|
||||
#define PragTyp_HEXKEY 36
|
||||
#define PragTyp_KEY 37
|
||||
#define PragTyp_REKEY 38
|
||||
#define PragTyp_LOCK_STATUS 39
|
||||
#define PragTyp_PARSER_TRACE 40
|
||||
#define PragFlag_NeedSchema 0x01
|
||||
static const struct sPragmaNames {
|
||||
const char *const zName; /* Name of pragma */
|
||||
@@ -93,11 +94,13 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ PragFlag_NeedSchema,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
#if !defined(SQLITE_OMIT_AUTOMATIC_INDEX)
|
||||
{ /* zName: */ "automatic_index",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_AutoIndex },
|
||||
#endif
|
||||
#endif
|
||||
{ /* zName: */ "busy_timeout",
|
||||
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
|
||||
@@ -109,18 +112,22 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ PragFlag_NeedSchema,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "cache_spill",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_CacheSpill },
|
||||
#endif
|
||||
{ /* zName: */ "case_sensitive_like",
|
||||
/* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "checkpoint_fullfsync",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_CkptFullFSync },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
||||
{ /* zName: */ "collation_list",
|
||||
/* ePragTyp: */ PragTyp_COLLATION_LIST,
|
||||
@@ -133,10 +140,12 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "count_changes",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_CountRows },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN
|
||||
{ /* zName: */ "data_store_directory",
|
||||
/* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY,
|
||||
@@ -155,16 +164,20 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ PragFlag_NeedSchema,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
{ /* zName: */ "defer_foreign_keys",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_DeferFKs },
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "empty_result_callbacks",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_NullCallback },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_UTF16)
|
||||
{ /* zName: */ "encoding",
|
||||
/* ePragTyp: */ PragTyp_ENCODING,
|
||||
@@ -183,18 +196,21 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ PragFlag_NeedSchema,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
{ /* zName: */ "foreign_keys",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_ForeignKeys },
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
||||
{ /* zName: */ "freelist_count",
|
||||
/* ePragTyp: */ PragTyp_HEADER_VALUE,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "full_column_names",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
@@ -203,6 +219,7 @@ static const struct sPragmaNames {
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_FullFSync },
|
||||
#endif
|
||||
#if defined(SQLITE_HAS_CODEC)
|
||||
{ /* zName: */ "hexkey",
|
||||
/* ePragTyp: */ PragTyp_HEXKEY,
|
||||
@@ -213,12 +230,14 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
#if !defined(SQLITE_OMIT_CHECK)
|
||||
{ /* zName: */ "ignore_check_constraints",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_IgnoreChecks },
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_AUTOVACUUM)
|
||||
{ /* zName: */ "incremental_vacuum",
|
||||
/* ePragTyp: */ PragTyp_INCREMENTAL_VACUUM,
|
||||
@@ -257,10 +276,12 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "legacy_file_format",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_LegacyFileFmt },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE
|
||||
{ /* zName: */ "lock_proxy_file",
|
||||
/* ePragTyp: */ PragTyp_LOCK_PROXY_FILE,
|
||||
@@ -301,16 +322,19 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "query_only",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_QueryOnly },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
|
||||
{ /* zName: */ "quick_check",
|
||||
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
|
||||
/* ePragFlag: */ PragFlag_NeedSchema,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "read_uncommitted",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
@@ -319,16 +343,19 @@ static const struct sPragmaNames {
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_RecTriggers },
|
||||
#endif
|
||||
#if defined(SQLITE_HAS_CODEC)
|
||||
{ /* zName: */ "rekey",
|
||||
/* ePragTyp: */ PragTyp_REKEY,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "reverse_unordered_selects",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_ReverseOrder },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
||||
{ /* zName: */ "schema_version",
|
||||
/* ePragTyp: */ PragTyp_HEADER_VALUE,
|
||||
@@ -341,10 +368,12 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "short_column_names",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_ShortColNames },
|
||||
#endif
|
||||
{ /* zName: */ "shrink_memory",
|
||||
/* ePragTyp: */ PragTyp_SHRINK_MEMORY,
|
||||
/* ePragFlag: */ 0,
|
||||
@@ -353,12 +382,20 @@ static const struct sPragmaNames {
|
||||
/* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
#if defined(SQLITE_DEBUG)
|
||||
{ /* zName: */ "sql_trace",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_SqlTrace },
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
||||
{ /* zName: */ "stats",
|
||||
/* ePragTyp: */ PragTyp_STATS,
|
||||
/* ePragFlag: */ PragFlag_NeedSchema,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
||||
{ /* zName: */ "synchronous",
|
||||
/* ePragTyp: */ PragTyp_SYNCHRONOUS,
|
||||
@@ -387,6 +424,7 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
#if defined(SQLITE_DEBUG)
|
||||
{ /* zName: */ "vdbe_addoptrace",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
@@ -405,6 +443,7 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_VdbeTrace },
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_WAL)
|
||||
{ /* zName: */ "wal_autocheckpoint",
|
||||
/* ePragTyp: */ PragTyp_WAL_AUTOCHECKPOINT,
|
||||
@@ -415,12 +454,14 @@ static const struct sPragmaNames {
|
||||
/* ePragFlag: */ PragFlag_NeedSchema,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "writable_schema",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
|
||||
#endif
|
||||
};
|
||||
/* Number of pragmas: 55 on by default, 67 total. */
|
||||
/* Number of pragmas: 56 on by default, 68 total. */
|
||||
/* End of the automatically generated pragma table.
|
||||
***************************************************************************/
|
||||
|
||||
@@ -1425,6 +1466,36 @@ void sqlite3Pragma(
|
||||
}
|
||||
break;
|
||||
|
||||
case PragTyp_STATS: {
|
||||
Index *pIdx;
|
||||
HashElem *i;
|
||||
v = sqlite3GetVdbe(pParse);
|
||||
sqlite3VdbeSetNumCols(v, 4);
|
||||
pParse->nMem = 4;
|
||||
sqlite3CodeVerifySchema(pParse, iDb);
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "table", SQLITE_STATIC);
|
||||
sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "index", SQLITE_STATIC);
|
||||
sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "width", SQLITE_STATIC);
|
||||
sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "height", SQLITE_STATIC);
|
||||
for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
|
||||
Table *pTab = sqliteHashData(i);
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, pTab->zName, 0);
|
||||
sqlite3VdbeAddOp2(v, OP_Null, 0, 2);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer,
|
||||
(int)sqlite3LogEstToInt(pTab->szTabRow), 3);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, (int)pTab->nRowEst, 4);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
|
||||
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pIdx->zName, 0);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer,
|
||||
(int)sqlite3LogEstToInt(pIdx->szIdxRow), 3);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, (int)pIdx->aiRowEst[0], 4);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PragTyp_INDEX_INFO: if( zRight ){
|
||||
Index *pIdx;
|
||||
Table *pTab;
|
||||
@@ -1457,28 +1528,17 @@ void sqlite3Pragma(
|
||||
pTab = sqlite3FindTable(db, zRight, zDb);
|
||||
if( pTab ){
|
||||
v = sqlite3GetVdbe(pParse);
|
||||
sqlite3VdbeSetNumCols(v, 4);
|
||||
pParse->nMem = 4;
|
||||
sqlite3VdbeSetNumCols(v, 3);
|
||||
pParse->nMem = 3;
|
||||
sqlite3CodeVerifySchema(pParse, iDb);
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", SQLITE_STATIC);
|
||||
sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE_STATIC);
|
||||
sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "unique", SQLITE_STATIC);
|
||||
sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "avgrowsize", SQLITE_STATIC);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, 0, 1);
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0,
|
||||
sqlite3MPrintf(db, "sqlite_pseudoindex_%s", pTab->zName),
|
||||
P4_DYNAMIC);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, 0, 3);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer,
|
||||
(int)sqlite3LogEstToInt(pTab->szTabRow), 4);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
|
||||
for(pIdx=pTab->pIndex, i=1; pIdx; pIdx=pIdx->pNext, i++){
|
||||
for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, i, 1);
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pIdx->zName, 0);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, pIdx->onError!=OE_None, 3);
|
||||
sqlite3VdbeAddOp2(v, OP_Integer,
|
||||
(int)sqlite3LogEstToInt(pIdx->szIdxRow), 4);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1612,8 +1672,8 @@ void sqlite3Pragma(
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, regResult, 0, pTab->zName,
|
||||
P4_TRANSIENT);
|
||||
for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
|
||||
pParent = sqlite3LocateTable(pParse, 0, pFK->zTo, zDb);
|
||||
if( pParent==0 ) break;
|
||||
pParent = sqlite3FindTable(db, pFK->zTo, zDb);
|
||||
if( pParent==0 ) continue;
|
||||
pIdx = 0;
|
||||
sqlite3TableLock(pParse, iDb, pParent->tnum, 0, pParent->zName);
|
||||
x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0);
|
||||
@@ -1630,18 +1690,20 @@ void sqlite3Pragma(
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert( pParse->nErr>0 || pFK==0 );
|
||||
if( pFK ) break;
|
||||
if( pParse->nTab<i ) pParse->nTab = i;
|
||||
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, 0);
|
||||
for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
|
||||
pParent = sqlite3LocateTable(pParse, 0, pFK->zTo, zDb);
|
||||
assert( pParent!=0 );
|
||||
pParent = sqlite3FindTable(db, pFK->zTo, zDb);
|
||||
pIdx = 0;
|
||||
aiCols = 0;
|
||||
x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols);
|
||||
assert( x==0 );
|
||||
if( pParent ){
|
||||
x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols);
|
||||
assert( x==0 );
|
||||
}
|
||||
addrOk = sqlite3VdbeMakeLabel(v);
|
||||
if( pIdx==0 ){
|
||||
if( pParent && pIdx==0 ){
|
||||
int iKey = pFK->aCol[0].iFrom;
|
||||
assert( iKey>=0 && iKey<pTab->nCol );
|
||||
if( iKey!=pTab->iPKey ){
|
||||
@@ -1659,13 +1721,15 @@ void sqlite3Pragma(
|
||||
}else{
|
||||
for(j=0; j<pFK->nCol; j++){
|
||||
sqlite3ExprCodeGetColumnOfTable(v, pTab, 0,
|
||||
aiCols ? aiCols[j] : pFK->aCol[0].iFrom, regRow+j);
|
||||
aiCols ? aiCols[j] : pFK->aCol[j].iFrom, regRow+j);
|
||||
sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk);
|
||||
}
|
||||
sqlite3VdbeAddOp3(v, OP_MakeRecord, regRow, pFK->nCol, regKey);
|
||||
sqlite3VdbeChangeP4(v, -1,
|
||||
sqlite3IndexAffinityStr(v,pIdx), P4_TRANSIENT);
|
||||
sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0);
|
||||
if( pParent ){
|
||||
sqlite3VdbeAddOp3(v, OP_MakeRecord, regRow, pFK->nCol, regKey);
|
||||
sqlite3VdbeChangeP4(v, -1,
|
||||
sqlite3IndexAffinityStr(v,pIdx), P4_TRANSIENT);
|
||||
sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0);
|
||||
}
|
||||
}
|
||||
sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1);
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, regResult+2, 0,
|
||||
|
||||
+1
-1
@@ -709,7 +709,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
}else{
|
||||
/* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is equivalent to
|
||||
** likelihood(X, 0.0625).
|
||||
** EVIDENCE-OF: R-35738-39582 The unlikely(X) fucntion is short-hand for
|
||||
** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is short-hand for
|
||||
** likelihood(X,0.0625). */
|
||||
pExpr->iTable = 62; /* TUNING: Default 2nd arg to unlikely() is 0.0625 */
|
||||
}
|
||||
|
||||
+71
-22
@@ -100,14 +100,37 @@ static int enableTimer = 0;
|
||||
#include <sys/resource.h>
|
||||
|
||||
/* Saved resource information for the beginning of an operation */
|
||||
static struct rusage sBegin;
|
||||
static struct TimerData {
|
||||
struct rusage sRusage;
|
||||
sqlite3_int64 iTime;
|
||||
} sBegin;
|
||||
|
||||
/*
|
||||
** Return the current-time according to the xCurrentTimeInt64() method
|
||||
** of the default VFS (in ms). Use the result of xCurrentTime() to
|
||||
** calculate an equivalent value if the VFS is too old for
|
||||
** xCurrentTimeInt64().
|
||||
*/
|
||||
static sqlite3_int64 vfsCurrentTime64(void){
|
||||
sqlite3_int64 iRet;
|
||||
sqlite3_vfs *pVfs = sqlite3_vfs_find(0);
|
||||
if( pVfs->iVersion>=2 ){
|
||||
pVfs->xCurrentTimeInt64(pVfs, &iRet);
|
||||
}else{
|
||||
double t;
|
||||
pVfs->xCurrentTime(pVfs, &t);
|
||||
iRet = (sqlite3_int64)(t * 86400000.0);
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** Begin timing an operation
|
||||
*/
|
||||
static void beginTimer(void){
|
||||
if( enableTimer ){
|
||||
getrusage(RUSAGE_SELF, &sBegin);
|
||||
sBegin.iTime = vfsCurrentTime64();
|
||||
getrusage(RUSAGE_SELF, &sBegin.sRusage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,9 +147,11 @@ static void endTimer(void){
|
||||
if( enableTimer ){
|
||||
struct rusage sEnd;
|
||||
getrusage(RUSAGE_SELF, &sEnd);
|
||||
printf("CPU Time: user %f sys %f\n",
|
||||
timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
|
||||
timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
|
||||
printf("CPU Time: user %f sys %f wall %f\n",
|
||||
timeDiff(&sBegin.sRusage.ru_utime, &sEnd.ru_utime),
|
||||
timeDiff(&sBegin.sRusage.ru_stime, &sEnd.ru_stime),
|
||||
(double)(vfsCurrentTime64() - sBegin.iTime) / 1000.0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,6 +461,7 @@ struct callback_data {
|
||||
** .explain ON */
|
||||
char outfile[FILENAME_MAX]; /* Filename for *out */
|
||||
const char *zDbFilename; /* name of the database file */
|
||||
char *zFreeOnClose; /* Filename to free when closing */
|
||||
const char *zVfs; /* Name of VFS to use */
|
||||
sqlite3_stmt *pStmt; /* Current statement if any. */
|
||||
FILE *pLog; /* Write log output here */
|
||||
@@ -1437,6 +1463,7 @@ static char zHelp[] =
|
||||
" tabs Tab-separated values\n"
|
||||
" tcl TCL list elements\n"
|
||||
".nullvalue STRING Use STRING in place of NULL values\n"
|
||||
".open ?FILENAME? Close existing database and reopen FILENAME\n"
|
||||
".output FILENAME Send output to FILENAME\n"
|
||||
".output stdout Send output to the screen\n"
|
||||
".print STRING... Print literal STRING\n"
|
||||
@@ -1470,7 +1497,7 @@ static int process_input(struct callback_data *p, FILE *in);
|
||||
** Make sure the database is open. If it is not, then open it. If
|
||||
** the database fails to open, print an error message and exit.
|
||||
*/
|
||||
static void open_db(struct callback_data *p){
|
||||
static void open_db(struct callback_data *p, int keepAlive){
|
||||
if( p->db==0 ){
|
||||
sqlite3_initialize();
|
||||
sqlite3_open(p->zDbFilename, &p->db);
|
||||
@@ -1482,6 +1509,7 @@ static void open_db(struct callback_data *p){
|
||||
if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
|
||||
fprintf(stderr,"Error: unable to open database \"%s\": %s\n",
|
||||
p->zDbFilename, sqlite3_errmsg(db));
|
||||
if( keepAlive ) return;
|
||||
exit(1);
|
||||
}
|
||||
#ifndef SQLITE_OMIT_LOAD_EXTENSION
|
||||
@@ -1834,7 +1862,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
sqlite3_close(pDest);
|
||||
return 1;
|
||||
}
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb);
|
||||
if( pBackup==0 ){
|
||||
fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
|
||||
@@ -1866,7 +1894,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 && nArg==1 ){
|
||||
struct callback_data data;
|
||||
char *zErrMsg = 0;
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
memcpy(&data, p, sizeof(data));
|
||||
data.showHeader = 1;
|
||||
data.mode = MODE_Column;
|
||||
@@ -1883,7 +1911,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
}else
|
||||
|
||||
if( c=='d' && strncmp(azArg[0], "dump", n)==0 && nArg<3 ){
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
/* When playing back a "dump", the content might appear in an order
|
||||
** which causes immediate foreign key constraints to be violated.
|
||||
** So disable foreign-key constraint enforcement to prevent problems. */
|
||||
@@ -2002,7 +2030,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
|
||||
seenInterrupt = 0;
|
||||
memset(&sCsv, 0, sizeof(sCsv));
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
nSep = strlen30(p->separator);
|
||||
if( nSep==0 ){
|
||||
fprintf(stderr, "Error: non-null separator required for import\n");
|
||||
@@ -2140,7 +2168,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg<3 ){
|
||||
struct callback_data data;
|
||||
char *zErrMsg = 0;
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
memcpy(&data, p, sizeof(data));
|
||||
data.showHeader = 0;
|
||||
data.mode = MODE_List;
|
||||
@@ -2206,7 +2234,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
char *zErrMsg = 0;
|
||||
zFile = azArg[1];
|
||||
zProc = nArg>=3 ? azArg[2] : 0;
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg);
|
||||
if( rc!=SQLITE_OK ){
|
||||
fprintf(stderr, "Error: %s\n", zErrMsg);
|
||||
@@ -2272,6 +2300,26 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
"%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]);
|
||||
}else
|
||||
|
||||
if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
|
||||
sqlite3 *savedDb = p->db;
|
||||
const char *zSavedFilename = p->zDbFilename;
|
||||
char *zNewFilename = 0;
|
||||
p->db = 0;
|
||||
if( nArg>=2 ){
|
||||
p->zDbFilename = zNewFilename = sqlite3_mprintf("%s", azArg[1]);
|
||||
}
|
||||
open_db(p, 1);
|
||||
if( p->db!=0 ){
|
||||
sqlite3_close(savedDb);
|
||||
sqlite3_free(p->zFreeOnClose);
|
||||
p->zFreeOnClose = zNewFilename;
|
||||
}else{
|
||||
sqlite3_free(zNewFilename);
|
||||
p->db = savedDb;
|
||||
p->zDbFilename = zSavedFilename;
|
||||
}
|
||||
}else
|
||||
|
||||
if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){
|
||||
if( p->outfile[0]=='|' ){
|
||||
pclose(p->out);
|
||||
@@ -2355,7 +2403,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
sqlite3_close(pSrc);
|
||||
return 1;
|
||||
}
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
pBackup = sqlite3_backup_init(p->db, zDb, pSrc, "main");
|
||||
if( pBackup==0 ){
|
||||
fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
|
||||
@@ -2385,7 +2433,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
if( c=='s' && strncmp(azArg[0], "schema", n)==0 && nArg<3 ){
|
||||
struct callback_data data;
|
||||
char *zErrMsg = 0;
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
memcpy(&data, p, sizeof(data));
|
||||
data.showHeader = 0;
|
||||
data.mode = MODE_Semi;
|
||||
@@ -2516,7 +2564,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
int nRow, nAlloc;
|
||||
char *zSql = 0;
|
||||
int ii;
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
|
||||
if( rc ) return rc;
|
||||
zSql = sqlite3_mprintf(
|
||||
@@ -2616,7 +2664,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
int testctrl = -1;
|
||||
int rc = 0;
|
||||
int i, n;
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
|
||||
/* convert testctrl text option to value. allow any unique prefix
|
||||
** of the option name, or a numerical value. */
|
||||
@@ -2715,7 +2763,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
}else
|
||||
|
||||
if( c=='t' && n>4 && strncmp(azArg[0], "timeout", n)==0 && nArg==2 ){
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
sqlite3_busy_timeout(p->db, (int)integerValue(azArg[1]));
|
||||
}else
|
||||
|
||||
@@ -2726,7 +2774,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
}else
|
||||
|
||||
if( c=='t' && strncmp(azArg[0], "trace", n)==0 && nArg>1 ){
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
output_file_close(p->traceOut);
|
||||
p->traceOut = output_file_open(azArg[1]);
|
||||
#if !defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_OMIT_FLOATING_POINT)
|
||||
@@ -2918,7 +2966,7 @@ static int process_input(struct callback_data *p, FILE *in){
|
||||
if( nSql && line_contains_semicolon(&zSql[nSqlPrior], nSql-nSqlPrior)
|
||||
&& sqlite3_complete(zSql) ){
|
||||
p->cnt = 0;
|
||||
open_db(p);
|
||||
open_db(p, 0);
|
||||
BEGIN_TIMER;
|
||||
rc = shell_exec(p->db, zSql, shell_callback, p, &zErrMsg);
|
||||
END_TIMER;
|
||||
@@ -3245,7 +3293,7 @@ int main(int argc, char **argv){
|
||||
** to the sqlite command-line tool.
|
||||
*/
|
||||
if( access(data.zDbFilename, 0)==0 ){
|
||||
open_db(&data);
|
||||
open_db(&data, 0);
|
||||
}
|
||||
|
||||
/* Process the initialization file if there is one. If no -init option
|
||||
@@ -3325,7 +3373,7 @@ int main(int argc, char **argv){
|
||||
rc = do_meta_command(z, &data);
|
||||
if( rc && bail_on_error ) return rc==2 ? 0 : rc;
|
||||
}else{
|
||||
open_db(&data);
|
||||
open_db(&data, 0);
|
||||
rc = shell_exec(data.db, z, shell_callback, &data, &zErrMsg);
|
||||
if( zErrMsg!=0 ){
|
||||
fprintf(stderr,"Error: %s\n", zErrMsg);
|
||||
@@ -3349,7 +3397,7 @@ int main(int argc, char **argv){
|
||||
rc = do_meta_command(zFirstCmd, &data);
|
||||
if( rc==2 ) rc = 0;
|
||||
}else{
|
||||
open_db(&data);
|
||||
open_db(&data, 0);
|
||||
rc = shell_exec(data.db, zFirstCmd, shell_callback, &data, &zErrMsg);
|
||||
if( zErrMsg!=0 ){
|
||||
fprintf(stderr,"Error: %s\n", zErrMsg);
|
||||
@@ -3396,5 +3444,6 @@ int main(int argc, char **argv){
|
||||
if( data.db ){
|
||||
sqlite3_close(data.db);
|
||||
}
|
||||
sqlite3_free(data.zFreeOnClose);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -907,6 +907,14 @@ struct sqlite3_io_methods {
|
||||
** can be queried by passing in a pointer to a negative number. This
|
||||
** file-control is used internally to implement [PRAGMA mmap_size].
|
||||
**
|
||||
** <li>[[SQLITE_FCNTL_TRACE]]
|
||||
** The [SQLITE_FCNTL_TRACE] file control provides advisory information
|
||||
** to the VFS about what the higher layers of the SQLite stack are doing.
|
||||
** This file control is used by some VFS activity tracing [shims].
|
||||
** The argument is a zero-terminated string. Higher layers in the
|
||||
** SQLite stack may generate instances of this file control if
|
||||
** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
|
||||
**
|
||||
** </ul>
|
||||
*/
|
||||
#define SQLITE_FCNTL_LOCKSTATE 1
|
||||
@@ -926,6 +934,7 @@ struct sqlite3_io_methods {
|
||||
#define SQLITE_FCNTL_BUSYHANDLER 15
|
||||
#define SQLITE_FCNTL_TEMPFILENAME 16
|
||||
#define SQLITE_FCNTL_MMAP_SIZE 18
|
||||
#define SQLITE_FCNTL_TRACE 19
|
||||
|
||||
/*
|
||||
** CAPI3REF: Mutex Handle
|
||||
|
||||
+3
-3
@@ -3248,10 +3248,10 @@ const char *sqlite3JournalModename(int);
|
||||
FKey *sqlite3FkReferences(Table *);
|
||||
#else
|
||||
#define sqlite3FkActions(a,b,c,d,e,f)
|
||||
#define sqlite3FkCheck(a,b,c,d)
|
||||
#define sqlite3FkCheck(a,b,c,d,e,f)
|
||||
#define sqlite3FkDropTable(a,b,c)
|
||||
#define sqlite3FkOldmask(a,b) 0
|
||||
#define sqlite3FkRequired(a,b,c,d,e,f) 0
|
||||
#define sqlite3FkOldmask(a,b) 0
|
||||
#define sqlite3FkRequired(a,b,c,d) 0
|
||||
#endif
|
||||
#ifndef SQLITE_OMIT_FOREIGN_KEY
|
||||
void sqlite3FkDelete(sqlite3 *, Table*);
|
||||
|
||||
@@ -6160,6 +6160,7 @@ static int tclLoadStaticExtensionCmd(
|
||||
extern int sqlite3_percentile_init(sqlite3*,char**,const sqlite3_api_routines*);
|
||||
extern int sqlite3_regexp_init(sqlite3*,char**,const sqlite3_api_routines*);
|
||||
extern int sqlite3_spellfix_init(sqlite3*,char**,const sqlite3_api_routines*);
|
||||
extern int sqlite3_totype_init(sqlite3*,char**,const sqlite3_api_routines*);
|
||||
extern int sqlite3_wholenumber_init(sqlite3*,char**,const sqlite3_api_routines*);
|
||||
static const struct {
|
||||
const char *zExtName;
|
||||
@@ -6173,6 +6174,7 @@ static int tclLoadStaticExtensionCmd(
|
||||
{ "percentile", sqlite3_percentile_init },
|
||||
{ "regexp", sqlite3_regexp_init },
|
||||
{ "spellfix", sqlite3_spellfix_init },
|
||||
{ "totype", sqlite3_totype_init },
|
||||
{ "wholenumber", sqlite3_wholenumber_init },
|
||||
};
|
||||
sqlite3 *db;
|
||||
|
||||
+2
-2
@@ -133,9 +133,9 @@ struct CrashFile {
|
||||
** OsFileSize() calls. Although both could be done by traversing the
|
||||
** write-list, in practice this is impractically slow.
|
||||
*/
|
||||
int iSize; /* Size of file in bytes */
|
||||
int nData; /* Size of buffer allocated at zData */
|
||||
u8 *zData; /* Buffer containing file contents */
|
||||
int nData; /* Size of buffer allocated at zData */
|
||||
i64 iSize; /* Size of file in bytes */
|
||||
};
|
||||
|
||||
struct CrashGlobal {
|
||||
|
||||
+17
-1
@@ -40,6 +40,7 @@ int sqlite3_client_finalize(sqlite3_stmt*);
|
||||
int sqlite3_client_close(sqlite3*);
|
||||
int sqlite3_server_start(void);
|
||||
int sqlite3_server_stop(void);
|
||||
void sqlite3_server_start2(int *pnDecr);
|
||||
|
||||
/*
|
||||
** Each thread is controlled by an instance of the following
|
||||
@@ -68,6 +69,13 @@ struct Thread {
|
||||
int argc; /* number of columns in result */
|
||||
const char *argv[100]; /* result columns */
|
||||
const char *colv[100]; /* result column names */
|
||||
|
||||
/* Initialized to 1 by the supervisor thread when the client is
|
||||
** created, and then deemed read-only to the supervisor thread.
|
||||
** Is set to 0 by the server thread belonging to this client
|
||||
** just before it exits.
|
||||
*/
|
||||
int nServer; /* Number of server threads running */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -175,7 +183,10 @@ static int tcl_client_create(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
pthread_detach(x);
|
||||
sqlite3_server_start();
|
||||
if( threadset[i].nServer==0 ){
|
||||
threadset[i].nServer = 1;
|
||||
sqlite3_server_start2(&threadset[i].nServer);
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -268,6 +279,11 @@ static int tcl_client_halt(
|
||||
for(i=0; i<N_THREAD && threadset[i].busy==0; i++){}
|
||||
if( i>=N_THREAD ){
|
||||
sqlite3_server_stop();
|
||||
while( 1 ){
|
||||
for(i=0; i<N_THREAD && threadset[i].nServer==0; i++);
|
||||
if( i==N_THREAD ) break;
|
||||
sched_yield();
|
||||
}
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -472,6 +472,32 @@ void sqlite3_server_start(void){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** A wrapper around sqlite3_server() that decrements the int variable
|
||||
** pointed to by the first argument after the sqlite3_server() call
|
||||
** returns.
|
||||
*/
|
||||
static void *serverWrapper(void *pnDecr){
|
||||
void *p = sqlite3_server(0);
|
||||
(*(int*)pnDecr)--;
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
** This function is the similar to sqlite3_server_start(), except that
|
||||
** the integer pointed to by the first argument is decremented when
|
||||
** the server thread exits.
|
||||
*/
|
||||
void sqlite3_server_start2(int *pnDecr){
|
||||
pthread_t x;
|
||||
int rc;
|
||||
g.serverHalt = 0;
|
||||
rc = pthread_create(&x, 0, serverWrapper, (void*)pnDecr);
|
||||
if( rc==0 ){
|
||||
pthread_detach(x);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** If a server thread is running, then stop it. If no server is
|
||||
** running, this routine is effectively a no-op.
|
||||
|
||||
+10
@@ -6138,6 +6138,16 @@ case OP_Trace: {
|
||||
db->xTrace(db->pTraceArg, z);
|
||||
sqlite3DbFree(db, z);
|
||||
}
|
||||
#ifdef SQLITE_USE_FCNTL_TRACE
|
||||
zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql);
|
||||
if( zTrace ){
|
||||
int i;
|
||||
for(i=0; i<db->nDb; i++){
|
||||
if( ((1<<i) & p->btreeMask)==0 ) continue;
|
||||
sqlite3_file_control(db, db->aDb[i].zName, SQLITE_FCNTL_TRACE, zTrace);
|
||||
}
|
||||
}
|
||||
#endif /* SQLITE_USE_FCNTL_TRACE */
|
||||
#ifdef SQLITE_DEBUG
|
||||
if( (db->flags & SQLITE_SqlTrace)!=0
|
||||
&& (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
|
||||
|
||||
+1
-1
@@ -1075,7 +1075,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){
|
||||
** NULL, it is assumed that the caller will free any allocated object
|
||||
** in all cases.
|
||||
*/
|
||||
int valueFromExpr(
|
||||
static int valueFromExpr(
|
||||
sqlite3 *db, /* The database connection */
|
||||
Expr *pExpr, /* The expression to evaluate */
|
||||
u8 enc, /* Encoding to use */
|
||||
|
||||
+82
-26
@@ -878,7 +878,10 @@ static WhereTerm *whereScanNext(WhereScan *pScan){
|
||||
iColumn = pScan->aEquiv[pScan->iEquiv-1];
|
||||
while( (pWC = pScan->pWC)!=0 ){
|
||||
for(pTerm=pWC->a+k; k<pWC->nTerm; k++, pTerm++){
|
||||
if( pTerm->leftCursor==iCur && pTerm->u.leftColumn==iColumn ){
|
||||
if( pTerm->leftCursor==iCur
|
||||
&& pTerm->u.leftColumn==iColumn
|
||||
&& (pScan->iEquiv<=2 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
|
||||
){
|
||||
if( (pTerm->eOperator & WO_EQUIV)!=0
|
||||
&& pScan->nEquiv<ArraySize(pScan->aEquiv)
|
||||
){
|
||||
@@ -2550,7 +2553,7 @@ static int whereRangeScanEst(
|
||||
nOut = nNew;
|
||||
}
|
||||
pLoop->nOut = (LogEst)nOut;
|
||||
WHERETRACE(0x100, ("range scan regions: %u..%u est=%d\n",
|
||||
WHERETRACE(0x10, ("range scan regions: %u..%u est=%d\n",
|
||||
(u32)iLower, (u32)iUpper, nOut));
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@@ -2636,7 +2639,7 @@ static int whereEqualScanEst(
|
||||
pBuilder->nRecValid = nEq;
|
||||
|
||||
whereKeyStats(pParse, p, pRec, 0, a);
|
||||
WHERETRACE(0x100,("equality scan regions: %d\n", (int)a[1]));
|
||||
WHERETRACE(0x10,("equality scan regions: %d\n", (int)a[1]));
|
||||
*pnRow = a[1];
|
||||
|
||||
return rc;
|
||||
@@ -2684,7 +2687,7 @@ static int whereInScanEst(
|
||||
if( rc==SQLITE_OK ){
|
||||
if( nRowEst > p->aiRowEst[0] ) nRowEst = p->aiRowEst[0];
|
||||
*pnRow = nRowEst;
|
||||
WHERETRACE(0x100,("IN row estimate: est=%g\n", nRowEst));
|
||||
WHERETRACE(0x10,("IN row estimate: est=%g\n", nRowEst));
|
||||
}
|
||||
assert( pBuilder->nRecValid==nRecValid );
|
||||
return rc;
|
||||
@@ -3889,22 +3892,38 @@ static Bitmask codeOneLoopStart(
|
||||
return pLevel->notReady;
|
||||
}
|
||||
|
||||
#if defined(WHERETRACE_ENABLED) && defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
||||
/*
|
||||
** Generate "Explanation" text for a WhereTerm.
|
||||
*/
|
||||
static void whereExplainTerm(Vdbe *v, WhereTerm *pTerm){
|
||||
char zType[4];
|
||||
memcpy(zType, "...", 4);
|
||||
if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V';
|
||||
if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E';
|
||||
if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L';
|
||||
sqlite3ExplainPrintf(v, "%s ", zType);
|
||||
sqlite3ExplainExpr(v, pTerm->pExpr);
|
||||
}
|
||||
#endif /* WHERETRACE_ENABLED && SQLITE_ENABLE_TREE_EXPLAIN */
|
||||
|
||||
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
/*
|
||||
** Print a WhereLoop object for debugging purposes
|
||||
*/
|
||||
static void whereLoopPrint(WhereLoop *p, SrcList *pTabList){
|
||||
int nb = 1+(pTabList->nSrc+7)/8;
|
||||
struct SrcList_item *pItem = pTabList->a + p->iTab;
|
||||
static void whereLoopPrint(WhereLoop *p, WhereClause *pWC){
|
||||
WhereInfo *pWInfo = pWC->pWInfo;
|
||||
int nb = 1+(pWInfo->pTabList->nSrc+7)/8;
|
||||
struct SrcList_item *pItem = pWInfo->pTabList->a + p->iTab;
|
||||
Table *pTab = pItem->pTab;
|
||||
sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId,
|
||||
p->iTab, nb, p->maskSelf, nb, p->prereq);
|
||||
sqlite3DebugPrintf(" %12s",
|
||||
pItem->zAlias ? pItem->zAlias : pTab->zName);
|
||||
if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){
|
||||
if( p->u.btree.pIndex ){
|
||||
const char *zName = p->u.btree.pIndex->zName;
|
||||
if( zName==0 ) zName = "ipk";
|
||||
const char *zName;
|
||||
if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){
|
||||
if( strncmp(zName, "sqlite_autoindex_", 17)==0 ){
|
||||
int i = sqlite3Strlen30(zName) - 1;
|
||||
while( zName[i]!='_' ) i--;
|
||||
@@ -3927,6 +3946,26 @@ static void whereLoopPrint(WhereLoop *p, SrcList *pTabList){
|
||||
}
|
||||
sqlite3DebugPrintf(" f %04x N %d", p->wsFlags, p->nLTerm);
|
||||
sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
|
||||
#ifdef SQLITE_ENABLE_TREE_EXPLAIN
|
||||
/* If the 0x100 bit of wheretracing is set, then show all of the constraint
|
||||
** expressions in the WhereLoop.aLTerm[] array.
|
||||
*/
|
||||
if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){ /* WHERETRACE 0x100 */
|
||||
int i;
|
||||
Vdbe *v = pWInfo->pParse->pVdbe;
|
||||
sqlite3ExplainBegin(v);
|
||||
for(i=0; i<p->nLTerm; i++){
|
||||
WhereTerm *pTerm = p->aLTerm[i];
|
||||
sqlite3ExplainPrintf(v, " (%d) #%-2d ", i+1, (int)(pTerm-pWC->a));
|
||||
sqlite3ExplainPush(v);
|
||||
whereExplainTerm(v, pTerm);
|
||||
sqlite3ExplainPop(v);
|
||||
sqlite3ExplainNL(v);
|
||||
}
|
||||
sqlite3ExplainFinish(v);
|
||||
sqlite3DebugPrintf("%s", sqlite3VdbeExplanation(v));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4066,10 +4105,10 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
|
||||
#endif
|
||||
whereOrInsert(pBuilder->pOrSet, pTemplate->prereq, pTemplate->rRun,
|
||||
pTemplate->nOut);
|
||||
#if WHERETRACE_ENABLED
|
||||
#if WHERETRACE_ENABLED /* 0x8 */
|
||||
if( sqlite3WhereTrace & 0x8 ){
|
||||
sqlite3DebugPrintf(x?" or-%d: ":" or-X: ", n);
|
||||
whereLoopPrint(pTemplate, pWInfo->pTabList);
|
||||
whereLoopPrint(pTemplate, pBuilder->pWC);
|
||||
}
|
||||
#endif
|
||||
return SQLITE_OK;
|
||||
@@ -4139,14 +4178,14 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
|
||||
** with pTemplate[] if p[] exists, or if p==NULL then allocate a new
|
||||
** WhereLoop and insert it.
|
||||
*/
|
||||
#if WHERETRACE_ENABLED
|
||||
#if WHERETRACE_ENABLED /* 0x8 */
|
||||
if( sqlite3WhereTrace & 0x8 ){
|
||||
if( p!=0 ){
|
||||
sqlite3DebugPrintf("ins-del: ");
|
||||
whereLoopPrint(p, pWInfo->pTabList);
|
||||
whereLoopPrint(p, pBuilder->pWC);
|
||||
}
|
||||
sqlite3DebugPrintf("ins-new: ");
|
||||
whereLoopPrint(pTemplate, pWInfo->pTabList);
|
||||
whereLoopPrint(pTemplate, pBuilder->pWC);
|
||||
}
|
||||
#endif
|
||||
if( p==0 ){
|
||||
@@ -4167,10 +4206,10 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
|
||||
|
||||
/* Jump here if the insert is a no-op */
|
||||
whereLoopInsert_noop:
|
||||
#if WHERETRACE_ENABLED
|
||||
#if WHERETRACE_ENABLED /* 0x8 */
|
||||
if( sqlite3WhereTrace & 0x8 ){
|
||||
sqlite3DebugPrintf("ins-noop: ");
|
||||
whereLoopPrint(pTemplate, pWInfo->pTabList);
|
||||
whereLoopPrint(pTemplate, pBuilder->pWC);
|
||||
}
|
||||
#endif
|
||||
return SQLITE_OK;
|
||||
@@ -5328,7 +5367,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
||||
}
|
||||
if( jj>=nTo ){
|
||||
if( nTo>=mxChoice && rCost>=mxCost ){
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
#ifdef WHERETRACE_ENABLED /* 0x4 */
|
||||
if( sqlite3WhereTrace&0x4 ){
|
||||
sqlite3DebugPrintf("Skip %s cost=%-3d,%3d order=%c\n",
|
||||
wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,
|
||||
@@ -5346,7 +5385,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
||||
jj = mxI;
|
||||
}
|
||||
pTo = &aTo[jj];
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
#ifdef WHERETRACE_ENABLED /* 0x4 */
|
||||
if( sqlite3WhereTrace&0x4 ){
|
||||
sqlite3DebugPrintf("New %s cost=%-3d,%3d order=%c\n",
|
||||
wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,
|
||||
@@ -5355,7 +5394,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
||||
#endif
|
||||
}else{
|
||||
if( pTo->rCost<=rCost && pTo->nRow<=nOut ){
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
#ifdef WHERETRACE_ENABLED /* 0x4 */
|
||||
if( sqlite3WhereTrace&0x4 ){
|
||||
sqlite3DebugPrintf(
|
||||
"Skip %s cost=%-3d,%3d order=%c",
|
||||
@@ -5371,7 +5410,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
||||
}
|
||||
testcase( pTo->rCost==rCost+1 );
|
||||
/* A new and better score for a previously created equivalent path */
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
#ifdef WHERETRACE_ENABLED /* 0x4 */
|
||||
if( sqlite3WhereTrace&0x4 ){
|
||||
sqlite3DebugPrintf(
|
||||
"Update %s cost=%-3d,%3d order=%c",
|
||||
@@ -5407,7 +5446,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
#ifdef WHERETRACE_ENABLED /* >=2 */
|
||||
if( sqlite3WhereTrace>=2 ){
|
||||
sqlite3DebugPrintf("---- after round %d ----\n", iLoop);
|
||||
for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){
|
||||
@@ -5816,12 +5855,29 @@ WhereInfo *sqlite3WhereBegin(
|
||||
|
||||
/* Construct the WhereLoop objects */
|
||||
WHERETRACE(0xffff,("*** Optimizer Start ***\n"));
|
||||
/* Display all terms of the WHERE clause */
|
||||
#if defined(WHERETRACE_ENABLED) && defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
||||
if( sqlite3WhereTrace & 0x100 ){
|
||||
int i;
|
||||
Vdbe *v = pParse->pVdbe;
|
||||
sqlite3ExplainBegin(v);
|
||||
for(i=0; i<sWLB.pWC->nTerm; i++){
|
||||
sqlite3ExplainPrintf(v, "#%-2d ", i);
|
||||
sqlite3ExplainPush(v);
|
||||
whereExplainTerm(v, &sWLB.pWC->a[i]);
|
||||
sqlite3ExplainPop(v);
|
||||
sqlite3ExplainNL(v);
|
||||
}
|
||||
sqlite3ExplainFinish(v);
|
||||
sqlite3DebugPrintf("%s", sqlite3VdbeExplanation(v));
|
||||
}
|
||||
#endif
|
||||
if( nTabList!=1 || whereShortCut(&sWLB)==0 ){
|
||||
rc = whereLoopAddAll(&sWLB);
|
||||
if( rc ) goto whereBeginError;
|
||||
|
||||
/* Display all of the WhereLoop objects if wheretrace is enabled */
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
#ifdef WHERETRACE_ENABLED /* !=0 */
|
||||
if( sqlite3WhereTrace ){
|
||||
WhereLoop *p;
|
||||
int i;
|
||||
@@ -5829,7 +5885,7 @@ WhereInfo *sqlite3WhereBegin(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWYXZ";
|
||||
for(p=pWInfo->pLoops, i=0; p; p=p->pNextLoop, i++){
|
||||
p->cId = zLabel[i%sizeof(zLabel)];
|
||||
whereLoopPrint(p, pTabList);
|
||||
whereLoopPrint(p, sWLB.pWC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -5847,7 +5903,7 @@ WhereInfo *sqlite3WhereBegin(
|
||||
if( pParse->nErr || NEVER(db->mallocFailed) ){
|
||||
goto whereBeginError;
|
||||
}
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
#ifdef WHERETRACE_ENABLED /* !=0 */
|
||||
if( sqlite3WhereTrace ){
|
||||
int ii;
|
||||
sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut);
|
||||
@@ -5870,7 +5926,7 @@ WhereInfo *sqlite3WhereBegin(
|
||||
}
|
||||
sqlite3DebugPrintf("\n");
|
||||
for(ii=0; ii<pWInfo->nLevel; ii++){
|
||||
whereLoopPrint(pWInfo->a[ii].pWLoop, pTabList);
|
||||
whereLoopPrint(pWInfo->a[ii].pWLoop, sWLB.pWC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -102,6 +102,7 @@ SQLITE_READ sqlite_master name main {}
|
||||
SQLITE_READ sqlite_master rootpage main {}
|
||||
SQLITE_READ sqlite_master sql main {}
|
||||
SQLITE_READ sqlite_master tbl_name main {}
|
||||
SQLITE_READ sqlite_master type main {}
|
||||
SQLITE_READ sqlite_master ROWID main {}
|
||||
}
|
||||
do_test auth2-2.2 {
|
||||
@@ -122,6 +123,7 @@ SQLITE_READ sqlite_master name main {}
|
||||
SQLITE_READ sqlite_master rootpage main {}
|
||||
SQLITE_READ sqlite_master sql main {}
|
||||
SQLITE_READ sqlite_master tbl_name main {}
|
||||
SQLITE_READ sqlite_master type main {}
|
||||
SQLITE_READ sqlite_master ROWID main {}
|
||||
}
|
||||
do_test auth2-2.3 {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix fkey5
|
||||
|
||||
ifcapable {!foreignkey} {
|
||||
finish_test
|
||||
@@ -325,5 +326,38 @@ do_test fkey5-8.7 {
|
||||
} {}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Tests 9.* verify that missing parent tables are handled correctly.
|
||||
#
|
||||
do_execsql_test 9.1.1 {
|
||||
CREATE TABLE k1(x REFERENCES s1);
|
||||
PRAGMA foreign_key_check(k1);
|
||||
} {}
|
||||
do_execsql_test 9.1.2 {
|
||||
INSERT INTO k1 VALUES(NULL);
|
||||
PRAGMA foreign_key_check(k1);
|
||||
} {}
|
||||
do_execsql_test 9.1.3 {
|
||||
INSERT INTO k1 VALUES(1);
|
||||
PRAGMA foreign_key_check(k1);
|
||||
} {k1 2 s1 0}
|
||||
|
||||
do_execsql_test 9.2.1 {
|
||||
CREATE TABLE k2(x, y, FOREIGN KEY(x, y) REFERENCES s1(a, b));
|
||||
PRAGMA foreign_key_check(k2);
|
||||
} {}
|
||||
do_execsql_test 9.2 {
|
||||
INSERT INTO k2 VALUES(NULL, 'five');
|
||||
PRAGMA foreign_key_check(k2);
|
||||
} {}
|
||||
do_execsql_test 9.3 {
|
||||
INSERT INTO k2 VALUES('one', NULL);
|
||||
PRAGMA foreign_key_check(k2);
|
||||
} {}
|
||||
do_execsql_test 9.4 {
|
||||
INSERT INTO k2 VALUES('six', 'seven');
|
||||
PRAGMA foreign_key_check(k2);
|
||||
} {k2 3 s1 0}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
+68
-6
@@ -81,12 +81,23 @@ do_test fkey6-1.8 {
|
||||
do_test fkey6-1.9 {
|
||||
sqlite3_db_status db DBSTATUS_DEFERRED_FKS 0
|
||||
} {0 1 0}
|
||||
do_test fkey6-1.10 {
|
||||
execsql {
|
||||
ROLLBACK;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
BEGIN;
|
||||
}
|
||||
|
||||
# EVIDENCE-OF: R-21752-26913 The defer_foreign_keys pragma is
|
||||
# automatically switched off at each COMMIT or ROLLBACK. Hence, the
|
||||
# defer_foreign_keys pragma must be separately enabled for each
|
||||
# transaction.
|
||||
do_execsql_test fkey6-1.10.1 {
|
||||
PRAGMA defer_foreign_keys;
|
||||
ROLLBACK;
|
||||
PRAGMA defer_foreign_keys;
|
||||
BEGIN;
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys;
|
||||
COMMIT;
|
||||
PRAGMA defer_foreign_keys;
|
||||
BEGIN;
|
||||
} {1 0 1 0}
|
||||
do_test fkey6-1.10.2 {
|
||||
catchsql {DELETE FROM t1 WHERE x=3}
|
||||
} {1 {foreign key constraint failed}}
|
||||
db eval {ROLLBACK}
|
||||
@@ -110,5 +121,56 @@ do_test fkey6-1.22 {
|
||||
}
|
||||
} {}
|
||||
|
||||
do_execsql_test fkey6-2.1 {
|
||||
CREATE TABLE p1(a PRIMARY KEY);
|
||||
INSERT INTO p1 VALUES('one'), ('two');
|
||||
CREATE TABLE c1(x REFERENCES p1);
|
||||
INSERT INTO c1 VALUES('two'), ('one');
|
||||
}
|
||||
|
||||
do_execsql_test fkey6-2.2 {
|
||||
BEGIN;
|
||||
PRAGMA defer_foreign_keys = 1;
|
||||
DELETE FROM p1;
|
||||
ROLLBACK;
|
||||
PRAGMA defer_foreign_keys;
|
||||
} {0}
|
||||
|
||||
do_execsql_test fkey6-2.3 {
|
||||
BEGIN;
|
||||
PRAGMA defer_foreign_keys = 1;
|
||||
DROP TABLE p1;
|
||||
PRAGMA vdbe_trace = 0;
|
||||
ROLLBACK;
|
||||
PRAGMA defer_foreign_keys;
|
||||
} {0}
|
||||
|
||||
do_execsql_test fkey6-2.4 {
|
||||
BEGIN;
|
||||
PRAGMA defer_foreign_keys = 1;
|
||||
DELETE FROM p1;
|
||||
DROP TABLE c1;
|
||||
COMMIT;
|
||||
PRAGMA defer_foreign_keys;
|
||||
} {0}
|
||||
|
||||
do_execsql_test fkey6-2.5 {
|
||||
DROP TABLE p1;
|
||||
CREATE TABLE p1(a PRIMARY KEY);
|
||||
INSERT INTO p1 VALUES('one'), ('two');
|
||||
CREATE TABLE c1(x REFERENCES p1);
|
||||
INSERT INTO c1 VALUES('two'), ('one');
|
||||
}
|
||||
|
||||
do_execsql_test fkey6-2.6 {
|
||||
BEGIN;
|
||||
PRAGMA defer_foreign_keys = 1;
|
||||
INSERT INTO c1 VALUES('three');
|
||||
DROP TABLE c1;
|
||||
COMMIT;
|
||||
PRAGMA defer_foreign_keys;
|
||||
} {0}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
# 2011 January 27
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#*************************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is testing the FTS3 module.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
ifcapable !fts3 { finish_test ; return }
|
||||
set ::testprefix fts3aux2
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts4(a, b, languageid=l);
|
||||
INSERT INTO t1(a, b, l) VALUES
|
||||
('zero zero', 'zero zero', 0),
|
||||
('one two', 'three four', 1),
|
||||
('five six', 'seven eight', 2)
|
||||
;
|
||||
CREATE VIRTUAL TABLE terms USING fts4aux(t1);
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.2.1 {
|
||||
SELECT term, documents, occurrences, languageid FROM terms WHERE col = '*';
|
||||
} {zero 1 4 0}
|
||||
|
||||
do_execsql_test 1.2.2 {
|
||||
SELECT * FROM terms;
|
||||
} {zero * 1 4 zero 0 1 2 zero 1 1 2}
|
||||
|
||||
do_execsql_test 1.2.3 {
|
||||
SELECT * FROM terms WHERE languageid='';
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.2.4 {
|
||||
SELECT * FROM terms WHERE languageid=-1;
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.2.5 {
|
||||
SELECT * FROM terms WHERE languageid=9223372036854775807;
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.2.6 {
|
||||
SELECT * FROM terms WHERE languageid=-9223372036854775808;
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.2.7 {
|
||||
SELECT * FROM terms WHERE languageid=NULL;
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.3.1 {
|
||||
SELECT term, documents, occurrences, languageid
|
||||
FROM terms WHERE col = '*' AND languageid=1;
|
||||
} {
|
||||
four 1 1 1 one 1 1 1 three 1 1 1 two 1 1 1
|
||||
}
|
||||
|
||||
do_execsql_test 1.3.2 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE languageid=1;
|
||||
} {
|
||||
four * 1 1 1 four 1 1 1 1
|
||||
one * 1 1 1 one 0 1 1 1
|
||||
three * 1 1 1 three 1 1 1 1
|
||||
two * 1 1 1 two 0 1 1 1
|
||||
}
|
||||
|
||||
do_execsql_test 1.3.3 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE languageid=1 AND term='zero'
|
||||
} {
|
||||
}
|
||||
|
||||
do_execsql_test 1.3.4 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE languageid='1' AND term='two'
|
||||
} {
|
||||
two * 1 1 1 two 0 1 1 1
|
||||
}
|
||||
|
||||
do_execsql_test 1.3.5 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE languageid='+1' AND term>'four'
|
||||
} {
|
||||
one * 1 1 1 one 0 1 1 1
|
||||
three * 1 1 1 three 1 1 1 1
|
||||
two * 1 1 1 two 0 1 1 1
|
||||
}
|
||||
|
||||
do_execsql_test 1.4.1 {
|
||||
SELECT term, documents, occurrences, languageid
|
||||
FROM terms WHERE col = '*' AND languageid=2;
|
||||
} {
|
||||
eight 1 1 2 five 1 1 2 seven 1 1 2 six 1 1 2
|
||||
}
|
||||
|
||||
do_execsql_test 1.4.2 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE languageid=2;
|
||||
} {
|
||||
eight * 1 1 2 eight 1 1 1 2
|
||||
five * 1 1 2 five 0 1 1 2
|
||||
seven * 1 1 2 seven 1 1 1 2
|
||||
six * 1 1 2 six 0 1 1 2
|
||||
}
|
||||
|
||||
do_execsql_test 1.4.3 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE languageid=2 AND term='five';
|
||||
} {
|
||||
five * 1 1 2 five 0 1 1 2
|
||||
}
|
||||
|
||||
do_execsql_test 1.4.4 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE term='five' AND languageid=2
|
||||
} {
|
||||
five * 1 1 2 five 0 1 1 2
|
||||
}
|
||||
|
||||
do_execsql_test 1.4.5 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE term>='seven' AND languageid=2
|
||||
} {
|
||||
seven * 1 1 2 seven 1 1 1 2
|
||||
six * 1 1 2 six 0 1 1 2
|
||||
}
|
||||
|
||||
do_execsql_test 1.4.6 {
|
||||
SELECT term, col, documents, occurrences, languageid
|
||||
FROM terms WHERE term>='e' AND term<'seven' AND languageid=2
|
||||
} {
|
||||
eight * 1 1 2 eight 1 1 1 2
|
||||
five * 1 1 2 five 0 1 1 2
|
||||
}
|
||||
|
||||
finish_test
|
||||
@@ -50,4 +50,26 @@ foreach {tn q res} {
|
||||
puts "with optimization: $t(0) without: $t(1)"
|
||||
}
|
||||
|
||||
do_test 2.1 {
|
||||
execsql {
|
||||
CREATE VIRTUAL TABLE t2 USING fts4(order=DESC);
|
||||
}
|
||||
set num [list one two three four five six seven eight nine ten]
|
||||
execsql BEGIN
|
||||
for {set i 0} {$i < 10000} {incr i} {
|
||||
set x "[lindex $num [expr $i%10]] zero"
|
||||
execsql { INSERT INTO t2(docid, content) VALUES($i, $x) }
|
||||
}
|
||||
execsql COMMIT
|
||||
execsql { INSERT INTO t2(t2) VALUES('optimize') }
|
||||
} {}
|
||||
|
||||
do_execsql_test 2.2 {
|
||||
SELECT count(*) FROM t2 WHERE t2 MATCH '"never zero"'
|
||||
} {0}
|
||||
|
||||
do_execsql_test 2.3 {
|
||||
SELECT count(*) FROM t2 WHERE t2 MATCH '"two zero"'
|
||||
} {1000}
|
||||
|
||||
finish_test
|
||||
|
||||
+758
@@ -0,0 +1,758 @@
|
||||
# 2013 March 10
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The focus of
|
||||
# this file is testing the tointeger() and toreal() functions.
|
||||
#
|
||||
# Several of the toreal() tests are disabled on platforms where floating
|
||||
# point precision is not high enough to represent their constant integer
|
||||
# expression arguments as double precision floating point values.
|
||||
#
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set saved_tcl_precision $tcl_precision
|
||||
set tcl_precision 0
|
||||
load_static_extension db totype
|
||||
|
||||
set highPrecision(1) [expr \
|
||||
{[db eval {SELECT tointeger(9223372036854775807 + 1);}] eq {{}}}]
|
||||
|
||||
do_execsql_test func4-1.1 {
|
||||
SELECT tointeger(NULL);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.2 {
|
||||
SELECT tointeger('');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.3 {
|
||||
SELECT tointeger(' ');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.4 {
|
||||
SELECT tointeger('1234');
|
||||
} {1234}
|
||||
do_execsql_test func4-1.5 {
|
||||
SELECT tointeger(' 1234');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.6 {
|
||||
SELECT tointeger('bad');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.7 {
|
||||
SELECT tointeger('0xBAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.8 {
|
||||
SELECT tointeger('123BAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.9 {
|
||||
SELECT tointeger('0x123BAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.10 {
|
||||
SELECT tointeger('123NO');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.11 {
|
||||
SELECT tointeger('0x123NO');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.12 {
|
||||
SELECT tointeger('-0x1');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.13 {
|
||||
SELECT tointeger('-0x0');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.14 {
|
||||
SELECT tointeger('0x0');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.15 {
|
||||
SELECT tointeger('0x1');
|
||||
} {{}}
|
||||
do_execsql_test func4-1.16 {
|
||||
SELECT tointeger(-1);
|
||||
} {-1}
|
||||
do_execsql_test func4-1.17 {
|
||||
SELECT tointeger(-0);
|
||||
} {0}
|
||||
do_execsql_test func4-1.18 {
|
||||
SELECT tointeger(0);
|
||||
} {0}
|
||||
do_execsql_test func4-1.19 {
|
||||
SELECT tointeger(1);
|
||||
} {1}
|
||||
do_execsql_test func4-1.20 {
|
||||
SELECT tointeger(-1.79769313486232e308 - 1);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.21 {
|
||||
SELECT tointeger(-1.79769313486232e308);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.22 {
|
||||
SELECT tointeger(-1.79769313486232e308 + 1);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.23 {
|
||||
SELECT tointeger(-9223372036854775808 - 1);
|
||||
} {-9223372036854775808}
|
||||
do_execsql_test func4-1.24 {
|
||||
SELECT tointeger(-9223372036854775808);
|
||||
} {-9223372036854775808}
|
||||
do_execsql_test func4-1.25 {
|
||||
SELECT tointeger(-9223372036854775808 + 1);
|
||||
} {-9223372036854775807}
|
||||
do_execsql_test func4-1.26 {
|
||||
SELECT tointeger(-9223372036854775807 - 1);
|
||||
} {-9223372036854775808}
|
||||
do_execsql_test func4-1.27 {
|
||||
SELECT tointeger(-9223372036854775807);
|
||||
} {-9223372036854775807}
|
||||
do_execsql_test func4-1.28 {
|
||||
SELECT tointeger(-9223372036854775807 + 1);
|
||||
} {-9223372036854775806}
|
||||
do_execsql_test func4-1.29 {
|
||||
SELECT tointeger(-2147483648 - 1);
|
||||
} {-2147483649}
|
||||
do_execsql_test func4-1.30 {
|
||||
SELECT tointeger(-2147483648);
|
||||
} {-2147483648}
|
||||
do_execsql_test func4-1.31 {
|
||||
SELECT tointeger(-2147483648 + 1);
|
||||
} {-2147483647}
|
||||
do_execsql_test func4-1.32 {
|
||||
SELECT tointeger(2147483647 - 1);
|
||||
} {2147483646}
|
||||
do_execsql_test func4-1.33 {
|
||||
SELECT tointeger(2147483647);
|
||||
} {2147483647}
|
||||
do_execsql_test func4-1.34 {
|
||||
SELECT tointeger(2147483647 + 1);
|
||||
} {2147483648}
|
||||
do_execsql_test func4-1.35 {
|
||||
SELECT tointeger(9223372036854775807 - 1);
|
||||
} {9223372036854775806}
|
||||
do_execsql_test func4-1.36 {
|
||||
SELECT tointeger(9223372036854775807);
|
||||
} {9223372036854775807}
|
||||
if {$highPrecision(1)} {
|
||||
do_execsql_test func4-1.37 {
|
||||
SELECT tointeger(9223372036854775807 + 1);
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-1.38 {
|
||||
SELECT tointeger(1.79769313486232e308 - 1);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.39 {
|
||||
SELECT tointeger(1.79769313486232e308);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.40 {
|
||||
SELECT tointeger(1.79769313486232e308 + 1);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.41 {
|
||||
SELECT tointeger(4503599627370496 - 1);
|
||||
} {4503599627370495}
|
||||
do_execsql_test func4-1.42 {
|
||||
SELECT tointeger(4503599627370496);
|
||||
} {4503599627370496}
|
||||
do_execsql_test func4-1.43 {
|
||||
SELECT tointeger(4503599627370496 + 1);
|
||||
} {4503599627370497}
|
||||
do_execsql_test func4-1.44 {
|
||||
SELECT tointeger(9007199254740992 - 1);
|
||||
} {9007199254740991}
|
||||
do_execsql_test func4-1.45 {
|
||||
SELECT tointeger(9007199254740992);
|
||||
} {9007199254740992}
|
||||
do_execsql_test func4-1.46 {
|
||||
SELECT tointeger(9007199254740992 + 1);
|
||||
} {9007199254740993}
|
||||
do_execsql_test func4-1.47 {
|
||||
SELECT tointeger(9223372036854775807 - 1);
|
||||
} {9223372036854775806}
|
||||
do_execsql_test func4-1.48 {
|
||||
SELECT tointeger(9223372036854775807);
|
||||
} {9223372036854775807}
|
||||
if {$highPrecision(1)} {
|
||||
do_execsql_test func4-1.49 {
|
||||
SELECT tointeger(9223372036854775807 + 1);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.50 {
|
||||
SELECT tointeger(9223372036854775808 - 1);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.51 {
|
||||
SELECT tointeger(9223372036854775808);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.52 {
|
||||
SELECT tointeger(9223372036854775808 + 1);
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-1.53 {
|
||||
SELECT tointeger(18446744073709551616 - 1);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.54 {
|
||||
SELECT tointeger(18446744073709551616);
|
||||
} {{}}
|
||||
do_execsql_test func4-1.55 {
|
||||
SELECT tointeger(18446744073709551616 + 1);
|
||||
} {{}}
|
||||
|
||||
ifcapable floatingpoint {
|
||||
set highPrecision(2) [expr \
|
||||
{[db eval {SELECT toreal(-9223372036854775808 + 1);}] eq {{}}}]
|
||||
|
||||
do_execsql_test func4-2.1 {
|
||||
SELECT toreal(NULL);
|
||||
} {{}}
|
||||
do_execsql_test func4-2.2 {
|
||||
SELECT toreal('');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.3 {
|
||||
SELECT toreal(' ');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.4 {
|
||||
SELECT toreal('1234');
|
||||
} {1234.0}
|
||||
do_execsql_test func4-2.5 {
|
||||
SELECT toreal(' 1234');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.6 {
|
||||
SELECT toreal('bad');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.7 {
|
||||
SELECT toreal('0xBAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.8 {
|
||||
SELECT toreal('123BAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.9 {
|
||||
SELECT toreal('0x123BAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.10 {
|
||||
SELECT toreal('123NO');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.11 {
|
||||
SELECT toreal('0x123NO');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.12 {
|
||||
SELECT toreal('-0x1');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.13 {
|
||||
SELECT toreal('-0x0');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.14 {
|
||||
SELECT toreal('0x0');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.15 {
|
||||
SELECT toreal('0x1');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.16 {
|
||||
SELECT toreal(-1);
|
||||
} {-1.0}
|
||||
do_execsql_test func4-2.17 {
|
||||
SELECT toreal(-0);
|
||||
} {0.0}
|
||||
do_execsql_test func4-2.18 {
|
||||
SELECT toreal(0);
|
||||
} {0.0}
|
||||
do_execsql_test func4-2.19 {
|
||||
SELECT toreal(1);
|
||||
} {1.0}
|
||||
do_execsql_test func4-2.20 {
|
||||
SELECT toreal(-1.79769313486232e308 - 1);
|
||||
} {-Inf}
|
||||
do_execsql_test func4-2.21 {
|
||||
SELECT toreal(-1.79769313486232e308);
|
||||
} {-Inf}
|
||||
do_execsql_test func4-2.22 {
|
||||
SELECT toreal(-1.79769313486232e308 + 1);
|
||||
} {-Inf}
|
||||
do_execsql_test func4-2.23 {
|
||||
SELECT toreal(-9223372036854775808 - 1);
|
||||
} {-9.223372036854776e+18}
|
||||
do_execsql_test func4-2.24 {
|
||||
SELECT toreal(-9223372036854775808);
|
||||
} {-9.223372036854776e+18}
|
||||
if {$highPrecision(2)} {
|
||||
do_execsql_test func4-2.25 {
|
||||
SELECT toreal(-9223372036854775808 + 1);
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-2.26 {
|
||||
SELECT toreal(-9223372036854775807 - 1);
|
||||
} {-9.223372036854776e+18}
|
||||
if {$highPrecision(2)} {
|
||||
do_execsql_test func4-2.27 {
|
||||
SELECT toreal(-9223372036854775807);
|
||||
} {{}}
|
||||
do_execsql_test func4-2.28 {
|
||||
SELECT toreal(-9223372036854775807 + 1);
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-2.29 {
|
||||
SELECT toreal(-2147483648 - 1);
|
||||
} {-2147483649.0}
|
||||
do_execsql_test func4-2.30 {
|
||||
SELECT toreal(-2147483648);
|
||||
} {-2147483648.0}
|
||||
do_execsql_test func4-2.31 {
|
||||
SELECT toreal(-2147483648 + 1);
|
||||
} {-2147483647.0}
|
||||
do_execsql_test func4-2.32 {
|
||||
SELECT toreal(2147483647 - 1);
|
||||
} {2147483646.0}
|
||||
do_execsql_test func4-2.33 {
|
||||
SELECT toreal(2147483647);
|
||||
} {2147483647.0}
|
||||
do_execsql_test func4-2.34 {
|
||||
SELECT toreal(2147483647 + 1);
|
||||
} {2147483648.0}
|
||||
if {$highPrecision(2)} {
|
||||
do_execsql_test func4-2.35 {
|
||||
SELECT toreal(9223372036854775807 - 1);
|
||||
} {{}}
|
||||
if {$highPrecision(1)} {
|
||||
do_execsql_test func4-2.36 {
|
||||
SELECT toreal(9223372036854775807);
|
||||
} {{}}
|
||||
}
|
||||
}
|
||||
do_execsql_test func4-2.37 {
|
||||
SELECT toreal(9223372036854775807 + 1);
|
||||
} {9.223372036854776e+18}
|
||||
do_execsql_test func4-2.38 {
|
||||
SELECT toreal(1.79769313486232e308 - 1);
|
||||
} {Inf}
|
||||
do_execsql_test func4-2.39 {
|
||||
SELECT toreal(1.79769313486232e308);
|
||||
} {Inf}
|
||||
do_execsql_test func4-2.40 {
|
||||
SELECT toreal(1.79769313486232e308 + 1);
|
||||
} {Inf}
|
||||
do_execsql_test func4-2.41 {
|
||||
SELECT toreal(4503599627370496 - 1);
|
||||
} {4503599627370495.0}
|
||||
do_execsql_test func4-2.42 {
|
||||
SELECT toreal(4503599627370496);
|
||||
} {4503599627370496.0}
|
||||
do_execsql_test func4-2.43 {
|
||||
SELECT toreal(4503599627370496 + 1);
|
||||
} {4503599627370497.0}
|
||||
do_execsql_test func4-2.44 {
|
||||
SELECT toreal(9007199254740992 - 1);
|
||||
} {9007199254740991.0}
|
||||
do_execsql_test func4-2.45 {
|
||||
SELECT toreal(9007199254740992);
|
||||
} {9007199254740992.0}
|
||||
if {$highPrecision(2)} {
|
||||
do_execsql_test func4-2.46 {
|
||||
SELECT toreal(9007199254740992 + 1);
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-2.47 {
|
||||
SELECT toreal(9007199254740992 + 2);
|
||||
} {9007199254740994.0}
|
||||
do_execsql_test func4-2.48 {
|
||||
SELECT toreal(tointeger(9223372036854775808) - 1);
|
||||
} {{}}
|
||||
if {$highPrecision(1)} {
|
||||
do_execsql_test func4-2.49 {
|
||||
SELECT toreal(tointeger(9223372036854775808));
|
||||
} {{}}
|
||||
do_execsql_test func4-2.50 {
|
||||
SELECT toreal(tointeger(9223372036854775808) + 1);
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-2.51 {
|
||||
SELECT toreal(tointeger(18446744073709551616) - 1);
|
||||
} {{}}
|
||||
do_execsql_test func4-2.52 {
|
||||
SELECT toreal(tointeger(18446744073709551616));
|
||||
} {{}}
|
||||
do_execsql_test func4-2.53 {
|
||||
SELECT toreal(tointeger(18446744073709551616) + 1);
|
||||
} {{}}
|
||||
}
|
||||
|
||||
ifcapable check {
|
||||
do_execsql_test func4-3.1 {
|
||||
CREATE TABLE t1(
|
||||
x INTEGER CHECK(tointeger(x) IS NOT NULL)
|
||||
);
|
||||
} {}
|
||||
do_test func4-3.2 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (NULL);
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.3 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (NULL);
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.4 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES ('');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.5 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES ('bad');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.6 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES ('1234bad');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.7 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES ('1234.56bad');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.8 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (1234);
|
||||
}
|
||||
} {0 {}}
|
||||
do_test func4-3.9 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (1234.56);
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.10 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES ('1234');
|
||||
}
|
||||
} {0 {}}
|
||||
do_test func4-3.11 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES ('1234.56');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.12 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (ZEROBLOB(4));
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.13 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (X'');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.14 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (X'1234');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.15 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (X'12345678');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.16 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES ('1234.00');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-3.17 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (1234.00);
|
||||
}
|
||||
} {0 {}}
|
||||
do_test func4-3.18 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES ('-9223372036854775809');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
if {$highPrecision(1)} {
|
||||
do_test func4-3.19 {
|
||||
catchsql {
|
||||
INSERT INTO t1 (x) VALUES (9223372036854775808);
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
}
|
||||
do_execsql_test func4-3.20 {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
} {1234 1234 1234}
|
||||
|
||||
ifcapable floatingpoint {
|
||||
do_execsql_test func4-4.1 {
|
||||
CREATE TABLE t2(
|
||||
x REAL CHECK(toreal(x) IS NOT NULL)
|
||||
);
|
||||
} {}
|
||||
do_test func4-4.2 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES (NULL);
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.3 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES (NULL);
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.4 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES ('');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.5 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES ('bad');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.6 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES ('1234bad');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.7 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES ('1234.56bad');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.8 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES (1234);
|
||||
}
|
||||
} {0 {}}
|
||||
do_test func4-4.9 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES (1234.56);
|
||||
}
|
||||
} {0 {}}
|
||||
do_test func4-4.10 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES ('1234');
|
||||
}
|
||||
} {0 {}}
|
||||
do_test func4-4.11 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES ('1234.56');
|
||||
}
|
||||
} {0 {}}
|
||||
do_test func4-4.12 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES (ZEROBLOB(4));
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.13 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES (X'');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.14 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES (X'1234');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test func4-4.15 {
|
||||
catchsql {
|
||||
INSERT INTO t2 (x) VALUES (X'12345678');
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_execsql_test func4-4.16 {
|
||||
SELECT x FROM t2 ORDER BY x;
|
||||
} {1234.0 1234.0 1234.56 1234.56}
|
||||
}
|
||||
}
|
||||
|
||||
ifcapable floatingpoint {
|
||||
do_execsql_test func4-5.1 {
|
||||
SELECT tointeger(toreal('1234'));
|
||||
} {1234}
|
||||
do_execsql_test func4-5.2 {
|
||||
SELECT tointeger(toreal(-1));
|
||||
} {-1}
|
||||
do_execsql_test func4-5.3 {
|
||||
SELECT tointeger(toreal(-0));
|
||||
} {0}
|
||||
do_execsql_test func4-5.4 {
|
||||
SELECT tointeger(toreal(0));
|
||||
} {0}
|
||||
do_execsql_test func4-5.5 {
|
||||
SELECT tointeger(toreal(1));
|
||||
} {1}
|
||||
do_execsql_test func4-5.6 {
|
||||
SELECT tointeger(toreal(-9223372036854775808 - 1));
|
||||
} {-9223372036854775808}
|
||||
do_execsql_test func4-5.7 {
|
||||
SELECT tointeger(toreal(-9223372036854775808));
|
||||
} {-9223372036854775808}
|
||||
if {$highPrecision(2)} {
|
||||
do_execsql_test func4-5.8 {
|
||||
SELECT tointeger(toreal(-9223372036854775808 + 1));
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-5.9 {
|
||||
SELECT tointeger(toreal(-2147483648 - 1));
|
||||
} {-2147483649}
|
||||
do_execsql_test func4-5.10 {
|
||||
SELECT tointeger(toreal(-2147483648));
|
||||
} {-2147483648}
|
||||
do_execsql_test func4-5.11 {
|
||||
SELECT tointeger(toreal(-2147483648 + 1));
|
||||
} {-2147483647}
|
||||
do_execsql_test func4-5.12 {
|
||||
SELECT tointeger(toreal(2147483647 - 1));
|
||||
} {2147483646}
|
||||
do_execsql_test func4-5.13 {
|
||||
SELECT tointeger(toreal(2147483647));
|
||||
} {2147483647}
|
||||
do_execsql_test func4-5.14 {
|
||||
SELECT tointeger(toreal(2147483647 + 1));
|
||||
} {2147483648}
|
||||
do_execsql_test func4-5.15 {
|
||||
SELECT tointeger(toreal(9223372036854775807 - 1));
|
||||
} {{}}
|
||||
if {$highPrecision(1)} {
|
||||
do_execsql_test func4-5.16 {
|
||||
SELECT tointeger(toreal(9223372036854775807));
|
||||
} {{}}
|
||||
do_execsql_test func4-5.17 {
|
||||
SELECT tointeger(toreal(9223372036854775807 + 1));
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-5.18 {
|
||||
SELECT tointeger(toreal(4503599627370496 - 1));
|
||||
} {4503599627370495}
|
||||
do_execsql_test func4-5.19 {
|
||||
SELECT tointeger(toreal(4503599627370496));
|
||||
} {4503599627370496}
|
||||
do_execsql_test func4-5.20 {
|
||||
SELECT tointeger(toreal(4503599627370496 + 1));
|
||||
} {4503599627370497}
|
||||
do_execsql_test func4-5.21 {
|
||||
SELECT tointeger(toreal(9007199254740992 - 1));
|
||||
} {9007199254740991}
|
||||
do_execsql_test func4-5.22 {
|
||||
SELECT tointeger(toreal(9007199254740992));
|
||||
} {9007199254740992}
|
||||
if {$highPrecision(2)} {
|
||||
do_execsql_test func4-5.23 {
|
||||
SELECT tointeger(toreal(9007199254740992 + 1));
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-5.24 {
|
||||
SELECT tointeger(toreal(9007199254740992 + 2));
|
||||
} {9007199254740994}
|
||||
if {$highPrecision(1)} {
|
||||
do_execsql_test func4-5.25 {
|
||||
SELECT tointeger(toreal(9223372036854775808 - 1));
|
||||
} {{}}
|
||||
do_execsql_test func4-5.26 {
|
||||
SELECT tointeger(toreal(9223372036854775808));
|
||||
} {{}}
|
||||
do_execsql_test func4-5.27 {
|
||||
SELECT tointeger(toreal(9223372036854775808 + 1));
|
||||
} {{}}
|
||||
}
|
||||
do_execsql_test func4-5.28 {
|
||||
SELECT tointeger(toreal(18446744073709551616 - 1));
|
||||
} {{}}
|
||||
do_execsql_test func4-5.29 {
|
||||
SELECT tointeger(toreal(18446744073709551616));
|
||||
} {{}}
|
||||
do_execsql_test func4-5.30 {
|
||||
SELECT tointeger(toreal(18446744073709551616 + 1));
|
||||
} {{}}
|
||||
}
|
||||
|
||||
for {set i 0} {$i < 10} {incr i} {
|
||||
if {$i == 8} continue
|
||||
do_execsql_test func4-6.1.$i.1 [subst {
|
||||
SELECT tointeger(x'[string repeat 01 $i]');
|
||||
}] {{}}
|
||||
ifcapable floatingpoint {
|
||||
do_execsql_test func4-6.1.$i.2 [subst {
|
||||
SELECT toreal(x'[string repeat 01 $i]');
|
||||
}] {{}}
|
||||
}
|
||||
}
|
||||
|
||||
do_execsql_test func4-6.2.1 {
|
||||
SELECT tointeger(x'0102030405060708');
|
||||
} {578437695752307201}
|
||||
do_execsql_test func4-6.2.2 {
|
||||
SELECT tointeger(x'0807060504030201');
|
||||
} {72623859790382856}
|
||||
|
||||
ifcapable floatingpoint {
|
||||
do_execsql_test func4-6.3.1 {
|
||||
SELECT toreal(x'ffefffffffffffff');
|
||||
} {-1.7976931348623157e+308}
|
||||
do_execsql_test func4-6.3.2 {
|
||||
SELECT toreal(x'8010000000000000');
|
||||
} {-2.2250738585072014e-308}
|
||||
do_execsql_test func4-6.3.3 {
|
||||
SELECT toreal(x'c000000000000000');
|
||||
} {-2.0}
|
||||
do_execsql_test func4-6.3.4 {
|
||||
SELECT toreal(x'bff0000000000000');
|
||||
} {-1.0}
|
||||
do_execsql_test func4-6.3.5 {
|
||||
SELECT toreal(x'8000000000000000');
|
||||
} {-0.0}
|
||||
do_execsql_test func4-6.3.6 {
|
||||
SELECT toreal(x'0000000000000000');
|
||||
} {0.0}
|
||||
do_execsql_test func4-6.3.7 {
|
||||
SELECT toreal(x'3ff0000000000000');
|
||||
} {1.0}
|
||||
do_execsql_test func4-6.3.8 {
|
||||
SELECT toreal(x'4000000000000000');
|
||||
} {2.0}
|
||||
do_execsql_test func4-6.3.9 {
|
||||
SELECT toreal(x'0010000000000000');
|
||||
} {2.2250738585072014e-308}
|
||||
do_execsql_test func4-6.3.10 {
|
||||
SELECT toreal(x'7fefffffffffffff');
|
||||
} {1.7976931348623157e+308}
|
||||
do_execsql_test func4-6.3.11 {
|
||||
SELECT toreal(x'8000000000000001');
|
||||
} {-5e-324}
|
||||
do_execsql_test func4-6.3.12 {
|
||||
SELECT toreal(x'800fffffffffffff');
|
||||
} {-2.225073858507201e-308}
|
||||
do_execsql_test func4-6.3.13 {
|
||||
SELECT toreal(x'0000000000000001');
|
||||
} {5e-324}
|
||||
do_execsql_test func4-6.3.14 {
|
||||
SELECT toreal(x'000fffffffffffff');
|
||||
} {2.225073858507201e-308}
|
||||
do_execsql_test func4-6.3.15 {
|
||||
SELECT toreal(x'fff0000000000000');
|
||||
} {-Inf}
|
||||
do_execsql_test func4-6.3.16 {
|
||||
SELECT toreal(x'7ff0000000000000');
|
||||
} {Inf}
|
||||
do_execsql_test func4-6.3.17 {
|
||||
SELECT toreal(x'fff8000000000000');
|
||||
} {{}}
|
||||
do_execsql_test func4-6.3.18 {
|
||||
SELECT toreal(x'fff0000000000001');
|
||||
} {{}}
|
||||
do_execsql_test func4-6.3.19 {
|
||||
SELECT toreal(x'fff7ffffffffffff');
|
||||
} {{}}
|
||||
do_execsql_test func4-6.3.20 {
|
||||
SELECT toreal(x'7ff0000000000001');
|
||||
} {{}}
|
||||
do_execsql_test func4-6.3.21 {
|
||||
SELECT toreal(x'7ff7ffffffffffff');
|
||||
} {{}}
|
||||
do_execsql_test func4-6.3.22 {
|
||||
SELECT toreal(x'fff8000000000001');
|
||||
} {{}}
|
||||
do_execsql_test func4-6.3.23 {
|
||||
SELECT toreal(x'ffffffffffffffff');
|
||||
} {{}}
|
||||
do_execsql_test func4-6.3.24 {
|
||||
SELECT toreal(x'7ff8000000000000');
|
||||
} {{}}
|
||||
do_execsql_test func4-6.3.25 {
|
||||
SELECT toreal(x'7fffffffffffffff');
|
||||
} {{}}
|
||||
}
|
||||
|
||||
set tcl_precision $saved_tcl_precision
|
||||
unset saved_tcl_precision
|
||||
finish_test
|
||||
+3
-3
@@ -574,7 +574,7 @@ ifcapable {foreignkey} {
|
||||
execsql {
|
||||
pragma index_list(t3);
|
||||
}
|
||||
} {/0 sqlite_pseudoindex_t3 0 \d+ 1 sqlite_autoindex_t3_1 1 \d+/}
|
||||
} {0 sqlite_autoindex_t3_1 1}
|
||||
}
|
||||
ifcapable {!foreignkey} {
|
||||
execsql {CREATE TABLE t3(a,b UNIQUE)}
|
||||
@@ -647,7 +647,7 @@ do_test pragma-7.1.1 {
|
||||
execsql {
|
||||
pragma index_list(t3);
|
||||
}
|
||||
} {/0 sqlite_pseudoindex_t3 0 \d+ 1 t3i1 0 \d+ 2 sqlite_autoindex_t3_1 1 \d+/}
|
||||
} {0 t3i1 0 1 sqlite_autoindex_t3_1 1}
|
||||
do_test pragma-7.1.2 {
|
||||
execsql {
|
||||
pragma index_list(t3_bogus);
|
||||
@@ -1661,7 +1661,7 @@ do_test 23.3 {
|
||||
CREATE INDEX i3 ON t1(d,b,c);
|
||||
}
|
||||
db2 eval {PRAGMA index_list(t1)}
|
||||
} {/0 sqlite_pseudoindex_t1 0 \d+ 1 i3 0 \d+ 2 i2 0 \d+ 3 i1 0 \d+/}
|
||||
} {0 i3 0 1 i2 0 2 i1 0}
|
||||
do_test 23.4 {
|
||||
db eval {
|
||||
ALTER TABLE t1 ADD COLUMN e;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix temptrigger
|
||||
|
||||
ifcapable {!trigger || !shared_cache} { finish_test ; return }
|
||||
|
||||
@@ -201,4 +202,78 @@ do_test temptrigger-3.4 {
|
||||
catch { db close }
|
||||
catch { db2 close }
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that creating a temp table after a temp trigger on the same name
|
||||
# has been created is an error.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 4.0 {
|
||||
CREATE TABLE t1(x);
|
||||
CREATE TEMP TRIGGER tr1 BEFORE INSERT ON t1 BEGIN
|
||||
SELECT 1,2,3;
|
||||
END;
|
||||
}
|
||||
|
||||
do_execsql_test 4.1 {
|
||||
CREATE TEMP TABLE t1(x);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that no harm is done if the table a temp trigger is attached to is
|
||||
# deleted by an external connection.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 5.0 {
|
||||
CREATE TABLE t1(x);
|
||||
CREATE TEMP TRIGGER tr1 BEFORE INSERT ON t1 BEGIN SELECT 1,2,3; END;
|
||||
}
|
||||
|
||||
do_test 5.1 {
|
||||
sqlite3 db2 test.db
|
||||
execsql { DROP TABLE t1 } db2
|
||||
} {}
|
||||
|
||||
do_execsql_test 5.2 {
|
||||
SELECT * FROM sqlite_master;
|
||||
SELECT * FROM sqlite_temp_master;
|
||||
} {
|
||||
trigger tr1 t1 0
|
||||
{CREATE TRIGGER tr1 BEFORE INSERT ON t1 BEGIN SELECT 1,2,3; END}
|
||||
}
|
||||
db2 close
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Check that if a second connection creates a table in an attached database
|
||||
# with the same name as a table in the main database that has a temp
|
||||
# trigger attached to it nothing goes awry.
|
||||
#
|
||||
reset_db
|
||||
forcedelete test.db2
|
||||
|
||||
do_execsql_test 6.0 {
|
||||
CREATE TABLE t1(x);
|
||||
CREATE TEMP TRIGGER tr1 BEFORE INSERT ON t1 BEGIN
|
||||
SELECT raise(ABORT, 'error');
|
||||
END;
|
||||
ATTACH 'test.db2' AS aux;
|
||||
}
|
||||
|
||||
do_test 6.1 {
|
||||
sqlite3 db2 test.db2
|
||||
execsql { CREATE TABLE t1(a, b, c); } db2
|
||||
} {}
|
||||
|
||||
do_execsql_test 6.2 {
|
||||
SELECT * FROM aux.sqlite_master;
|
||||
INSERT INTO aux.t1 VALUES(1,2,3);
|
||||
} {
|
||||
table t1 t1 2 {CREATE TABLE t1(a, b, c)}
|
||||
}
|
||||
|
||||
do_catchsql_test 6.3 {
|
||||
INSERT INTO main.t1 VALUES(1);
|
||||
} {1 error}
|
||||
db2 close
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -102,4 +102,183 @@ do_execsql_test transitive1-332 {
|
||||
ORDER BY w DESC;
|
||||
} {3 4 3 6 1 2 1 3}
|
||||
|
||||
# Ticket [c620261b5b5dc] circa 2013-10-28.
|
||||
# Make sureconstraints are not used with LEFT JOINs.
|
||||
#
|
||||
# The next case is from the ticket report. It outputs no rows in 3.8.1
|
||||
# prior to the bug-fix.
|
||||
#
|
||||
do_execsql_test transitive1-400 {
|
||||
CREATE TABLE t401(a);
|
||||
CREATE TABLE t402(b);
|
||||
CREATE TABLE t403(c INTEGER PRIMARY KEY);
|
||||
INSERT INTO t401 VALUES(1);
|
||||
INSERT INTO t403 VALUES(1);
|
||||
SELECT '1-row' FROM t401 LEFT JOIN t402 ON b=a JOIN t403 ON c=a;
|
||||
} {1-row}
|
||||
|
||||
# The following is a script distilled from the XBMC project where the
|
||||
# bug was originally encountered. The correct answer is a single row
|
||||
# of output. Before the bug was fixed, zero rows were generated.
|
||||
#
|
||||
do_execsql_test transitive1-410 {
|
||||
CREATE TABLE bookmark ( idBookmark integer primary key, idFile integer, timeInSeconds double, totalTimeInSeconds double, thumbNailImage text, player text, playerState text, type integer);
|
||||
CREATE TABLE path ( idPath integer primary key, strPath text, strContent text, strScraper text, strHash text, scanRecursive integer, useFolderNames bool, strSettings text, noUpdate bool, exclude bool, dateAdded text);
|
||||
INSERT INTO "path" VALUES(1,'/tmp/tvshows/','tvshows','metadata.tvdb.com','989B1CE5680A14F5F86123F751169B49',0,0,'<settings><setting id="absolutenumber" value="false" /><setting id="dvdorder" value="false" /><setting id="fanart" value="true" /><setting id="language" value="en" /></settings>',0,0,NULL);
|
||||
INSERT INTO "path" VALUES(2,'/tmp/tvshows/The.Big.Bang.Theory/','','','85E1DAAB2F5FF6EAE8AEDF1B5C882D1E',NULL,NULL,NULL,NULL,NULL,'2013-10-23 18:58:43');
|
||||
CREATE TABLE files ( idFile integer primary key, idPath integer, strFilename text, playCount integer, lastPlayed text, dateAdded text);
|
||||
INSERT INTO "files" VALUES(1,2,'The.Big.Bang.Theory.S01E01.WEB-DL.AAC2.0.H264.mkv',NULL,NULL,'2013-10-23 18:57:36');
|
||||
CREATE TABLE tvshow ( idShow integer primary key,c00 text,c01 text,c02 text,c03 text,c04 text,c05 text,c06 text,c07 text,c08 text,c09 text,c10 text,c11 text,c12 text,c13 text,c14 text,c15 text,c16 text,c17 text,c18 text,c19 text,c20 text,c21 text,c22 text,c23 text);
|
||||
INSERT INTO "tvshow" VALUES(1,'The Big Bang Theory','Leonard Hofstadter and Sheldon Cooper are brilliant physicists, the kind of "beautiful minds" that understand how the universe works. But none of that genius helps them interact with people, especially women. All this begins to change when a free-spirited beauty named Penny moves in next door. Sheldon, Leonard''s roommate, is quite content spending his nights playing Klingon Boggle with their socially dysfunctional friends, fellow CalTech scientists Howard Wolowitz and Raj Koothrappali. However, Leonard sees in Penny a whole new universe of possibilities... including love.','','','9.200000','2007-09-24','<thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g13.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g23.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g18.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g17.jpg</thumb><thumb aspect="banner">http://
|
||||
thetvdb.com/banners/graphical/80379-g6.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g5.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g2.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g11.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g12.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g19.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g3.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g4.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g15.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g22.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g7.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g10.jpg</thumb><thumb
|
||||
aspect="banner">http://thetvdb.com/banners/graphical/80379-g24.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g8.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g9.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g14.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g16.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/graphical/80379-g21.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/text/80379-4.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/text/80379-2.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/text/80379-3.jpg</thumb><thumb aspect="banner">http://thetvdb.com/banners/text/80379-5.jpg</thumb><thumb aspect="poster" type="season" season="6">http://thetvdb.com/banners/seasons/80379-6-8.jpg</thumb><thumb aspect="poster" type="season" season="0">http://thetvdb.com/banners/seasons/80379-0-4.jpg</thumb><thumb aspect="poster" type="season"
|
||||
season="1">http://thetvdb.com/banners/seasons/80379-1-12.jpg</thumb><thumb aspect="poster" type="season" season="3">http://thetvdb.com/banners/seasons/80379-3-9.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-11.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5-9.jpg</thumb><thumb aspect="poster" type="season" season="4">http://thetvdb.com/banners/seasons/80379-4-8.jpg</thumb><thumb aspect="poster" type="season" season="7">http://thetvdb.com/banners/seasons/80379-7-3.jpg</thumb><thumb aspect="poster" type="season" season="3">http://thetvdb.com/banners/seasons/80379-3-4.jpg</thumb><thumb aspect="poster" type="season" season="4">http://thetvdb.com/banners/seasons/80379-4-5.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-9.jpg</thumb><thumb aspect="poster" type="season" season="0">http://thetvdb.com/banners/seasons/80379-0-2.jpg</thumb><thumb aspect="
|
||||
poster" type="season" season="6">http://thetvdb.com/banners/seasons/80379-6-6.jpg</thumb><thumb aspect="poster" type="season" season="4">http://thetvdb.com/banners/seasons/80379-4-4.jpg</thumb><thumb aspect="poster" type="season" season="6">http://thetvdb.com/banners/seasons/80379-6-2.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-1-9.jpg</thumb><thumb aspect="poster" type="season" season="6">http://thetvdb.com/banners/seasons/80379-6-4.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-1.jpg</thumb><thumb aspect="poster" type="season" season="3">http://thetvdb.com/banners/seasons/80379-3.jpg</thumb><thumb aspect="poster" type="season" season="4">http://thetvdb.com/banners/seasons/80379-4-2.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5-7.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-10.jpg</
|
||||
thumb><thumb aspect="poster" type="season" season="6">http://thetvdb.com/banners/seasons/80379-6-5.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-1-5.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5-4.jpg</thumb><thumb aspect="poster" type="season" season="4">http://thetvdb.com/banners/seasons/80379-4.jpg</thumb><thumb aspect="poster" type="season" season="6">http://thetvdb.com/banners/seasons/80379-6-3.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5.jpg</thumb><thumb aspect="poster" type="season" season="3">http://thetvdb.com/banners/seasons/80379-3-6.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2.jpg</thumb><thumb aspect="poster" type="season" season="7">http://thetvdb.com/banners/seasons/80379-7.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-
|
||||
1-7.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5-2.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5-3.jpg</thumb><thumb aspect="poster" type="season" season="7">http://thetvdb.com/banners/seasons/80379-7-2.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-1-2.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-5.jpg</thumb><thumb aspect="poster" type="season" season="4">http://thetvdb.com/banners/seasons/80379-4-3.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5-5.jpg</thumb><thumb aspect="poster" type="season" season="0">http://thetvdb.com/banners/seasons/80379-0.jpg</thumb><thumb aspect="poster" type="season" season="3">http://thetvdb.com/banners/seasons/80379-3-5.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/
|
||||
seasons/80379-1-6.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-3.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-8.jpg</thumb><thumb aspect="poster" type="season" season="6">http://thetvdb.com/banners/seasons/80379-6-7.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5-8.jpg</thumb><thumb aspect="poster" type="season" season="4">http://thetvdb.com/banners/seasons/80379-4-7.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-6.jpg</thumb><thumb aspect="poster" type="season" season="3">http://thetvdb.com/banners/seasons/80379-3-8.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-1-11.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-1-10.jpg</thumb><thumb aspect="poster" type="season" season="1">http://
|
||||
thetvdb.com/banners/seasons/80379-1-8.jpg</thumb><thumb aspect="poster" type="season" season="3">http://thetvdb.com/banners/seasons/80379-3-7.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-4.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-1-3.jpg</thumb><thumb aspect="poster" type="season" season="1">http://thetvdb.com/banners/seasons/80379-1-4.jpg</thumb><thumb aspect="poster" type="season" season="3">http://thetvdb.com/banners/seasons/80379-3-3.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-7.jpg</thumb><thumb aspect="poster" type="season" season="6">http://thetvdb.com/banners/seasons/80379-6.jpg</thumb><thumb aspect="poster" type="season" season="2">http://thetvdb.com/banners/seasons/80379-2-2.jpg</thumb><thumb aspect="poster" type="season" season="5">http://thetvdb.com/banners/seasons/80379-5-6.jpg</thumb><thumb aspect="poster" type="season"
|
||||
season="3">http://thetvdb.com/banners/seasons/80379-3-2.jpg</thumb><thumb aspect="poster" type="season" season="4">http://thetvdb.com/banners/seasons/80379-4-6.jpg</thumb><thumb aspect="banner" type="season" season="5">http://thetvdb.com/banners/seasonswide/80379-5.jpg</thumb><thumb aspect="banner" type="season" season="3">http://thetvdb.com/banners/seasonswide/80379-3-2.jpg</thumb><thumb aspect="banner" type="season" season="1">http://thetvdb.com/banners/seasonswide/80379-1-2.jpg</thumb><thumb aspect="banner" type="season" season="2">http://thetvdb.com/banners/seasonswide/80379-2-2.jpg</thumb><thumb aspect="banner" type="season" season="4">http://thetvdb.com/banners/seasonswide/80379-4-2.jpg</thumb><thumb aspect="banner" type="season" season="0">http://thetvdb.com/banners/seasonswide/80379-0.jpg</thumb><thumb aspect="banner" type="season" season="0">http://thetvdb.com/banners/seasonswide/80379-0-2.jpg</thumb><thumb aspect="banner" type="season" season="1">http://thetvdb.com/banners/seasonswide/80379-1.jpg</
|
||||
thumb><thumb aspect="banner" type="season" season="2">http://thetvdb.com/banners/seasonswide/80379-2.jpg</thumb><thumb aspect="banner" type="season" season="4">http://thetvdb.com/banners/seasonswide/80379-4.jpg</thumb><thumb aspect="banner" type="season" season="3">http://thetvdb.com/banners/seasonswide/80379-3.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-22.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-18.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-13.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-10.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-16.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-1.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-9.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-2.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-19.jpg</
|
||||
thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-8.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-4.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-20.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-23.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-7.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-3.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-12.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-11.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-15.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-21.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-14.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-17.jpg</thumb><thumb aspect="poster">http://thetvdb.com/banners/posters/80379-6.jpg</thumb><thumb
|
||||
aspect="poster">http://thetvdb.com/banners/posters/80379-5.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-22.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-18.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-13.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-10.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-16.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-1.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-9.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-2.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-19.jpg</thumb><thumb aspect="
|
||||
poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-8.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-4.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-20.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-23.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-7.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-3.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-12.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-11.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-15.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-21.jpg</
|
||||
thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-14.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-17.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-6.jpg</thumb><thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/posters/80379-5.jpg</thumb>','','Comedy','','<episodeguide><url cache="80379-en.xml">http://thetvdb.com/api/1D62F2F90030C444/series/80379/all/en.zip</url></episodeguide>','<fanart url="http://thetvdb.com/banners/"><thumb dim="1920x1080" colors="|192,185,169|19,20,25|57,70,89|" preview="_cache/fanart/original/80379-2.jpg">fanart/original/80379-2.jpg</thumb><thumb dim="1920x1080" colors="|94,28,16|194,18,38|0,0,8|" preview="_cache/fanart/original/80379-34.jpg">fanart/original/80379-34.jpg</thumb><thumb dim="1280x720" colors="|254,157,210|11,12,7|191,152,111|" preview="_cache/fanart/original/80379-4.jpg">fanart/original/80379-
|
||||
4.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-42.jpg">fanart/original/80379-42.jpg</thumb><thumb dim="1920x1080" colors="|236,187,155|136,136,128|254,254,252|" preview="_cache/fanart/original/80379-37.jpg">fanart/original/80379-37.jpg</thumb><thumb dim="1920x1080" colors="|112,102,152|116,109,116|235,152,146|" preview="_cache/fanart/original/80379-14.jpg">fanart/original/80379-14.jpg</thumb><thumb dim="1920x1080" colors="|150,158,161|174,75,121|150,98,58|" preview="_cache/fanart/original/80379-16.jpg">fanart/original/80379-16.jpg</thumb><thumb dim="1280x720" colors="|224,200,176|11,1,28|164,96,0|" preview="_cache/fanart/original/80379-1.jpg">fanart/original/80379-1.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-35.jpg">fanart/original/80379-35.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-40.jpg">fanart/original/80379-40.jpg</thumb><thumb dim="1920x1080" colors="|255,255,255|30,19,13|155,112,70|"
|
||||
preview="_cache/fanart/original/80379-31.jpg">fanart/original/80379-31.jpg</thumb><thumb dim="1920x1080" colors="|241,195,172|84,54,106|254,221,206|" preview="_cache/fanart/original/80379-29.jpg">fanart/original/80379-29.jpg</thumb><thumb dim="1280x720" colors="|197,167,175|219,29,39|244,208,192|" preview="_cache/fanart/original/80379-11.jpg">fanart/original/80379-11.jpg</thumb><thumb dim="1280x720" colors="|195,129,97|244,192,168|219,148,118|" preview="_cache/fanart/original/80379-24.jpg">fanart/original/80379-24.jpg</thumb><thumb dim="1920x1080" colors="|14,10,11|255,255,255|175,167,164|" preview="_cache/fanart/original/80379-30.jpg">fanart/original/80379-30.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-19.jpg">fanart/original/80379-19.jpg</thumb><thumb dim="1920x1080" colors="|246,199,69|98,55,38|161,127,82|" preview="_cache/fanart/original/80379-9.jpg">fanart/original/80379-9.jpg</thumb><thumb dim="1280x720" colors="|129,22,14|48,50,39|223,182,64|" preview="_cache/
|
||||
fanart/original/80379-13.jpg">fanart/original/80379-13.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-45.jpg">fanart/original/80379-45.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-33.jpg">fanart/original/80379-33.jpg</thumb><thumb dim="1280x720" colors="|103,77,60|224,180,153|129,100,84|" preview="_cache/fanart/original/80379-10.jpg">fanart/original/80379-10.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-23.jpg">fanart/original/80379-23.jpg</thumb><thumb dim="1280x720" colors="|219,29,39|0,4,10|88,117,135|" preview="_cache/fanart/original/80379-12.jpg">fanart/original/80379-12.jpg</thumb><thumb dim="1920x1080" colors="|226,209,165|51,18,9|89,54,24|" preview="_cache/fanart/original/80379-5.jpg">fanart/original/80379-5.jpg</thumb><thumb dim="1280x720" colors="" preview="_cache/fanart/original/80379-26.jpg">fanart/original/80379-26.jpg</thumb><thumb dim="1280x720" colors="|249,251,229|126,47,53|251,226,
|
||||
107|" preview="_cache/fanart/original/80379-27.jpg">fanart/original/80379-27.jpg</thumb><thumb dim="1920x1080" colors="|233,218,65|30,27,46|173,53,18|" preview="_cache/fanart/original/80379-32.jpg">fanart/original/80379-32.jpg</thumb><thumb dim="1280x720" colors="|248,248,248|64,54,78|188,193,196|" preview="_cache/fanart/original/80379-3.jpg">fanart/original/80379-3.jpg</thumb><thumb dim="1280x720" colors="" preview="_cache/fanart/original/80379-25.jpg">fanart/original/80379-25.jpg</thumb><thumb dim="1280x720" colors="|159,150,133|59,39,32|168,147,104|" preview="_cache/fanart/original/80379-7.jpg">fanart/original/80379-7.jpg</thumb><thumb dim="1920x1080" colors="|221,191,157|11,7,6|237,146,102|" preview="_cache/fanart/original/80379-21.jpg">fanart/original/80379-21.jpg</thumb><thumb dim="1280x720" colors="" preview="_cache/fanart/original/80379-28.jpg">fanart/original/80379-28.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-36.jpg">fanart/original/80379-36.jpg</thumb><thumb
|
||||
dim="1920x1080" colors="|253,237,186|33,25,22|245,144,38|" preview="_cache/fanart/original/80379-38.jpg">fanart/original/80379-38.jpg</thumb><thumb dim="1920x1080" colors="|174,111,68|243,115,50|252,226,45|" preview="_cache/fanart/original/80379-20.jpg">fanart/original/80379-20.jpg</thumb><thumb dim="1920x1080" colors="|63,56,123|87,59,47|63,56,123|" preview="_cache/fanart/original/80379-17.jpg">fanart/original/80379-17.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-43.jpg">fanart/original/80379-43.jpg</thumb><thumb dim="1280x720" colors="|69,68,161|142,118,142|222,191,137|" preview="_cache/fanart/original/80379-22.jpg">fanart/original/80379-22.jpg</thumb><thumb dim="1280x720" colors="|1,108,206|242,209,192|250,197,163|" preview="_cache/fanart/original/80379-15.jpg">fanart/original/80379-15.jpg</thumb><thumb dim="1280x720" colors="|239,229,237|0,0,0|167,136,115|" preview="_cache/fanart/original/80379-18.jpg">fanart/original/80379-18.jpg</thumb><thumb dim="1280x720" colors=""
|
||||
preview="_cache/fanart/original/80379-6.jpg">fanart/original/80379-6.jpg</thumb><thumb dim="1280x720" colors="" preview="_cache/fanart/original/80379-8.jpg">fanart/original/80379-8.jpg</thumb><thumb dim="1280x720" colors="" preview="_cache/fanart/original/80379-41.jpg">fanart/original/80379-41.jpg</thumb><thumb dim="1920x1080" colors="" preview="_cache/fanart/original/80379-44.jpg">fanart/original/80379-44.jpg</thumb><thumb dim="1280x720" colors="" preview="_cache/fanart/original/80379-39.jpg">fanart/original/80379-39.jpg</thumb></fanart>','80379','TV-PG','CBS','','/tmp/tvshows/The.Big.Bang.Theory/','1',NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
CREATE TABLE episode ( idEpisode integer primary key, idFile integer,c00 text,c01 text,c02 text,c03 text,c04 text,c05 text,c06 text,c07 text,c08 text,c09 text,c10 text,c11 text,c12 varchar(24),c13 varchar(24),c14 text,c15 text,c16 text,c17 varchar(24),c18 text,c19 text,c20 text,c21 text,c22 text,c23 text, idShow integer);
|
||||
INSERT INTO "episode" VALUES(1,1,'Pilot','Brilliant physicist roommates Leonard and Sheldon meet their new neighbor Penny, who begins showing them that as much as they know about science, they know little about actual living.','','7.700000','Chuck Lorre / Bill Prady','2007-09-24','<thumb>http://thetvdb.com/banners/episodes/80379/332484.jpg</thumb>','',NULL,'1800','James Burrows','','1','1','','-1','-1','-1','/tmp/tvshows/The.Big.Bang.Theory/The.Big.Bang.Theory.S01E01.WEB-DL.AAC2.0.H264.mkv','2','332484',NULL,NULL,NULL,1);
|
||||
CREATE TABLE tvshowlinkpath (idShow integer, idPath integer);
|
||||
INSERT INTO "tvshowlinkpath" VALUES(1,2);
|
||||
CREATE TABLE seasons ( idSeason integer primary key, idShow integer, season integer);
|
||||
INSERT INTO "seasons" VALUES(1,1,-1);
|
||||
INSERT INTO "seasons" VALUES(2,1,0);
|
||||
INSERT INTO "seasons" VALUES(3,1,1);
|
||||
INSERT INTO "seasons" VALUES(4,1,2);
|
||||
INSERT INTO "seasons" VALUES(5,1,3);
|
||||
INSERT INTO "seasons" VALUES(6,1,4);
|
||||
INSERT INTO "seasons" VALUES(7,1,5);
|
||||
INSERT INTO "seasons" VALUES(8,1,6);
|
||||
INSERT INTO "seasons" VALUES(9,1,7);
|
||||
CREATE TABLE art(art_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, type TEXT, url TEXT);
|
||||
INSERT INTO "art" VALUES(1,1,'actor','thumb','http://thetvdb.com/banners/actors/73597.jpg');
|
||||
INSERT INTO "art" VALUES(2,2,'actor','thumb','http://thetvdb.com/banners/actors/73596.jpg');
|
||||
INSERT INTO "art" VALUES(3,3,'actor','thumb','http://thetvdb.com/banners/actors/73595.jpg');
|
||||
INSERT INTO "art" VALUES(4,4,'actor','thumb','http://thetvdb.com/banners/actors/73599.jpg');
|
||||
INSERT INTO "art" VALUES(5,5,'actor','thumb','http://thetvdb.com/banners/actors/73598.jpg');
|
||||
INSERT INTO "art" VALUES(6,6,'actor','thumb','http://thetvdb.com/banners/actors/283158.jpg');
|
||||
INSERT INTO "art" VALUES(7,7,'actor','thumb','http://thetvdb.com/banners/actors/283157.jpg');
|
||||
INSERT INTO "art" VALUES(8,8,'actor','thumb','http://thetvdb.com/banners/actors/91271.jpg');
|
||||
INSERT INTO "art" VALUES(9,9,'actor','thumb','http://thetvdb.com/banners/actors/294178.jpg');
|
||||
INSERT INTO "art" VALUES(10,10,'actor','thumb','http://thetvdb.com/banners/actors/283159.jpg');
|
||||
INSERT INTO "art" VALUES(11,1,'tvshow','banner','http://thetvdb.com/banners/graphical/80379-g13.jpg');
|
||||
INSERT INTO "art" VALUES(12,1,'tvshow','fanart','http://thetvdb.com/banners/fanart/original/80379-2.jpg');
|
||||
INSERT INTO "art" VALUES(13,1,'tvshow','poster','http://thetvdb.com/banners/posters/80379-22.jpg');
|
||||
INSERT INTO "art" VALUES(14,1,'season','poster','http://thetvdb.com/banners/posters/80379-22.jpg');
|
||||
INSERT INTO "art" VALUES(15,2,'season','banner','http://thetvdb.com/banners/seasonswide/80379-0.jpg');
|
||||
INSERT INTO "art" VALUES(16,2,'season','poster','http://thetvdb.com/banners/seasons/80379-0-4.jpg');
|
||||
INSERT INTO "art" VALUES(17,3,'season','banner','http://thetvdb.com/banners/seasonswide/80379-1-2.jpg');
|
||||
INSERT INTO "art" VALUES(18,3,'season','poster','http://thetvdb.com/banners/seasons/80379-1-12.jpg');
|
||||
INSERT INTO "art" VALUES(19,4,'season','banner','http://thetvdb.com/banners/seasonswide/80379-2-2.jpg');
|
||||
INSERT INTO "art" VALUES(20,4,'season','poster','http://thetvdb.com/banners/seasons/80379-2-11.jpg');
|
||||
INSERT INTO "art" VALUES(21,5,'season','banner','http://thetvdb.com/banners/seasonswide/80379-3-2.jpg');
|
||||
INSERT INTO "art" VALUES(22,5,'season','poster','http://thetvdb.com/banners/seasons/80379-3-9.jpg');
|
||||
INSERT INTO "art" VALUES(23,6,'season','banner','http://thetvdb.com/banners/seasonswide/80379-4-2.jpg');
|
||||
INSERT INTO "art" VALUES(24,6,'season','poster','http://thetvdb.com/banners/seasons/80379-4-8.jpg');
|
||||
INSERT INTO "art" VALUES(25,7,'season','banner','http://thetvdb.com/banners/seasonswide/80379-5.jpg');
|
||||
INSERT INTO "art" VALUES(26,7,'season','poster','http://thetvdb.com/banners/seasons/80379-5-9.jpg');
|
||||
INSERT INTO "art" VALUES(27,8,'season','poster','http://thetvdb.com/banners/seasons/80379-6-8.jpg');
|
||||
INSERT INTO "art" VALUES(28,9,'season','poster','http://thetvdb.com/banners/seasons/80379-7-3.jpg');
|
||||
INSERT INTO "art" VALUES(29,1,'episode','thumb','http://thetvdb.com/banners/episodes/80379/332484.jpg');
|
||||
CREATE INDEX ix_bookmark ON bookmark (idFile, type);
|
||||
CREATE INDEX ix_path ON path ( strPath );
|
||||
CREATE INDEX ix_files ON files ( idPath, strFilename );
|
||||
CREATE UNIQUE INDEX ix_episode_file_1 on episode (idEpisode, idFile);
|
||||
CREATE UNIQUE INDEX id_episode_file_2 on episode (idFile, idEpisode);
|
||||
CREATE INDEX ix_episode_season_episode on episode (c12, c13);
|
||||
CREATE INDEX ix_episode_bookmark on episode (c17);
|
||||
CREATE INDEX ix_episode_show1 on episode(idEpisode,idShow);
|
||||
CREATE INDEX ix_episode_show2 on episode(idShow,idEpisode);
|
||||
CREATE UNIQUE INDEX ix_tvshowlinkpath_1 ON tvshowlinkpath ( idShow, idPath );
|
||||
CREATE UNIQUE INDEX ix_tvshowlinkpath_2 ON tvshowlinkpath ( idPath, idShow );
|
||||
CREATE INDEX ixEpisodeBasePath ON episode ( c19 );
|
||||
CREATE INDEX ixTVShowBasePath on tvshow ( c17 );
|
||||
CREATE INDEX ix_seasons ON seasons (idShow, season);
|
||||
CREATE INDEX ix_art ON art(media_id, media_type, type);
|
||||
CREATE VIEW episodeview
|
||||
AS
|
||||
SELECT episode.*,
|
||||
files.strfilename AS strFileName,
|
||||
path.strpath AS strPath,
|
||||
files.playcount AS playCount,
|
||||
files.lastplayed AS lastPlayed,
|
||||
files.dateadded AS dateAdded,
|
||||
tvshow.c00 AS strTitle,
|
||||
tvshow.c14 AS strStudio,
|
||||
tvshow.c05 AS premiered,
|
||||
tvshow.c13 AS mpaa,
|
||||
tvshow.c16 AS strShowPath,
|
||||
bookmark.timeinseconds AS resumeTimeInSeconds,
|
||||
bookmark.totaltimeinseconds AS totalTimeInSeconds,
|
||||
seasons.idseason AS idSeason
|
||||
FROM episode
|
||||
JOIN files
|
||||
ON files.idfile = episode.idfile
|
||||
JOIN tvshow
|
||||
ON tvshow.idshow = episode.idshow
|
||||
LEFT JOIN seasons
|
||||
ON seasons.idshow = episode.idshow
|
||||
AND seasons.season = episode.c12
|
||||
JOIN path
|
||||
ON files.idpath = path.idpath
|
||||
LEFT JOIN bookmark
|
||||
ON bookmark.idfile = episode.idfile
|
||||
AND bookmark.type = 1;
|
||||
CREATE VIEW tvshowview
|
||||
AS
|
||||
SELECT tvshow.*,
|
||||
path.strpath AS strPath,
|
||||
path.dateadded AS dateAdded,
|
||||
Max(files.lastplayed) AS lastPlayed,
|
||||
NULLIF(Count(episode.c12), 0) AS totalCount,
|
||||
Count(files.playcount) AS watchedcount,
|
||||
NULLIF(Count(DISTINCT( episode.c12 )), 0) AS totalSeasons
|
||||
FROM tvshow
|
||||
LEFT JOIN tvshowlinkpath
|
||||
ON tvshowlinkpath.idshow = tvshow.idshow
|
||||
LEFT JOIN path
|
||||
ON path.idpath = tvshowlinkpath.idpath
|
||||
LEFT JOIN episode
|
||||
ON episode.idshow = tvshow.idshow
|
||||
LEFT JOIN files
|
||||
ON files.idfile = episode.idfile
|
||||
GROUP BY tvshow.idshow;
|
||||
SELECT
|
||||
episodeview.c12,
|
||||
path.strPath,
|
||||
tvshowview.c00,
|
||||
tvshowview.c01,
|
||||
tvshowview.c05,
|
||||
tvshowview.c08,
|
||||
tvshowview.c14,
|
||||
tvshowview.c13,
|
||||
seasons.idSeason,
|
||||
count(1),
|
||||
count(files.playCount)
|
||||
FROM episodeview
|
||||
JOIN tvshowview ON tvshowview.idShow = episodeview.idShow
|
||||
JOIN seasons ON (seasons.idShow = tvshowview.idShow
|
||||
AND seasons.season = episodeview.c12)
|
||||
JOIN files ON files.idFile = episodeview.idFile
|
||||
JOIN tvshowlinkpath ON tvshowlinkpath.idShow = tvshowview.idShow
|
||||
JOIN path ON path.idPath = tvshowlinkpath.idPath
|
||||
WHERE tvshowview.idShow = 1
|
||||
GROUP BY episodeview.c12;
|
||||
} {1 /tmp/tvshows/The.Big.Bang.Theory/ {The Big Bang Theory} {Leonard Hofstadter and Sheldon Cooper are brilliant physicists, the kind of "beautiful minds" that understand how the universe works. But none of that genius helps them interact with people, especially women. All this begins to change when a free-spirited beauty named Penny moves in next door. Sheldon, Leonard's roommate, is quite content spending his nights playing Klingon Boggle with their socially dysfunctional friends, fellow CalTech scientists Howard Wolowitz and Raj Koothrappali. However, Leonard sees in Penny a whole new universe of possibilities... including love.} 2007-09-24 Comedy CBS TV-PG 3 1 0}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
+43
-4
@@ -14,98 +14,120 @@ set pragma_def {
|
||||
NAME: full_column_names
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_FullColNames
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: short_column_names
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_ShortColNames
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: count_changes
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_CountRows
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: empty_result_callbacks
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_NullCallback
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: legacy_file_format
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_LegacyFileFmt
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: fullfsync
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_FullFSync
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: checkpoint_fullfsync
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_CkptFullFSync
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: cache_spill
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_CacheSpill
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: reverse_unordered_selects
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_ReverseOrder
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: query_only
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_QueryOnly
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: automatic_index
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_AutoIndex
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: !defined(SQLITE_OMIT_AUTOMATIC_INDEX)
|
||||
|
||||
NAME: sql_trace
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_SqlTrace
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: defined(SQLITE_DEBUG)
|
||||
|
||||
NAME: vdbe_listing
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_VdbeListing
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: defined(SQLITE_DEBUG)
|
||||
|
||||
NAME: vdbe_trace
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_VdbeTrace
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: defined(SQLITE_DEBUG)
|
||||
|
||||
NAME: vdbe_addoptrace
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_VdbeAddopTrace
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: defined(SQLITE_DEBUG)
|
||||
|
||||
NAME: vdbe_debug
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: defined(SQLITE_DEBUG)
|
||||
|
||||
NAME: ignore_check_constraints
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_IgnoreChecks
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: !defined(SQLITE_OMIT_CHECK)
|
||||
|
||||
NAME: writable_schema
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_WriteSchema|SQLITE_RecoveryMode
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: read_uncommitted
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_ReadUncommitted
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: recursive_triggers
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_RecTriggers
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: foreign_keys
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_ForeignKeys
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
|
||||
NAME: defer_foreign_keys
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_DeferFKs
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
|
||||
NAME: default_cache_size
|
||||
@@ -172,6 +194,10 @@ set pragma_def {
|
||||
FLAG: NeedSchema
|
||||
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
||||
|
||||
NAME: stats
|
||||
FLAG: NeedSchema
|
||||
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
||||
|
||||
NAME: index_info
|
||||
FLAG: NeedSchema
|
||||
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
||||
@@ -263,6 +289,7 @@ set pragma_def {
|
||||
|
||||
NAME: soft_heap_limit
|
||||
}
|
||||
fconfigure stdout -translation lf
|
||||
set name {}
|
||||
set type {}
|
||||
set if {}
|
||||
@@ -292,7 +319,7 @@ foreach line [split $pragma_def \n] {
|
||||
} elseif {$id=="ARG"} {
|
||||
set arg $val
|
||||
} elseif {$id=="IF"} {
|
||||
set if $val
|
||||
lappend if $val
|
||||
} elseif {$id=="FLAG"} {
|
||||
foreach term [split $val] {
|
||||
lappend flags $term
|
||||
@@ -358,9 +385,17 @@ set spacer [format { %26s } {}]
|
||||
foreach name $allnames {
|
||||
foreach {type arg if flag} $allbyname($name) break
|
||||
if {$if!=$current_if} {
|
||||
if {$current_if!=""} {puts "#endif"}
|
||||
if {$current_if!=""} {
|
||||
foreach this_if $current_if {
|
||||
puts "#endif"
|
||||
}
|
||||
}
|
||||
set current_if $if
|
||||
if {$current_if!=""} {puts "#if $current_if"}
|
||||
if {$current_if!=""} {
|
||||
foreach this_if $current_if {
|
||||
puts "#if $this_if"
|
||||
}
|
||||
}
|
||||
}
|
||||
set typex [format PragTyp_%-23s $type,]
|
||||
if {$flag==""} {
|
||||
@@ -373,7 +408,11 @@ foreach name $allnames {
|
||||
puts " /* ePragFlag: */ $flagx,"
|
||||
puts " /* iArg: */ $arg \175,"
|
||||
}
|
||||
if {$current_if!=""} {puts "#endif"}
|
||||
if {$current_if!=""} {
|
||||
foreach this_if $current_if {
|
||||
puts "#endif"
|
||||
}
|
||||
}
|
||||
puts "\175;"
|
||||
|
||||
# count the number of pragmas, for information purposes
|
||||
|
||||
Reference in New Issue
Block a user