diff --git a/Makefile.msc b/Makefile.msc index 43c91e92e2..02a5cacf26 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -19,6 +19,12 @@ USE_ICU = 0 # USE_CRT_DLL = 0 +# Set this non-0 to attempt setting the native compiler automatically +# for cross-compiling the command line tools needed during the compilation +# process. +# +XCOMPILE = 0 + # Set this non-0 to use the native libraries paths for cross-compiling # the command line tools needed during the compilation process. # @@ -85,11 +91,21 @@ LD = link.exe # line similar to the following could be used (all on one line): # # nmake /f Makefile.msc sqlite3.dll +# XCOMPILE=1 USE_NATIVE_LIBPATHS=1 +# +# Alternatively, the full path and file name to the compiler binary for the +# platform the compilation process is taking place may be specified (all on +# one line): +# +# nmake /f Makefile.msc sqlite3.dll # "NCC=""%VCINSTALLDIR%\bin\cl.exe""" # USE_NATIVE_LIBPATHS=1 # !IFDEF NCC NCC = $(NCC:\\=\) +!ELSEIF $(XCOMPILE)!=0 +NCC = "$(VCINSTALLDIR)\bin\cl.exe" +NCC = $(NCC:\\=\) !ELSE NCC = $(CC) !ENDIF diff --git a/doc/lemon.html b/doc/lemon.html index 2c65555972..b16e35960e 100644 --- a/doc/lemon.html +++ b/doc/lemon.html @@ -481,7 +481,7 @@ as follows:
+** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->
+** TemporaryFolder->Path->Data();
+** char zPathBuf[MAX_PATH + 1];
+** memset(zPathBuf, 0, sizeof(zPathBuf));
+** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
+** NULL, NULL);
+** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf);
+**
*/
SQLITE_EXTERN char *sqlite3_temp_directory;
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 18a5088628..c7280b03c5 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1925,7 +1925,7 @@ struct WherePlan {
/*
** For each nested loop in a WHERE clause implementation, the WhereInfo
** structure contains a single instance of this structure. This structure
-** is intended to be private the the where.c module and should not be
+** is intended to be private to the where.c module and should not be
** access or modified by other modules.
**
** The pIdxInfo field is used to help pick the best index on a
diff --git a/src/test4.c b/src/test4.c
index 5c94370a3d..5b4c5a1c17 100644
--- a/src/test4.c
+++ b/src/test4.c
@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
-** Code for testing the the SQLite library in a multithreaded environment.
+** Code for testing the SQLite library in a multithreaded environment.
*/
#include "sqliteInt.h"
#include "tcl.h"
diff --git a/src/test_spellfix.c b/src/test_spellfix.c
index 68247fed0f..e5fdac42bc 100644
--- a/src/test_spellfix.c
+++ b/src/test_spellfix.c
@@ -222,7 +222,8 @@ static unsigned char *phoneticHash(const unsigned char *zIn, int nIn){
if( c==CCLASS_SILENT ) continue;
cPrevX = c;
c = className[c];
- if( c!=zOut[nOut-1] ) zOut[nOut++] = c;
+ assert( nOut>=0 );
+ if( nOut==0 || c!=zOut[nOut-1] ) zOut[nOut++] = c;
}
zOut[nOut] = 0;
return zOut;
diff --git a/src/test_vfstrace.c b/src/test_vfstrace.c
index 3a0e2cf03e..d2f7455e3d 100644
--- a/src/test_vfstrace.c
+++ b/src/test_vfstrace.c
@@ -45,7 +45,7 @@
** interprets VFS calls before passing them off to another VFS which does
** the actual work. In this case the other VFS - the one that does the
** real work - is identified by the second parameter, zOldVfsName. If
-** the the 2nd parameter is NULL then the default VFS is used. The common
+** the 2nd parameter is NULL then the default VFS is used. The common
** case is for the 2nd parameter to be NULL.
**
** The third and fourth parameters are the pointer to the output function
diff --git a/src/trigger.c b/src/trigger.c
index 3c4bf62a18..8985ec6eb8 100644
--- a/src/trigger.c
+++ b/src/trigger.c
@@ -111,7 +111,7 @@ void sqlite3BeginTrigger(
iDb = 1;
pName = pName1;
}else{
- /* Figure out the db that the the trigger will be created in */
+ /* Figure out the db that the trigger will be created in */
iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);
if( iDb<0 ){
goto trigger_cleanup;
diff --git a/src/vdbe.c b/src/vdbe.c
index 2407984400..2f42ae2600 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -666,7 +666,7 @@ int sqlite3VdbeExec(
}
#endif
- /* On any opcode with the "out2-prerelase" tag, free any
+ /* On any opcode with the "out2-prerelease" tag, free any
** external allocations out of mem[p2] and set mem[p2] to be
** an undefined integer. Opcodes will either fill in the integer
** value or convert mem[p2] to a different type.
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 79ec08ee40..e722056644 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -775,7 +775,7 @@ void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
#ifndef NDEBUG
/*
-** Change the comment on the the most recently coded instruction. Or
+** Change the comment on the most recently coded instruction. Or
** insert a No-op and add the comment to that new instruction. This
** makes the code easier to read during debugging. None of this happens
** in a production build.
diff --git a/src/vtab.c b/src/vtab.c
index 0e082a05d9..50d576fc38 100644
--- a/src/vtab.c
+++ b/src/vtab.c
@@ -131,7 +131,7 @@ void sqlite3VtabUnlock(VTable *pVTab){
assert( db );
assert( pVTab->nRef>0 );
- assert( sqlite3SafetyCheckOk(db) );
+ assert( db->magic==SQLITE_MAGIC_OPEN || db->magic==SQLITE_MAGIC_ZOMBIE );
pVTab->nRef--;
if( pVTab->nRef==0 ){
diff --git a/src/wal.c b/src/wal.c
index 28749fd31e..cc166ba430 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -150,7 +150,7 @@
** more index blocks.
**
** The wal-index header contains the total number of frames within the WAL
-** in the the mxFrame field.
+** in the mxFrame field.
**
** Each index block except for the first contains information on
** HASHTABLE_NPAGE frames. The first index block contains information on
diff --git a/src/where.c b/src/where.c
index a460abc2d7..9bbbd43d10 100644
--- a/src/where.c
+++ b/src/where.c
@@ -5093,10 +5093,10 @@ WhereInfo *sqlite3WhereBegin(
if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){
Index *pIx = pLevel->plan.u.pIdx;
KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIx);
- int iIdxCur = pLevel->iIdxCur;
+ int iIndexCur = pLevel->iIdxCur;
assert( pIx->pSchema==pTab->pSchema );
- assert( iIdxCur>=0 );
- sqlite3VdbeAddOp4(v, OP_OpenRead, iIdxCur, pIx->tnum, iDb,
+ assert( iIndexCur>=0 );
+ sqlite3VdbeAddOp4(v, OP_OpenRead, iIndexCur, pIx->tnum, iDb,
(char*)pKey, P4_KEYINFO_HANDOFF);
VdbeComment((v, "%s", pIx->zName));
}
diff --git a/test/crash.test b/test/crash.test
index f644dcaf73..c1901daec6 100644
--- a/test/crash.test
+++ b/test/crash.test
@@ -119,7 +119,7 @@ do_test crash-1.11 {
} {0 {}}
#--------------------------------------------------------------------------
-# The following tests test recovery when both the database file and the the
+# The following tests test recovery when both the database file and the
# journal file contain corrupt data. This can happen after pages are
# written to the database file before a transaction is committed due to
# cache-pressure.
diff --git a/test/journal1.test b/test/journal1.test
index 2fdadfd68c..c89dd2b4c9 100644
--- a/test/journal1.test
+++ b/test/journal1.test
@@ -41,7 +41,7 @@ do_test journal1-1.1 {
} 8
# Make changes to the database and save the journal file.
-# Then delete the database. Replace the the journal file
+# Then delete the database. Replace the journal file
# and try to create a new database with the same name. The
# old journal should not attempt to rollback into the new
# database.
diff --git a/test/permutations.test b/test/permutations.test
index c59eb29cdb..6bbdd9b83f 100644
--- a/test/permutations.test
+++ b/test/permutations.test
@@ -145,7 +145,7 @@ test_suite "valgrind" -prefix "" -description {
Run the "veryquick" test suite with a couple of multi-process tests (that
fail under valgrind) omitted.
} -files [
- test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test
+ test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test atof1.test
] -initialize {
set ::G(valgrind) 1
} -shutdown {
diff --git a/test/rowid.test b/test/rowid.test
index 4a9404defb..5daf581ea6 100644
--- a/test/rowid.test
+++ b/test/rowid.test
@@ -657,7 +657,7 @@ do_test rowid-11.4 {
# Test the automatic generation of rowids when the table already contains
# a rowid with the maximum value.
#
-# Once the the maximum rowid is taken, rowids are normally chosen at
+# Once the maximum rowid is taken, rowids are normally chosen at
# random. By by reseting the random number generator, we can cause
# the rowid guessing loop to collide with prior rowids, and test the
# loop out to its limit of 100 iterations. After 100 collisions, the
diff --git a/test/select6.test b/test/select6.test
index e0ff165c55..64a8519d89 100644
--- a/test/select6.test
+++ b/test/select6.test
@@ -22,6 +22,7 @@ ifcapable !subquery {
finish_test
return
}
+set ::testprefix select6
do_test select6-1.0 {
execsql {
@@ -513,5 +514,48 @@ do_test select6-9.11 {
} {2 12 3 13 4 14}
+#-------------------------------------------------------------------------
+# Test that if a UNION ALL sub-query that would otherwise be eligible for
+# flattening consists of two or more SELECT statements that do not all
+# return the same number of result columns, the error is detected.
+#
+do_execsql_test 10.1 {
+ CREATE TABLE t(i,j,k);
+ CREATE TABLE j(l,m);
+ CREATE TABLE k(o);
+}
+
+set err [list 1 {SELECTs to the left and right of UNION ALL do not have the same number of result columns}]
+
+do_execsql_test 10.2 {
+ SELECT * FROM (SELECT * FROM t), j;
+}
+do_catchsql_test 10.3 {
+ SELECT * FROM t UNION ALL SELECT * FROM j
+} $err
+do_catchsql_test 10.4 {
+ SELECT * FROM (SELECT i FROM t UNION ALL SELECT l, m FROM j)
+} $err
+do_catchsql_test 10.5 {
+ SELECT * FROM (SELECT j FROM t UNION ALL SELECT * FROM j)
+} $err
+do_catchsql_test 10.6 {
+ SELECT * FROM (SELECT * FROM t UNION ALL SELECT * FROM j)
+} $err
+do_catchsql_test 10.7 {
+ SELECT * FROM (
+ SELECT * FROM t UNION ALL
+ SELECT l,m,l FROM j UNION ALL
+ SELECT * FROM k
+ )
+} $err
+do_catchsql_test 10.8 {
+ SELECT * FROM (
+ SELECT * FROM k UNION ALL
+ SELECT * FROM t UNION ALL
+ SELECT l,m,l FROM j
+ )
+} $err
+
finish_test
diff --git a/test/wal2.test b/test/wal2.test
index 22db67991f..4371e988b2 100644
--- a/test/wal2.test
+++ b/test/wal2.test
@@ -86,7 +86,7 @@ proc incr_tvfs_hdr {file idx incrval} {
#
# 2. Attempt to read the database using the reader. Before the reader
# has a chance to snapshot the wal-index header, increment one
-# of the the integer fields (so that the reader ends up with a corrupted
+# of the integer fields (so that the reader ends up with a corrupted
# header).
#
# 3. Check that the reader recovers the wal-index and reads the correct