+
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
# define NDEBUG 1
#endif
diff --git a/ext/fts3/fts3_snippet.c b/ext/fts3/fts3_snippet.c
index 36ee94a48b..9c7f0ade97 100644
--- a/ext/fts3/fts3_snippet.c
+++ b/ext/fts3/fts3_snippet.c
@@ -1027,16 +1027,16 @@ static size_t fts3MatchinfoSize(MatchInfo *pInfo, char cArg){
break;
case FTS3_MATCHINFO_LHITS:
- nVal = pInfo->nCol * pInfo->nPhrase;
+ nVal = (size_t)pInfo->nCol * pInfo->nPhrase;
break;
case FTS3_MATCHINFO_LHITS_BM:
- nVal = pInfo->nPhrase * ((pInfo->nCol + 31) / 32);
+ nVal = (size_t)pInfo->nPhrase * ((pInfo->nCol + 31) / 32);
break;
default:
assert( cArg==FTS3_MATCHINFO_HITS );
- nVal = pInfo->nCol * pInfo->nPhrase * 3;
+ nVal = (size_t)pInfo->nCol * pInfo->nPhrase * 3;
break;
}
diff --git a/ext/fts3/fts3_test.c b/ext/fts3/fts3_test.c
index 3c42a7bf02..70bccf0c52 100644
--- a/ext/fts3/fts3_test.c
+++ b/ext/fts3/fts3_test.c
@@ -219,7 +219,7 @@ static int SQLITE_TCLAPI fts3_near_match_cmd(
rc = Tcl_ListObjGetElements(interp, pPhrase, &nToken, &apToken);
if( rc!=TCL_OK ) goto near_match_out;
if( nToken>NM_MAX_TOKEN ){
- Tcl_AppendResult(interp, "Too many tokens in phrase", 0);
+ Tcl_AppendResult(interp, "Too many tokens in phrase", NULL);
rc = TCL_ERROR;
goto near_match_out;
}
@@ -547,7 +547,7 @@ static int SQLITE_TCLAPI fts3_test_varint_cmd(
if( w!=w2 || nByte!=nByte2 ){
char *zErr = sqlite3_mprintf("error testing %lld", w);
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, zErr, 0);
+ Tcl_AppendResult(interp, zErr, NULL);
return TCL_ERROR;
}
@@ -557,7 +557,7 @@ static int SQLITE_TCLAPI fts3_test_varint_cmd(
if( (int)w!=i || nByte!=nByte2 ){
char *zErr = sqlite3_mprintf("error testing %lld (32-bit)", w);
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, zErr, 0);
+ Tcl_AppendResult(interp, zErr, NULL);
return TCL_ERROR;
}
}
diff --git a/ext/fts3/fts3_tokenize_vtab.c b/ext/fts3/fts3_tokenize_vtab.c
index 7e8d09bd48..b9d83982c8 100644
--- a/ext/fts3/fts3_tokenize_vtab.c
+++ b/ext/fts3/fts3_tokenize_vtab.c
@@ -346,7 +346,7 @@ static int fts3tokFilterMethod(
fts3tokResetCursor(pCsr);
if( idxNum==1 ){
const char *zByte = (const char *)sqlite3_value_text(apVal[0]);
- int nByte = sqlite3_value_bytes(apVal[0]);
+ sqlite3_int64 nByte = sqlite3_value_bytes(apVal[0]);
pCsr->zInput = sqlite3_malloc64(nByte+1);
if( pCsr->zInput==0 ){
rc = SQLITE_NOMEM;
diff --git a/ext/fts5/fts5_test_mi.c b/ext/fts5/fts5_test_mi.c
index f56c890cd7..e8648a4d22 100644
--- a/ext/fts5/fts5_test_mi.c
+++ b/ext/fts5/fts5_test_mi.c
@@ -14,7 +14,7 @@
** versions of FTS5. It contains the implementation of an FTS5 auxiliary
** function very similar to the FTS4 function matchinfo():
**
-** https://www.sqlite.org/fts3.html#matchinfo
+** https://sqlite.org/fts3.html#matchinfo
**
** Known differences are that:
**
diff --git a/ext/fts5/fts5_unicode2.c b/ext/fts5/fts5_unicode2.c
index cc164a4569..2133d5d5b8 100644
--- a/ext/fts5/fts5_unicode2.c
+++ b/ext/fts5/fts5_unicode2.c
@@ -778,4 +778,3 @@ void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii){
}
aAscii[0] = 0; /* 0x00 is never a token character */
}
-
diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile
index 668b6e0841..f2fc7fb7bd 100644
--- a/ext/jni/GNUmakefile
+++ b/ext/jni/GNUmakefile
@@ -429,7 +429,7 @@ $(doc.index): $(JAVA_FILES.main) $(MAKEFILE)
.FORCE: doc
doc: $(doc.index)
javadoc: $(doc.index)
-# Force rebild of docs
+# Force rebuild of docs
redoc:
@rm -f $(doc.index)
@$(MAKE) doc
diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c
index 6bd6daaec8..d6723453d0 100644
--- a/ext/jni/src/c/sqlite3-jni.c
+++ b/ext/jni/src/c/sqlite3-jni.c
@@ -133,7 +133,7 @@
** Which sqlite3.c we're using needs to be configurable to enable
** building against a custom copy, e.g. the SEE variant. We have to
** include sqlite3.c, as opposed to sqlite3.h, in order to get access
-** to some interal details like SQLITE_MAX_... and friends. This
+** to some internal details like SQLITE_MAX_... and friends. This
** increases the rebuild time considerably but we need this in order
** to access some internal functionality and keep the to-Java-exported
** values of SQLITE_MAX_... and SQLITE_LIMIT_... in sync with the C
@@ -5512,7 +5512,7 @@ static inline jobject new_java_fts5_api(JNIEnv * const env, fts5_api *sv){
** Returns a per-JNIEnv global ref to the Fts5ExtensionApi singleton
** instance, or NULL on OOM.
*/
-static jobject s3jni_getFts5ExensionApi(JNIEnv * const env){
+static jobject s3jni_getFts5ExtensionApi(JNIEnv * const env){
if( !SJG.fts5.jExt ){
S3JniGlobal_mutex_enter;
if( !SJG.fts5.jExt ){
@@ -5578,7 +5578,7 @@ JniDeclFtsApi(jobject,getInstanceForDb)(JniArgsEnvClass,jobject jDb){
JniDeclFtsXA(jobject,getInstance)(JniArgsEnvClass){
- return s3jni_getFts5ExensionApi(env);
+ return s3jni_getFts5ExtensionApi(env);
}
JniDeclFtsXA(jint,xColumnCount)(JniArgsEnvObj,jobject jCtx){
@@ -5641,7 +5641,7 @@ static void s3jni_fts5_extension_function(Fts5ExtensionApi const *pApi,
S3JniDeclLocal_env;
assert(pAux);
- jFXA = s3jni_getFts5ExensionApi(env);
+ jFXA = s3jni_getFts5ExtensionApi(env);
if( !jFXA ) goto error_oom;
jpFts = new_java_Fts5Context(env, pFts);
if( !jpFts ) goto error_oom;
diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h
index 082a202122..6f93bf8ab7 100644
--- a/ext/jni/src/c/sqlite3-jni.h
+++ b/ext/jni/src/c/sqlite3-jni.h
@@ -1342,7 +1342,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1data_1count
* Method: sqlite3_db_config
* Signature: (Lorg/sqlite/jni/capi/sqlite3;IILorg/sqlite/jni/capi/OutputPointer/Int32;)I
*/
-JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_Int32_2
+JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_00024Int32_2
(JNIEnv *, jclass, jobject, jint, jint, jobject);
/*
diff --git a/ext/jni/src/org/sqlite/jni/annotation/NotNull.java b/ext/jni/src/org/sqlite/jni/annotation/NotNull.java
index 0c31782f23..2873082446 100644
--- a/ext/jni/src/org/sqlite/jni/annotation/NotNull.java
+++ b/ext/jni/src/org/sqlite/jni/annotation/NotNull.java
@@ -31,11 +31,11 @@ import java.lang.annotation.*;
never pass a null value to the callback for that parameter.
Passing a null, for this annotation's definition of null, for
- any parameter marked with this annoation specifically invokes
+ any parameter marked with this annotation specifically invokes
undefined behavior (see below).
Passing 0 (i.e. C NULL) or a negative value for any long-type
- parameter marked with this annoation specifically invokes undefined
+ parameter marked with this annotation specifically invokes undefined
behavior (see below). Such values are treated as C pointers in the
JNI layer.
diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java
index 13367a6102..731fb0ac3b 100644
--- a/ext/jni/src/org/sqlite/jni/capi/CApi.java
+++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java
@@ -12,14 +12,9 @@
** This file declares the main JNI bindings for the sqlite3 C API.
*/
package org.sqlite.jni.capi;
-import java.nio.charset.StandardCharsets;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import org.sqlite.jni.annotation.*;
import java.util.Arrays;
+import java.nio.charset.StandardCharsets;
+import org.sqlite.jni.annotation.*;
/**
This class contains the entire C-style sqlite3 JNI API binding,
@@ -169,7 +164,7 @@ public final class CApi {
Like the C API, it returns 0 if allocation fails or if
initialize is false and no prior aggregate context was allocated
for cx. If initialize is true then it returns 0 only on
- allocation error. In all casses, 0 is considered the sentinel
+ allocation error. In all cases, 0 is considered the sentinel
"not a key" value.
*/
public static native long sqlite3_aggregate_context(sqlite3_context cx, boolean initialize);
@@ -563,7 +558,7 @@ public final class CApi {
sqlite3_blob_open(db.getNativePointer(), dbName, tableName, columnName,
iRow, flags, out);
return out.take();
- };
+ }
private static native int sqlite3_blob_read(
@NotNull long ptrToBlob, @NotNull byte[] target, int srcOffset
@@ -1298,7 +1293,7 @@ public final class CApi {
final OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
sqlite3_open(filename, out);
return out.take();
- };
+ }
public static native int sqlite3_open_v2(
@Nullable String filename, @NotNull OutputPointer.sqlite3 ppDb,
@@ -1314,7 +1309,7 @@ public final class CApi {
final OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
sqlite3_open_v2(filename, out, flags, zVfs);
return out.take();
- };
+ }
/**
The sqlite3_prepare() family of functions require slightly
@@ -1410,7 +1405,7 @@ public final class CApi {
/**
Works like the canonical sqlite3_prepare_v2() but its "tail"
- output paramter is returned as the index offset into the given
+ output parameter is returned as the index offset into the given
byte array at which SQL parsing stopped.
*/
public static int sqlite3_prepare_v2(
@@ -1462,7 +1457,7 @@ public final class CApi {
/**
Works like the canonical sqlite3_prepare_v2() but its "tail"
- output paramter is returned as the index offset into the given
+ output parameter is returned as the index offset into the given
byte array at which SQL parsing stopped.
*/
public static int sqlite3_prepare_v3(
@@ -1542,7 +1537,7 @@ public final class CApi {
int rc = 0;
final OutputPointer.sqlite3_stmt outStmt = new OutputPointer.sqlite3_stmt();
while( 0==rc && pos0 ){
sqlChunk = Arrays.copyOfRange(sqlChunk, pos,
sqlChunk.length);
diff --git a/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java b/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java
index ffd7761190..04000a3f31 100644
--- a/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java
+++ b/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java
@@ -13,7 +13,7 @@
*/
package org.sqlite.jni.capi;
/**
- This marker interface exists soley for use as a documentation and
+ This marker interface exists solely for use as a documentation and
class-grouping tool. It should be applied to interfaces or
classes which have a call() method implementing some specific
callback interface on behalf of the C library.
@@ -34,7 +34,7 @@ package org.sqlite.jni.capi;
proxying for, minus the {@code sqlite3_} prefix, plus a {@code
Callback} suffix. e.g. {@code sqlite3_busy_handler()}'s callback is
named {@code BusyHandlerCallback}. Exceptions are made where that
- would potentially be ambiguous, e.g. {@link ConfigSqllogCallback}
+ would potentially be ambiguous, e.g. {@link ConfigSqlLogCallback}
instead of {@code ConfigCallback} because the {@code
sqlite3_config()} interface may need to support more callback types
in the future.
diff --git a/ext/jni/src/org/sqlite/jni/capi/OutputPointer.java b/ext/jni/src/org/sqlite/jni/capi/OutputPointer.java
index 7bf7529da1..f50d0c57cb 100644
--- a/ext/jni/src/org/sqlite/jni/capi/OutputPointer.java
+++ b/ext/jni/src/org/sqlite/jni/capi/OutputPointer.java
@@ -20,7 +20,7 @@ package org.sqlite.jni.capi;
from the native JNI code is unduly quirky due to a lack of
autoboxing at that level.
- The usage is similar for all of thes types:
+
The usage is similar for all of these types:
{@code
OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
@@ -55,9 +55,9 @@ public final class OutputPointer {
/** Sets the current value to null. */
public void clear(){value = null;}
/** Returns the current value. */
- public final org.sqlite.jni.capi.sqlite3 get(){return value;}
+ public org.sqlite.jni.capi.sqlite3 get(){return value;}
/** Equivalent to calling get() then clear(). */
- public final org.sqlite.jni.capi.sqlite3 take(){
+ public org.sqlite.jni.capi.sqlite3 take(){
final org.sqlite.jni.capi.sqlite3 v = value;
value = null;
return v;
@@ -76,9 +76,9 @@ public final class OutputPointer {
/** Sets the current value to null. */
public void clear(){value = null;}
/** Returns the current value. */
- public final org.sqlite.jni.capi.sqlite3_blob get(){return value;}
+ public org.sqlite.jni.capi.sqlite3_blob get(){return value;}
/** Equivalent to calling get() then clear(). */
- public final org.sqlite.jni.capi.sqlite3_blob take(){
+ public org.sqlite.jni.capi.sqlite3_blob take(){
final org.sqlite.jni.capi.sqlite3_blob v = value;
value = null;
return v;
@@ -98,9 +98,9 @@ public final class OutputPointer {
/** Sets the current value to null. */
public void clear(){value = null;}
/** Returns the current value. */
- public final org.sqlite.jni.capi.sqlite3_stmt get(){return value;}
+ public org.sqlite.jni.capi.sqlite3_stmt get(){return value;}
/** Equivalent to calling get() then clear(). */
- public final org.sqlite.jni.capi.sqlite3_stmt take(){
+ public org.sqlite.jni.capi.sqlite3_stmt take(){
final org.sqlite.jni.capi.sqlite3_stmt v = value;
value = null;
return v;
@@ -120,9 +120,9 @@ public final class OutputPointer {
/** Sets the current value to null. */
public void clear(){value = null;}
/** Returns the current value. */
- public final org.sqlite.jni.capi.sqlite3_value get(){return value;}
+ public org.sqlite.jni.capi.sqlite3_value get(){return value;}
/** Equivalent to calling get() then clear(). */
- public final org.sqlite.jni.capi.sqlite3_value take(){
+ public org.sqlite.jni.capi.sqlite3_value take(){
final org.sqlite.jni.capi.sqlite3_value v = value;
value = null;
return v;
@@ -144,9 +144,9 @@ public final class OutputPointer {
/** Initializes with the value v. */
public Bool(boolean v){value = v;}
/** Returns the current value. */
- public final boolean get(){return value;}
+ public boolean get(){return value;}
/** Sets the current value to v. */
- public final void set(boolean v){value = v;}
+ public void set(boolean v){value = v;}
}
/**
@@ -164,9 +164,9 @@ public final class OutputPointer {
/** Initializes with the value v. */
public Int32(int v){value = v;}
/** Returns the current value. */
- public final int get(){return value;}
+ public int get(){return value;}
/** Sets the current value to v. */
- public final void set(int v){value = v;}
+ public void set(int v){value = v;}
}
/**
@@ -184,9 +184,9 @@ public final class OutputPointer {
/** Initializes with the value v. */
public Int64(long v){value = v;}
/** Returns the current value. */
- public final long get(){return value;}
+ public long get(){return value;}
/** Sets the current value. */
- public final void set(long v){value = v;}
+ public void set(long v){value = v;}
}
/**
@@ -204,9 +204,9 @@ public final class OutputPointer {
/** Initializes with the value v. */
public String(java.lang.String v){value = v;}
/** Returns the current value. */
- public final java.lang.String get(){return value;}
+ public java.lang.String get(){return value;}
/** Sets the current value. */
- public final void set(java.lang.String v){value = v;}
+ public void set(java.lang.String v){value = v;}
}
/**
@@ -224,9 +224,9 @@ public final class OutputPointer {
/** Initializes with the value v. */
public ByteArray(byte[] v){value = v;}
/** Returns the current value. */
- public final byte[] get(){return value;}
+ public byte[] get(){return value;}
/** Sets the current value. */
- public final void set(byte[] v){value = v;}
+ public void set(byte[] v){value = v;}
}
/**
@@ -246,8 +246,8 @@ public final class OutputPointer {
/** Initializes with the value v. */
public ByteBuffer(java.nio.ByteBuffer v){value = v;}
/** Returns the current value. */
- public final java.nio.ByteBuffer get(){return value;}
+ public java.nio.ByteBuffer get(){return value;}
/** Sets the current value. */
- public final void set(java.nio.ByteBuffer v){value = v;}
+ public void set(java.nio.ByteBuffer v){value = v;}
}
}
diff --git a/ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java b/ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java
index af242fb3c1..35bb069c49 100644
--- a/ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java
+++ b/ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java
@@ -65,7 +65,7 @@ public interface PrepareMultiCallback extends CallbackProxy {
A PrepareMultiCallback impl which steps entirely through a result set,
ignoring all non-error results.
*/
- public static final class StepAll implements PrepareMultiCallback {
+ final class StepAll implements PrepareMultiCallback {
public StepAll(){}
/**
Calls sqlite3_step() on st until it returns something other than
diff --git a/ext/jni/src/org/sqlite/jni/capi/SQLTester.java b/ext/jni/src/org/sqlite/jni/capi/SQLTester.java
index 634f844c24..bc2e75f8be 100644
--- a/ext/jni/src/org/sqlite/jni/capi/SQLTester.java
+++ b/ext/jni/src/org/sqlite/jni/capi/SQLTester.java
@@ -13,7 +13,6 @@
** SQLTester framework.
*/
package org.sqlite.jni.capi;
-import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.nio.charset.StandardCharsets;
@@ -31,7 +30,7 @@ enum ResultBufferMode {
ESCAPED,
//! Append output as-is
ASIS
-};
+}
/**
Modes to specify how to emit multi-row output from
@@ -42,7 +41,7 @@ enum ResultRowMode {
ONELINE,
//! Add a newline between each result row.
NEWLINE
-};
+}
/**
Base exception type for test-related failures.
@@ -278,7 +277,7 @@ public class SQLTester {
}
private StringBuilder clearBuffer(StringBuilder b){
- b.setLength(0);;
+ b.setLength(0);
return b;
}
@@ -334,7 +333,7 @@ public class SQLTester {
return this;
}
- sqlite3 setCurrentDb(int n) throws Exception{
+ sqlite3 setCurrentDb(int n){
affirmDbId(n);
iCurrentDb = n;
return this.aDb[n];
@@ -342,7 +341,7 @@ public class SQLTester {
sqlite3 getCurrentDb(){ return aDb[iCurrentDb]; }
- sqlite3 getDbById(int id) throws Exception{
+ sqlite3 getDbById(int id){
return affirmDbId(id).aDb[id];
}
@@ -363,7 +362,7 @@ public class SQLTester {
}
}
- sqlite3 openDb(String name, boolean createIfNeeded) throws DbException {
+ sqlite3 openDb(String name, boolean createIfNeeded) {
closeDb();
int flags = SQLITE_OPEN_READWRITE;
if( createIfNeeded ) flags |= SQLITE_OPEN_CREATE;
@@ -755,7 +754,7 @@ abstract class Command {
fall in the inclusive range (min,max) then this function throws. Use
a max value of -1 to mean unlimited.
*/
- protected final void argcCheck(TestScript ts, String[] argv, int min, int max) throws Exception{
+ protected final void argcCheck(TestScript ts, String[] argv, int min, int max){
int argc = argv.length-1;
if(argc=0 && argc>max)){
if( min==max ){
@@ -771,16 +770,16 @@ abstract class Command {
/**
Equivalent to argcCheck(argv,argc,argc).
*/
- protected final void argcCheck(TestScript ts, String[] argv, int argc) throws Exception{
+ protected final void argcCheck(TestScript ts, String[] argv, int argc){
argcCheck(ts, argv, argc, argc);
}
}
//! --close command
class CloseDbCommand extends Command {
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,0,1);
- Integer id;
+ int id;
if(argv.length>1){
String arg = argv[1];
if("all".equals(arg)){
@@ -801,7 +800,7 @@ class CloseDbCommand extends Command {
class ColumnNamesCommand extends Command {
public void process(
SQLTester st, TestScript ts, String[] argv
- ) throws Exception{
+ ){
argcCheck(ts,argv,1);
st.outputColumnNames( Integer.parseInt(argv[1])!=0 );
}
@@ -809,7 +808,7 @@ class ColumnNamesCommand extends Command {
//! --db command
class DbCommand extends Command {
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,1);
t.setCurrentDb( Integer.parseInt(argv[1]) );
}
@@ -821,7 +820,7 @@ class GlobCommand extends Command {
public GlobCommand(){}
protected GlobCommand(boolean negate){ this.negate = negate; }
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,1,-1);
t.incrementTestCounter();
final String sql = t.takeInputBuffer();
@@ -851,7 +850,7 @@ class JsonBlockCommand extends TableResultCommand {
//! --new command
class NewDbCommand extends OpenDbCommand {
public NewDbCommand(){ super(true); }
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
if(argv.length>1){
Util.unlink(argv[1]);
}
@@ -867,7 +866,7 @@ class NoopCommand extends Command {
this.verbose = verbose;
}
public NoopCommand(){}
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
if( this.verbose ){
t.outln("Skipping unhandled command: "+argv[0]);
}
@@ -885,7 +884,7 @@ class NotGlobCommand extends GlobCommand {
class NullCommand extends Command {
public void process(
SQLTester st, TestScript ts, String[] argv
- ) throws Exception{
+ ){
argcCheck(ts,argv,1);
st.setNullValue( argv[1] );
}
@@ -896,7 +895,7 @@ class OpenDbCommand extends Command {
private boolean createIfNeeded = false;
public OpenDbCommand(){}
protected OpenDbCommand(boolean c){createIfNeeded = c;}
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,1);
t.openDb(argv[1], createIfNeeded);
}
@@ -906,7 +905,7 @@ class OpenDbCommand extends Command {
class PrintCommand extends Command {
public void process(
SQLTester st, TestScript ts, String[] argv
- ) throws Exception{
+ ){
st.out(ts.getOutputPrefix(),": ");
if( 1==argv.length ){
st.out( st.getInputText() );
@@ -921,7 +920,7 @@ class ResultCommand extends Command {
private final ResultBufferMode bufferMode;
protected ResultCommand(ResultBufferMode bm){ bufferMode = bm; }
public ResultCommand(){ this(ResultBufferMode.ESCAPED); }
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,0,-1);
t.incrementTestCounter();
final String sql = t.takeInputBuffer();
@@ -939,7 +938,7 @@ class ResultCommand extends Command {
//! --run command
class RunCommand extends Command {
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,0,1);
final sqlite3 db = (1==argv.length)
? t.getCurrentDb() : t.getDbById( Integer.parseInt(argv[1]) );
@@ -959,7 +958,7 @@ class TableResultCommand extends Command {
private final boolean jsonMode;
protected TableResultCommand(boolean jsonMode){ this.jsonMode = jsonMode; }
public TableResultCommand(){ this(false); }
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,0);
t.incrementTestCounter();
String body = ts.fetchCommandBody(t);
@@ -1002,7 +1001,7 @@ class TableResultCommand extends Command {
//! --testcase command
class TestCaseCommand extends Command {
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,1);
ts.setTestCaseName(argv[1]);
t.clearResultBuffer();
@@ -1012,7 +1011,7 @@ class TestCaseCommand extends Command {
//! --verbosity command
class VerbosityCommand extends Command {
- public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
+ public void process(SQLTester t, TestScript ts, String[] argv){
argcCheck(ts,argv,1);
ts.setVerbosity( Integer.parseInt(argv[1]) );
}
@@ -1020,7 +1019,7 @@ class VerbosityCommand extends Command {
class CommandDispatcher {
- private static java.util.Map commandMap =
+ private static final java.util.Map commandMap =
new java.util.HashMap<>();
/**
@@ -1244,7 +1243,7 @@ class TestScript {
}
cur.pos = i;
final String rv = cur.sb.toString();
- if( i==cur.src.length && 0==rv.length() ){
+ if( i==cur.src.length && rv.isEmpty() ){
return null /* EOF */;
}
return rv;
@@ -1364,7 +1363,7 @@ class TestScript {
if( m.find() ){
throw new IncompatibleDirective(this, m.group(1)+": "+m.group(3));
}
- if( line.indexOf("\n|")>=0 ){
+ if( line.contains("\n|") ){
throw new IncompatibleDirective(this, "newline-pipe combination.");
}
return;
diff --git a/ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java b/ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java
index d8b6226ac9..54808cd1ca 100644
--- a/ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java
+++ b/ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java
@@ -18,11 +18,11 @@ package org.sqlite.jni.capi;
They are populated only via that interface.
*/
public final class TableColumnMetadata {
- OutputPointer.Bool pNotNull = new OutputPointer.Bool();
- OutputPointer.Bool pPrimaryKey = new OutputPointer.Bool();
- OutputPointer.Bool pAutoinc = new OutputPointer.Bool();
- OutputPointer.String pzCollSeq = new OutputPointer.String();
- OutputPointer.String pzDataType = new OutputPointer.String();
+ final OutputPointer.Bool pNotNull = new OutputPointer.Bool();
+ final OutputPointer.Bool pPrimaryKey = new OutputPointer.Bool();
+ final OutputPointer.Bool pAutoinc = new OutputPointer.Bool();
+ final OutputPointer.String pzCollSeq = new OutputPointer.String();
+ final OutputPointer.String pzDataType = new OutputPointer.String();
public TableColumnMetadata(){
}
diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java
index 05b1cfeaed..a9b766e9f3 100644
--- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java
+++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java
@@ -19,7 +19,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
/**
An annotation for Tester1 tests which we do not want to run in
@@ -62,13 +61,13 @@ public class Tester1 implements Runnable {
//! List of test*() methods to run.
private static List testMethods = null;
//! List of exceptions collected by run()
- private static List listErrors = new ArrayList<>();
+ private static final List listErrors = new ArrayList<>();
private static final class Metrics {
//! Number of times createNewDb() (or equivalent) is invoked.
volatile int dbOpen = 0;
}
- private Integer tId;
+ private final Integer tId;
Tester1(Integer id){
tId = id;
@@ -78,7 +77,7 @@ public class Tester1 implements Runnable {
public static synchronized void outln(){
if( !quietMode ){
- System.out.println("");
+ System.out.println();
}
}
@@ -523,7 +522,7 @@ public class Tester1 implements Runnable {
}
sqlite3_finalize(stmt);
affirm(3 == n);
- affirm("w😃rldhell🤩!🤩".equals(sbuf.toString()));
+ affirm("w😃rldhell🤩!🤩".contentEquals(sbuf));
try( sqlite3_stmt stmt2 = prepare(db, "SELECT ?, ?") ){
rc = sqlite3_bind_text(stmt2, 1, "");
@@ -668,7 +667,7 @@ public class Tester1 implements Runnable {
execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')");
final ValueHolder xDestroyCalled = new ValueHolder<>(0);
final CollationCallback myCollation = new CollationCallback() {
- private String myState =
+ private final String myState =
"this is local state. There is much like it, but this is mine.";
@Override
// Reverse-sorts its inputs...
@@ -847,7 +846,7 @@ public class Tester1 implements Runnable {
SQLFunction funcAgg = new AggregateFunction(){
@Override public void xStep(sqlite3_context cx, sqlite3_value[] args){
/** Throwing from here should emit loud noise on stdout or stderr
- but the exception is supressed because we have no way to inform
+ but the exception is suppressed because we have no way to inform
sqlite about it from these callbacks. */
//throw new RuntimeException("Throwing from an xStep");
}
@@ -1850,7 +1849,7 @@ public class Tester1 implements Runnable {
"; insert into t(a) values(1),(2),(3);",
"select a from t;"
};
- final List liStmt = new ArrayList();
+ final List liStmt = new ArrayList<>();
final PrepareMultiCallback proxy = new PrepareMultiCallback.StepAll();
final ValueHolder toss = new ValueHolder<>(null);
PrepareMultiCallback m = new PrepareMultiCallback() {
@@ -1984,9 +1983,9 @@ public class Tester1 implements Runnable {
-v: emit some developer-mode info at the end.
*/
public static void main(String[] args) throws Exception {
- Integer nThread = 1;
+ int nThread = 1;
boolean doSomethingForDev = false;
- Integer nRepeat = 1;
+ int nRepeat = 1;
boolean forceFail = false;
boolean sqlLog = false;
boolean configLog = false;
@@ -2048,7 +2047,7 @@ public class Tester1 implements Runnable {
final ConfigLogCallback log = new ConfigLogCallback() {
@Override public void call(int code, String msg){
outln("ConfigLogCallback: ",ResultCode.getEntryForInt(code),": ", msg);
- };
+ }
};
int rc = sqlite3_config( log );
affirm( 0==rc );
diff --git a/ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java b/ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java
index 372e4ec8d0..ce6c6a6abf 100644
--- a/ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java
+++ b/ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java
@@ -33,5 +33,5 @@ public interface XDestroyCallback {
each individual reference, leading to memory corruption or a
crash via duplicate free().
*/
- public void xDestroy();
+ void xDestroy();
}
diff --git a/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java b/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java
index 594f3eaad6..f409f4961d 100644
--- a/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java
+++ b/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java
@@ -12,7 +12,6 @@
** This file is part of the JNI bindings for the sqlite3 C API.
*/
package org.sqlite.jni.fts5;
-import java.nio.charset.StandardCharsets;
import org.sqlite.jni.capi.*;
import org.sqlite.jni.annotation.*;
@@ -24,7 +23,7 @@ public final class Fts5ExtensionApi extends NativePointerHolder aOut = new ArrayList();
+ List aOut = new ArrayList<>();
/* Iterate through the list of SQL statements. For each, step through
** it and add any results to the aOut[] array. */
@@ -137,14 +136,14 @@ public class TesterFts5 {
** fts5_columncount()
*/
private static void create_test_functions(sqlite3 db){
- /*
+ /*
** A user-defined-function fts5_rowid() that uses xRowid()
*/
fts5_extension_function fts5_rowid = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
long rowid = ext.xRowid(fCx);
@@ -153,14 +152,14 @@ public class TesterFts5 {
public void xDestroy(){ }
};
- /*
- ** fts5_columncount() - xColumnCount()
+ /*
+ ** fts5_columncount() - xColumnCount()
*/
fts5_extension_function fts5_columncount = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
int nCol = ext.xColumnCount(fCx);
@@ -169,14 +168,14 @@ public class TesterFts5 {
public void xDestroy(){ }
};
- /*
- ** fts5_columnsize() - xColumnSize()
+ /*
+ ** fts5_columnsize() - xColumnSize()
*/
fts5_extension_function fts5_columnsize = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=1 ){
@@ -194,14 +193,14 @@ public class TesterFts5 {
public void xDestroy(){ }
};
- /*
- ** fts5_columntext() - xColumnText()
+ /*
+ ** fts5_columntext() - xColumnText()
*/
fts5_extension_function fts5_columntext = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=1 ){
@@ -219,14 +218,14 @@ public class TesterFts5 {
public void xDestroy(){ }
};
- /*
- ** fts5_columntotalsize() - xColumnTotalSize()
+ /*
+ ** fts5_columntotalsize() - xColumnTotalSize()
*/
fts5_extension_function fts5_columntsize = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=1 ){
@@ -251,9 +250,9 @@ public class TesterFts5 {
*/
class fts5_aux implements fts5_extension_function {
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length>1 ){
@@ -268,13 +267,13 @@ public class TesterFts5 {
if( argv.length==1 ){
String val = sqlite3_value_text16(argv[0]);
- if( !val.equals("") ){
+ if( !val.isEmpty() ){
ext.xSetAuxdata(fCx, val);
}
}
}
public void xDestroy(){ }
- };
+ }
/*
** fts5_inst();
@@ -286,9 +285,9 @@ public class TesterFts5 {
*/
fts5_extension_function fts5_inst = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=0 ){
@@ -299,7 +298,7 @@ public class TesterFts5 {
OutputPointer.Int32 piPhrase = new OutputPointer.Int32();
OutputPointer.Int32 piCol = new OutputPointer.Int32();
OutputPointer.Int32 piOff = new OutputPointer.Int32();
- String ret = new String();
+ String ret = "";
int rc = ext.xInstCount(fCx, pnInst);
int nInst = pnInst.get();
@@ -327,9 +326,9 @@ public class TesterFts5 {
*/
fts5_extension_function fts5_pinst = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=0 ){
@@ -338,7 +337,7 @@ public class TesterFts5 {
OutputPointer.Int32 piCol = new OutputPointer.Int32();
OutputPointer.Int32 piOff = new OutputPointer.Int32();
- String ret = new String();
+ String ret = "";
int rc = SQLITE_OK;
int nPhrase = ext.xPhraseCount(fCx);
@@ -350,7 +349,7 @@ public class TesterFts5 {
rc==SQLITE_OK && piCol.get()>=0;
ext.xPhraseNext(fCx, pIter, piCol, piOff)
){
- if( !ret.equals("") ) ret += " ";
+ if( !ret.isEmpty() ) ret += " ";
ret += "{"+ii+" "+piCol.get()+" "+piOff.get()+"}";
}
}
@@ -374,9 +373,9 @@ public class TesterFts5 {
*/
fts5_extension_function fts5_pcolinst = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=0 ){
@@ -384,7 +383,7 @@ public class TesterFts5 {
}
OutputPointer.Int32 piCol = new OutputPointer.Int32();
- String ret = new String();
+ String ret = "";
int rc = SQLITE_OK;
int nPhrase = ext.xPhraseCount(fCx);
@@ -396,7 +395,7 @@ public class TesterFts5 {
rc==SQLITE_OK && piCol.get()>=0;
ext.xPhraseNextColumn(fCx, pIter, piCol)
){
- if( !ret.equals("") ) ret += " ";
+ if( !ret.isEmpty() ) ret += " ";
ret += "{"+ii+" "+piCol.get()+"}";
}
}
@@ -415,9 +414,9 @@ public class TesterFts5 {
*/
fts5_extension_function fts5_rowcount = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=0 ){
@@ -440,9 +439,9 @@ public class TesterFts5 {
*/
fts5_extension_function fts5_phrasesize = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=1 ){
@@ -464,9 +463,9 @@ public class TesterFts5 {
*/
fts5_extension_function fts5_phrasehits = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=1 ){
@@ -503,9 +502,9 @@ public class TesterFts5 {
*/
fts5_extension_function fts5_tokenize = new fts5_extension_function(){
@Override public void call(
- Fts5ExtensionApi ext,
+ Fts5ExtensionApi ext,
Fts5Context fCx,
- sqlite3_context pCx,
+ sqlite3_context pCx,
sqlite3_value argv[]
){
if( argv.length!=1 ){
@@ -515,7 +514,7 @@ public class TesterFts5 {
int rc = SQLITE_OK;
class MyCallback implements XTokenizeCallback {
- private List myList = new ArrayList();
+ private List myList = new ArrayList<>();
public String getval() {
return String.join("+", myList);
@@ -524,7 +523,7 @@ public class TesterFts5 {
@Override
public int call(int tFlags, byte[] txt, int iStart, int iEnd){
try {
- String str = new String(txt, "UTF-8");
+ String str = new String(txt, StandardCharsets.UTF_8);
myList.add(str);
} catch (Exception e) {
}
diff --git a/ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java b/ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java
index 5e47633baa..6e98f64ff3 100644
--- a/ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java
+++ b/ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java
@@ -39,7 +39,11 @@ public interface fts5_extension_function {
*/
void xDestroy();
- public static abstract class Abstract implements fts5_extension_function {
+ /**
+ A base implementation of fts5_extension_function() which has a
+ no-op xDestroy() method.
+ */
+ abstract class Abstract implements fts5_extension_function {
@Override public abstract void call(Fts5ExtensionApi ext, Fts5Context fCx,
sqlite3_context pCx, sqlite3_value argv[]);
@Override public void xDestroy(){}
diff --git a/ext/jni/src/org/sqlite/jni/test-script-interpreter.md b/ext/jni/src/org/sqlite/jni/test-script-interpreter.md
index c10122349e..cc7b7e7f9a 100644
--- a/ext/jni/src/org/sqlite/jni/test-script-interpreter.md
+++ b/ext/jni/src/org/sqlite/jni/test-script-interpreter.md
@@ -4,7 +4,7 @@
The purpose of the Test Script Interpreter is to read and interpret
script files that contain SQL commands and desired results. The
-interpreter will check results and report any discrepencies found.
+interpreter will check results and report any discrepancies found.
The test script files are ASCII text files. The filename always ends with
".test". Each script is evaluated independently; context does not carry
@@ -160,7 +160,7 @@ the result buffer. This distinction does not matter for the --result
command itself, but it is important for related commands like --glob
and --notglob. Sometimes test cases will contains a bunch of SQL
followed by multiple --glob and/or --notglob statements. All of the
-globs should be evaluated agains the result buffer, but the SQL should
+globs should be evaluated against the result buffer, but the SQL should
only be run once. This is accomplished by resetting the input buffer
but not the result buffer.
diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java
index 067a6983eb..c616ae7393 100644
--- a/ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java
+++ b/ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java
@@ -12,10 +12,6 @@
** This file is part of the wrapper1 interface for sqlite3.
*/
package org.sqlite.jni.wrapper1;
-import org.sqlite.jni.capi.CApi;
-import org.sqlite.jni.annotation.*;
-import org.sqlite.jni.capi.sqlite3_context;
-import org.sqlite.jni.capi.sqlite3_value;
/**
The SqlFunction type for scalar SQL functions.
diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java
index dcfc2ebebd..bb0fd0ccd4 100644
--- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java
+++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java
@@ -22,13 +22,13 @@ import org.sqlite.jni.capi.sqlite3_value;
*/
public interface SqlFunction {
- public static final int DETERMINISTIC = CApi.SQLITE_DETERMINISTIC;
- public static final int INNOCUOUS = CApi.SQLITE_INNOCUOUS;
- public static final int DIRECTONLY = CApi.SQLITE_DIRECTONLY;
- public static final int SUBTYPE = CApi.SQLITE_SUBTYPE;
- public static final int RESULT_SUBTYPE = CApi.SQLITE_RESULT_SUBTYPE;
- public static final int UTF8 = CApi.SQLITE_UTF8;
- public static final int UTF16 = CApi.SQLITE_UTF16;
+ int DETERMINISTIC = CApi.SQLITE_DETERMINISTIC;
+ int INNOCUOUS = CApi.SQLITE_INNOCUOUS;
+ int DIRECTONLY = CApi.SQLITE_DIRECTONLY;
+ int SUBTYPE = CApi.SQLITE_SUBTYPE;
+ int RESULT_SUBTYPE = CApi.SQLITE_RESULT_SUBTYPE;
+ int UTF8 = CApi.SQLITE_UTF8;
+ int UTF16 = CApi.SQLITE_UTF16;
/**
The Arguments type is an abstraction on top of the lower-level
@@ -36,7 +36,7 @@ public interface SqlFunction {
of the lower-level interface, insofar as possible without "leaking"
those types into this API.
*/
- public final static class Arguments implements Iterable{
+ final class Arguments implements Iterable{
private final sqlite3_context cx;
private final sqlite3_value args[];
public final int length;
@@ -144,7 +144,7 @@ public interface SqlFunction {
range.
*/
public void setAuxData(int argNdx, Object o){
- /* From the API docs: https://www.sqlite.org/c3ref/get_auxdata.html
+ /* From the API docs: https://sqlite.org/c3ref/get_auxdata.html
The value of the N parameter to these interfaces should be
non-negative. Future enhancements may make use of negative N
@@ -207,7 +207,7 @@ public interface SqlFunction {
Internal-use adapter for wrapping this package's ScalarFunction
for use with the org.sqlite.jni.capi.ScalarFunction interface.
*/
- static final class ScalarAdapter extends org.sqlite.jni.capi.ScalarFunction {
+ final class ScalarAdapter extends org.sqlite.jni.capi.ScalarFunction {
private final ScalarFunction impl;
ScalarAdapter(ScalarFunction impl){
this.impl = impl;
@@ -234,8 +234,8 @@ public interface SqlFunction {
Internal-use adapter for wrapping this package's AggregateFunction
for use with the org.sqlite.jni.capi.AggregateFunction interface.
*/
- static /*cannot be final without duplicating the whole body in WindowAdapter*/
class AggregateAdapter extends org.sqlite.jni.capi.AggregateFunction {
+ /*cannot be final without duplicating the whole body in WindowAdapter*/
private final AggregateFunction impl;
AggregateAdapter(AggregateFunction impl){
this.impl = impl;
@@ -277,7 +277,7 @@ public interface SqlFunction {
Internal-use adapter for wrapping this package's WindowFunction
for use with the org.sqlite.jni.capi.WindowFunction interface.
*/
- static final class WindowAdapter extends AggregateAdapter {
+ final class WindowAdapter extends AggregateAdapter {
private final WindowFunction impl;
WindowAdapter(WindowFunction impl){
super(impl);
diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java
index 2855d4c25f..d259e0ce62 100644
--- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java
+++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java
@@ -19,7 +19,6 @@ import org.sqlite.jni.capi.sqlite3_stmt;
import org.sqlite.jni.capi.sqlite3_backup;
import org.sqlite.jni.capi.sqlite3_blob;
import org.sqlite.jni.capi.OutputPointer;
-import java.nio.ByteBuffer;
/**
This class represents a database connection, analog to the C-side
@@ -388,10 +387,10 @@ public final class Sqlite implements AutoCloseable {
return CApi.sqlite3_compileoption_used(optName);
}
- private static boolean hasNormalizeSql =
+ private static final boolean hasNormalizeSql =
compileOptionUsed("ENABLE_NORMALIZE");
- private static boolean hasSqlLog =
+ private static final boolean hasSqlLog =
compileOptionUsed("ENABLE_SQLLOG");
/**
@@ -450,7 +449,7 @@ public final class Sqlite implements AutoCloseable {
long current;
/** The peak value for the requested status() or libStatus() metric. */
long peak;
- };
+ }
/**
As per sqlite3_status64(), but returns its current and high-water
@@ -696,7 +695,7 @@ public final class Sqlite implements AutoCloseable {
final org.sqlite.jni.capi.OutputPointer.Int32 oTail =
new org.sqlite.jni.capi.OutputPointer.Int32();
while( pos < sqlChunk.length ){
- sqlite3_stmt stmt = null;
+ sqlite3_stmt stmt;
if( pos>0 ){
sqlChunk = java.util.Arrays.copyOfRange(sqlChunk, pos, sqlChunk.length);
}
@@ -988,15 +987,15 @@ public final class Sqlite implements AutoCloseable {
}
};
checkRc( CApi.sqlite3_trace_v2(thisDb(), traceMask, tc) );
- };
+ }
/**
Corresponds to the sqlite3_stmt class. Use Sqlite.prepare() to
create new instances.
*/
public static final class Stmt implements AutoCloseable {
- private Sqlite _db = null;
- private sqlite3_stmt stmt = null;
+ private Sqlite _db;
+ private sqlite3_stmt stmt;
/** Only called by the prepare() factory functions. */
Stmt(Sqlite db, sqlite3_stmt stmt){
@@ -1379,9 +1378,9 @@ public final class Sqlite implements AutoCloseable {
Sqlite.initBackup() to create new instances.
*/
public static final class Backup implements AutoCloseable {
- private sqlite3_backup b = null;
- private Sqlite dbTo = null;
- private Sqlite dbFrom = null;
+ private sqlite3_backup b;
+ private Sqlite dbTo;
+ private Sqlite dbFrom;
Backup(Sqlite dbDest, String schemaDest,Sqlite dbSrc, String schemaSrc){
this.dbTo = dbDest;
@@ -1491,7 +1490,7 @@ public final class Sqlite implements AutoCloseable {
Warning: the SQLite core has no mechanism for reporting errors
from custom collations and its workflow does not accommodate
propagation of exceptions from callbacks. Any exceptions thrown
- from collations will be silently supressed and sorting results
+ from collations will be silently suppressed and sorting results
will be unpredictable.
*/
int call(byte[] lhs, byte[] rhs);
@@ -1506,7 +1505,7 @@ public final class Sqlite implements AutoCloseable {
*/
public void createCollation(String name, int encoding, Collation c){
thisDb();
- if( null==name || 0==name.length()){
+ if( null==name || name.isEmpty()){
throw new IllegalArgumentException("Collation name may not be null or empty.");
}
if( null==c ){
@@ -1599,11 +1598,12 @@ public final class Sqlite implements AutoCloseable {
public void setBusyHandler( BusyHandler b ){
org.sqlite.jni.capi.BusyHandlerCallback bhc = null;
if( null!=b ){
- bhc = new org.sqlite.jni.capi.BusyHandlerCallback(){
+ /*bhc = new org.sqlite.jni.capi.BusyHandlerCallback(){
@Override public int call(int n){
return b.call(n);
}
- };
+ };*/
+ bhc = b::call;
}
checkRc( CApi.sqlite3_busy_handler(thisDb(), bhc) );
}
@@ -1781,9 +1781,10 @@ public final class Sqlite implements AutoCloseable {
public void setProgressHandler( int n, ProgressHandler p ){
org.sqlite.jni.capi.ProgressHandlerCallback phc = null;
if( null!=p ){
- phc = new org.sqlite.jni.capi.ProgressHandlerCallback(){
+ /*phc = new org.sqlite.jni.capi.ProgressHandlerCallback(){
@Override public int call(){ return p.call(); }
- };
+ };*/
+ phc = p::call;
}
CApi.sqlite3_progress_handler( thisDb(), n, phc );
}
@@ -1808,11 +1809,12 @@ public final class Sqlite implements AutoCloseable {
public void setAuthorizer( Authorizer a ) {
org.sqlite.jni.capi.AuthorizerCallback ac = null;
if( null!=a ){
- ac = new org.sqlite.jni.capi.AuthorizerCallback(){
+ /*ac = new org.sqlite.jni.capi.AuthorizerCallback(){
@Override public int call(int opId, String s1, String s2, String s3, String s4){
return a.call(opId, s1, s2, s3, s4);
}
- };
+ };*/
+ ac = a::call;
}
checkRc( CApi.sqlite3_set_authorizer( thisDb(), ac ) );
}
@@ -1932,11 +1934,12 @@ public final class Sqlite implements AutoCloseable {
final org.sqlite.jni.capi.ConfigLogCallback l =
null==log
? null
- : new org.sqlite.jni.capi.ConfigLogCallback() {
+ /*: new org.sqlite.jni.capi.ConfigLogCallback() {
@Override public void call(int errCode, String msg){
log.call(errCode, msg);
}
- };
+ };*/
+ : log::call;
checkRcStatic(CApi.sqlite3_config(l));
}
diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java
index 5ac41323cb..528e1f61c6 100644
--- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java
+++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java
@@ -13,7 +13,6 @@
*/
package org.sqlite.jni.wrapper1;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
@@ -53,14 +52,14 @@ public class Tester2 implements Runnable {
//! List of test*() methods to run.
private static List testMethods = null;
//! List of exceptions collected by run()
- private static List listErrors = new ArrayList<>();
+ private static final List listErrors = new ArrayList<>();
private static final class Metrics {
//! Number of times createNewDb() (or equivalent) is invoked.
volatile int dbOpen = 0;
}
//! Instance ID.
- private Integer tId;
+ private final Integer tId;
Tester2(Integer id){
tId = id;
@@ -70,7 +69,7 @@ public class Tester2 implements Runnable {
public static synchronized void outln(){
if( !quietMode ){
- System.out.println("");
+ System.out.println();
}
}
@@ -547,7 +546,7 @@ public class Tester2 implements Runnable {
err = e;
}
affirm( err!=null );
- affirm( err.getMessage().indexOf(toss.value)>=0 );
+ affirm( err.getMessage().contains(toss.value) );
toss.value = null;
val.value = 0;
@@ -616,7 +615,7 @@ public class Tester2 implements Runnable {
final Sqlite db = openDb();
execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')");
final Sqlite.Collation myCollation = new Sqlite.Collation() {
- private String myState =
+ private final String myState =
"this is local state. There is much like it, but this is mine.";
@Override
// Reverse-sorts its inputs...
@@ -1038,9 +1037,9 @@ public class Tester2 implements Runnable {
-v: emit some developer-mode info at the end.
*/
public static void main(String[] args) throws Exception {
- Integer nThread = 1;
+ int nThread = 1;
+ int nRepeat = 1;
boolean doSomethingForDev = false;
- Integer nRepeat = 1;
boolean forceFail = false;
boolean sqlLog = false;
boolean configLog = false;
@@ -1097,7 +1096,7 @@ public class Tester2 implements Runnable {
Sqlite.libConfigLog( new Sqlite.ConfigLog() {
@Override public void call(int code, String msg){
outln("ConfigLog: ",Sqlite.errstr(code),": ", msg);
- };
+ }
}
);
}
diff --git a/ext/misc/README.md b/ext/misc/README.md
index 69cb230255..cfc9e867c0 100644
--- a/ext/misc/README.md
+++ b/ext/misc/README.md
@@ -1,7 +1,7 @@
## Miscellaneous Extensions
This folder contains a collection of smaller loadable extensions.
-See for instructions on how
+See for instructions on how
to compile and use loadable extensions.
Each extension in this folder is implemented in a single file of C code.
@@ -10,9 +10,9 @@ header comments for details about each extension. Additional notes are
as follows:
* **carray.c** — This module implements the
- [carray](https://www.sqlite.org/carray.html) table-valued function.
+ [carray](https://sqlite.org/carray.html) table-valued function.
It is a good example of how to go about implementing a custom
- [table-valued function](https://www.sqlite.org/vtab.html#tabfunc2).
+ [table-valued function](https://sqlite.org/vtab.html#tabfunc2).
* **csv.c** — A [virtual table](https://sqlite.org/vtab.html)
for reading
@@ -21,7 +21,7 @@ as follows:
* **dbdump.c** — This is not actually a loadable extension, but
rather a library that implements an approximate equivalent to the
".dump" command of the
- [command-line shell](https://www.sqlite.org/cli.html).
+ [command-line shell](https://sqlite.org/cli.html).
* **json1.c** — Various SQL functions and table-valued functions
for processing JSON. This extension is already built into the
@@ -29,7 +29,7 @@ as follows:
for additional information.
* **memvfs.c** — This file implements a custom
- [VFS](https://www.sqlite.org/vfs.html) that stores an entire database
+ [VFS](https://sqlite.org/vfs.html) that stores an entire database
file in a single block of RAM. It serves as a good example of how
to implement a simple custom VFS.
@@ -38,7 +38,7 @@ as follows:
new custom SQL functions for SQLite.
* **series.c** — This is an implementation of the
- "generate_series" [virtual table](https://www.sqlite.org/vtab.html).
+ "generate_series" [virtual table](https://sqlite.org/vtab.html).
It can make a good template for new custom virtual table implementations.
* **shathree.c** — An implementation of the sha3() and
diff --git a/ext/misc/closure.c b/ext/misc/closure.c
index 267ae1c424..14caf271f9 100644
--- a/ext/misc/closure.c
+++ b/ext/misc/closure.c
@@ -137,7 +137,7 @@
** AND closure.idname='groupId'
** AND closure.parentname='parentId';
**
-** See the documentation at http://www.sqlite.org/loadext.html for information
+** See the documentation at http://sqlite.org/loadext.html for information
** on how to compile and use loadable extensions such as this one.
*/
#include "sqlite3ext.h"
diff --git a/ext/misc/fossildelta.c b/ext/misc/fossildelta.c
index e638737d2b..9f81270d7b 100644
--- a/ext/misc/fossildelta.c
+++ b/ext/misc/fossildelta.c
@@ -22,7 +22,7 @@
** The delta format is the Fossil delta format, described in a comment
** on the delete_create() function implementation below, and also at
**
-** https://www.fossil-scm.org/fossil/doc/trunk/www/delta_format.wiki
+** https://fossil-scm.org/fossil/doc/trunk/www/delta_format.wiki
**
** This delta format is used by the RBU extension, which is the main
** reason that these routines are included in the extension library.
diff --git a/ext/misc/memstat.c b/ext/misc/memstat.c
index c56af9f297..8e69b46955 100644
--- a/ext/misc/memstat.c
+++ b/ext/misc/memstat.c
@@ -401,8 +401,14 @@ static sqlite3_module memstatModule = {
#endif /* SQLITE_OMIT_VIRTUALTABLE */
-int sqlite3MemstatVtabInit(sqlite3 *db){
+int sqlite3MemstatVtabInit(
+ sqlite3 *db,
+ char **NotUsed1,
+ const sqlite3_api_routines *NotUsed2
+){
int rc = SQLITE_OK;
+ (void)NotUsed1;
+ (void)NotUsed2;
#ifndef SQLITE_OMIT_VIRTUALTABLE
rc = sqlite3_create_module(db, "sqlite_memstat", &memstatModule, 0);
#endif
@@ -421,7 +427,7 @@ int sqlite3_memstat_init(
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
#ifndef SQLITE_OMIT_VIRTUALTABLE
- rc = sqlite3MemstatVtabInit(db);
+ rc = sqlite3MemstatVtabInit(db, 0, 0);
#endif
return rc;
}
diff --git a/ext/misc/series.c b/ext/misc/series.c
index e8188f1c97..22e0f7edbe 100644
--- a/ext/misc/series.c
+++ b/ext/misc/series.c
@@ -115,6 +115,7 @@ SQLITE_EXTENSION_INIT1
#include
#include
#include
+#include
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
@@ -480,25 +481,52 @@ static int seriesFilter(
** constraints on the "value" column.
*/
if( idxNum & 0x0080 ){
- iMin = iMax = sqlite3_value_int64(argv[i++]);
+ if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
+ double r = sqlite3_value_double(argv[i++]);
+ if( r==ceil(r) ){
+ iMin = iMax = (sqlite3_int64)r;
+ }else{
+ returnNoRows = 1;
+ }
+ }else{
+ iMin = iMax = sqlite3_value_int64(argv[i++]);
+ }
}else{
if( idxNum & 0x0300 ){
- iMin = sqlite3_value_int64(argv[i++]);
- if( idxNum & 0x0200 ){
- if( iMin==LARGEST_INT64 ){
- returnNoRows = 1;
+ if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
+ double r = sqlite3_value_double(argv[i++]);
+ if( idxNum & 0x0200 && r==ceil(r) ){
+ iMin = (sqlite3_int64)ceil(r+1.0);
}else{
- iMin++;
+ iMin = (sqlite3_int64)ceil(r);
+ }
+ }else{
+ iMin = sqlite3_value_int64(argv[i++]);
+ if( idxNum & 0x0200 ){
+ if( iMin==LARGEST_INT64 ){
+ returnNoRows = 1;
+ }else{
+ iMin++;
+ }
}
}
}
if( idxNum & 0x3000 ){
- iMax = sqlite3_value_int64(argv[i++]);
- if( idxNum & 0x2000 ){
- if( iMax==SMALLEST_INT64 ){
- returnNoRows = 1;
+ if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
+ double r = sqlite3_value_double(argv[i++]);
+ if( (idxNum & 0x2000)!=0 && r==floor(r) ){
+ iMax = (sqlite3_int64)(r-1.0);
}else{
- iMax--;
+ iMax = (sqlite3_int64)floor(r);
+ }
+ }else{
+ iMax = sqlite3_value_int64(argv[i++]);
+ if( idxNum & 0x2000 ){
+ if( iMax==SMALLEST_INT64 ){
+ returnNoRows = 1;
+ }else{
+ iMax--;
+ }
}
}
}
@@ -552,7 +580,7 @@ static int seriesFilter(
for(i=0; inCol==0 ){
u8 *abPK;
assert( pTab->azCol==0 || pTab->abPK==0 );
+ sqlite3_free(pTab->azCol);
+ pTab->abPK = 0;
rc = sessionTableInfo(pSession, db, zDb,
pTab->zName, &pTab->nCol, &pTab->nTotalCol, 0, &pTab->azCol,
&pTab->azDflt, &pTab->aiIdx, &abPK,
@@ -2216,7 +2218,9 @@ int sqlite3session_diff(
SessionTable *pTo; /* Table zTbl */
/* Locate and if necessary initialize the target table object */
+ pSession->bAutoAttach++;
rc = sessionFindTable(pSession, zTbl, &pTo);
+ pSession->bAutoAttach--;
if( pTo==0 ) goto diff_out;
if( sessionInitTable(pSession, pTo, pSession->db, pSession->zDb) ){
rc = pSession->rc;
@@ -2227,17 +2231,43 @@ int sqlite3session_diff(
if( rc==SQLITE_OK ){
int bHasPk = 0;
int bMismatch = 0;
- int nCol; /* Columns in zFrom.zTbl */
+ int nCol = 0; /* Columns in zFrom.zTbl */
int bRowid = 0;
- u8 *abPK;
+ u8 *abPK = 0;
const char **azCol = 0;
- rc = sessionTableInfo(0, db, zFrom, zTbl,
- &nCol, 0, 0, &azCol, 0, 0, &abPK,
- pSession->bImplicitPK ? &bRowid : 0
- );
+ char *zDbExists = 0;
+
+ /* Check that database zFrom is attached. */
+ zDbExists = sqlite3_mprintf("SELECT * FROM %Q.sqlite_schema", zFrom);
+ if( zDbExists==0 ){
+ rc = SQLITE_NOMEM;
+ }else{
+ sqlite3_stmt *pDbExists = 0;
+ rc = sqlite3_prepare_v2(db, zDbExists, -1, &pDbExists, 0);
+ if( rc==SQLITE_ERROR ){
+ rc = SQLITE_OK;
+ nCol = -1;
+ }
+ sqlite3_finalize(pDbExists);
+ sqlite3_free(zDbExists);
+ }
+
+ if( rc==SQLITE_OK && nCol==0 ){
+ rc = sessionTableInfo(0, db, zFrom, zTbl,
+ &nCol, 0, 0, &azCol, 0, 0, &abPK,
+ pSession->bImplicitPK ? &bRowid : 0
+ );
+ }
if( rc==SQLITE_OK ){
if( pTo->nCol!=nCol ){
- bMismatch = 1;
+ if( nCol<=0 ){
+ rc = SQLITE_SCHEMA;
+ if( pzErrMsg ){
+ *pzErrMsg = sqlite3_mprintf("no such table: %s.%s", zFrom, zTbl);
+ }
+ }else{
+ bMismatch = 1;
+ }
}else{
int i;
for(i=0; iaiColumn[j] = pPk->aiColumn[i];
pIdx->azColl[j] = pPk->azColl[i];
if( pPk->aSortOrder[i] ){
- /* See ticket https://www.sqlite.org/src/info/bba7b69f9849b5bf */
+ /* See ticket https://sqlite.org/src/info/bba7b69f9849b5bf */
pIdx->bAscKeyBug = 1;
}
j++;
@@ -3835,7 +3835,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
** not work for UNIQUE constraint indexes on WITHOUT ROWID tables
** with DESC primary keys, since those indexes have there keys in
** a different order from the main table.
- ** See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf
+ ** See ticket: https://sqlite.org/src/info/bba7b69f9849b5bf
*/
sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
}
@@ -4219,6 +4219,7 @@ void sqlite3CreateIndex(
assert( j<=0x7fff );
if( j<0 ){
j = pTab->iPKey;
+ pIndex->bIdxRowid = 1;
}else{
if( pTab->aCol[j].notNull==0 ){
pIndex->uniqNotNull = 0;
diff --git a/src/insert.c b/src/insert.c
index 7dc9bfd8b1..fdd9c8da2a 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -2113,7 +2113,7 @@ void sqlite3GenerateConstraintChecks(
** could happen in any order, but they are grouped up front for
** convenience.
**
- ** 2018-08-14: Ticket https://www.sqlite.org/src/info/908f001483982c43
+ ** 2018-08-14: Ticket https://sqlite.org/src/info/908f001483982c43
** The order of constraints used to have OE_Update as (2) and OE_Abort
** and so forth as (1). But apparently PostgreSQL checks the OE_Update
** constraint before any others, so it had to be moved.
diff --git a/src/json.c b/src/json.c
index 5360831af0..9c38bde985 100644
--- a/src/json.c
+++ b/src/json.c
@@ -23,8 +23,8 @@
** Beginning with version 3.45.0 (circa 2024-01-01), these routines also
** accept BLOB values that have JSON encoded using a binary representation
** called "JSONB". The name JSONB comes from PostgreSQL, however the on-disk
-** format SQLite JSONB is completely different and incompatible with
-** PostgreSQL JSONB.
+** format for SQLite-JSONB is completely different and incompatible with
+** PostgreSQL-JSONB.
**
** Decoding and interpreting JSONB is still O(N) where N is the size of
** the input, the same as text JSON. However, the constant of proportionality
@@ -81,7 +81,7 @@
**
** The payload size need not be expressed in its minimal form. For example,
** if the payload size is 10, the size can be expressed in any of 5 different
-** ways: (1) (X>>4)==10, (2) (X>>4)==12 following by on 0x0a byte,
+** ways: (1) (X>>4)==10, (2) (X>>4)==12 following by one 0x0a byte,
** (3) (X>>4)==13 followed by 0x00 and 0x0a, (4) (X>>4)==14 followed by
** 0x00 0x00 0x00 0x0a, or (5) (X>>4)==15 followed by 7 bytes of 0x00 and
** a single byte of 0x0a. The shorter forms are preferred, of course, but
@@ -91,7 +91,7 @@
** the size when it becomes known, resulting in a non-minimal encoding.
**
** The value (X>>4)==15 is not actually used in the current implementation
-** (as SQLite is currently unable handle BLOBs larger than about 2GB)
+** (as SQLite is currently unable to handle BLOBs larger than about 2GB)
** but is included in the design to allow for future enhancements.
**
** The payload follows the header. NULL, TRUE, and FALSE have no payload and
@@ -151,23 +151,47 @@ static const char * const jsonbType[] = {
** increase for the text-JSON parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
*/
static const char jsonIsSpace[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+#ifdef SQLITE_ASCII
+/*0 1 2 3 4 5 6 7 8 9 a b c d e f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, /* 0 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 5 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 7 */
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 8 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 9 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f */
+#endif
+#ifdef SQLITE_EBCDIC
+/*0 1 2 3 4 5 6 7 8 9 a b c d e f */
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, /* 0 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3 */
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 5 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 7 */
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 8 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 9 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f */
+#endif
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#define jsonIsspace(x) (jsonIsSpace[(unsigned char)x])
@@ -175,7 +199,13 @@ static const char jsonIsSpace[] = {
** The set of all space characters recognized by jsonIsspace().
** Useful as the second argument to strspn().
*/
+#ifdef SQLITE_ASCII
static const char jsonSpaces[] = "\011\012\015\040";
+#endif
+#ifdef SQLITE_EBCDIC
+static const char jsonSpaces[] = "\005\045\015\100";
+#endif
+
/*
** Characters that are special to JSON. Control characters,
@@ -184,23 +214,46 @@ static const char jsonSpaces[] = "\011\012\015\040";
** it in the set of special characters.
*/
static const char jsonIsOk[256] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+#ifdef SQLITE_ASCII
+/*0 1 2 3 4 5 6 7 8 9 a b c d e f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
+ 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 2 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 3 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, /* 5 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 7 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 8 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* f */
+#endif
+#ifdef SQLITE_EBCDIC
+/*0 1 2 3 4 5 6 7 8 9 a b c d e f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* 3 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 5 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, /* 7 */
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 8 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* f */
+#endif
};
/* Objects */
@@ -1165,7 +1218,7 @@ static SQLITE_NOINLINE void jsonBlobExpandAndAppendNode(
}
-/* Append an node type byte together with the payload size and
+/* Append a node type byte together with the payload size and
** possibly also the payload.
**
** If aPayload is not NULL, then it is a pointer to the payload which
@@ -2500,6 +2553,82 @@ static void jsonAfterEditSizeAdjust(JsonParse *pParse, u32 iRoot){
pParse->delta += jsonBlobChangePayloadSize(pParse, iRoot, sz);
}
+/*
+** If the JSONB at aIns[0..nIns-1] can be expanded (by denormalizing the
+** size field) by d bytes, then write the expansion into aOut[] and
+** return true. In this way, an overwrite happens without changing the
+** size of the JSONB, which reduces memcpy() operations and also make it
+** faster and easier to update the B-Tree entry that contains the JSONB
+** in the database.
+**
+** If the expansion of aIns[] by d bytes cannot be (easily) accomplished
+** then return false.
+**
+** The d parameter is guaranteed to be between 1 and 8.
+**
+** This routine is an optimization. A correct answer is obtained if it
+** always leaves the output unchanged and returns false.
+*/
+static int jsonBlobOverwrite(
+ u8 *aOut, /* Overwrite here */
+ const u8 *aIns, /* New content */
+ u32 nIns, /* Bytes of new content */
+ u32 d /* Need to expand new content by this much */
+){
+ u32 szPayload; /* Bytes of payload */
+ u32 i; /* New header size, after expansion & a loop counter */
+ u8 szHdr; /* Size of header before expansion */
+
+ /* Lookup table for finding the upper 4 bits of the first byte of the
+ ** expanded aIns[], based on the size of the expanded aIns[] header:
+ **
+ ** 2 3 4 5 6 7 8 9 */
+ static const u8 aType[] = { 0xc0, 0xd0, 0, 0xe0, 0, 0, 0, 0xf0 };
+
+ if( (aIns[0]&0x0f)<=2 ) return 0; /* Cannot enlarge NULL, true, false */
+ switch( aIns[0]>>4 ){
+ default: { /* aIns[] header size 1 */
+ if( ((1<=2 && i<=9 && aType[i-2]!=0 );
+ aOut[0] = (aIns[0] & 0x0f) | aType[i-2];
+ memcpy(&aOut[i], &aIns[szHdr], nIns-szHdr);
+ szPayload = nIns - szHdr;
+ while( 1/*edit-by-break*/ ){
+ i--;
+ aOut[i] = szPayload & 0xff;
+ if( i==1 ) break;
+ szPayload >>= 8;
+ }
+ assert( (szPayload>>8)==0 );
+ return 1;
+}
+
/*
** Modify the JSONB blob at pParse->aBlob by removing nDel bytes of
** content beginning at iDel, and replacing them with nIns bytes of
@@ -2521,6 +2650,11 @@ static void jsonBlobEdit(
u32 nIns /* Bytes of content to insert */
){
i64 d = (i64)nIns - (i64)nDel;
+ if( d<0 && d>=(-8) && aIns!=0
+ && jsonBlobOverwrite(&pParse->aBlob[iDel], aIns, nIns, (int)-d)
+ ){
+ return;
+ }
if( d!=0 ){
if( pParse->nBlob + d > pParse->nBlobAlloc ){
jsonBlobExpand(pParse, pParse->nBlob+d);
@@ -2532,7 +2666,9 @@ static void jsonBlobEdit(
pParse->nBlob += d;
pParse->delta += d;
}
- if( nIns && aIns ) memcpy(&pParse->aBlob[iDel], aIns, nIns);
+ if( nIns && aIns ){
+ memcpy(&pParse->aBlob[iDel], aIns, nIns);
+ }
}
/*
@@ -3295,7 +3431,7 @@ static char *jsonBadPathError(
}
/* argv[0] is a BLOB that seems likely to be a JSONB. Subsequent
-** arguments come in parse where each pair contains a JSON path and
+** arguments come in pairs where each pair contains a JSON path and
** content to insert or set at that patch. Do the updates
** and return the result.
**
diff --git a/src/os_win.c b/src/os_win.c
index dab8af34c4..0dd56af583 100644
--- a/src/os_win.c
+++ b/src/os_win.c
@@ -617,7 +617,7 @@ static struct win_syscall {
{ "FileTimeToLocalFileTime", (SYSCALL)0, 0 },
#endif
-#define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(CONST FILETIME*, \
+#define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(const FILETIME*, \
LPFILETIME))aSyscall[11].pCurrent)
#if SQLITE_OS_WINCE
@@ -626,7 +626,7 @@ static struct win_syscall {
{ "FileTimeToSystemTime", (SYSCALL)0, 0 },
#endif
-#define osFileTimeToSystemTime ((BOOL(WINAPI*)(CONST FILETIME*, \
+#define osFileTimeToSystemTime ((BOOL(WINAPI*)(const FILETIME*, \
LPSYSTEMTIME))aSyscall[12].pCurrent)
{ "FlushFileBuffers", (SYSCALL)FlushFileBuffers, 0 },
@@ -906,7 +906,7 @@ static struct win_syscall {
{ "LockFile", (SYSCALL)0, 0 },
#endif
-#ifndef osLockFile
+#if !defined(osLockFile) && defined(SQLITE_WIN32_HAS_ANSI)
#define osLockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
DWORD))aSyscall[47].pCurrent)
#endif
@@ -970,7 +970,7 @@ static struct win_syscall {
{ "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 },
-#define osSystemTimeToFileTime ((BOOL(WINAPI*)(CONST SYSTEMTIME*, \
+#define osSystemTimeToFileTime ((BOOL(WINAPI*)(const SYSTEMTIME*, \
LPFILETIME))aSyscall[56].pCurrent)
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
@@ -979,7 +979,7 @@ static struct win_syscall {
{ "UnlockFile", (SYSCALL)0, 0 },
#endif
-#ifndef osUnlockFile
+#if !defined(osUnlockFile) && defined(SQLITE_WIN32_HAS_ANSI)
#define osUnlockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
DWORD))aSyscall[57].pCurrent)
#endif
@@ -1207,6 +1207,63 @@ static struct win_syscall {
#define osCancelIo ((BOOL(WINAPI*)(HANDLE))aSyscall[81].pCurrent)
+#if defined(SQLITE_WIN32_HAS_WIDE) && defined(_WIN32)
+ { "GetModuleHandleW", (SYSCALL)GetModuleHandleW, 0 },
+#else
+ { "GetModuleHandleW", (SYSCALL)0, 0 },
+#endif
+
+#define osGetModuleHandleW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[82].pCurrent)
+
+#ifndef _WIN32
+ { "getenv", (SYSCALL)getenv, 0 },
+#else
+ { "getenv", (SYSCALL)0, 0 },
+#endif
+
+#define osGetenv ((const char *(*)(const char *))aSyscall[83].pCurrent)
+
+#ifndef _WIN32
+ { "getcwd", (SYSCALL)getcwd, 0 },
+#else
+ { "getcwd", (SYSCALL)0, 0 },
+#endif
+
+#define osGetcwd ((char*(*)(char*,size_t))aSyscall[84].pCurrent)
+
+#ifndef _WIN32
+ { "readlink", (SYSCALL)readlink, 0 },
+#else
+ { "readlink", (SYSCALL)0, 0 },
+#endif
+
+#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[85].pCurrent)
+
+#ifndef _WIN32
+ { "lstat", (SYSCALL)lstat, 0 },
+#else
+ { "lstat", (SYSCALL)0, 0 },
+#endif
+
+#define osLstat ((int(*)(const char*,struct stat*))aSyscall[86].pCurrent)
+
+#ifndef _WIN32
+ { "__errno", (SYSCALL)__errno, 0 },
+#else
+ { "__errno", (SYSCALL)0, 0 },
+#endif
+
+#define osErrno (*((int*(*)(void))aSyscall[87].pCurrent)())
+
+#ifndef _WIN32
+ { "cygwin_conv_path", (SYSCALL)cygwin_conv_path, 0 },
+#else
+ { "cygwin_conv_path", (SYSCALL)0, 0 },
+#endif
+
+#define osCygwin_conv_path ((size_t(*)(unsigned int, \
+ const void *, void *, size_t))aSyscall[88].pCurrent)
+
}; /* End of the overrideable system calls */
/*
@@ -1380,6 +1437,7 @@ int sqlite3_win32_reset_heap(){
}
#endif /* SQLITE_WIN32_MALLOC */
+#ifdef _WIN32
/*
** This function outputs the specified (ANSI) string to the Win32 debugger
** (if available).
@@ -1422,6 +1480,7 @@ void sqlite3_win32_write_debug(const char *zBuf, int nBuf){
}
#endif
}
+#endif /* _WIN32 */
/*
** The following routine suspends the current thread for at least ms
@@ -1722,6 +1781,7 @@ void sqlite3MemSetDefault(void){
}
#endif /* SQLITE_WIN32_MALLOC */
+#ifdef _WIN32
/*
** Convert a UTF-8 string to Microsoft Unicode.
**
@@ -1747,6 +1807,7 @@ static LPWSTR winUtf8ToUnicode(const char *zText){
}
return zWideText;
}
+#endif /* _WIN32 */
/*
** Convert a Microsoft Unicode string to UTF-8.
@@ -1781,28 +1842,29 @@ static char *winUnicodeToUtf8(LPCWSTR zWideText){
** Space to hold the returned string is obtained from sqlite3_malloc().
*/
static LPWSTR winMbcsToUnicode(const char *zText, int useAnsi){
- int nByte;
+ int nWideChar;
LPWSTR zMbcsText;
int codepage = useAnsi ? CP_ACP : CP_OEMCP;
- nByte = osMultiByteToWideChar(codepage, 0, zText, -1, NULL,
- 0)*sizeof(WCHAR);
- if( nByte==0 ){
+ nWideChar = osMultiByteToWideChar(codepage, 0, zText, -1, NULL,
+ 0);
+ if( nWideChar==0 ){
return 0;
}
- zMbcsText = sqlite3MallocZero( nByte*sizeof(WCHAR) );
+ zMbcsText = sqlite3MallocZero( nWideChar*sizeof(WCHAR) );
if( zMbcsText==0 ){
return 0;
}
- nByte = osMultiByteToWideChar(codepage, 0, zText, -1, zMbcsText,
- nByte);
- if( nByte==0 ){
+ nWideChar = osMultiByteToWideChar(codepage, 0, zText, -1, zMbcsText,
+ nWideChar);
+ if( nWideChar==0 ){
sqlite3_free(zMbcsText);
zMbcsText = 0;
}
return zMbcsText;
}
+#ifdef _WIN32
/*
** Convert a Microsoft Unicode string to a multi-byte character string,
** using the ANSI or OEM code page.
@@ -1830,6 +1892,7 @@ static char *winUnicodeToMbcs(LPCWSTR zWideText, int useAnsi){
}
return zText;
}
+#endif /* _WIN32 */
/*
** Convert a multi-byte character string to UTF-8.
@@ -1849,6 +1912,7 @@ static char *winMbcsToUtf8(const char *zText, int useAnsi){
return zTextUtf8;
}
+#ifdef _WIN32
/*
** Convert a UTF-8 string to a multi-byte character string.
**
@@ -1898,6 +1962,7 @@ char *sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){
#endif
return winUnicodeToUtf8(zWideText);
}
+#endif /* _WIN32 */
/*
** This is a public wrapper for the winMbcsToUtf8() function.
@@ -1915,6 +1980,7 @@ char *sqlite3_win32_mbcs_to_utf8(const char *zText){
return winMbcsToUtf8(zText, osAreFileApisANSI());
}
+#ifdef _WIN32
/*
** This is a public wrapper for the winMbcsToUtf8() function.
*/
@@ -2039,6 +2105,7 @@ int sqlite3_win32_set_directory(
){
return sqlite3_win32_set_directory16(type, zValue);
}
+#endif /* _WIN32 */
/*
** The return value of winGetLastErrorMsg
@@ -2587,9 +2654,11 @@ static BOOL winLockFile(
ovlp.Offset = offsetLow;
ovlp.OffsetHigh = offsetHigh;
return osLockFileEx(*phFile, flags, 0, numBytesLow, numBytesHigh, &ovlp);
+#ifdef SQLITE_WIN32_HAS_ANSI
}else{
return osLockFile(*phFile, offsetLow, offsetHigh, numBytesLow,
numBytesHigh);
+#endif
}
#endif
}
@@ -2697,9 +2766,11 @@ static BOOL winUnlockFile(
ovlp.Offset = offsetLow;
ovlp.OffsetHigh = offsetHigh;
return osUnlockFileEx(*phFile, 0, numBytesLow, numBytesHigh, &ovlp);
+#ifdef SQLITE_WIN32_HAS_ANSI
}else{
return osUnlockFile(*phFile, offsetLow, offsetHigh, numBytesLow,
numBytesHigh);
+#endif
}
#endif
}
@@ -4113,14 +4184,91 @@ static int winLockSharedMemory(winShmNode *pShmNode, DWORD nMs){
** Convert a UTF-8 filename into whatever form the underlying
** operating system wants filenames in. Space to hold the result
** is obtained from malloc and must be freed by the calling
-** function.
+** function
+**
+** On Cygwin, 3 possible input forms are accepted:
+** - If the filename starts with ":/" or ":\",
+** it is converted to UTF-16 as-is.
+** - If the filename contains '/', it is assumed to be a
+** Cygwin absolute path, it is converted to a win32
+** absolute path in UTF-16.
+** - Otherwise it must be a filename only, the win32 filename
+** is returned in UTF-16.
+** Note: If the function cygwin_conv_path() fails, only
+** UTF-8 -> UTF-16 conversion will be done. This can only
+** happen when the file path >32k, in which case winUtf8ToUnicode()
+** will fail too.
*/
static void *winConvertFromUtf8Filename(const char *zFilename){
void *zConverted = 0;
if( osIsNT() ){
+#ifdef __CYGWIN__
+ int nChar;
+ LPWSTR zWideFilename;
+
+ if( osCygwin_conv_path && !(winIsDriveLetterAndColon(zFilename)
+ && winIsDirSep(zFilename[2])) ){
+ int nByte;
+ int convertflag = CCP_POSIX_TO_WIN_W;
+ if( !strchr(zFilename, '/') ) convertflag |= CCP_RELATIVE;
+ nByte = (int)osCygwin_conv_path(convertflag,
+ zFilename, 0, 0);
+ if( nByte>0 ){
+ zConverted = sqlite3MallocZero(nByte+12);
+ if ( zConverted==0 ){
+ return zConverted;
+ }
+ zWideFilename = zConverted;
+ /* Filenames should be prefixed, except when converted
+ * full path already starts with "\\?\". */
+ if( osCygwin_conv_path(convertflag, zFilename,
+ zWideFilename+4, nByte)==0 ){
+ if( (convertflag&CCP_RELATIVE) ){
+ memmove(zWideFilename, zWideFilename+4, nByte);
+ }else if( memcmp(zWideFilename+4, L"\\\\", 4) ){
+ memcpy(zWideFilename, L"\\\\?\\", 8);
+ }else if( zWideFilename[6]!='?' ){
+ memmove(zWideFilename+6, zWideFilename+4, nByte);
+ memcpy(zWideFilename, L"\\\\?\\UNC", 14);
+ }else{
+ memmove(zWideFilename, zWideFilename+4, nByte);
+ }
+ return zConverted;
+ }
+ sqlite3_free(zConverted);
+ }
+ }
+ nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0);
+ if( nChar==0 ){
+ return 0;
+ }
+ zWideFilename = sqlite3MallocZero( nChar*sizeof(WCHAR)+12 );
+ if( zWideFilename==0 ){
+ return 0;
+ }
+ nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1,
+ zWideFilename, nChar);
+ if( nChar==0 ){
+ sqlite3_free(zWideFilename);
+ zWideFilename = 0;
+ }else if( nChar>MAX_PATH
+ && winIsDriveLetterAndColon(zFilename)
+ && winIsDirSep(zFilename[2]) ){
+ memmove(zWideFilename+4, zWideFilename, nChar*sizeof(WCHAR));
+ zWideFilename[2] = '\\';
+ memcpy(zWideFilename, L"\\\\?\\", 8);
+ }else if( nChar>MAX_PATH
+ && winIsDirSep(zFilename[0]) && winIsDirSep(zFilename[1])
+ && zFilename[2] != '?' ){
+ memmove(zWideFilename+6, zWideFilename, nChar*sizeof(WCHAR));
+ memcpy(zWideFilename, L"\\\\?\\UNC", 14);
+ }
+ zConverted = zWideFilename;
+#else
zConverted = winUtf8ToUnicode(zFilename);
+#endif /* __CYGWIN__ */
}
-#ifdef SQLITE_WIN32_HAS_ANSI
+#if defined(SQLITE_WIN32_HAS_ANSI) && defined(_WIN32)
else{
zConverted = winUtf8ToMbcs(zFilename, osAreFileApisANSI());
}
@@ -4949,7 +5097,7 @@ static winVfsAppData winNolockAppData = {
** sqlite3_vfs object.
*/
-#if defined(__CYGWIN__)
+#if 0 /* No longer necessary */
/*
** Convert a filename from whatever the underlying operating system
** supports for filenames into UTF-8. Space to hold the result is
@@ -4982,7 +5130,14 @@ static int winMakeEndInDirSep(int nBuf, char *zBuf){
if( winIsDirSep(zBuf[nLen-1]) ){
return 1;
}else if( nLen+1nOut ){
+ /* SQLite assumes that xFullPathname() nul-terminates the output buffer
+ ** even if it returns an error. */
+ zOut[iOff] = '\0';
+ return SQLITE_CANTOPEN_BKPT;
+ }
+ sqlite3_snprintf(nOut-iOff, &zOut[iOff], "%s", zPath);
+ return SQLITE_OK;
+}
+#endif /* __CYGWIN__ */
/*
** Turn a relative pathname into a full pathname. Write the full
@@ -5863,8 +6103,8 @@ static int winFullPathnameNoMutex(
int nFull, /* Size of output buffer in bytes */
char *zFull /* Output buffer */
){
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__)
- DWORD nByte;
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
+ int nByte;
void *zConverted;
char *zOut;
#endif
@@ -5877,64 +6117,110 @@ static int winFullPathnameNoMutex(
zRelative++;
}
-#if defined(__CYGWIN__)
+ SimulateIOError( return SQLITE_ERROR );
+
+#ifdef __CYGWIN__
+ if( osGetcwd ){
+ zFull[nFull-1] = '\0';
+ if( !winIsDriveLetterAndColon(zRelative) || !winIsDirSep(zRelative[2]) ){
+ int rc = SQLITE_OK;
+ int nLink = 1; /* Number of symbolic links followed so far */
+ const char *zIn = zRelative; /* Input path for each iteration of loop */
+ char *zDel = 0;
+ struct stat buf;
+
+ UNUSED_PARAMETER(pVfs);
+
+ do {
+ /* Call lstat() on path zIn. Set bLink to true if the path is a symbolic
+ ** link, or false otherwise. */
+ int bLink = 0;
+ if( osLstat && osReadlink ) {
+ if( osLstat(zIn, &buf)!=0 ){
+ int myErrno = osErrno;
+ if( myErrno!=ENOENT ){
+ rc = winLogError(SQLITE_CANTOPEN_BKPT, (DWORD)myErrno, "lstat", zIn);
+ }
+ }else{
+ bLink = ((buf.st_mode & 0170000) == 0120000);
+ }
+
+ if( bLink ){
+ if( zDel==0 ){
+ zDel = sqlite3MallocZero(nFull);
+ if( zDel==0 ) rc = SQLITE_NOMEM;
+ }else if( ++nLink>SQLITE_MAX_SYMLINKS ){
+ rc = SQLITE_CANTOPEN_BKPT;
+ }
+
+ if( rc==SQLITE_OK ){
+ nByte = osReadlink(zIn, zDel, nFull-1);
+ if( nByte ==(DWORD)-1 ){
+ rc = winLogError(SQLITE_CANTOPEN_BKPT, (DWORD)osErrno, "readlink", zIn);
+ }else{
+ if( zDel[0]!='/' ){
+ int n;
+ for(n = sqlite3Strlen30(zIn); n>0 && zIn[n-1]!='/'; n--);
+ if( nByte+n+1>nFull ){
+ rc = SQLITE_CANTOPEN_BKPT;
+ }else{
+ memmove(&zDel[n], zDel, nByte+1);
+ memcpy(zDel, zIn, n);
+ nByte += n;
+ }
+ }
+ zDel[nByte] = '\0';
+ }
+ }
+
+ zIn = zDel;
+ }
+ }
+
+ assert( rc!=SQLITE_OK || zIn!=zFull || zIn[0]=='/' );
+ if( rc==SQLITE_OK && zIn!=zFull ){
+ rc = mkFullPathname(zIn, zFull, nFull);
+ }
+ if( bLink==0 ) break;
+ zIn = zFull;
+ }while( rc==SQLITE_OK );
+
+ sqlite3_free(zDel);
+ winSimplifyName(zFull);
+ return rc;
+ }
+ }
+#endif /* __CYGWIN__ */
+#if 0 /* This doesn't work correctly at all! See:
+
+*/
SimulateIOError( return SQLITE_ERROR );
UNUSED_PARAMETER(nFull);
assert( nFull>=pVfs->mxPathname );
- if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){
- /*
- ** NOTE: We are dealing with a relative path name and the data
- ** directory has been set. Therefore, use it as the basis
- ** for converting the relative path name to an absolute
- ** one by prepending the data directory and a slash.
- */
- char *zOut = sqlite3MallocZero( 1+(u64)pVfs->mxPathname );
- if( !zOut ){
- return SQLITE_IOERR_NOMEM_BKPT;
- }
- if( cygwin_conv_path(
- (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) |
- CCP_RELATIVE, zRelative, zOut, pVfs->mxPathname+1)<0 ){
- sqlite3_free(zOut);
- return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno,
- "winFullPathname1", zRelative);
- }else{
- char *zUtf8 = winConvertToUtf8Filename(zOut);
- if( !zUtf8 ){
- sqlite3_free(zOut);
- return SQLITE_IOERR_NOMEM_BKPT;
- }
- sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
- sqlite3_data_directory, winGetDirSep(), zUtf8);
- sqlite3_free(zUtf8);
- sqlite3_free(zOut);
- }
+ char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
+ if( !zOut ){
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( osCygwin_conv_path(
+ CCP_POSIX_TO_WIN_W,
+ zRelative, zOut, pVfs->mxPathname+1)<0 ){
+ sqlite3_free(zOut);
+ return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno,
+ "winFullPathname2", zRelative);
}else{
- char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
- if( !zOut ){
+ char *zUtf8 = winConvertToUtf8Filename(zOut);
+ if( !zUtf8 ){
+ sqlite3_free(zOut);
return SQLITE_IOERR_NOMEM_BKPT;
}
- if( cygwin_conv_path(
- (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A),
- zRelative, zOut, pVfs->mxPathname+1)<0 ){
- sqlite3_free(zOut);
- return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno,
- "winFullPathname2", zRelative);
- }else{
- char *zUtf8 = winConvertToUtf8Filename(zOut);
- if( !zUtf8 ){
- sqlite3_free(zOut);
- return SQLITE_IOERR_NOMEM_BKPT;
- }
- sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8);
- sqlite3_free(zUtf8);
- sqlite3_free(zOut);
- }
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8);
+ sqlite3_free(zUtf8);
+ sqlite3_free(zOut);
}
return SQLITE_OK;
#endif
-#if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__)
+#if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && defined(_WIN32)
SimulateIOError( return SQLITE_ERROR );
/* WinCE has no concept of a relative pathname, or so I am told. */
/* WinRT has no way to convert a relative path to an absolute one. */
@@ -5953,7 +6239,8 @@ static int winFullPathnameNoMutex(
return SQLITE_OK;
#endif
-#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__)
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
+#if defined(_WIN32)
/* It's odd to simulate an io-error here, but really this is just
** using the io-error infrastructure to test that SQLite handles this
** function failing. This function could fail if, for example, the
@@ -5971,6 +6258,7 @@ static int winFullPathnameNoMutex(
sqlite3_data_directory, winGetDirSep(), zRelative);
return SQLITE_OK;
}
+#endif
zConverted = winConvertFromUtf8Filename(zRelative);
if( zConverted==0 ){
return SQLITE_IOERR_NOMEM_BKPT;
@@ -5983,12 +6271,13 @@ static int winFullPathnameNoMutex(
return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
"winFullPathname1", zRelative);
}
- zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) );
+ nByte += 3;
+ zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
if( zTemp==0 ){
sqlite3_free(zConverted);
return SQLITE_IOERR_NOMEM_BKPT;
}
- nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte+3, zTemp, 0);
+ nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0);
if( nByte==0 ){
sqlite3_free(zConverted);
sqlite3_free(zTemp);
@@ -6026,7 +6315,26 @@ static int winFullPathnameNoMutex(
}
#endif
if( zOut ){
+#ifdef __CYGWIN__
+ if( memcmp(zOut, "\\\\?\\", 4) ){
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zOut);
+ }else if( memcmp(zOut+4, "UNC\\", 4) ){
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zOut+4);
+ }else{
+ char *p = zOut+6;
+ *p = '\\';
+ if( osGetcwd ){
+ /* On Cygwin, UNC paths use forward slashes */
+ while( *p ){
+ if( *p=='\\' ) *p = '/';
+ ++p;
+ }
+ }
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zOut+6);
+ }
+#else
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zOut);
+#endif /* __CYGWIN__ */
sqlite3_free(zOut);
return SQLITE_OK;
}else{
@@ -6056,7 +6364,9 @@ static int winFullPathname(
*/
static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
HANDLE h;
-#if defined(__CYGWIN__)
+#if 0 /* This doesn't work correctly at all! See:
+
+*/
int nFull = pVfs->mxPathname+1;
char *zFull = sqlite3MallocZero( nFull );
void *zConverted = 0;
@@ -6423,7 +6733,7 @@ int sqlite3_os_init(void){
/* Double-check that the aSyscall[] array has been constructed
** correctly. See ticket [bb3a86e890c8e96ab] */
- assert( ArraySize(aSyscall)==82 );
+ assert( ArraySize(aSyscall)==89 );
/* get memory map allocation granularity */
memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
diff --git a/src/os_win.h b/src/os_win.h
index 27714ed079..a0845f0038 100644
--- a/src/os_win.h
+++ b/src/os_win.h
@@ -22,6 +22,8 @@
#ifdef __CYGWIN__
# include
+# include /* amalgamator: dontcache */
+# include /* amalgamator: dontcache */
# include /* amalgamator: dontcache */
#endif
diff --git a/src/printf.c b/src/printf.c
index 166c11194e..8cb5a43c5e 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -1344,6 +1344,15 @@ char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
return zBuf;
}
+/* Maximum size of an sqlite3_log() message. */
+#if defined(SQLITE_MAX_LOG_MESSAGE)
+ /* Leave the definition as supplied */
+#elif SQLITE_PRINT_BUF_SIZE*10>10000
+# define SQLITE_MAX_LOG_MESSAGE 10000
+#else
+# define SQLITE_MAX_LOG_MESSAGE (SQLITE_PRINT_BUF_SIZE*10)
+#endif
+
/*
** This is the routine that actually formats the sqlite3_log() message.
** We house it in a separate routine from sqlite3_log() to avoid using
@@ -1360,7 +1369,7 @@ char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
*/
static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
StrAccum acc; /* String accumulator */
- char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */
+ char zMsg[SQLITE_MAX_LOG_MESSAGE]; /* Complete log message */
sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0);
sqlite3_str_vappendf(&acc, zFormat, ap);
diff --git a/src/select.c b/src/select.c
index b2f2cc7fb8..6e8ee58bc6 100644
--- a/src/select.c
+++ b/src/select.c
@@ -4858,7 +4858,8 @@ static void constInsert(
return; /* Already present. Return without doing anything. */
}
}
- if( sqlite3ExprAffinity(pColumn)==SQLITE_AFF_BLOB ){
+ assert( SQLITE_AFF_NONEbHasAffBlob = 1;
}
@@ -4933,7 +4934,8 @@ static int propagateConstantExprRewriteOne(
if( pColumn==pExpr ) continue;
if( pColumn->iTable!=pExpr->iTable ) continue;
if( pColumn->iColumn!=pExpr->iColumn ) continue;
- if( bIgnoreAffBlob && sqlite3ExprAffinity(pColumn)==SQLITE_AFF_BLOB ){
+ assert( SQLITE_AFF_NONEnSelectRow ){
p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo);
+ if( pDest->eDest<=SRT_DistQueue && pDest->eDest>=SRT_DistFifo ){
+ /* TUNING: For a UNION CTE, because UNION is implies DISTINCT,
+ ** reduce the estimated output row count by 8 (LogEst 30).
+ ** Search for tag-20250414a to see other cases */
+ p->nSelectRow -= 30;
+ }
}
if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){
sDistinct.eTnctType = sqlite3WhereIsDistinct(pWInfo);
diff --git a/src/shell.c.in b/src/shell.c.in
index 8272956ebd..ca76e4a6e9 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -5238,6 +5238,7 @@ static const char *(azHelp[]) = {
#ifndef SQLITE_SHELL_FIDDLE
".output ?FILE? Send output to FILE or stdout if FILE is omitted",
" If FILE begins with '|' then open it as a pipe.",
+ " If FILE is 'off' then output is disabled.",
" Options:",
" --bom Prefix output with a UTF8 byte-order mark",
" -e Send output to the system text editor",
@@ -6855,7 +6856,7 @@ static int shell_dbtotxt_command(ShellState *p, int nArg, char **azArg){
for(j=0; j<16 && aLine[j]==0; j++){}
if( j==16 ) continue;
if( !seenPageLabel ){
- sqlite3_fprintf(p->out, "| page %lld offset %lld\n", pgno, pgno*pgSz);
+ sqlite3_fprintf(p->out, "| page %lld offset %lld\n",pgno,(pgno-1)*pgSz);
seenPageLabel = 1;
}
sqlite3_fprintf(p->out, "| %5d:", i);
@@ -10233,9 +10234,9 @@ static int do_meta_command(char *zLine, ShellState *p){
){
char *zFile = 0;
int i;
- int eMode = 0;
- int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
- int bPlain = 0; /* --plain option */
+ int eMode = 0; /* 0: .outout/.once, 'x'=.excel, 'w'=.www */
+ int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
+ int bPlain = 0; /* --plain option */
static const char *zBomUtf8 = "\357\273\277";
const char *zBom = 0;
@@ -10264,14 +10265,22 @@ static int do_meta_command(char *zLine, ShellState *p){
}else if( c=='o' && cli_strcmp(z,"-w")==0 ){
eMode = 'w'; /* Web browser */
}else{
- sqlite3_fprintf(p->out,
+ sqlite3_fprintf(p->out,
"ERROR: unknown option: \"%s\". Usage:\n", azArg[i]);
showHelp(p->out, azArg[0]);
rc = 1;
goto meta_command_exit;
}
}else if( zFile==0 && eMode==0 ){
- zFile = sqlite3_mprintf("%s", z);
+ if( cli_strcmp(z, "off")==0 ){
+#ifdef _WIN32
+ zFile = sqlite3_mprintf("nul");
+#else
+ zFile = sqlite3_mprintf("/dev/null");
+#endif
+ }else{
+ zFile = sqlite3_mprintf("%s", z);
+ }
if( zFile && zFile[0]=='|' ){
while( i+1Fossil configuration management
+** Fossil configuration management
** system. ^The SQLITE_SOURCE_ID macro evaluates to
** a string which identifies a particular check-in of SQLite
** within its configuration management system. ^The SQLITE_SOURCE_ID
diff --git a/src/sqlite3.rc b/src/sqlite3.rc
index 5a856490d6..aad468d349 100644
--- a/src/sqlite3.rc
+++ b/src/sqlite3.rc
@@ -70,7 +70,7 @@ BEGIN
VALUE "FileDescription", "SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine."
VALUE "FileVersion", SQLITE_VERSION
VALUE "InternalName", "sqlite3"
- VALUE "LegalCopyright", "http://www.sqlite.org/copyright.html"
+ VALUE "LegalCopyright", "http://sqlite.org/copyright.html"
VALUE "ProductName", "SQLite"
VALUE "ProductVersion", SQLITE_VERSION
VALUE "SourceId", SQLITE_SOURCE_ID
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 35e5b94d71..edf925964b 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2792,6 +2792,7 @@ struct Index {
unsigned bLowQual:1; /* sqlite_stat1 says this is a low-quality index */
unsigned bNoQuery:1; /* Do not use this index to optimize queries */
unsigned bAscKeyBug:1; /* True if the bba7b69f9849b5bf bug applies */
+ unsigned bIdxRowid:1; /* One or more of the index keys is the ROWID */
unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */
unsigned bHasExpr:1; /* Index contains an expression, either a literal
** expression, or a reference to a VIRTUAL column */
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index c619ffca4b..7675a91254 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -76,7 +76,9 @@
# define SQLITE_PTRSIZE 8
# endif
# endif /* SQLITE_PTRSIZE */
-# if defined(HAVE_STDINT_H)
+# if defined(HAVE_STDINT_H) || (defined(__STDC_VERSION__) && \
+ (__STDC_VERSION__ >= 199901L))
+# include
typedef uintptr_t uptr;
# elif SQLITE_PTRSIZE==4
typedef unsigned int uptr;
@@ -2525,7 +2527,7 @@ static int SQLITE_TCLAPI DbObjCmd(
Tcl_Channel in; /* The input file */
int lineno = 0; /* Line number of input file */
char zLineNum[80]; /* Line number print buffer */
- Tcl_DString str;
+ Tcl_Obj *str;
Tcl_Obj *pResult; /* interp result */
const char *zSep;
@@ -2609,19 +2611,22 @@ static int SQLITE_TCLAPI DbObjCmd(
sqlite3_finalize(pStmt);
return TCL_ERROR;
}
+ Tcl_SetChannelOption(NULL, in, "-translation", "auto");
azCol = malloc( sizeof(azCol[0])*(nCol+1) );
if( azCol==0 ) {
Tcl_AppendResult(interp, "Error: can't malloc()", (char*)0);
Tcl_Close(interp, in);
return TCL_ERROR;
}
- Tcl_DStringInit(&str);
+ str = Tcl_NewObj();
+ Tcl_IncrRefCount(str);
(void)sqlite3_exec(pDb->db, "BEGIN", 0, 0, 0);
zCommit = "COMMIT";
- while( Tcl_Gets(in, &str)>=0 ) {
+ while( Tcl_GetsObj(in, str)>=0 ) {
char *z;
+ Tcl_Size byteLen;
lineno++;
- zLine = Tcl_DStringValue(&str);
+ zLine = (char *)Tcl_GetByteArrayFromObj(str, &byteLen);
azCol[0] = zLine;
for(i=0, z=zLine; *z; z++){
if( *z==zSep[0] && strncmp(z, zSep, nSep)==0 ){
@@ -2659,14 +2664,14 @@ static int SQLITE_TCLAPI DbObjCmd(
}
sqlite3_step(pStmt);
rc = sqlite3_reset(pStmt);
- Tcl_DStringSetLength(&str, 0);
+ Tcl_SetObjLength(str, 0);
if( rc!=SQLITE_OK ){
Tcl_AppendResult(interp,"Error: ", sqlite3_errmsg(pDb->db), (char*)0);
zCommit = "ROLLBACK";
break;
}
}
- Tcl_DStringFree(&str);
+ Tcl_DecrRefCount(str);
free(azCol);
Tcl_Close(interp, in);
sqlite3_finalize(pStmt);
diff --git a/src/test1.c b/src/test1.c
index e45a05fe47..bb2f2d3b9d 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -102,7 +102,7 @@ static int SQLITE_TCLAPI get_sqlite_pointer(
}
p = (struct SqliteDb*)cmdInfo.objClientData;
sqlite3_snprintf(sizeof(zBuf), zBuf, "%p", p->db);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -153,7 +153,7 @@ int sqlite3TestErrCode(Tcl_Interp *interp, sqlite3 *db, int rc){
"error code %s (%d) does not match sqlite3_errcode %s (%d)",
t1ErrorName(rc), rc, t1ErrorName(r2), r2);
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return 1;
}
return 0;
@@ -504,7 +504,7 @@ static int SQLITE_TCLAPI test_mprintf_z(
for(i=2; isizeof(zStr) ) n = sizeof(zStr);
sqlite3_snprintf(sizeof(zStr), zStr, "abcdefghijklmnopqrstuvwxyz");
sqlite3_snprintf(n, zStr, zFormat, a1);
- Tcl_AppendResult(interp, zStr, 0);
+ Tcl_AppendResult(interp, zStr, NULL);
return TCL_OK;
}
@@ -639,12 +639,12 @@ static int SQLITE_TCLAPI test_last_rowid(
char zBuf[30];
if( argc!=2 ){
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB\"", 0);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB\"", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", sqlite3_last_insert_rowid(db));
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return SQLITE_OK;
}
@@ -1385,7 +1385,7 @@ static int SQLITE_TCLAPI sqlite3_mprintf_int(
if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR;
}
z = sqlite3_mprintf(argv[1], a[0], a[1], a[2]);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1411,12 +1411,12 @@ static int SQLITE_TCLAPI sqlite3_mprintf_int64(
}
for(i=2; i<5; i++){
if( sqlite3Atoi64(argv[i], &a[i-2], sqlite3Strlen30(argv[i]), SQLITE_UTF8) ){
- Tcl_AppendResult(interp, "argument is not a valid 64-bit integer", 0);
+ Tcl_AppendResult(interp, "argument is not a valid 64-bit integer", NULL);
return TCL_ERROR;
}
}
z = sqlite3_mprintf(argv[1], a[0], a[1], a[2]);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1449,7 +1449,7 @@ static int SQLITE_TCLAPI sqlite3_mprintf_long(
a[i-2] &= (((u64)1)<<(sizeof(int)*8))-1;
}
z = sqlite3_mprintf(argv[1], a[0], a[1], a[2]);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1476,7 +1476,7 @@ static int SQLITE_TCLAPI sqlite3_mprintf_str(
if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR;
}
z = sqlite3_mprintf(argv[1], a[0], a[1], argc>4 ? argv[4] : NULL);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1502,7 +1502,7 @@ static int SQLITE_TCLAPI sqlite3_snprintf_str(
}
if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR;
if( n<0 ){
- Tcl_AppendResult(interp, "N must be non-negative", 0);
+ Tcl_AppendResult(interp, "N must be non-negative", NULL);
return TCL_ERROR;
}
for(i=3; i<5; i++){
@@ -1510,7 +1510,7 @@ static int SQLITE_TCLAPI sqlite3_snprintf_str(
}
z = sqlite3_malloc( n+1 );
sqlite3_snprintf(n, z, argv[2], a[0], a[1], argc>4 ? argv[5] : NULL);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1539,7 +1539,7 @@ static int SQLITE_TCLAPI sqlite3_mprintf_double(
}
if( Tcl_GetDouble(interp, argv[4], &r) ) return TCL_ERROR;
z = sqlite3_mprintf(argv[1], a[0], a[1], r);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1569,7 +1569,7 @@ static int SQLITE_TCLAPI sqlite3_mprintf_scaled(
if( Tcl_GetDouble(interp, argv[i], &r[i-2]) ) return TCL_ERROR;
}
z = sqlite3_mprintf(argv[1], r[0]*r[1]);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1594,7 +1594,7 @@ static int SQLITE_TCLAPI sqlite3_mprintf_stronly(
return TCL_ERROR;
}
z = sqlite3_mprintf(argv[1], argv[2]);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1621,14 +1621,14 @@ static int SQLITE_TCLAPI sqlite3_mprintf_hexdouble(
return TCL_ERROR;
}
if( sscanf(argv[2], "%08x%08x", &x2, &x1)!=2 ){
- Tcl_AppendResult(interp, "2nd argument should be 16-characters of hex", 0);
+ Tcl_AppendResult(interp, "2nd argument should be 16-characters of hex", NULL);
return TCL_ERROR;
}
d = x2;
d = (d<<32) + x1;
memcpy(&r, &d, sizeof(r));
z = sqlite3_mprintf(argv[1], r);
- Tcl_AppendResult(interp, z, 0);
+ Tcl_AppendResult(interp, z, NULL);
sqlite3_free(z);
return TCL_OK;
}
@@ -1746,7 +1746,7 @@ static int SQLITE_TCLAPI test_table_column_metadata(
&zDatatype, &zCollseq, ¬null, &primarykey, &autoincrement);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3_errmsg(db), 0);
+ Tcl_AppendResult(interp, sqlite3_errmsg(db), NULL);
return TCL_ERROR;
}
@@ -2023,7 +2023,7 @@ static int SQLITE_TCLAPI test_create_function_v2(
);
if( rc!=SQLITE_OK ){
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -2212,7 +2212,7 @@ static int SQLITE_TCLAPI test_register_func(
rc = sqlite3_create_function(db, argv[2], -1, SQLITE_UTF8, 0,
testFunc, 0, 0);
if( rc!=0 ){
- Tcl_AppendResult(interp, sqlite3ErrStr(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrStr(rc), NULL);
return TCL_ERROR;
}
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
@@ -2773,7 +2773,7 @@ static int SQLITE_TCLAPI test_snapshot_open_blob(
zName = Tcl_GetString(objv[2]);
pBlob = Tcl_GetByteArrayFromObj(objv[3], &nBlob);
if( nBlob!=sizeof(sqlite3_snapshot) ){
- Tcl_AppendResult(interp, "bad SNAPSHOT", 0);
+ Tcl_AppendResult(interp, "bad SNAPSHOT", NULL);
return TCL_ERROR;
}
rc = sqlite3_snapshot_open(db, zName, (sqlite3_snapshot*)pBlob);
@@ -2810,7 +2810,7 @@ static int SQLITE_TCLAPI test_snapshot_cmp_blob(
p2 = Tcl_GetByteArrayFromObj(objv[2], &n2);
if( n1!=sizeof(sqlite3_snapshot) || n1!=n2 ){
- Tcl_AppendResult(interp, "bad SNAPSHOT", 0);
+ Tcl_AppendResult(interp, "bad SNAPSHOT", NULL);
return TCL_ERROR;
}
@@ -2867,7 +2867,7 @@ static int SQLITE_TCLAPI test_atomic_batch_write(
rc = sqlite3_open(zFile, &db);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3_errmsg(db), 0);
+ Tcl_AppendResult(interp, sqlite3_errmsg(db), NULL);
sqlite3_close(db);
return TCL_ERROR;
}
@@ -2909,7 +2909,7 @@ static int SQLITE_TCLAPI test_next_stmt(
pStmt = sqlite3_next_stmt(db, pStmt);
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
}
return TCL_OK;
}
@@ -3211,7 +3211,7 @@ static int SQLITE_TCLAPI test_bind(
if( rc ){
char zBuf[50];
sqlite3_snprintf(sizeof(zBuf), zBuf, "(%d) ", rc);
- Tcl_AppendResult(interp, zBuf, sqlite3ErrStr(rc), 0);
+ Tcl_AppendResult(interp, zBuf, sqlite3ErrStr(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -3343,14 +3343,14 @@ static int SQLITE_TCLAPI test_collate(
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
bad_args:
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " ", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " ", NULL);
return TCL_ERROR;
}
@@ -3629,7 +3629,7 @@ static int SQLITE_TCLAPI test_function(
return TCL_OK;
bad_args:
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " ", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " ", NULL);
#endif /* SQLITE_OMIT_UTF16 */
return TCL_ERROR;
}
@@ -3750,7 +3750,7 @@ static int SQLITE_TCLAPI test_bind_zeroblob64(
rc = sqlite3_bind_zeroblob64(pStmt, idx, n);
if( sqlite3TestErrCode(interp, StmtToDb(pStmt), rc) ) return TCL_ERROR;
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
@@ -3777,7 +3777,7 @@ static int SQLITE_TCLAPI test_bind_int(
if( objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", NULL);
return TCL_ERROR;
}
@@ -3954,7 +3954,7 @@ static int SQLITE_TCLAPI test_bind_int64(
if( objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", NULL);
return TCL_ERROR;
}
@@ -4010,7 +4010,7 @@ static int SQLITE_TCLAPI test_bind_double(
if( objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", NULL);
return TCL_ERROR;
}
@@ -4067,7 +4067,7 @@ static int SQLITE_TCLAPI test_bind_null(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " STMT N", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " STMT N", NULL);
return TCL_ERROR;
}
@@ -4107,7 +4107,7 @@ static int SQLITE_TCLAPI test_bind_text(
if( objc!=5 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE BYTES", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE BYTES", NULL);
return TCL_ERROR;
}
@@ -4167,7 +4167,7 @@ static int SQLITE_TCLAPI test_bind_text16(
if( objc!=5 && objc!=6){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE BYTES", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE BYTES", NULL);
return TCL_ERROR;
}
@@ -4189,7 +4189,7 @@ static int SQLITE_TCLAPI test_bind_text16(
free(toFree);
if( sqlite3TestErrCode(interp, StmtToDb(pStmt), rc) ) return TCL_ERROR;
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
@@ -4220,7 +4220,7 @@ static int SQLITE_TCLAPI test_bind_blob(
if( objc!=5 && objc!=6 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " STMT N DATA BYTES", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " STMT N DATA BYTES", NULL);
return TCL_ERROR;
}
@@ -4718,12 +4718,12 @@ static int SQLITE_TCLAPI test_ex_errcode(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB", 0);
+ Tcl_GetString(objv[0]), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
rc = sqlite3_extended_errcode(db);
- Tcl_AppendResult(interp, (char *)t1ErrorName(rc), 0);
+ Tcl_AppendResult(interp, (char *)t1ErrorName(rc), NULL);
return TCL_OK;
}
@@ -4745,12 +4745,12 @@ static int SQLITE_TCLAPI test_errcode(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB", 0);
+ Tcl_GetString(objv[0]), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
rc = sqlite3_errcode(db);
- Tcl_AppendResult(interp, (char *)t1ErrorName(rc), 0);
+ Tcl_AppendResult(interp, (char *)t1ErrorName(rc), NULL);
return TCL_OK;
}
@@ -4771,7 +4771,7 @@ static int SQLITE_TCLAPI test_errmsg(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB", 0);
+ Tcl_GetString(objv[0]), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -4799,7 +4799,7 @@ static int SQLITE_TCLAPI test_error_offset(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB", 0);
+ Tcl_GetString(objv[0]), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -4831,7 +4831,7 @@ static int SQLITE_TCLAPI test_errmsg16(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB", 0);
+ Tcl_GetString(objv[0]), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -4870,7 +4870,7 @@ static int SQLITE_TCLAPI test_prepare(
if( objc!=5 && objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -4892,13 +4892,13 @@ static int SQLITE_TCLAPI test_prepare(
if( rc!=SQLITE_OK ){
assert( pStmt==0 );
sqlite3_snprintf(sizeof(zBuf), zBuf, "(%d) ", rc);
- Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), 0);
+ Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), NULL);
return TCL_ERROR;
}
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
}
return TCL_OK;
}
@@ -4929,7 +4929,7 @@ static int SQLITE_TCLAPI test_prepare_v2(
if( objc!=5 && objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes tailvar", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes tailvar", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -4966,13 +4966,13 @@ static int SQLITE_TCLAPI test_prepare_v2(
if( rc!=SQLITE_OK ){
assert( pStmt==0 );
sqlite3_snprintf(sizeof(zBuf), zBuf, "(%d) ", rc);
- Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), 0);
+ Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), NULL);
return TCL_ERROR;
}
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
}
return TCL_OK;
}
@@ -5003,7 +5003,7 @@ static int SQLITE_TCLAPI test_prepare_v3(
if( objc!=6 && objc!=5 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes flags tailvar", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes flags tailvar", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -5039,13 +5039,13 @@ static int SQLITE_TCLAPI test_prepare_v3(
if( rc!=SQLITE_OK ){
assert( pStmt==0 );
sqlite3_snprintf(sizeof(zBuf), zBuf, "(%d) ", rc);
- Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), 0);
+ Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), NULL);
return TCL_ERROR;
}
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
}
return TCL_OK;
}
@@ -5070,7 +5070,7 @@ static int SQLITE_TCLAPI test_prepare_tkt3134(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes tailvar", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes tailvar", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -5080,13 +5080,13 @@ static int SQLITE_TCLAPI test_prepare_tkt3134(
if( rc!=SQLITE_OK ){
assert( pStmt==0 );
sqlite3_snprintf(sizeof(zBuf), zBuf, "(%d) ", rc);
- Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), 0);
+ Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), NULL);
return TCL_ERROR;
}
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
}
return TCL_OK;
}
@@ -5118,7 +5118,7 @@ static int SQLITE_TCLAPI test_prepare16(
if( objc!=5 && objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -5146,7 +5146,7 @@ static int SQLITE_TCLAPI test_prepare16(
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
}
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK;
}
@@ -5178,7 +5178,7 @@ static int SQLITE_TCLAPI test_prepare16_v2(
if( objc!=5 && objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -5206,7 +5206,7 @@ static int SQLITE_TCLAPI test_prepare16_v2(
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
}
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK;
}
@@ -5226,7 +5226,7 @@ static int SQLITE_TCLAPI test_open(
if( objc!=3 && objc!=2 && objc!=1 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " filename options-list", 0);
+ Tcl_GetString(objv[0]), " filename options-list", NULL);
return TCL_ERROR;
}
@@ -5234,7 +5234,7 @@ static int SQLITE_TCLAPI test_open(
sqlite3_open(zFilename, &db);
if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -5305,7 +5305,7 @@ static int SQLITE_TCLAPI test_open_v2(
rc = sqlite3_open_v2(zFilename, &db, flags, zVfs);
if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -5325,7 +5325,7 @@ static int SQLITE_TCLAPI test_open16(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " filename options-list", 0);
+ Tcl_GetString(objv[0]), " filename options-list", NULL);
return TCL_ERROR;
}
@@ -5333,7 +5333,7 @@ static int SQLITE_TCLAPI test_open16(
sqlite3_open16(zFilename, &db);
if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
#endif /* SQLITE_OMIT_UTF16 */
return TCL_OK;
}
@@ -5409,7 +5409,7 @@ static int SQLITE_TCLAPI test_step(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT", 0);
+ Tcl_GetString(objv[0]), " STMT", NULL);
return TCL_ERROR;
}
@@ -5493,7 +5493,7 @@ static int SQLITE_TCLAPI test_column_count(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5520,7 +5520,7 @@ static int SQLITE_TCLAPI test_column_type(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5569,7 +5569,7 @@ static int SQLITE_TCLAPI test_column_int64(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5598,7 +5598,7 @@ static int SQLITE_TCLAPI test_column_blob(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5628,7 +5628,7 @@ static int SQLITE_TCLAPI test_column_double(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5655,7 +5655,7 @@ static int SQLITE_TCLAPI test_data_count(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5688,7 +5688,7 @@ static int SQLITE_TCLAPI test_stmt_utf8(
xFuncU = (const unsigned char*(*)(sqlite3_stmt*,int))xFunc;
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5746,7 +5746,7 @@ static int SQLITE_TCLAPI test_stmt_utf16(
xFunc = (const void *(*)(sqlite3_stmt*, int))clientData;
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5787,7 +5787,7 @@ static int SQLITE_TCLAPI test_stmt_int(
xFunc = (int (*)(sqlite3_stmt*, int))clientData;
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " STMT column", 0);
+ Tcl_GetString(objv[0]), " STMT column", NULL);
return TCL_ERROR;
}
@@ -5811,7 +5811,7 @@ static int SQLITE_TCLAPI test_interrupt(
){
sqlite3 *db;
if( argc!=2 ){
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB", 0);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
@@ -5833,7 +5833,7 @@ static int SQLITE_TCLAPI test_is_interrupted(
sqlite3 *db;
int rc;
if( argc!=2 ){
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB", 0);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
@@ -5915,7 +5915,7 @@ static int SQLITE_TCLAPI get_autocommit(
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", sqlite3_get_autocommit(db));
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -5936,13 +5936,13 @@ static int SQLITE_TCLAPI test_busy_timeout(
sqlite3 *db;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " DB", 0);
+ " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
if( Tcl_GetInt(interp, argv[2], &ms) ) return TCL_ERROR;
rc = sqlite3_busy_timeout(db, ms);
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_OK;
}
@@ -5963,14 +5963,14 @@ static int SQLITE_TCLAPI test_setlk_timeout(
if( argc==4 ){
const char *zArg = argv[1];
- int nArg = strlen(zArg);
+ const size_t nArg = strlen(zArg);
if( nArg>=2 && nArg<=15 && memcmp(zArg, "-blockonconnect", nArg)==0 ){
bBlockOnConnect = 1;
}
}
if( argc!=(3+bBlockOnConnect) ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ?-blockonconnect? DB MS", 0);
+ " ?-blockonconnect? DB MS", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, argv[argc-2], &db) ) return TCL_ERROR;
@@ -5978,7 +5978,7 @@ static int SQLITE_TCLAPI test_setlk_timeout(
rc = sqlite3_setlk_timeout(
db, ms, (bBlockOnConnect ? SQLITE_SETLK_BLOCK_ON_CONNECT : 0)
);
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_OK;
}
@@ -6390,7 +6390,7 @@ static int SQLITE_TCLAPI test_pager_refcounts(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -6632,7 +6632,7 @@ static int SQLITE_TCLAPI file_control_test(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -6667,7 +6667,7 @@ static int SQLITE_TCLAPI file_control_lasterrno_test(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -6680,7 +6680,7 @@ static int SQLITE_TCLAPI file_control_lasterrno_test(
}
if( iArg!=0 ) {
Tcl_AppendResult(interp, "Unexpected non-zero errno: ",
- Tcl_GetStringFromObj(Tcl_NewIntObj(iArg), 0), " ", 0);
+ Tcl_GetStringFromObj(Tcl_NewIntObj(iArg), 0), " ", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -6816,7 +6816,7 @@ static int SQLITE_TCLAPI file_control_lockproxy_test(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB PWD", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB PWD", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -6852,7 +6852,7 @@ static int SQLITE_TCLAPI file_control_lockproxy_test(
rc = sqlite3_file_control(db, NULL, SQLITE_GET_LOCKPROXYFILE, &testPath);
if( strncmp(proxyPath,testPath,11) ){
Tcl_AppendResult(interp, "Lock proxy file did not match the "
- "previously assigned value", 0);
+ "previously assigned value", NULL);
return TCL_ERROR;
}
if( rc ){
@@ -6889,7 +6889,7 @@ static int SQLITE_TCLAPI file_control_win32_av_retry(
if( objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB NRETRY DELAY", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB NRETRY DELAY", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -6922,7 +6922,7 @@ static int file_control_win32_get_handle(
if( objc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -6954,7 +6954,7 @@ static int SQLITE_TCLAPI file_control_win32_set_handle(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB HANDLE", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB HANDLE", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -6990,7 +6990,7 @@ static int SQLITE_TCLAPI file_control_persist_wal(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB FLAG", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB FLAG", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -7022,7 +7022,7 @@ static int SQLITE_TCLAPI file_control_powersafe_overwrite(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB FLAG", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB FLAG", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -7053,7 +7053,7 @@ static int SQLITE_TCLAPI file_control_vfsname(
if( objc!=2 && objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB ?AUXDB?", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB ?AUXDB?", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -7115,7 +7115,7 @@ static int SQLITE_TCLAPI file_control_tempfilename(
if( objc!=2 && objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB ?AUXDB?", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB ?AUXDB?", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -7148,7 +7148,7 @@ static int SQLITE_TCLAPI file_control_external_reader(
if( objc!=2 && objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB ?AUXDB?", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB ?AUXDB?", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
@@ -7232,7 +7232,7 @@ static int SQLITE_TCLAPI test_limit(
if( objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " DB ID VALUE", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " DB ID VALUE", NULL);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
@@ -7543,7 +7543,7 @@ static int SQLITE_TCLAPI test_wal_checkpoint_v2(
if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
const char *zErrCode = sqlite3ErrName(rc);
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, zErrCode, " - ", (char *)sqlite3_errmsg(db), 0);
+ Tcl_AppendResult(interp, zErrCode, " - ", (char *)sqlite3_errmsg(db), NULL);
return TCL_ERROR;
}
@@ -7984,7 +7984,7 @@ struct win32FileLocker {
#endif
-#if SQLITE_OS_WIN
+#ifdef _WIN32
#include
/*
** The background thread that does file locking.
@@ -8017,7 +8017,7 @@ static void SQLITE_CDECL win32_file_locker(void *pAppData){
}
#endif
-#if SQLITE_OS_WIN
+#ifdef _WIN32
/*
** lock_win32_file FILENAME DELAY1 DELAY2
**
@@ -8826,7 +8826,7 @@ static int SQLITE_TCLAPI guess_number_of_cores(
Tcl_Obj *CONST objv[]
){
unsigned int nCore = 1;
-#if SQLITE_OS_WIN
+#ifdef _WIN32
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
nCore = (unsigned int)sysinfo.dwNumberOfProcessors;
@@ -9006,7 +9006,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "database_never_corrupt", database_never_corrupt, 0},
{ "database_may_be_corrupt", database_may_be_corrupt, 0},
{ "optimization_control", optimization_control,0},
-#if SQLITE_OS_WIN
+#ifdef _WIN32
{ "lock_win32_file", win32_file_lock, 0 },
#endif
{ "tcl_objproc", runAsObjProc, 0 },
diff --git a/src/test2.c b/src/test2.c
index a9549aa7f5..899728ead9 100644
--- a/src/test2.c
+++ b/src/test2.c
@@ -51,7 +51,7 @@ static int SQLITE_TCLAPI pager_open(
char zBuf[100];
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " FILENAME N-PAGE\"", 0);
+ " FILENAME N-PAGE\"", NULL);
return TCL_ERROR;
}
if( Tcl_GetInt(interp, argv[2], &nPage) ) return TCL_ERROR;
@@ -59,14 +59,14 @@ static int SQLITE_TCLAPI pager_open(
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB,
pager_test_reiniter);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
sqlite3PagerSetCachesize(pPager, nPage);
pageSize = test_pagesize;
sqlite3PagerSetPagesize(pPager, &pageSize, -1);
sqlite3_snprintf(sizeof(zBuf),zBuf,"%p",pPager);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -85,13 +85,13 @@ static int SQLITE_TCLAPI pager_close(
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
rc = sqlite3PagerClose(pPager, 0);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -112,13 +112,13 @@ static int SQLITE_TCLAPI pager_rollback(
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
rc = sqlite3PagerRollback(pPager);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -139,18 +139,18 @@ static int SQLITE_TCLAPI pager_commit(
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
rc = sqlite3PagerCommitPhaseOne(pPager, 0, 0);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
rc = sqlite3PagerCommitPhaseTwo(pPager);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -171,13 +171,13 @@ static int SQLITE_TCLAPI pager_stmt_begin(
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
rc = sqlite3PagerOpenSavepoint(pPager, 1);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -198,14 +198,14 @@ static int SQLITE_TCLAPI pager_stmt_rollback(
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, 0);
sqlite3PagerSavepoint(pPager, SAVEPOINT_RELEASE, 0);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -226,13 +226,13 @@ static int SQLITE_TCLAPI pager_stmt_commit(
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_RELEASE, 0);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -253,7 +253,7 @@ static int SQLITE_TCLAPI pager_stats(
int i, *a;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
@@ -287,13 +287,13 @@ static int SQLITE_TCLAPI pager_pagecount(
int nPage;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
sqlite3PagerPagecount(pPager, &nPage);
sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", nPage);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -315,7 +315,7 @@ static int SQLITE_TCLAPI page_get(
int rc;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID PGNO\"", 0);
+ " ID PGNO\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
@@ -325,11 +325,11 @@ static int SQLITE_TCLAPI page_get(
rc = sqlite3PagerGet(pPager, pgno, &pPage, 0);
}
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
sqlite3_snprintf(sizeof(zBuf),zBuf,"%p",pPage);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -351,7 +351,7 @@ static int SQLITE_TCLAPI page_lookup(
int pgno;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID PGNO\"", 0);
+ " ID PGNO\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
@@ -359,7 +359,7 @@ static int SQLITE_TCLAPI page_lookup(
pPage = sqlite3PagerLookup(pPager, pgno);
if( pPage ){
sqlite3_snprintf(sizeof(zBuf),zBuf,"%p",pPage);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
}
return TCL_OK;
}
@@ -377,7 +377,7 @@ static int SQLITE_TCLAPI pager_truncate(
int pgno;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID PGNO\"", 0);
+ " ID PGNO\"", NULL);
return TCL_ERROR;
}
pPager = sqlite3TestTextToPtr(argv[1]);
@@ -401,7 +401,7 @@ static int SQLITE_TCLAPI page_unref(
DbPage *pPage;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " PAGE\"", 0);
+ " PAGE\"", NULL);
return TCL_ERROR;
}
pPage = (DbPage *)sqlite3TestTextToPtr(argv[1]);
@@ -424,12 +424,12 @@ static int SQLITE_TCLAPI page_read(
DbPage *pPage;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " PAGE\"", 0);
+ " PAGE\"", NULL);
return TCL_ERROR;
}
pPage = sqlite3TestTextToPtr(argv[1]);
memcpy(zBuf, sqlite3PagerGetData(pPage), sizeof(zBuf));
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -448,12 +448,12 @@ static int SQLITE_TCLAPI page_number(
DbPage *pPage;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " PAGE\"", 0);
+ " PAGE\"", NULL);
return TCL_ERROR;
}
pPage = (DbPage *)sqlite3TestTextToPtr(argv[1]);
sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", sqlite3PagerPagenumber(pPage));
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -473,13 +473,13 @@ static int SQLITE_TCLAPI page_write(
int rc;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " PAGE DATA\"", 0);
+ " PAGE DATA\"", NULL);
return TCL_ERROR;
}
pPage = (DbPage *)sqlite3TestTextToPtr(argv[1]);
rc = sqlite3PagerWrite(pPage);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
pData = sqlite3PagerGetData(pPage);
@@ -513,7 +513,7 @@ static int SQLITE_TCLAPI fake_big_file(
int nFile;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " N-MEGABYTES FILE\"", 0);
+ " N-MEGABYTES FILE\"", NULL);
return TCL_ERROR;
}
if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR;
@@ -536,7 +536,7 @@ static int SQLITE_TCLAPI fake_big_file(
(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB), 0
);
if( rc ){
- Tcl_AppendResult(interp, "open failed: ", sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, "open failed: ", sqlite3ErrName(rc), NULL);
sqlite3_free(zFile);
return TCL_ERROR;
}
@@ -546,7 +546,7 @@ static int SQLITE_TCLAPI fake_big_file(
sqlite3OsCloseFree(fd);
sqlite3_free(zFile);
if( rc ){
- Tcl_AppendResult(interp, "write failed: ", sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, "write failed: ", sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
diff --git a/src/test3.c b/src/test3.c
index f1b2b01680..8fbb96a80d 100644
--- a/src/test3.c
+++ b/src/test3.c
@@ -46,9 +46,10 @@ static int SQLITE_TCLAPI btree_open(
char *zFilename;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " FILENAME NCACHE FLAGS\"", 0);
+ " FILENAME NCACHE FLAGS\"", NULL);
return TCL_ERROR;
}
+
if( Tcl_GetInt(interp, argv[2], &nCache) ) return TCL_ERROR;
nRefSqlite3++;
if( nRefSqlite3==1 ){
@@ -65,12 +66,12 @@ static int SQLITE_TCLAPI btree_open(
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB);
sqlite3_free(zFilename);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
sqlite3BtreeSetCacheSize(pBt, nCache);
sqlite3_snprintf(sizeof(zBuf), zBuf,"%p", pBt);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -89,13 +90,13 @@ static int SQLITE_TCLAPI btree_close(
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pBt = sqlite3TestTextToPtr(argv[1]);
rc = sqlite3BtreeClose(pBt);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
nRefSqlite3--;
@@ -124,7 +125,7 @@ static int SQLITE_TCLAPI btree_begin_transaction(
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pBt = sqlite3TestTextToPtr(argv[1]);
@@ -132,7 +133,7 @@ static int SQLITE_TCLAPI btree_begin_transaction(
rc = sqlite3BtreeBeginTrans(pBt, 1, 0);
sqlite3BtreeLeave(pBt);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -155,7 +156,7 @@ static int SQLITE_TCLAPI btree_pager_stats(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pBt = sqlite3TestTextToPtr(argv[1]);
@@ -208,7 +209,7 @@ static int SQLITE_TCLAPI btree_cursor(
if( argc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID TABLENUM WRITEABLE\"", 0);
+ " ID TABLENUM WRITEABLE\"", NULL);
return TCL_ERROR;
}
pBt = sqlite3TestTextToPtr(argv[1]);
@@ -229,11 +230,11 @@ static int SQLITE_TCLAPI btree_cursor(
sqlite3_mutex_leave(pBt->db->mutex);
if( rc ){
ckfree((char *)pCur);
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
sqlite3_snprintf(sizeof(zBuf), zBuf,"%p", pCur);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return SQLITE_OK;
}
@@ -253,7 +254,7 @@ static int SQLITE_TCLAPI btree_close_cursor(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pCur = sqlite3TestTextToPtr(argv[1]);
@@ -271,7 +272,7 @@ static int SQLITE_TCLAPI btree_close_cursor(
#endif
ckfree((char *)pCur);
if( rc ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return SQLITE_OK;
@@ -297,7 +298,7 @@ static int SQLITE_TCLAPI btree_next(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pCur = sqlite3TestTextToPtr(argv[1]);
@@ -309,11 +310,11 @@ static int SQLITE_TCLAPI btree_next(
}
sqlite3BtreeLeave(pCur->pBtree);
if( rc ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",res);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return SQLITE_OK;
}
@@ -336,7 +337,7 @@ static int SQLITE_TCLAPI btree_first(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pCur = sqlite3TestTextToPtr(argv[1]);
@@ -344,11 +345,11 @@ static int SQLITE_TCLAPI btree_first(
rc = sqlite3BtreeFirst(pCur, &res);
sqlite3BtreeLeave(pCur->pBtree);
if( rc ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",res);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return SQLITE_OK;
}
@@ -370,7 +371,7 @@ static int SQLITE_TCLAPI btree_eof(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pCur = sqlite3TestTextToPtr(argv[1]);
@@ -378,7 +379,7 @@ static int SQLITE_TCLAPI btree_eof(
rc = sqlite3BtreeEof(pCur);
sqlite3BtreeLeave(pCur->pBtree);
sqlite3_snprintf(sizeof(zBuf),zBuf, "%d", rc);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return SQLITE_OK;
}
@@ -399,7 +400,7 @@ static int SQLITE_TCLAPI btree_payload_size(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pCur = sqlite3TestTextToPtr(argv[1]);
@@ -407,7 +408,7 @@ static int SQLITE_TCLAPI btree_payload_size(
n = sqlite3BtreePayloadSize(pCur);
sqlite3BtreeLeave(pCur->pBtree);
sqlite3_snprintf(sizeof(zBuf),zBuf, "%u", n);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return SQLITE_OK;
}
@@ -437,7 +438,7 @@ static int SQLITE_TCLAPI btree_varint_test(
unsigned char zBuf[100];
if( argc!=5 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " START MULTIPLIER COUNT INCREMENT\"", 0);
+ " START MULTIPLIER COUNT INCREMENT\"", NULL);
return TCL_ERROR;
}
if( Tcl_GetInt(interp, argv[1], (int*)&start) ) return TCL_ERROR;
@@ -452,20 +453,20 @@ static int SQLITE_TCLAPI btree_varint_test(
if( n1>9 || n1<1 ){
sqlite3_snprintf(sizeof(zErr), zErr,
"putVarint returned %d - should be between 1 and 9", n1);
- Tcl_AppendResult(interp, zErr, 0);
+ Tcl_AppendResult(interp, zErr, NULL);
return TCL_ERROR;
}
n2 = getVarint(zBuf, &out);
if( n1!=n2 ){
sqlite3_snprintf(sizeof(zErr), zErr,
"putVarint returned %d and getVarint returned %d", n1, n2);
- Tcl_AppendResult(interp, zErr, 0);
+ Tcl_AppendResult(interp, zErr, NULL);
return TCL_ERROR;
}
if( in!=out ){
sqlite3_snprintf(sizeof(zErr), zErr,
"Wrote 0x%016llx and got back 0x%016llx", in, out);
- Tcl_AppendResult(interp, zErr, 0);
+ Tcl_AppendResult(interp, zErr, NULL);
return TCL_ERROR;
}
if( (in & 0xffffffff)==in ){
@@ -476,14 +477,14 @@ static int SQLITE_TCLAPI btree_varint_test(
sqlite3_snprintf(sizeof(zErr), zErr,
"putVarint returned %d and GetVarint32 returned %d",
n1, n2);
- Tcl_AppendResult(interp, zErr, 0);
+ Tcl_AppendResult(interp, zErr, NULL);
return TCL_ERROR;
}
if( in!=out ){
sqlite3_snprintf(sizeof(zErr), zErr,
"Wrote 0x%016llx and got back 0x%016llx from GetVarint32",
in, out);
- Tcl_AppendResult(interp, zErr, 0);
+ Tcl_AppendResult(interp, zErr, NULL);
return TCL_ERROR;
}
}
@@ -523,12 +524,12 @@ static int SQLITE_TCLAPI btree_from_db(
if( argc!=2 && argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " DB-HANDLE ?N?\"", 0);
+ " DB-HANDLE ?N?\"", NULL);
return TCL_ERROR;
}
if( 1!=Tcl_GetCommandInfo(interp, argv[1], &info) ){
- Tcl_AppendResult(interp, "No such db-handle: \"", argv[1], "\"", 0);
+ Tcl_AppendResult(interp, "No such db-handle: \"", argv[1], "\"", NULL);
return TCL_ERROR;
}
if( argc==3 ){
@@ -561,7 +562,7 @@ static int SQLITE_TCLAPI btree_ismemdb(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID\"", 0);
+ " ID\"", NULL);
return TCL_ERROR;
}
pBt = sqlite3TestTextToPtr(argv[1]);
@@ -591,7 +592,7 @@ static int SQLITE_TCLAPI btree_set_cache_size(
if( argc!=3 ){
Tcl_AppendResult(
- interp, "wrong # args: should be \"", argv[0], " BT NCACHE\"", 0);
+ interp, "wrong # args: should be \"", argv[0], " BT NCACHE\"", NULL);
return TCL_ERROR;
}
pBt = sqlite3TestTextToPtr(argv[1]);
@@ -646,7 +647,7 @@ static int SQLITE_TCLAPI btree_insert(
Tcl_ResetResult(interp);
if( rc ){
- Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrName(rc), NULL);
return TCL_ERROR;
}
return TCL_OK;
diff --git a/src/test4.c b/src/test4.c
index 8a68f7d3e4..07236b3e5d 100644
--- a/src/test4.c
+++ b/src/test4.c
@@ -119,7 +119,7 @@ static void *test_thread_main(void *pArg){
*/
static int parse_thread_id(Tcl_Interp *interp, const char *zArg){
if( zArg==0 || zArg[0]==0 || zArg[1]!=0 || !isupper((unsigned char)zArg[0]) ){
- Tcl_AppendResult(interp, "thread ID must be an upper case letter", 0);
+ Tcl_AppendResult(interp, "thread ID must be an upper case letter", NULL);
return -1;
}
return zArg[0] - 'A';
@@ -143,13 +143,13 @@ static int SQLITE_TCLAPI tcl_thread_create(
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID FILENAME", 0);
+ " ID FILENAME", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( threadset[i].busy ){
- Tcl_AppendResult(interp, "thread ", argv[1], " is already running", 0);
+ Tcl_AppendResult(interp, "thread ", argv[1], " is already running", NULL);
return TCL_ERROR;
}
threadset[i].busy = 1;
@@ -159,7 +159,7 @@ static int SQLITE_TCLAPI tcl_thread_create(
threadset[i].completed = 0;
rc = pthread_create(&x, 0, test_thread_main, &threadset[i]);
if( rc ){
- Tcl_AppendResult(interp, "failed to create the thread", 0);
+ Tcl_AppendResult(interp, "failed to create the thread", NULL);
sqlite3_free(threadset[i].zFilename);
threadset[i].busy = 0;
return TCL_ERROR;
@@ -192,13 +192,13 @@ static int SQLITE_TCLAPI tcl_thread_wait(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID", 0);
+ " ID", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
@@ -236,7 +236,7 @@ static int SQLITE_TCLAPI tcl_thread_halt(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID", 0);
+ " ID", NULL);
return TCL_ERROR;
}
if( argv[1][0]=='*' && argv[1][1]==0 ){
@@ -247,7 +247,7 @@ static int SQLITE_TCLAPI tcl_thread_halt(
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_stop_thread(&threadset[i]);
@@ -272,18 +272,18 @@ static int SQLITE_TCLAPI tcl_thread_argc(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID", 0);
+ " ID", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", threadset[i].argc);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -304,22 +304,22 @@ static int SQLITE_TCLAPI tcl_thread_argv(
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID N", 0);
+ " ID N", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
if( Tcl_GetInt(interp, argv[2], &n) ) return TCL_ERROR;
test_thread_wait(&threadset[i]);
if( n<0 || n>=threadset[i].argc ){
- Tcl_AppendResult(interp, "column number out of range", 0);
+ Tcl_AppendResult(interp, "column number out of range", NULL);
return TCL_ERROR;
}
- Tcl_AppendResult(interp, threadset[i].argv[n], 0);
+ Tcl_AppendResult(interp, threadset[i].argv[n], NULL);
return TCL_OK;
}
@@ -340,22 +340,22 @@ static int SQLITE_TCLAPI tcl_thread_colname(
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID N", 0);
+ " ID N", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
if( Tcl_GetInt(interp, argv[2], &n) ) return TCL_ERROR;
test_thread_wait(&threadset[i]);
if( n<0 || n>=threadset[i].argc ){
- Tcl_AppendResult(interp, "column number out of range", 0);
+ Tcl_AppendResult(interp, "column number out of range", NULL);
return TCL_ERROR;
}
- Tcl_AppendResult(interp, threadset[i].colv[n], 0);
+ Tcl_AppendResult(interp, threadset[i].colv[n], NULL);
return TCL_OK;
}
@@ -376,18 +376,18 @@ static int SQLITE_TCLAPI tcl_thread_result(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID", 0);
+ " ID", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
zName = sqlite3ErrName(threadset[i].rc);
- Tcl_AppendResult(interp, zName, 0);
+ Tcl_AppendResult(interp, zName, NULL);
return TCL_OK;
}
@@ -407,17 +407,17 @@ static int SQLITE_TCLAPI tcl_thread_error(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID", 0);
+ " ID", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
- Tcl_AppendResult(interp, threadset[i].zErr, 0);
+ Tcl_AppendResult(interp, threadset[i].zErr, NULL);
return TCL_OK;
}
@@ -451,13 +451,13 @@ static int SQLITE_TCLAPI tcl_thread_compile(
int i;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID SQL", 0);
+ " ID SQL", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
@@ -505,13 +505,13 @@ static int SQLITE_TCLAPI tcl_thread_step(
int i;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " IDL", 0);
+ " IDL", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
@@ -548,13 +548,13 @@ static int SQLITE_TCLAPI tcl_thread_finalize(
int i;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " IDL", 0);
+ " IDL", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
@@ -581,20 +581,20 @@ static int SQLITE_TCLAPI tcl_thread_swap(
sqlite3 *temp;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID1 ID2", 0);
+ " ID1 ID2", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
j = parse_thread_id(interp, argv[2]);
if( j<0 ) return TCL_ERROR;
if( !threadset[j].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[j]);
@@ -622,13 +622,13 @@ static int SQLITE_TCLAPI tcl_thread_db_get(
extern int sqlite3TestMakePointerStr(Tcl_Interp*, char*, void*);
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID", 0);
+ " ID", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
@@ -653,13 +653,13 @@ static int SQLITE_TCLAPI tcl_thread_db_put(
extern void *sqlite3TestTextToPtr(const char *);
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID DB", 0);
+ " ID DB", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
@@ -685,13 +685,13 @@ static int SQLITE_TCLAPI tcl_thread_stmt_get(
extern int sqlite3TestMakePointerStr(Tcl_Interp*, char*, void*);
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ID", 0);
+ " ID", NULL);
return TCL_ERROR;
}
i = parse_thread_id(interp, argv[1]);
if( i<0 ) return TCL_ERROR;
if( !threadset[i].busy ){
- Tcl_AppendResult(interp, "no such thread", 0);
+ Tcl_AppendResult(interp, "no such thread", NULL);
return TCL_ERROR;
}
test_thread_wait(&threadset[i]);
diff --git a/src/test5.c b/src/test5.c
index 334b5d07fe..06d2de911d 100644
--- a/src/test5.c
+++ b/src/test5.c
@@ -67,7 +67,7 @@ static int SQLITE_TCLAPI test_value_overhead(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetStringFromObj(objv[0], 0), " ", 0);
+ Tcl_GetStringFromObj(objv[0], 0), " ", NULL);
return TCL_ERROR;
}
@@ -106,7 +106,7 @@ static u8 name_to_enc(Tcl_Interp *interp, Tcl_Obj *pObj){
}
}
if( !pEnc->enc ){
- Tcl_AppendResult(interp, "No such encoding: ", z, 0);
+ Tcl_AppendResult(interp, "No such encoding: ", z, NULL);
}
if( pEnc->enc==SQLITE_UTF16 ){
return SQLITE_UTF16NATIVE;
@@ -135,7 +135,7 @@ static int SQLITE_TCLAPI test_translate(
if( objc!=4 && objc!=5 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0),
- " ", 0
+ " ", NULL
);
return TCL_ERROR;
}
diff --git a/src/test6.c b/src/test6.c
index 76db640c4d..aee7bf12aa 100644
--- a/src/test6.c
+++ b/src/test6.c
@@ -755,12 +755,12 @@ static int processDevSymArgs(
){
Tcl_AppendResult(interp,
"Bad option: \"", zOpt,
- "\" - must be \"-characteristics\" or \"-sectorsize\"", 0
+ "\" - must be \"-characteristics\" or \"-sectorsize\"", NULL
);
return TCL_ERROR;
}
if( i==objc-1 ){
- Tcl_AppendResult(interp, "Option requires an argument: \"", zOpt, "\"",0);
+ Tcl_AppendResult(interp, "Option requires an argument: \"", zOpt, "\"", NULL);
return TCL_ERROR;
}
@@ -934,7 +934,7 @@ static int SQLITE_TCLAPI crashParamsObjCmd(
zCrashFile = Tcl_GetStringFromObj(objv[objc-1], &nCrashFile);
if( nCrashFile>=sizeof(g.zCrashFile) ){
- Tcl_AppendResult(interp, "Filename is too long: \"", zCrashFile, "\"", 0);
+ Tcl_AppendResult(interp, "Filename is too long: \"", zCrashFile, "\"", NULL);
goto error;
}
if( Tcl_GetIntFromObj(interp, objv[objc-2], &iDelay) ){
@@ -1044,7 +1044,7 @@ static int SQLITE_TCLAPI jtObjCmd(
if( objc==3 ){
if( strcmp(zParent, "-default") ){
Tcl_AppendResult(interp,
- "bad option \"", zParent, "\": must be -default", 0
+ "bad option \"", zParent, "\": must be -default", NULL
);
return TCL_ERROR;
}
@@ -1055,7 +1055,7 @@ static int SQLITE_TCLAPI jtObjCmd(
zParent = 0;
}
if( jt_register(zParent, objc==3) ){
- Tcl_AppendResult(interp, "Error in jt_register", 0);
+ Tcl_AppendResult(interp, "Error in jt_register", NULL);
return TCL_ERROR;
}
diff --git a/src/test9.c b/src/test9.c
index b5362adb7f..62b16795e3 100644
--- a/src/test9.c
+++ b/src/test9.c
@@ -56,7 +56,7 @@ static int SQLITE_TCLAPI c_collation_test(
error_out:
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0);
+ Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, NULL);
return TCL_ERROR;
}
@@ -96,7 +96,7 @@ static int SQLITE_TCLAPI c_realloc_test(
error_out:
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0);
+ Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, NULL);
return TCL_ERROR;
}
@@ -174,7 +174,7 @@ static int SQLITE_TCLAPI c_misuse_test(
error_out:
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0);
+ Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, NULL);
return TCL_ERROR;
}
diff --git a/src/test_backup.c b/src/test_backup.c
index 8051888ee6..ae2348ebc2 100644
--- a/src/test_backup.c
+++ b/src/test_backup.c
@@ -135,7 +135,7 @@ static int SQLITE_TCLAPI backupTestInit(
pBackup = sqlite3_backup_init(pDestDb, zDestName, pSrcDb, zSrcName);
if( !pBackup ){
- Tcl_AppendResult(interp, "sqlite3_backup_init() failed", 0);
+ Tcl_AppendResult(interp, "sqlite3_backup_init() failed", NULL);
return TCL_ERROR;
}
diff --git a/src/test_blob.c b/src/test_blob.c
index bddad240ce..ae5a734179 100644
--- a/src/test_blob.c
+++ b/src/test_blob.c
@@ -237,7 +237,7 @@ static int SQLITE_TCLAPI test_blob_read(
if( nByte>0 ){
zBuf = (unsigned char *)Tcl_AttemptAlloc(nByte);
if( zBuf==0 ){
- Tcl_AppendResult(interp, "out of memory in " __FILE__, 0);
+ Tcl_AppendResult(interp, "out of memory in " __FILE__, NULL);
return TCL_ERROR;
}
}
diff --git a/src/test_delete.c b/src/test_delete.c
index 68fdbc6a75..3f34a72c46 100644
--- a/src/test_delete.c
+++ b/src/test_delete.c
@@ -63,7 +63,7 @@ static int sqlite3DeleteUnlinkIfExists(
int *pbExists
){
int rc = SQLITE_ERROR;
-#if SQLITE_OS_WIN
+#ifdef _WIN32
if( pVfs ){
if( pbExists ) *pbExists = 1;
rc = pVfs->xDelete(pVfs, zFile, 0);
@@ -115,7 +115,7 @@ SQLITE_API int sqlite3_delete_database(
{ "%s-wal%03d", SQLITE_MULTIPLEX_WAL_8_3_OFFSET, 1 },
};
-#ifdef SQLITE_OS_WIN
+#ifdef _WIN32
sqlite3_vfs *pVfs = sqlite3_vfs_find("win32");
#else
sqlite3_vfs *pVfs = 0;
diff --git a/src/test_fs.c b/src/test_fs.c
index d821a83b9d..1c47bbaacf 100644
--- a/src/test_fs.c
+++ b/src/test_fs.c
@@ -69,18 +69,15 @@
#include
#include
-#if SQLITE_OS_UNIX || defined(__MINGW_H)
+#if !defined(_WIN32) || defined(__MSVCRT__)
# include
# include
# ifndef DIRENT
# define DIRENT dirent
# endif
-#endif
-#if SQLITE_OS_WIN
+#else
# include
-# if !defined(__MINGW_H)
-# include "test_windirent.h"
-# endif
+# include "test_windirent.h"
# ifndef S_ISREG
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
# endif
@@ -485,7 +482,7 @@ static int fstreeFilter(
int nDir;
char aWild[2] = { '\0', '\0' };
-#if SQLITE_OS_WIN
+#ifdef _WIN32
const char *zDrive = windirent_getenv("fstreeDrive");
if( zDrive==0 ){
zDrive = windirent_getenv("SystemDrive");
@@ -538,7 +535,7 @@ static int fstreeFilter(
sqlite3_bind_text(pCsr->pStmt, 2, zRoot, nRoot, SQLITE_TRANSIENT);
sqlite3_bind_text(pCsr->pStmt, 3, zPrefix, nPrefix, SQLITE_TRANSIENT);
-#if SQLITE_OS_WIN
+#ifdef _WIN32
sqlite3_free(zPrefix);
sqlite3_free(zRoot);
#endif
diff --git a/src/test_hexio.c b/src/test_hexio.c
index 1a21e89aa0..048ab13246 100644
--- a/src/test_hexio.c
+++ b/src/test_hexio.c
@@ -122,7 +122,7 @@ static int SQLITE_TCLAPI hexio_read(
in = fopen(zFile, "r");
}
if( in==0 ){
- Tcl_AppendResult(interp, "cannot open input file ", zFile, 0);
+ Tcl_AppendResult(interp, "cannot open input file ", zFile, NULL);
return TCL_ERROR;
}
fseek(in, offset, SEEK_SET);
@@ -132,7 +132,7 @@ static int SQLITE_TCLAPI hexio_read(
got = 0;
}
sqlite3TestBinToHex(zBuf, got);
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
sqlite3_free(zBuf);
return TCL_OK;
}
@@ -175,7 +175,7 @@ static int SQLITE_TCLAPI hexio_write(
out = fopen(zFile, "r+");
}
if( out==0 ){
- Tcl_AppendResult(interp, "cannot open output file ", zFile, 0);
+ Tcl_AppendResult(interp, "cannot open output file ", zFile, NULL);
return TCL_ERROR;
}
fseek(out, offset, SEEK_SET);
@@ -324,12 +324,12 @@ static int SQLITE_TCLAPI utf8_to_utf8(
z[n] = 0;
nOut = sqlite3Utf8To8(z);
sqlite3TestBinToHex(z,nOut);
- Tcl_AppendResult(interp, (char*)z, 0);
+ Tcl_AppendResult(interp, (char*)z, NULL);
sqlite3_free(z);
return TCL_OK;
#else
Tcl_AppendResult(interp,
- "[utf8_to_utf8] unavailable - SQLITE_DEBUG not defined", 0
+ "[utf8_to_utf8] unavailable - SQLITE_DEBUG not defined", NULL
);
return TCL_ERROR;
#endif
diff --git a/src/test_init.c b/src/test_init.c
index f7b85875b0..0c6ac8eb56 100644
--- a/src/test_init.c
+++ b/src/test_init.c
@@ -201,7 +201,7 @@ static int SQLITE_TCLAPI init_wrapper_install(
}else if( strcmp(z, "pcache")==0 ){
wrapped.pcache_fail = 1;
}else{
- Tcl_AppendResult(interp, "Unknown argument: \"", z, "\"");
+ Tcl_AppendResult(interp, "Unknown argument: \"", z, "\"", NULL);
return TCL_ERROR;
}
}
diff --git a/src/test_malloc.c b/src/test_malloc.c
index 8d6c4fa505..1c19d896f2 100644
--- a/src/test_malloc.c
+++ b/src/test_malloc.c
@@ -646,7 +646,7 @@ static int SQLITE_TCLAPI test_memdebug_fail(
}
if( zErr ){
- Tcl_AppendResult(interp, zErr, zOption, 0);
+ Tcl_AppendResult(interp, zErr, zOption, NULL);
return TCL_ERROR;
}
}
diff --git a/src/test_multiplex.c b/src/test_multiplex.c
index e5b43f4cc1..82551200f2 100644
--- a/src/test_multiplex.c
+++ b/src/test_multiplex.c
@@ -1315,8 +1315,8 @@ static int SQLITE_TCLAPI test_multiplex_control(
}
if( 0==Tcl_GetCommandInfo(interp, Tcl_GetString(objv[1]), &cmdInfo) ){
- Tcl_AppendResult(interp, "expected database handle, got \"", 0);
- Tcl_AppendResult(interp, Tcl_GetString(objv[1]), "\"", 0);
+ Tcl_AppendResult(interp, "expected database handle, got \"", NULL);
+ Tcl_AppendResult(interp, Tcl_GetString(objv[1]), "\"", NULL);
return TCL_ERROR;
}else{
db = *(sqlite3 **)cmdInfo.objClientData;
diff --git a/src/test_mutex.c b/src/test_mutex.c
index e60a06df32..de064de4c4 100644
--- a/src/test_mutex.c
+++ b/src/test_mutex.c
@@ -225,8 +225,8 @@ static int SQLITE_TCLAPI test_install_mutex_counters(
assert(isInstall==0 || isInstall==1);
assert(g.isInstalled==0 || g.isInstalled==1);
if( isInstall==g.isInstalled ){
- Tcl_AppendResult(interp, "mutex counters are ", 0);
- Tcl_AppendResult(interp, isInstall?"already installed":"not installed", 0);
+ Tcl_AppendResult(interp, "mutex counters are ", NULL);
+ Tcl_AppendResult(interp, isInstall?"already installed":"not installed", NULL);
return TCL_ERROR;
}
diff --git a/src/test_osinst.c b/src/test_osinst.c
index 2d03d2bbcd..e776d89e55 100644
--- a/src/test_osinst.c
+++ b/src/test_osinst.c
@@ -71,9 +71,8 @@
#include "sqlite3.h"
-#include "os_setup.h"
-#if SQLITE_OS_WIN
-# include "os_win.h"
+#ifdef _WIN32
+#include
#endif
#include
@@ -219,14 +218,7 @@ static sqlite3_io_methods vfslog_io_methods = {
vfslogShmUnmap /* xShmUnmap */
};
-#if SQLITE_OS_UNIX && !defined(NO_GETTOD)
-#include
-static sqlite3_uint64 vfslog_time(){
- struct timeval sTime;
- gettimeofday(&sTime, 0);
- return sTime.tv_usec + (sqlite3_uint64)sTime.tv_sec * 1000000;
-}
-#elif SQLITE_OS_WIN
+#ifdef _WIN32
#include
static sqlite3_uint64 vfslog_time(){
FILETIME ft;
@@ -241,6 +233,13 @@ static sqlite3_uint64 vfslog_time(){
/* ft is 100-nanosecond intervals, we want microseconds */
return u64time /(sqlite3_uint64)10;
}
+#elif !defined(NO_GETTOD)
+#include
+static sqlite3_uint64 vfslog_time(){
+ struct timeval sTime;
+ gettimeofday(&sTime, 0);
+ return sTime.tv_usec + (sqlite3_uint64)sTime.tv_sec * 1000000;
+}
#else
static sqlite3_uint64 vfslog_time(){
return 0;
@@ -1146,7 +1145,7 @@ static int SQLITE_TCLAPI test_vfslog(
zMsg = Tcl_GetString(objv[3]);
rc = sqlite3_vfslog_annotate(zVfs, zMsg);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, "failed", 0);
+ Tcl_AppendResult(interp, "failed", (char*)0);
return TCL_ERROR;
}
break;
@@ -1160,7 +1159,7 @@ static int SQLITE_TCLAPI test_vfslog(
zVfs = Tcl_GetString(objv[2]);
rc = sqlite3_vfslog_finalize(zVfs);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, "failed", 0);
+ Tcl_AppendResult(interp, "failed", (char*)0);
return TCL_ERROR;
}
break;
@@ -1180,7 +1179,7 @@ static int SQLITE_TCLAPI test_vfslog(
if( *zParent=='\0' ) zParent = 0;
rc = sqlite3_vfslog_new(zVfs, zParent, zLog);
if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp, "failed", 0);
+ Tcl_AppendResult(interp, "failed", (char*)0);
return TCL_ERROR;
}
break;
diff --git a/src/test_quota.c b/src/test_quota.c
index 62d808a22b..d2f9cddd11 100644
--- a/src/test_quota.c
+++ b/src/test_quota.c
@@ -44,14 +44,12 @@
#define sqlite3_mutex_notheld(X) ((void)(X),1)
#endif /* SQLITE_THREADSAFE==0 */
-#include "os_setup.h"
-#if SQLITE_OS_UNIX
-# include
-#endif
-#if SQLITE_OS_WIN
-# include "os_win.h"
+#ifdef _WIN32
+# include
# include
+#else
+# include
#endif
@@ -130,7 +128,7 @@ struct quota_FILE {
FILE *f; /* Open stdio file pointer */
sqlite3_int64 iOfst; /* Current offset into the file */
quotaFile *pFile; /* The file record in the quota system */
-#if SQLITE_OS_WIN
+#ifdef _WIN32
char *zMbcsName; /* Full MBCS pathname of the file */
#endif
};
@@ -375,7 +373,7 @@ static quotaFile *quotaFindFile(
** used to store the returned pointer when done.
*/
static char *quota_utf8_to_mbcs(const char *zUtf8){
-#if SQLITE_OS_WIN
+#ifdef _WIN32
size_t n; /* Bytes in zUtf8 */
int nWide; /* number of UTF-16 characters */
int nMbcs; /* Bytes of MBCS */
@@ -410,7 +408,7 @@ static char *quota_utf8_to_mbcs(const char *zUtf8){
** Deallocate any memory allocated by quota_utf8_to_mbcs().
*/
static void quota_mbcs_free(char *zOld){
-#if SQLITE_OS_WIN
+#ifdef _WIN32
sqlite3_free(zOld);
#else
/* No-op on unix */
@@ -970,7 +968,7 @@ quota_FILE *sqlite3_quota_fopen(const char *zFilename, const char *zMode){
}
quotaLeave();
sqlite3_free(zFull);
-#if SQLITE_OS_WIN
+#ifdef _WIN32
p->zMbcsName = zFullTranslated;
#endif
return p;
@@ -1073,7 +1071,7 @@ int sqlite3_quota_fclose(quota_FILE *p){
}
quotaLeave();
}
-#if SQLITE_OS_WIN
+#ifdef _WIN32
quota_mbcs_free(p->zMbcsName);
#endif
sqlite3_free(p);
@@ -1087,11 +1085,10 @@ int sqlite3_quota_fflush(quota_FILE *p, int doFsync){
int rc;
rc = fflush(p->f);
if( rc==0 && doFsync ){
-#if SQLITE_OS_UNIX
- rc = fsync(fileno(p->f));
-#endif
-#if SQLITE_OS_WIN
+#ifdef _WIN32
rc = _commit(_fileno(p->f));
+#else
+ rc = fsync(fileno(p->f));
#endif
}
return rc!=0;
@@ -1143,17 +1140,16 @@ int sqlite3_quota_ftruncate(quota_FILE *p, sqlite3_int64 szNew){
pGroup->iSize += szNew - pFile->iSize;
quotaLeave();
}
-#if SQLITE_OS_UNIX
- rc = ftruncate(fileno(p->f), szNew);
-#endif
-#if SQLITE_OS_WIN
-# if defined(__MINGW32__) && defined(SQLITE_TEST)
+#ifdef _WIN32
+# if defined(__MSVCRT__) && defined(SQLITE_TEST)
/* _chsize_s() is missing from MingW (as of 2012-11-06). Use
** _chsize() as a work-around for testing purposes. */
rc = _chsize(_fileno(p->f), (long)szNew);
# else
rc = _chsize_s(_fileno(p->f), szNew);
# endif
+#else
+ rc = ftruncate(fileno(p->f), szNew);
#endif
if( pFile && rc==0 ){
quotaGroup *pGroup = pFile->pGroup;
@@ -1172,13 +1168,12 @@ int sqlite3_quota_ftruncate(quota_FILE *p, sqlite3_int64 szNew){
*/
int sqlite3_quota_file_mtime(quota_FILE *p, time_t *pTime){
int rc;
-#if SQLITE_OS_UNIX
- struct stat buf;
- rc = fstat(fileno(p->f), &buf);
-#endif
-#if SQLITE_OS_WIN
+#ifdef _WIN32
struct _stati64 buf;
rc = _stati64(p->zMbcsName, &buf);
+#else
+ struct stat buf;
+ rc = fstat(fileno(p->f), &buf);
#endif
if( rc==0 ) *pTime = buf.st_mtime;
return rc;
@@ -1190,13 +1185,12 @@ int sqlite3_quota_file_mtime(quota_FILE *p, time_t *pTime){
*/
sqlite3_int64 sqlite3_quota_file_truesize(quota_FILE *p){
int rc;
-#if SQLITE_OS_UNIX
- struct stat buf;
- rc = fstat(fileno(p->f), &buf);
-#endif
-#if SQLITE_OS_WIN
+#ifdef _WIN32
struct _stati64 buf;
rc = _stati64(p->zMbcsName, &buf);
+#else
+ struct stat buf;
+ rc = fstat(fileno(p->f), &buf);
#endif
return rc==0 ? buf.st_size : -1;
}
diff --git a/src/test_sqllog.c b/src/test_sqllog.c
index 9ae0e50685..5abf59a8bf 100644
--- a/src/test_sqllog.c
+++ b/src/test_sqllog.c
@@ -84,7 +84,7 @@
#include
#include
static int getProcessId(void){
-#if SQLITE_OS_WIN
+#ifdef _WIN32
return (int)_getpid();
#else
return (int)getpid();
diff --git a/src/test_superlock.c b/src/test_superlock.c
index 7f3bf163a5..82997927c4 100644
--- a/src/test_superlock.c
+++ b/src/test_superlock.c
@@ -338,7 +338,7 @@ static int SQLITE_TCLAPI superlock_cmd(
if( rc!=SQLITE_OK ){
extern const char *sqlite3ErrStr(int);
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, sqlite3ErrStr(rc), 0);
+ Tcl_AppendResult(interp, sqlite3ErrStr(rc), NULL);
return TCL_ERROR;
}
diff --git a/src/test_syscall.c b/src/test_syscall.c
index af2ae10015..35c303f8ee 100644
--- a/src/test_syscall.c
+++ b/src/test_syscall.c
@@ -686,7 +686,7 @@ static int SQLITE_TCLAPI test_syscall_pagesize(
}
}else{
if( pgsz<512 || (pgsz & (pgsz-1)) ){
- Tcl_AppendResult(interp, "pgsz out of range", 0);
+ Tcl_AppendResult(interp, "pgsz out of range", NULL);
return TCL_ERROR;
}
gSyscall.orig_getpagesize = pVfs->xGetSystemCall(pVfs, "getpagesize");
@@ -729,7 +729,7 @@ static int SQLITE_TCLAPI test_syscall(
return TCL_ERROR;
}
if( pVfs->iVersion<3 || pVfs->xSetSystemCall==0 ){
- Tcl_AppendResult(interp, "VFS does not support xSetSystemCall", 0);
+ Tcl_AppendResult(interp, "VFS does not support xSetSystemCall", NULL);
rc = TCL_ERROR;
}else{
rc = Tcl_GetIndexFromObjStruct(interp,
diff --git a/src/test_thread.c b/src/test_thread.c
index 7c06d110ac..98ef2c2468 100644
--- a/src/test_thread.c
+++ b/src/test_thread.c
@@ -201,7 +201,7 @@ static int SQLITE_TCLAPI sqlthread_spawn(
rc = Tcl_CreateThread(&x, tclScriptThread, (void *)pNew, nStack, flags);
if( rc!=TCL_OK ){
- Tcl_AppendResult(interp, "Error in Tcl_CreateThread()", 0);
+ Tcl_AppendResult(interp, "Error in Tcl_CreateThread()", NULL);
ckfree((char *)pNew);
return TCL_ERROR;
}
@@ -235,7 +235,7 @@ static int SQLITE_TCLAPI sqlthread_parent(
UNUSED_PARAMETER(objc);
if( p==0 ){
- Tcl_AppendResult(interp, "no parent thread", 0);
+ Tcl_AppendResult(interp, "no parent thread", NULL);
return TCL_ERROR;
}
@@ -287,7 +287,7 @@ static int SQLITE_TCLAPI sqlthread_open(
sqlite3_busy_handler(db, xBusy, 0);
if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
return TCL_OK;
}
@@ -614,13 +614,13 @@ static int SQLITE_TCLAPI blocking_prepare_v2_proc(
if( rc!=SQLITE_OK ){
assert( pStmt==0 );
sqlite3_snprintf(sizeof(zBuf), zBuf, "%s ", (char *)sqlite3ErrName(rc));
- Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), 0);
+ Tcl_AppendResult(interp, zBuf, sqlite3_errmsg(db), NULL);
return TCL_ERROR;
}
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
- Tcl_AppendResult(interp, zBuf, 0);
+ Tcl_AppendResult(interp, zBuf, NULL);
}
return TCL_OK;
}
diff --git a/src/test_vfs.c b/src/test_vfs.c
index f75ef956b6..0d90a53a53 100644
--- a/src/test_vfs.c
+++ b/src/test_vfs.c
@@ -1138,7 +1138,7 @@ static int SQLITE_TCLAPI testvfs_obj_cmd(
);
if( rc!=SQLITE_OK ){
Tcl_AppendResult(interp, "failed to get full path: ",
- Tcl_GetString(objv[2]), 0);
+ Tcl_GetString(objv[2]), NULL);
ckfree(zName);
return TCL_ERROR;
}
@@ -1147,7 +1147,7 @@ static int SQLITE_TCLAPI testvfs_obj_cmd(
}
ckfree(zName);
if( !pBuffer ){
- Tcl_AppendResult(interp, "no such file: ", Tcl_GetString(objv[2]), 0);
+ Tcl_AppendResult(interp, "no such file: ", Tcl_GetString(objv[2]), NULL);
return TCL_ERROR;
}
if( objc==4 ){
@@ -1225,7 +1225,7 @@ static int SQLITE_TCLAPI testvfs_obj_cmd(
}
}
if( iMethod==ArraySize(vfsmethod) ){
- Tcl_AppendResult(interp, "unknown method: ", zElem, 0);
+ Tcl_AppendResult(interp, "unknown method: ", zElem, NULL);
return TCL_ERROR;
}
}
@@ -1353,7 +1353,7 @@ static int SQLITE_TCLAPI testvfs_obj_cmd(
return TCL_ERROR;
}
if( aFlag[idx].iValue<0 && nFlags>1 ){
- Tcl_AppendResult(interp, "bad flags: ", Tcl_GetString(objv[2]), 0);
+ Tcl_AppendResult(interp, "bad flags: ", Tcl_GetString(objv[2]), NULL);
return TCL_ERROR;
}
iNew |= aFlag[idx].iValue;
@@ -1673,7 +1673,7 @@ static int SQLITE_TCLAPI test_vfs_set_readmark(
return TCL_ERROR;
}
if( pShm==0 ){
- Tcl_AppendResult(interp, "*-shm is not yet mapped", 0);
+ Tcl_AppendResult(interp, "*-shm is not yet mapped", NULL);
return TCL_ERROR;
}
aShm = (u32*)pShm;
diff --git a/src/utf.c b/src/utf.c
index 57700bf20d..e24e1586bb 100644
--- a/src/utf.c
+++ b/src/utf.c
@@ -555,7 +555,7 @@ int sqlite3Utf16ByteLen(const void *zIn, int nByte, int nChar){
int n = 0;
if( SQLITE_UTF16NATIVE==SQLITE_UTF16LE ) z++;
- while( n=0xd8 && c<0xdc && z<=zEnd && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
diff --git a/src/vacuum.c b/src/vacuum.c
index ae3af86b7a..96d77e5bc4 100644
--- a/src/vacuum.c
+++ b/src/vacuum.c
@@ -116,7 +116,7 @@ void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){
#else
/* When SQLITE_BUG_COMPATIBLE_20160819 is defined, unrecognized arguments
** to VACUUM are silently ignored. This is a back-out of a bug fix that
- ** occurred on 2016-08-19 (https://www.sqlite.org/src/info/083f9e6270).
+ ** occurred on 2016-08-19 (https://sqlite.org/src/info/083f9e6270).
** The buggy behavior is required for binary compatibility with some
** legacy applications. */
iDb = sqlite3FindDb(pParse->db, pNm);
diff --git a/src/vdbe.c b/src/vdbe.c
index 19bc670e3a..586b03edd0 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -1318,7 +1318,7 @@ case OP_Halt: {
sqlite3VdbeError(p, "%s", pOp->p4.z);
}
pcx = (int)(pOp - aOp);
- sqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg);
+ sqlite3_log(pOp->p1, "abort at %d: %s; [%s]", pcx, p->zErrMsg, p->zSql);
}
rc = sqlite3VdbeHalt(p);
assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR );
@@ -9166,8 +9166,8 @@ abort_due_to_error:
p->rc = rc;
sqlite3SystemError(db, rc);
testcase( sqlite3GlobalConfig.xLog!=0 );
- sqlite3_log(rc, "statement aborts at %d: [%s] %s",
- (int)(pOp - aOp), p->zSql, p->zErrMsg);
+ sqlite3_log(rc, "statement aborts at %d: %s; [%s]",
+ (int)(pOp - aOp), p->zErrMsg, p->zSql);
if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p);
if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db);
if( rc==SQLITE_CORRUPT && db->autoCommit==0 ){
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index 523f80097d..ed95494628 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -1808,7 +1808,7 @@ int sqlite3_bind_text64(
assert( xDel!=SQLITE_DYNAMIC );
if( enc!=SQLITE_UTF8 ){
if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
- nData &= ~(u16)1;
+ nData &= ~(u64)1;
}
return bindText(pStmt, i, zData, nData, xDel, enc);
}
diff --git a/src/vdbemem.c b/src/vdbemem.c
index 8534849432..6db9e4b1a7 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -141,7 +141,7 @@ static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){
** corresponding string value, then it is important that the string be
** derived from the numeric value, not the other way around, to ensure
** that the index and table are consistent. See ticket
-** https://www.sqlite.org/src/info/343634942dd54ab (2018-01-31) for
+** https://sqlite.org/src/info/343634942dd54ab (2018-01-31) for
** an example.
**
** This routine looks at pMem to verify that if it has both a numeric
diff --git a/src/wal.c b/src/wal.c
index 7d33a54c90..69de588dbb 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -1133,10 +1133,8 @@ static void walChecksumBytes(
s1 = s2 = 0;
}
- assert( nByte>=8 );
- assert( (nByte&0x00000007)==0 );
- assert( nByte<=65536 );
- assert( nByte%4==0 );
+ /* nByte is a multiple of 8 between 8 and 65536 */
+ assert( nByte>=8 && (nByte&7)==0 && nByte<=65536 );
if( !nativeCksum ){
do {
diff --git a/src/where.c b/src/where.c
index ed63203495..c51d1ba815 100644
--- a/src/where.c
+++ b/src/where.c
@@ -3476,7 +3476,7 @@ static int whereLoopAddBtreeIndex(
if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
&& pNew->u.btree.nEqnColumn
&& (pNew->u.btree.nEqnKeyCol ||
- pProbe->idxType!=SQLITE_IDXTYPE_PRIMARYKEY)
+ (pProbe->idxType!=SQLITE_IDXTYPE_PRIMARYKEY && !pProbe->bIdxRowid))
){
if( pNew->u.btree.nEq>3 ){
sqlite3ProgressCheck(pParse);
@@ -6934,7 +6934,8 @@ WhereInfo *sqlite3WhereBegin(
}
/* TUNING: Assume that a DISTINCT clause on a subquery reduces
- ** the output size by a factor of 8 (LogEst -30).
+ ** the output size by a factor of 8 (LogEst -30). Search for
+ ** tag-20250414a to see other cases.
*/
if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)!=0 ){
WHERETRACE(0x0080,("nRowOut reduced from %d to %d due to DISTINCT\n",
diff --git a/src/wherecode.c b/src/wherecode.c
index 5fe2308137..014f697d97 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -542,7 +542,7 @@ static void adjustOrderByCol(ExprList *pOrderBy, ExprList *pEList){
/*
** pX is an expression of the form: (vector) IN (SELECT ...)
** In other words, it is a vector IN operator with a SELECT clause on the
-** LHS. But not all terms in the vector are indexable and the terms might
+** RHS. But not all terms in the vector are indexable and the terms might
** not be in the correct order for indexing.
**
** This routine makes a copy of the input pX expression and then adjusts
@@ -2364,7 +2364,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
**
** This optimization also only applies if the (x1 OR x2 OR ...) term
** is not contained in the ON clause of a LEFT JOIN.
- ** See ticket http://www.sqlite.org/src/info/f2369304e4
+ ** See ticket http://sqlite.org/src/info/f2369304e4
**
** 2022-02-04: Do not push down slices of a row-value comparison.
** In other words, "w" or "y" may not be a slice of a vector. Otherwise,
diff --git a/test/affinity2.test b/test/affinity2.test
index 6ad257ac36..59f9dada53 100644
--- a/test/affinity2.test
+++ b/test/affinity2.test
@@ -116,7 +116,7 @@ do_execsql_test 507 {
SELECT * FROM t0 WHERE +-+'ce' >= t0.c0;
} {-1 {}}
-# 2019-08-30 ticket https://www.sqlite.org/src/info/40812aea1fde9594
+# 2019-08-30 ticket https://sqlite.org/src/info/40812aea1fde9594
#
# Due to some differences in floating point computations, these tests do not
# work under valgrind.
diff --git a/test/affinity3.test b/test/affinity3.test
index 3695ea8479..be415de46c 100644
--- a/test/affinity3.test
+++ b/test/affinity3.test
@@ -11,14 +11,14 @@
#
# Test cases for bugs:
#
-# https://www.sqlite.org/src/info/91e2e8ba6ff2e2
-# https://www.sqlite.org/src/info/7ffd1ca1d2ad4ecf
+# https://sqlite.org/src/info/91e2e8ba6ff2e2
+# https://sqlite.org/src/info/7ffd1ca1d2ad4ecf
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-# Ticket https://www.sqlite.org/src/info/91e2e8ba6ff2e2 (2011-09-19)
+# Ticket https://sqlite.org/src/info/91e2e8ba6ff2e2 (2011-09-19)
# Automatic index causes undesired type conversions
#
do_execsql_test affinity3-100 {
@@ -87,7 +87,7 @@ do_execsql_test affinity3-142 {
SELECT id, (apr / 100), typeof(apr) apr_type FROM v2rjrj;
} {1 0.12 real 2 0.1201 real}
-# Ticket https://www.sqlite.org/src/info/7ffd1ca1d2ad4ecf (2017-01-16)
+# Ticket https://sqlite.org/src/info/7ffd1ca1d2ad4ecf (2017-01-16)
# Incorrect affinity when using automatic indexes
#
do_execsql_test affinity3-200 {
diff --git a/test/all.test b/test/all.test
index 46e8115fba..22d7b8daed 100644
--- a/test/all.test
+++ b/test/all.test
@@ -42,7 +42,7 @@ run_test_suite pcache100
run_test_suite prepare
run_test_suite mmap
-if {$::tcl_platform(platform)=="unix"} {
+if {$::tcl_platform(platform) eq "unix"} {
ifcapable !default_autovacuum {
run_test_suite autovacuum_crash
}
diff --git a/test/alter4.test b/test/alter4.test
index f6ada8f3fb..7e2d7e66a8 100644
--- a/test/alter4.test
+++ b/test/alter4.test
@@ -379,7 +379,7 @@ do_execsql_test alter4-9.3 {
# Confirm that doing an ALTER TABLE on a legacy format database
# does not corrupt DESC indexes.
#
-# Ticket https://www.sqlite.org/src/tktview/f68bf68513a1c
+# Ticket https://sqlite.org/src/tktview/f68bf68513a1c
#
do_test alter4-10.1 {
db close
diff --git a/test/altercol.test b/test/altercol.test
index f44aa2e065..5f7de57a4e 100644
--- a/test/altercol.test
+++ b/test/altercol.test
@@ -796,7 +796,7 @@ do_execsql_test 19.1 {
{CREATE VIEW v2(e) AS SELECT coalesce(t2.c,t1.f) FROM t1, t2 WHERE t1.b=t2.d}
}
-# 2019-01-08: https://www.sqlite.org/src/tktview/bc8d94f0fbd633fd9a051e3
+# 2019-01-08: https://sqlite.org/src/tktview/bc8d94f0fbd633fd9a051e3
#
# ALTER TABLE RENAME COLUMN does not work for tables that have redundant
# UNIQUE constraints.
diff --git a/test/altertab2.test b/test/altertab2.test
index 576dc49670..56e42f1a69 100644
--- a/test/altertab2.test
+++ b/test/altertab2.test
@@ -351,7 +351,7 @@ do_execsql_test 8.5 {
SELECT sql FROM sqlite_master WHERE name = 'v4'
} {{CREATE VIEW v4 AS SELECT * FROM t4 WHERE (c=1 AND 0) OR b=2}}
-# 2019-06-10 https://www.sqlite.org/src/info/533010b8cacebe82
+# 2019-06-10 https://sqlite.org/src/info/533010b8cacebe82
reset_db
do_catchsql_test 8.6 {
CREATE TABLE t0(c0);
diff --git a/test/analyzeC.test b/test/analyzeC.test
index 2f43d57a1e..f5bcaeb781 100644
--- a/test/analyzeC.test
+++ b/test/analyzeC.test
@@ -133,7 +133,7 @@ do_execsql_test 4.3 {
} {/.*INDEX t1ca.*/}
# 2019-08-15.
-# Ticket https://www.sqlite.org/src/tktview/e4598ecbdd18bd82945f602901
+# Ticket https://sqlite.org/src/tktview/e4598ecbdd18bd82945f602901
# The sz=N parameter in the sqlite_stat1 table needs to have a value of
# 2 or more to avoid a division by zero in the query planner.
#
diff --git a/test/analyzer1.test b/test/analyzer1.test
index 51b5f8b6af..1f0b0f6376 100644
--- a/test/analyzer1.test
+++ b/test/analyzer1.test
@@ -19,7 +19,7 @@ ifcapable !vtab {
return
}
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
set PROG "sqlite3_analyzer.exe"
} else {
set PROG "./sqlite3_analyzer"
diff --git a/test/attach.test b/test/attach.test
index 557201d654..3445c43fa7 100644
--- a/test/attach.test
+++ b/test/attach.test
@@ -759,7 +759,7 @@ do_test attach-6.1 {
ATTACH DATABASE 'no-such-file' AS nosuch;
}
} {0 {}}
-if {$tcl_platform(platform)=="unix"} {
+if {$tcl_platform(platform) eq "unix"} {
do_test attach-6.2 {
sqlite3 dbx cannot-read
dbx eval {CREATE TABLE t1(a,b,c)}
diff --git a/test/autoinc.test b/test/autoinc.test
index 2c7ee2a7e8..9f869f35ea 100644
--- a/test/autoinc.test
+++ b/test/autoinc.test
@@ -669,7 +669,7 @@ ifcapable trigger {
} {1 124 2 10123}
}
-# 2016-10-03 ticket https://www.sqlite.org/src/tktview/7b3328086a5c1
+# 2016-10-03 ticket https://sqlite.org/src/tktview/7b3328086a5c1
# Make sure autoincrement plays nicely with the xfer optimization
#
do_execsql_test autoinc-10.1 {
diff --git a/test/autoindex5.test b/test/autoindex5.test
index aa8dec27d9..adfc3e5f76 100644
--- a/test/autoindex5.test
+++ b/test/autoindex5.test
@@ -142,7 +142,7 @@ do_catchsql_test 2.2 {
);
} {0 9}
-# Ticket https://www.sqlite.org/src/info/787fa716be3a7f65
+# Ticket https://sqlite.org/src/info/787fa716be3a7f65
# Segfault due to multiple uses of the same subquery where the
# subquery is implemented via coroutine.
#
diff --git a/test/avtrans.test b/test/avtrans.test
index 6fc4a3e393..b483c71a44 100644
--- a/test/avtrans.test
+++ b/test/avtrans.test
@@ -903,7 +903,7 @@ for {set i 2} {$i<=$limit} {incr i} {
INSERT INTO t3 SELECT randstr(10,400) FROM t3 WHERE random()%10==0;
}
} {}
- if {$tcl_platform(platform)=="unix"} {
+ if {$tcl_platform(platform) eq "unix"} {
do_test avtrans-9.$i.4-$cnt {
expr {$sqlite_sync_count>0}
} 1
diff --git a/test/backup2.test b/test/backup2.test
index 1822e2dbf0..095ecc752d 100644
--- a/test/backup2.test
+++ b/test/backup2.test
@@ -141,7 +141,7 @@ do_test backup2-9 {
# Try to restore from an unreadable file.
#
-if {$tcl_platform(platform)=="windows"} {
+if {$::tcl_platform(os) eq "Windows NT"} {
set msg {cannot open source database: unable to open database file}
} elseif {[string match *BSD $tcl_platform(os)]} {
set msg {}
diff --git a/test/bc_common.tcl b/test/bc_common.tcl
index c47f99681f..953ce62621 100644
--- a/test/bc_common.tcl
+++ b/test/bc_common.tcl
@@ -9,7 +9,7 @@ proc bc_find_binaries {zCaption} {
set binaries [list]
set self [info nameofexec]
set pattern "$self?*"
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
set pattern [string map {\.exe {}} $pattern]
}
foreach file [glob -nocomplain $pattern] {
diff --git a/test/btree01.test b/test/btree01.test
index 6e4717ae65..b1909a3adb 100644
--- a/test/btree01.test
+++ b/test/btree01.test
@@ -17,7 +17,7 @@ source $testdir/tester.tcl
set testprefix btree01
# The refactoring on the b-tree balance() routine in check-in
-# http://www.sqlite.org/src/info/face33bea1ba3a (2014-10-27)
+# http://sqlite.org/src/info/face33bea1ba3a (2014-10-27)
# caused the integrity_check on the following SQL to fail.
#
do_execsql_test btree01-1.1 {
diff --git a/test/cast.test b/test/cast.test
index 1c9071d775..c1b564328a 100644
--- a/test/cast.test
+++ b/test/cast.test
@@ -385,7 +385,7 @@ do_execsql_test cast-6.1 {
} {9000000000000000001 9000000000000000001 9000000000000000001 9000000000000000001}
# 2019-06-07
-# https://www.sqlite.org/src/info/4c2d7639f076aa7c
+# https://sqlite.org/src/info/4c2d7639f076aa7c
do_execsql_test cast-7.1 {
SELECT CAST('-' AS NUMERIC);
} {0}
@@ -400,7 +400,7 @@ do_execsql_test cast-7.4 {
} {0}
# 2019-06-07
-# https://www.sqlite.org/src/info/e8bedb2a184001bb
+# https://sqlite.org/src/info/e8bedb2a184001bb
do_execsql_test cast-7.10 {
SELECT '' - 2851427734582196970;
} {-2851427734582196970}
@@ -412,7 +412,7 @@ do_execsql_test cast-7.12 {
} {-1}
# 2019-06-10
-# https://www.sqlite.org/src/info/dd6bffbfb6e61db9
+# https://sqlite.org/src/info/dd6bffbfb6e61db9
#
# EVIDENCE-OF: R-55084-10555 Casting a TEXT or BLOB value into NUMERIC
# yields either an INTEGER or a REAL result.
@@ -441,7 +441,7 @@ do_execsql_test cast-7.33 {
} 0
# 2019-06-12
-# https://www.sqlite.org/src/info/674385aeba91c774
+# https://sqlite.org/src/info/674385aeba91c774
#
do_execsql_test cast-7.40 {
SELECT CAST('-0.0' AS numeric);
diff --git a/test/chunksize.test b/test/chunksize.test
index 47d118d841..be3795fc5c 100644
--- a/test/chunksize.test
+++ b/test/chunksize.test
@@ -14,7 +14,7 @@ set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix chunksize
-if {$::tcl_platform(platform)!="unix"} {
+if {$::tcl_platform(platform) ne "unix"} {
finish_test
return
}
diff --git a/test/colname.test b/test/colname.test
index 24fb51acfc..0907df641e 100644
--- a/test/colname.test
+++ b/test/colname.test
@@ -378,7 +378,7 @@ do_test colname-9.210 {
execsql2 {SELECT t1.a, v3.a AS n FROM t1 JOIN v3}
} {a 1 n 3}
-# 2017-12-23: Ticket https://www.sqlite.org/src/info/3b4450072511e621
+# 2017-12-23: Ticket https://sqlite.org/src/info/3b4450072511e621
# Inconsistent column names in CREATE TABLE AS
#
# Verify that the names of columns in the created table of a CREATE TABLE AS
diff --git a/test/conflict.test b/test/conflict.test
index ba3ad9b0dd..54c01d36de 100644
--- a/test/conflict.test
+++ b/test/conflict.test
@@ -824,7 +824,7 @@ do_test conflict-13.2 {
} {1 3}
-# Ticket https://www.sqlite.org/src/tktview/e6f1f2e34dceeb1ed61531c7e9
+# Ticket https://sqlite.org/src/tktview/e6f1f2e34dceeb1ed61531c7e9
# Verify that it is not possible to sneak a NULL value into a NOT NULL
# column using REPLACE.
#
diff --git a/test/crash8.test b/test/crash8.test
index c07829979f..b2b01183fd 100644
--- a/test/crash8.test
+++ b/test/crash8.test
@@ -356,7 +356,7 @@ ifcapable pragma {
# is not created on F2FS file-systems that support atomic
# write. So do not run these tests in that case either.
#
-if {$::tcl_platform(platform)=="unix" && [atomic_batch_write test.db]==0 } {
+if {$::tcl_platform(os) ne "Windows NT" && [atomic_batch_write test.db]==0 } {
for {set i 1} {$i < 10} {incr i} {
catch { db close }
forcedelete test.db test.db-journal
diff --git a/test/date.test b/test/date.test
index 2042880a92..8badccf3fb 100644
--- a/test/date.test
+++ b/test/date.test
@@ -584,7 +584,7 @@ datetest 16.30 {datetime(5373484,'-14712 years')} {-4713-12-31 12:00:00}
datetest 16.31 {datetime(5373484,'-14713 years')} NULL
# 2017-03-02: Wrong 'start of day' computation.
-# https://www.sqlite.org/src/info/6097cb92745327a1
+# https://sqlite.org/src/info/6097cb92745327a1
#
datetest 17.1 {datetime(2457754, 'start of day')} {2016-12-31 00:00:00}
datetest 17.2 {datetime(2457828)} {2017-03-15 12:00:00}
diff --git a/test/delete4.test b/test/delete4.test
index 8d6a1b8c7c..34151446b1 100644
--- a/test/delete4.test
+++ b/test/delete4.test
@@ -170,7 +170,7 @@ do_execsql_test 5.0 {
} {}
# 2016-05-02
-# Ticket https://www.sqlite.org/src/tktview/dc6ebeda93960877
+# Ticket https://sqlite.org/src/tktview/dc6ebeda93960877
# A subquery in the WHERE clause of a one-pass DELETE can cause an
# incorrect answer.
#
diff --git a/test/expr.test b/test/expr.test
index 55b1dc9502..71518df690 100644
--- a/test/expr.test
+++ b/test/expr.test
@@ -1002,7 +1002,7 @@ do_execsql_test expr-13.9 {
SELECT '' <= "";
} {1}
-# 2018-02-26. Ticket https://www.sqlite.org/src/tktview/36fae083b450e3af85
+# 2018-02-26. Ticket https://sqlite.org/src/tktview/36fae083b450e3af85
#
do_execsql_test expr-14.1 {
DROP TABLE IF EXISTS t1;
diff --git a/test/extension01.test b/test/extension01.test
index 97b772680e..ba8a44edb5 100644
--- a/test/extension01.test
+++ b/test/extension01.test
@@ -60,7 +60,7 @@ do_test 1.5 {
} {0}
do_test 1.6 {
- if {$::tcl_platform(platform)=="unix"} {
+ if {$::tcl_platform(os) ne "Windows NT"} {
file attributes ./file2.txt -permissions r--r--r--
} else {
file attributes ./file2.txt -readonly 1
@@ -70,7 +70,7 @@ do_test 1.6 {
}
} {nil}
do_test 1.7 {
- if {$::tcl_platform(platform)=="unix"} {
+ if {$::tcl_platform(os) ne "Windows NT"} {
file attributes ./file2.txt -permissions rw-r--r--
} else {
file attributes ./file2.txt -readonly 0
diff --git a/test/external_reader.test b/test/external_reader.test
index 5d293981c5..d56aa4e261 100644
--- a/test/external_reader.test
+++ b/test/external_reader.test
@@ -19,7 +19,7 @@ ifcapable !wal {
finish_test
return
}
-if {$::tcl_platform(platform)!="unix"} {
+if {$::tcl_platform(os) eq "Windows NT"} {
finish_test
return
}
diff --git a/test/filectrl.test b/test/filectrl.test
index fee29e0442..9b1a1c7589 100644
--- a/test/filectrl.test
+++ b/test/filectrl.test
@@ -47,7 +47,7 @@ db close
forcedelete .test_control_lockproxy.db-conch test.proxy
forcedelete test.db test2.db
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
do_test filectrl-2.1 {
sqlite3 db test2.db
set size [file size test2.db]
diff --git a/test/func.test b/test/func.test
index 85c9ada7eb..4e5f617e74 100644
--- a/test/func.test
+++ b/test/func.test
@@ -1241,7 +1241,7 @@ do_test func-24.12 {
WHEN 'program' THEN null ELSE t1 END) FROM tbl1
}
} {,is,free,software}
-# Tests to verify ticket http://www.sqlite.org/src/tktview/55746f9e65f8587c0
+# Tests to verify ticket http://sqlite.org/src/tktview/55746f9e65f8587c0
do_test func-24.13 {
execsql {
SELECT typeof(group_concat(x)) FROM (SELECT '' AS x);
diff --git a/test/func3.test b/test/func3.test
index 0221a0dfd6..518bd51c79 100644
--- a/test/func3.test
+++ b/test/func3.test
@@ -154,7 +154,7 @@ do_test func3-5.39 {
} [db eval {EXPLAIN SELECT min(1.0+'2.0',4*11)}]
# Unlikely() does not preserve the affinity of X.
-# ticket https://www.sqlite.org/src/tktview/0c620df60b
+# ticket https://sqlite.org/src/tktview/0c620df60b
#
do_execsql_test func3-5.40 {
SELECT likely(CAST(1 AS INT))=='1';
diff --git a/test/gencol1.test b/test/gencol1.test
index ed7ea567d4..a247a7148d 100644
--- a/test/gencol1.test
+++ b/test/gencol1.test
@@ -211,9 +211,9 @@ do_catchsql_test gencol1-6.10 {
REPLACE INTO t0(c1) VALUES(NULL);
} {1 {NOT NULL constraint failed: t0.c0}}
-# 2019-11-06 ticket https://www.sqlite.org/src/info/2399f5986134f79c
-# 2019-12-27 ticket https://www.sqlite.org/src/info/5fbc159eeb092130
-# 2019-12-27 ticket https://www.sqlite.org/src/info/37823501c68a09f9
+# 2019-11-06 ticket https://sqlite.org/src/info/2399f5986134f79c
+# 2019-12-27 ticket https://sqlite.org/src/info/5fbc159eeb092130
+# 2019-12-27 ticket https://sqlite.org/src/info/37823501c68a09f9
#
# All of the above tickets deal with NOT NULL ON CONFLICT REPLACE
# constraints on tables that have generated columns.
diff --git a/test/in.test b/test/in.test
index 601c7e3b4d..67fdd4f555 100644
--- a/test/in.test
+++ b/test/in.test
@@ -652,7 +652,7 @@ do_execsql_test in-14.1 {
SELECT * FROM c1 WHERE a IN (SELECT a FROM c1) ORDER BY 1
} {1 2 3 4}
-# 2019-02-20 Ticket https://www.sqlite.org/src/tktview/df46dfb631f75694fbb97033b69
+# 2019-02-20 Ticket https://sqlite.org/src/tktview/df46dfb631f75694fbb97033b69
#
do_execsql_test in-15.0 {
DROP TABLE IF EXISTS t1;
@@ -736,7 +736,7 @@ do_execsql_test in-16.2 {
} {}
# 2019-06-11
-# https://www.sqlite.org/src/info/57353f8243c637c0
+# https://sqlite.org/src/info/57353f8243c637c0
#
do_execsql_test in-17.1 {
SELECT 1 IN ('1');
@@ -760,7 +760,7 @@ do_execsql_test in-18.1 {
SELECT * FROM t0 WHERE '1' IN (t0.c0);
} {}
-# 2019-09-02 ticket https://www.sqlite.org/src/info/2841e99d104c6436
+# 2019-09-02 ticket https://sqlite.org/src/info/2841e99d104c6436
# For the IN_INDEX_NOOP optimization, apply REAL affinity to the LHS
# values prior to comparison if the RHS has REAL affinity.
#
diff --git a/test/index.test b/test/index.test
index 11d3d7191c..25ff41762d 100644
--- a/test/index.test
+++ b/test/index.test
@@ -738,7 +738,7 @@ do_test index-21.2 {
}
} {0 {9 5 1}}
-# 2019-05-01 ticket https://www.sqlite.org/src/info/3be1295b264be2fa
+# 2019-05-01 ticket https://sqlite.org/src/info/3be1295b264be2fa
do_execsql_test index-22.0 {
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a, b TEXT);
@@ -748,7 +748,7 @@ do_execsql_test index-22.0 {
SELECT a, b, '|' FROM t1;
} {a 1 | a 0 |}
-# 2019-05-10 ticket https://www.sqlite.org/src/info/ae0f637bddc5290b
+# 2019-05-10 ticket https://sqlite.org/src/info/ae0f637bddc5290b
do_execsql_test index-23.0 {
DROP TABLE t1;
CREATE TABLE t1(a TEXT, b REAL);
diff --git a/test/index6.test b/test/index6.test
index 16370f521d..007823a283 100644
--- a/test/index6.test
+++ b/test/index6.test
@@ -391,7 +391,7 @@ do_execsql_test index6-11.2 {
} {/USING INDEX t11x/}
# 2018-12-08
-# Ticket https://www.sqlite.org/src/info/1d958d90596593a7
+# Ticket https://sqlite.org/src/info/1d958d90596593a7
# NOT IN operator fails when using a partial index.
#
do_execsql_test index6-12.1 {
@@ -412,7 +412,7 @@ do_execsql_test index6-12.2 {
} {1 2}
# 2019-05-04
-# Ticket https://www.sqlite.org/src/tktview/5c6955204c392ae763a95
+# Ticket https://sqlite.org/src/tktview/5c6955204c392ae763a95
# Theorem prover error
#
do_execsql_test index6-13.1 {
@@ -438,8 +438,8 @@ do_execsql_test index6-14.2 {
} {{} row}
# 2019-08-30
-# Ticket https://www.sqlite.org/src/info/a6408d42b9f44462
-# Ticket https://www.sqlite.org/src/info/fba33c8b1df6a915
+# Ticket https://sqlite.org/src/info/a6408d42b9f44462
+# Ticket https://sqlite.org/src/info/fba33c8b1df6a915
# https://sqlite.org/src/info/bac716244fddac1fe841
#
do_execsql_test index6-15.1 {
diff --git a/test/indexexpr1.test b/test/indexexpr1.test
index d5c47e403e..ca6682cda7 100644
--- a/test/indexexpr1.test
+++ b/test/indexexpr1.test
@@ -330,7 +330,7 @@ do_execsql_test indexexpr1-1010 {
# 2016-10-10
# Make sure indexes on expressions skip over initial NULL values in the
# index as they are suppose to do.
-# Ticket https://www.sqlite.org/src/tktview/4baa46491212947
+# Ticket https://sqlite.org/src/tktview/4baa46491212947
#
do_execsql_test indexexpr1-1100 {
DROP TABLE IF EXISTS t1;
@@ -374,7 +374,7 @@ do_execsql_test indexexpr1-1200.4 {
0 0 0 2 0 4 2 0 2 2 4 0
}
-# Ticket https://www.sqlite.org/src/tktview/eb703ba7b50c1a
+# Ticket https://sqlite.org/src/tktview/eb703ba7b50c1a
# Incorrect result using an index on an expression with a collating function
#
do_execsql_test indexexpr1-1300.1 {
@@ -429,7 +429,7 @@ do_execsql_test indexexpr1-1510 {
REPLACE INTO t1 SELECT a, randomblob(a) FROM t1
} {}
-# 2018-01-31 https://www.sqlite.org/src/tktview/343634942dd54ab57b702411
+# 2018-01-31 https://sqlite.org/src/tktview/343634942dd54ab57b702411
# When an index on an expression depends on the string representation of
# a numeric table column, trouble can arise since there are multiple
# string that can map to the same numeric value. (Ex: 123, 0123, 000123).
@@ -449,7 +449,7 @@ do_execsql_test indexexpr1-1620 {
SELECT b FROM t1 WHERE lower(a)='01234' ORDER BY +b;
} {}
-# 2019-08-09 https://www.sqlite.org/src/info/9080b6227fabb466
+# 2019-08-09 https://sqlite.org/src/info/9080b6227fabb466
# ExprImpliesExpr theorem prover bug:
# "(NULL IS FALSE) IS FALSE" does not imply "NULL IS NULL"
#
@@ -461,7 +461,7 @@ do_execsql_test indexexpr1-1700 {
SELECT * FROM t0 WHERE ((NULL IS FALSE) IS FALSE);
} {0}
-# 2019-09-02 https://www.sqlite.org/src/tktview/57af00b6642ecd6848
+# 2019-09-02 https://sqlite.org/src/tktview/57af00b6642ecd6848
# When the expression of an an index-on-expression references a
# table column of type REAL that is actually holding an MEM_IntReal
# value, be sure to use the REAL value and not the INT value when
diff --git a/test/insert.test b/test/insert.test
index 51e62268db..fd08eb43b8 100644
--- a/test/insert.test
+++ b/test/insert.test
@@ -413,7 +413,7 @@ do_execsql_test insert-11.1 {
# More columns of input than there are columns in the table.
-# Ticket http://www.sqlite.org/src/info/e9654505cfda9361
+# Ticket http://sqlite.org/src/info/e9654505cfda9361
#
do_execsql_test insert-12.1 {
CREATE TABLE t12a(a,b,c,d,e,f,g);
@@ -437,7 +437,7 @@ do_execsql_test insert-12.3 {
# 2018-06-11. From OSSFuzz. A column cache malfunction in
# the constraint checking on an index of expressions causes
# an assertion fault in a REPLACE. Ticket
-# https://www.sqlite.org/src/info/c2432ef9089ee73b
+# https://sqlite.org/src/info/c2432ef9089ee73b
#
do_execsql_test insert-13.1 {
DROP TABLE IF EXISTS t13;
@@ -475,7 +475,7 @@ do_execsql_test insert-15.1 {
} {4 33000}
# 2019-10-16
-# ticket https://www.sqlite.org/src/info/a8a4847a2d96f5de
+# ticket https://sqlite.org/src/info/a8a4847a2d96f5de
# On a REPLACE INTO, if an AFTER trigger adds back the conflicting
# row, you can end up with the wrong number of rows in an index.
#
diff --git a/test/instr.test b/test/instr.test
index d23d66c25c..326f8eb9ee 100644
--- a/test/instr.test
+++ b/test/instr.test
@@ -257,7 +257,7 @@ do_execsql_test instr-1.64 {
SELECT instr(a, b) FROM x1;
} 0
-# 2019-09-16 ticket https://www.sqlite.org/src/info/587791f92620090e
+# 2019-09-16 ticket https://sqlite.org/src/info/587791f92620090e
#
do_execsql_test instr-2.0 {
DROP TABLE IF EXISTS t0;
diff --git a/test/intpkey.test b/test/intpkey.test
index d6b8833a27..a8d2fb2ffb 100644
--- a/test/intpkey.test
+++ b/test/intpkey.test
@@ -604,7 +604,7 @@ do_test intpkey-15.7 {
}
} {}
-# 2016-04-18 ticket https://www.sqlite.org/src/tktview/7d7525cb01b68712495d3a
+# 2016-04-18 ticket https://sqlite.org/src/tktview/7d7525cb01b68712495d3a
# Be sure to escape quoted typenames.
#
do_execsql_test intpkey-16.0 {
@@ -614,7 +614,7 @@ do_execsql_test intpkey-16.1 {
PRAGMA table_info=t16a;
} {0 id INTEGER 0 {} 1 1 b TEXT 0 {} 0 2 c INT 0 {} 0}
-# 2016-05-06 ticket https://www.sqlite.org/src/tktview/16c9801ceba4923939085
+# 2016-05-06 ticket https://sqlite.org/src/tktview/16c9801ceba4923939085
# When the schema contains an index on the IPK and no other index
# and a WHERE clause on a delete uses an OR where both sides referencing
# the IPK, then it is possible that the OP_Delete will fail because there
diff --git a/test/io.test b/test/io.test
index dfadcd1362..1dc84bdee0 100644
--- a/test/io.test
+++ b/test/io.test
@@ -443,7 +443,7 @@ sqlite3_simulate_device -char safe_append
# on the journal file between steps (2) and (3) above.
#
set expected_sync_count 2
-if {$::tcl_platform(platform)=="unix"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
ifcapable dirsync {
incr expected_sync_count
}
@@ -465,7 +465,7 @@ do_test io-4.2.1 {
execsql { INSERT INTO abc VALUES('c', 'd') }
file exists test.db-journal
} {1}
-if {$::tcl_platform(platform)=="unix"} {
+if {$::tcl_platform(platform) eq "unix"} {
do_test io-4.2.2 {
hexio_read test.db-journal 8 4
} {FFFFFFFF}
diff --git a/test/ioerr.test b/test/ioerr.test
index fb54d8b384..c76c9c1e6f 100644
--- a/test/ioerr.test
+++ b/test/ioerr.test
@@ -172,7 +172,7 @@ ifcapable crashtest&&attach {
# These tests can't be run on windows because the windows version of
# SQLite holds a mandatory exclusive lock on journal files it has open.
#
-if {$tcl_platform(platform)!="windows" && ![atomic_batch_write test.db]} {
+if {$tcl_platform(platform) ne"windows" && ![atomic_batch_write test.db]} {
do_ioerr_test ioerr-7 -tclprep {
db close
sqlite3 db2 test2.db
@@ -211,7 +211,7 @@ do_ioerr_test ioerr-8 -ckrefcount true -tclprep {
# For test coverage: Cause an IO error whilst reading the master-journal
# name from a journal file.
-if {$tcl_platform(platform)=="unix" && [atomic_batch_write test.db]==0} {
+if {$tcl_platform(platform) eq "unix" && [atomic_batch_write test.db]==0} {
do_ioerr_test ioerr-9 -ckrefcount true -tclprep {
execsql {
CREATE TABLE t1(a,b,c);
diff --git a/test/join.test b/test/join.test
index aa526aeb29..b34136f5dd 100644
--- a/test/join.test
+++ b/test/join.test
@@ -799,7 +799,7 @@ do_execsql_test join-14.9 {
} {111 {}}
# Verify the fix to ticket
-# https://www.sqlite.org/src/tktview/7fde638e94287d2c948cd9389
+# https://sqlite.org/src/tktview/7fde638e94287d2c948cd9389
#
db close
sqlite3 db :memory:
@@ -819,7 +819,7 @@ do_execsql_test join-14.12 {
} {4 {} {} | 2 2 1 |}
# Verify the fix for ticket
-# https://www.sqlite.org/src/info/892fc34f173e99d8
+# https://sqlite.org/src/info/892fc34f173e99d8
#
db close
sqlite3 db :memory:
@@ -904,7 +904,7 @@ do_execsql_test join-15.110 {
ORDER BY a1, a2, a3, a4, a5;
} {1 {} {} {} {} 1 11 {} {} {} 1 12 {} {} {} 1 12 121 {} {} 1 13 {} {} {}}
-# 2019-02-05 Ticket https://www.sqlite.org/src/tktview/5948e09b8c415bc45da5c
+# 2019-02-05 Ticket https://sqlite.org/src/tktview/5948e09b8c415bc45da5c
# Error in join due to the LEFT JOIN strength reduction optimization.
#
do_execsql_test join-16.100 {
diff --git a/test/join5.test b/test/join5.test
index 703c256f86..eb8ba3c7b5 100644
--- a/test/join5.test
+++ b/test/join5.test
@@ -106,7 +106,7 @@ do_test join5-2.12 {
execsql {SELECT * FROM xy LEFT JOIN ab ON NULL WHERE NULL}
} {}
-# Ticket https://www.sqlite.org/src/tktview/6f2222d550f5b0ee7ed37601
+# Ticket https://sqlite.org/src/tktview/6f2222d550f5b0ee7ed37601
# Incorrect output on a LEFT JOIN.
#
do_execsql_test join5-3.1 {
@@ -161,7 +161,7 @@ do_execsql_test join5-3.3 {
SELECT * FROM x1 LEFT JOIN x2 JOIN x3 WHERE x3.d = x2.b;
} {}
-# Ticket https://www.sqlite.org/src/tktview/c2a19d81652f40568c770c43 on
+# Ticket https://sqlite.org/src/tktview/c2a19d81652f40568c770c43 on
# 2015-08-20. LEFT JOIN and the push-down optimization.
#
do_execsql_test join5-4.1 {
diff --git a/test/journal1.test b/test/journal1.test
index bcbafe30f6..56c862f055 100644
--- a/test/journal1.test
+++ b/test/journal1.test
@@ -25,7 +25,7 @@ source $testdir/tester.tcl
# Or with atomic_batch_write systems, as journal files are
# not created.
#
-if {$tcl_platform(platform)=="windows"
+if {$tcl_platform(platform) eq "windows"
|| [atomic_batch_write test.db]
} {
finish_test
diff --git a/test/journal3.test b/test/journal3.test
index c3e3d12db6..a29b68d54a 100644
--- a/test/journal3.test
+++ b/test/journal3.test
@@ -20,7 +20,7 @@ source $testdir/malloc_common.tcl
# If a connection is required to create a journal file, it creates it with
# the same file-system permissions as the database file itself. Test this.
#
-if {$::tcl_platform(platform) == "unix"
+if {$::tcl_platform(os) ne "Windows NT"
&& [atomic_batch_write test.db]==0
} {
diff --git a/test/json101.test b/test/json101.test
index 3963ffbb6b..aec959acb2 100644
--- a/test/json101.test
+++ b/test/json101.test
@@ -444,7 +444,7 @@ foreach {tn isvalid ws} {
$isvalid
}
-# Ticket https://www.sqlite.org/src/info/ad2559db380abf8e
+# Ticket https://sqlite.org/src/info/ad2559db380abf8e
# Control characters must be escaped in JSON strings.
#
do_execsql_test json101-8.1 {
@@ -807,7 +807,7 @@ do_execsql_test json101-10.95 {
} {0}
#--------------------------------------------------------------------------
-# 2017-04-11. https://www.sqlite.org/src/info/981329adeef51011
+# 2017-04-11. https://sqlite.org/src/info/981329adeef51011
# Stack overflow on deeply nested JSON.
#
# The following tests confirm that deeply nested JSON is considered invalid.
@@ -878,7 +878,7 @@ do_execsql_test json101-12.120b {
} {0}
# 2018-01-26
-# ticket https://www.sqlite.org/src/tktview/80177f0c226ff54f6ddd41
+# ticket https://sqlite.org/src/tktview/80177f0c226ff54f6ddd41
# Make sure the query planner knows about the arguments to table-valued functions.
#
do_execsql_test json101-13.100 {
diff --git a/test/json103.test b/test/json103.test
index e7483073b6..f94217ac10 100644
--- a/test/json103.test
+++ b/test/json103.test
@@ -55,7 +55,7 @@ do_execsql_test json103-220 {
WHERE rowid<7 GROUP BY b ORDER BY b;
} {0 {{"n3":3,"n6":6}} 1 {{"n1":1,"n4":4}} 2 {{"n2":2,"n5":5}}}
-# ticket https://www.sqlite.org/src/info/f45ac567eaa9f93c 2016-01-30
+# ticket https://sqlite.org/src/info/f45ac567eaa9f93c 2016-01-30
# Invalid JSON generated by json_group_array()
#
# The underlying problem is a failure to reset Mem.eSubtype
diff --git a/test/like.test b/test/like.test
index 0d732b569c..1f9a810e5d 100644
--- a/test/like.test
+++ b/test/like.test
@@ -1013,7 +1013,7 @@ do_execsql_test like-12.16 {
SELECT id FROM t12b WHERE x LIKE 'abc%' COLLATE binary ORDER BY +id;
} {/SCAN/}
-# Ticket [https://www.sqlite.org/src/tktview/80369eddd5c94d49f7fbbcf5]
+# Ticket [https://sqlite.org/src/tktview/80369eddd5c94d49f7fbbcf5]
# 2016-01-20
#
do_execsql_test like-13.1 {
diff --git a/test/like3.test b/test/like3.test
index 01d19a54f6..03681606c3 100644
--- a/test/like3.test
+++ b/test/like3.test
@@ -112,7 +112,7 @@ do_execsql_test like3-4.2ck {
SELECT quote(x) FROM t4 WHERE x LIKE 'ab%' ORDER BY +x ASC;
} {'abc' 'abd' 'abe' X'616263' X'616264' X'616265'}
-# 2018-09-10 ticket https://www.sqlite.org/src/tktview/c94369cae9b561b1f996
+# 2018-09-10 ticket https://sqlite.org/src/tktview/c94369cae9b561b1f996
# The like optimization fails for a column with numeric affinity if
# the pattern '/%' or begins with the escape character.
#
@@ -199,7 +199,7 @@ do_execsql_test like3-5.400 {
} {./}
# 2019-06-14
-# Ticket https://www.sqlite.org/src/info/ce8717f0885af975
+# Ticket https://sqlite.org/src/info/ce8717f0885af975
do_execsql_test like3-5.410 {
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(c0 INT UNIQUE COLLATE NOCASE);
@@ -208,7 +208,7 @@ do_execsql_test like3-5.410 {
} {.1%}
# 2019-09-03
-# Ticket https://www.sqlite.org/src/info/0f0428096f
+# Ticket https://sqlite.org/src/info/0f0428096f
do_execsql_test like3-5.420 {
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(c0 UNIQUE);
diff --git a/test/limit2.test b/test/limit2.test
index c03f39cd9c..2ecd8ab5f5 100644
--- a/test/limit2.test
+++ b/test/limit2.test
@@ -98,7 +98,7 @@ do_execsql_test limit2-210 {
} {1 1 {} {} | 3 3 {} {} | 4 4 {} {} |}
# Bug in the ORDER BY LIMIT optimization reported on 2016-09-06.
-# Ticket https://www.sqlite.org/src/info/559733b09e96
+# Ticket https://sqlite.org/src/info/559733b09e96
#
do_execsql_test limit2-300 {
CREATE TABLE t300(a,b,c);
@@ -150,11 +150,11 @@ do_execsql_test 502 {
SELECT j FROM t502 WHERE i IN (1,2,3,4,5) ORDER BY j LIMIT 3;
} {1 3 4}
-# Ticket https://www.sqlite.org/src/info/123c9ba32130a6c9 2017-12-13
+# Ticket https://sqlite.org/src/info/123c9ba32130a6c9 2017-12-13
# Incorrect result when an idnex is used for an ordered join.
#
# This test case is in the limit2.test module because the problem was first
-# exposed by check-in https://www.sqlite.org/src/info/559733b09e which
+# exposed by check-in https://sqlite.org/src/info/559733b09e which
# implemented the ORDER BY LIMIT optimization that limit2.test strives to
# test.
#
@@ -167,7 +167,7 @@ do_execsql_test 600 {
SELECT y FROM t1, t2 WHERE a=x AND b<=y ORDER BY b DESC;
} {3}
-# Ticket https://www.sqlite.org/src/info/9936b2fa443fec03 2018-09-08
+# Ticket https://sqlite.org/src/info/9936b2fa443fec03 2018-09-08
# Infinite loop due to the ORDER BY LIMIT optimization.
#
do_execsql_test 700 {
diff --git a/test/loadext.test b/test/loadext.test
index 6da8a52894..e95d5f6eb8 100644
--- a/test/loadext.test
+++ b/test/loadext.test
@@ -66,9 +66,13 @@ if {$::tcl_platform(os) eq "Darwin"} {
set dlerror_nosymbol {dlsym.XXX, %2$s.: symbol not found}
}
-if {$::tcl_platform(platform) eq "windows"} {
+if {$::tcl_platform(os) eq "Windows NT"} {
set dlerror_nosuchfile {The specified module could not be found.*}
- set dlerror_notadll {%%1 is not a valid Win32 application.*}
+ if {$::tcl_platform(platform) eq "unix"} {
+ set dlerror_notadll $dlerror_nosuchfile
+ } else {
+ set dlerror_notadll {%%1 is not a valid Win32 application.*}
+ }
set dlerror_nosymbol {The specified procedure could not be found.*}
}
diff --git a/test/lock.test b/test/lock.test
index cacb6d3ff1..3f4631a623 100644
--- a/test/lock.test
+++ b/test/lock.test
@@ -145,7 +145,7 @@ do_test lock-1.21 {
# connections, because UNIX supports reader/writer locks. Under windows,
# this is not possible.
#
-if {$::tcl_platform(platform)=="unix"} {
+if {$::tcl_platform(platform) eq "unix"} {
do_test lock-1.22 {
db eval {SELECT * FROM t1} qv {
set r [catch {db2 eval {SELECT a FROM t1}} msg]
diff --git a/test/malloc.test b/test/malloc.test
index 5e82e8028b..e53bfcd192 100644
--- a/test/malloc.test
+++ b/test/malloc.test
@@ -329,7 +329,7 @@ ifcapable crashtest&&attach {
}
}
-if {$tcl_platform(platform)!="windows" && [atomic_batch_write test.db]==0} {
+if {$tcl_platform(platform) ne "windows" && [atomic_batch_write test.db]==0} {
do_malloc_test 14 -tclprep {
catch {db close}
sqlite3 db2 test2.db
diff --git a/test/minmax.test b/test/minmax.test
index 81bd46dbe2..232ac14a05 100644
--- a/test/minmax.test
+++ b/test/minmax.test
@@ -633,7 +633,7 @@ do_test_13_noopt 13.7 {
SELECT min(c), count(c) FROM t1 WHERE a='a';
} {1 5}
-# 2016-07-26. https://www.sqlite.org/src/info/a0bac8b3c3d1bb75
+# 2016-07-26. https://sqlite.org/src/info/a0bac8b3c3d1bb75
# Incorrect result on a min() query after a CREATE INDEX.
#
do_execsql_test 14.1 {
diff --git a/test/misc7.test b/test/misc7.test
index add9014b08..f4ef2d2103 100644
--- a/test/misc7.test
+++ b/test/misc7.test
@@ -100,7 +100,7 @@ proc do_fileopen_test {prefix sql} {
execsql { CREATE TABLE abc(a PRIMARY KEY, b, c); }
db close
-if {$tcl_platform(platform)!="windows"} {
+if {$tcl_platform(platform) ne "windows"} {
do_fileopen_test misc7-6.1 {
BEGIN;
INSERT INTO abc VALUES(1, 2, 3);
@@ -390,7 +390,7 @@ do_test misc7-16.X {
# These tests do not work on windows due to restrictions in the
# windows file system.
#
-if {$tcl_platform(platform)!="windows"} {
+if {$tcl_platform(platform) ne "windows"} {
# Some network filesystems (ex: AFP) do not support setting read-only
# permissions. Only run these tests if full unix permission setting
@@ -534,7 +534,7 @@ do_test misc7-22.4 {
catch { db close }
forcedelete test.db
-if {$::tcl_platform(platform)=="unix"
+if {$::tcl_platform(platform) eq "unix"
&& [atomic_batch_write test.db]==0
} {
reset_db
diff --git a/test/mmap2.test b/test/mmap2.test
index 1f8346b915..df96671dfb 100644
--- a/test/mmap2.test
+++ b/test/mmap2.test
@@ -21,10 +21,10 @@ set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix mmap2
-if {$::tcl_platform(platform)!="unix" || [test_syscall defaultvfs] != "unix"} {
+if {[llength [info commands test_syscall]]==0} {
finish_test
return
-}
+}
ifcapable !mmap {
finish_test
return
diff --git a/test/nockpt.test b/test/nockpt.test
index 4cc61d11e1..f5d11732be 100644
--- a/test/nockpt.test
+++ b/test/nockpt.test
@@ -61,7 +61,7 @@ do_test 1.14 { sqlite3_db_config db NO_CKPT_ON_CLOSE 1 } {1}
do_execsql_test 1.14 { PRAGMA main.journal_mode = delete } {delete}
do_test 1.15 { file exists test.db-wal } {0}
-if {$::tcl_platform(platform)!="windows"} {
+if {$::tcl_platform(platform) ne "windows"} {
#-------------------------------------------------------------------------
# Test an unusual scenario:
#
@@ -102,7 +102,9 @@ sqlite3_close_v2 $::db1
# Delete the database, wal and shm files.
#
-forcedelete test.db test.db-wal test.db-shm
+catch {forcedelete test.db}
+catch {forcedelete test.db-wal}
+catch {forcedelete test.db-shm}
# Open and populate a new database file at the same file-system location
# as the one just deleted. Contrive a partial checkpoint on it.
diff --git a/test/orderby1.test b/test/orderby1.test
index 41444a44c3..73eda83992 100644
--- a/test/orderby1.test
+++ b/test/orderby1.test
@@ -536,7 +536,7 @@ do_test 8.3 {
} 5000
#---------------------------------------------------------------------------
-# https://www.sqlite.org/src/tktview/cb3aa0641d9a413841c004293a4fc06cdc122029
+# https://sqlite.org/src/tktview/cb3aa0641d9a413841c004293a4fc06cdc122029
#
# Adverse interaction between scalar subqueries and the partial-sorting
# logic.
diff --git a/test/orderby3.test b/test/orderby3.test
index f005f0d2e8..09e9156d0f 100644
--- a/test/orderby3.test
+++ b/test/orderby3.test
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing that the optimizations that disable
# ORDER BY clauses work correctly on a 3-way join. See ticket
-# http://www.sqlite.org/src/956e4d7f89
+# http://sqlite.org/src/956e4d7f89
#
diff --git a/test/orderby4.test b/test/orderby4.test
index ec6eb041f6..944a91f37d 100644
--- a/test/orderby4.test
+++ b/test/orderby4.test
@@ -12,7 +12,7 @@
# focus of this file is testing that the optimizations that disable
# ORDER BY clauses work correctly on multi-value primary keys and
# unique indices when only some prefix of the terms in the key are
-# used. See ticket http://www.sqlite.org/src/info/a179fe74659
+# used. See ticket http://sqlite.org/src/info/a179fe74659
#
diff --git a/test/oserror.test b/test/oserror.test
index a51301cc52..43d72569d9 100644
--- a/test/oserror.test
+++ b/test/oserror.test
@@ -16,7 +16,10 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-if {$::tcl_platform(platform)!="unix"} { finish_test ; return }
+if {[llength [info commands test_syscall]]==0} {
+ finish_test
+ return
+}
set ::testprefix oserror
db close
diff --git a/test/pager1.test b/test/pager1.test
index 79598e2a70..9a39e6f374 100644
--- a/test/pager1.test
+++ b/test/pager1.test
@@ -454,7 +454,7 @@ do_test pager1.4.2.1 {
tstvfs delete
} {}
-if {$::tcl_platform(platform)!="windows"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
do_test pager1.4.2.2 {
faultsim_restore_and_reopen
execsql {
@@ -567,7 +567,7 @@ foreach {tn1 tcl} {
# make sure SQLite doesn't get confused by this.
#
set nPadding [expr 511 - $::mj_filename_length]
- if {$tcl_platform(platform)=="windows"} {
+ if {$tcl_platform(platform) eq "windows"} {
# TBD need to figure out how to do this correctly for Windows!!!
set nPadding [expr 255 - $::mj_filename_length]
}
@@ -1714,7 +1714,7 @@ do_execsql_test pager1-13.1.1 {
UPDATE t1 SET b = a_string(400);
} {persist}
-if {$::tcl_platform(platform)!="windows"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
# Run transactions of increasing sizes. Eventually, one (or more than one)
# of these will write just enough content that one of the old headers created
# by the transaction in the block above lies immediately after the content
@@ -1739,7 +1739,7 @@ for {set nUp 1} {$nUp<64} {incr nUp} {
}
}
-if {$::tcl_platform(platform)!="windows"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
# Same test as above. But this time with an index on the table.
#
do_execsql_test pager1-13.2.1 {
@@ -2538,7 +2538,7 @@ do_test pager1-30.1 {
# file can still be rolled back. This is required for backward compatibility -
# versions of SQLite prior to 3.5.8 always set this field to zero.
#
-if {$tcl_platform(platform)=="unix"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
do_test pager1-31.1 {
faultsim_delete_and_reopen
execsql {
@@ -2612,7 +2612,7 @@ forcedelete test.db
# and the call to unlink() returns an ENOENT error, the COMMIT does not
# succeed.
#
-if {$::tcl_platform(platform)=="unix"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
do_test pager1-33.1 {
sqlite3 db test.db
execsql {
diff --git a/test/pager4.test b/test/pager4.test
index 2cf73d1b17..537f529dd3 100644
--- a/test/pager4.test
+++ b/test/pager4.test
@@ -13,7 +13,7 @@
# is unlinked or renamed out from under SQLite.
#
-if {$tcl_platform(platform)!="unix"} return
+if {$tcl_platform(os) eq "Windows NT"} return
set testdir [file dirname $argv0]
source $testdir/tester.tcl
diff --git a/test/pagerfault.test b/test/pagerfault.test
index 3006dad7cc..6e82b90090 100644
--- a/test/pagerfault.test
+++ b/test/pagerfault.test
@@ -20,7 +20,7 @@ if {[permutation] == "inmemory_journal"} {
return
}
-if {$::tcl_platform(platform)=="windows"} {
+if {$::tcl_platform(os) eq "Windows NT"} {
finish_test
return
}
diff --git a/test/permutations.test b/test/permutations.test
index 18e423f94e..50c41770ad 100644
--- a/test/permutations.test
+++ b/test/permutations.test
@@ -104,7 +104,7 @@ foreach f [glob -nocomplain $testdir/../ext/session/*.test] {
}
unset f
-if {$::tcl_platform(platform)!="unix"} {
+if {$::tcl_platform(platform) ne "unix"} {
set alltests [test_set $alltests -exclude crash.test crash2.test]
}
set alltests [test_set $alltests -exclude {
diff --git a/test/pragma.test b/test/pragma.test
index e823a67630..5249cc7c41 100644
--- a/test/pragma.test
+++ b/test/pragma.test
@@ -1823,7 +1823,7 @@ do_test pragma-19.5 {
file tail [lindex [execsql {PRAGMA filename}] 0]
} {test.db}
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
# Test data_store_directory pragma
#
db close
diff --git a/test/quota.test b/test/quota.test
index 5d0bda3ad3..f49600043e 100644
--- a/test/quota.test
+++ b/test/quota.test
@@ -216,7 +216,7 @@ do_test quota-3.2.9 {
set ::quota [list]
proc quota_callback {file limitvar size} {
upvar $limitvar limit
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
set file [ lindex [string map {\\ \/} $file] 0 ]
}
lappend ::quota $file $size
@@ -351,7 +351,7 @@ do_test quota-4.3.1 {
} {}
unset -nocomplain quotagroup
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
set quotagroup *\\quota-test-A?.db
} else {
set quotagroup */quota-test-A?.db
@@ -402,7 +402,7 @@ do_test quota-4.4.7 {
} [expr {[file size quota-test-A1.db]+[file size quota-test-A2.db]}]
unset -nocomplain quotagroup
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
set quotagroup *\\quota-test-B*
} else {
set quotagroup */quota-test-B*
diff --git a/test/readonly.test b/test/readonly.test
index 303300e6f1..00392266eb 100644
--- a/test/readonly.test
+++ b/test/readonly.test
@@ -15,7 +15,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
finish_test
return
}
diff --git a/test/rowvalue.test b/test/rowvalue.test
index 59b44d9386..e2688e9030 100644
--- a/test/rowvalue.test
+++ b/test/rowvalue.test
@@ -255,7 +255,7 @@ do_catchsql_test 11.8 {
SELECT * FROM t11 WHERE (a,a) IS NOT 1;
} {1 {row value misused}}
-# 2016-10-27: https://www.sqlite.org/src/tktview/fef4bb4bd9185ec8f
+# 2016-10-27: https://sqlite.org/src/tktview/fef4bb4bd9185ec8f
# Incorrect result from a LEFT JOIN with a row-value constraint
#
do_execsql_test 12.1 {
@@ -349,7 +349,7 @@ do_catchsql_test 15.5 {
#-------------------------------------------------------------------------
# Row-values used in UPDATE statements within TRIGGERs
#
-# Ticket https://www.sqlite.org/src/info/8c9458e703666e1a
+# Ticket https://sqlite.org/src/info/8c9458e703666e1a
#
do_execsql_test 16.1 {
CREATE TABLE t16a(a,b,c);
@@ -449,7 +449,7 @@ do_execsql_test 18.6 {
} {1 1 1 1 2 1}
-# 2018-02-13 Ticket https://www.sqlite.org/src/tktview/f484b65f3d6230593c3
+# 2018-02-13 Ticket https://sqlite.org/src/tktview/f484b65f3d6230593c3
# Incorrect result from a row-value comparison in the WHERE clause.
#
do_execsql_test 19.1 {
@@ -558,7 +558,7 @@ do_catchsql_test 20.1 {
SELECT 1 WHERE (2,(2,0)) IS (2,(2,0));
} {0 1}
-# 2018-11-03: Ticket https://www.sqlite.org/src/info/1a84668dcfdebaf1
+# 2018-11-03: Ticket https://sqlite.org/src/info/1a84668dcfdebaf1
# Assertion fault when doing row-value operations on a primary key
# containing duplicate columns.
#
@@ -782,4 +782,27 @@ do_execsql_test 33.3 {
SELECT * FROM t1 WHERE (a,b) BETWEEN (2,99) AND (4,0);
} {3 100}
+# 2025-04-15 https://sqlite.org/forum/forumpost/b9647a113b465950
+# Incorrect result when the schema includes a table with a UNIQUE
+# constraint and one of the columns in the UNIQUE constraint is the
+# INTEGER PRIMARY KEY, and the columns that UNIQUE constraint are
+# used in a rowvalue-IN operator constraint.
+#
+reset_db
+do_execsql_test 34.1 {
+ CREATE TABLE items (
+ Id INTEGER /* rowid alias */,
+ Item INTEGER /* any type */,
+ Test TEXT /* TEXT or BLOB */,
+ Filler, /* any type */
+ PRIMARY KEY(Id),
+ UNIQUE(Item, Id)
+ );
+ INSERT INTO items (Id, Item)
+ VALUES (1, 2), (2, 2), (3, 3), (4, 5);
+ UPDATE items SET test='ok'
+ WHERE (Id, Item) IN (SELECT Id, Item FROM items);
+ SELECT Id, Item, test FROM items ORDER BY id;
+} {1 2 ok 2 2 ok 3 3 ok 4 5 ok}
+
finish_test
diff --git a/test/rowvalue3.test b/test/rowvalue3.test
index 80ebeb7617..7d07976948 100644
--- a/test/rowvalue3.test
+++ b/test/rowvalue3.test
@@ -203,7 +203,7 @@ foreach {tn idx} {
#-------------------------------------------------------------------------
# 2016-11-17. Query flattening in a vector SELECT on the RHS of an IN
-# operator. Ticket https://www.sqlite.org/src/info/da7841375186386c
+# operator. Ticket https://sqlite.org/src/info/da7841375186386c
#
do_execsql_test 5.0 {
DROP TABLE IF EXISTS t1;
diff --git a/test/rowvalue7.test b/test/rowvalue7.test
index 03591afaf4..2823667e73 100644
--- a/test/rowvalue7.test
+++ b/test/rowvalue7.test
@@ -56,7 +56,7 @@ do_catchsql_test 2.2 {
} {1 {3 columns assigned 2 values}}
# 2019-08-26
-# ticket https://www.sqlite.org/src/info/78acc9d40f0786e8
+# ticket https://sqlite.org/src/info/78acc9d40f0786e8
#
do_catchsql_test 3.0 {
DROP TABLE IF EXISTS t1;
diff --git a/test/savepoint7.test b/test/savepoint7.test
index 59c3cd6cdc..2652cc3972 100644
--- a/test/savepoint7.test
+++ b/test/savepoint7.test
@@ -95,7 +95,7 @@ do_test savepoint7-2.2 {
list $rc $msg [db eval {SELECT * FROM t2}]
} {1 {abort due to ROLLBACK} {}}
-# Ticket: https://www.sqlite.org/src/tktview/7f7f8026eda387d544b
+# Ticket: https://sqlite.org/src/tktview/7f7f8026eda387d544b
# Segfault in the in-memory journal logic triggered by a tricky
# combination of SAVEPOINT operations.
#
diff --git a/test/select3.test b/test/select3.test
index 4bbd70cc75..ab16ab9fd8 100644
--- a/test/select3.test
+++ b/test/select3.test
@@ -268,7 +268,7 @@ do_test select3-8.2 {
}
} {real}
-# 2019-05-09 ticket https://www.sqlite.org/src/tktview/6c1d3febc00b22d457c7
+# 2019-05-09 ticket https://sqlite.org/src/tktview/6c1d3febc00b22d457c7
#
unset -nocomplain x
foreach {id x} {
diff --git a/test/select4.test b/test/select4.test
index d49708ece8..890897f2a9 100644
--- a/test/select4.test
+++ b/test/select4.test
@@ -915,7 +915,7 @@ do_execsql_test select4-14.17 {
VALUES(1),(2),(3),(4) UNION ALL SELECT 5 LIMIT 3;
} {1 2 3}
-# Ticket https://www.sqlite.org/src/info/d06a25c84454a372
+# Ticket https://sqlite.org/src/info/d06a25c84454a372
# Incorrect answer due to two co-routines using the same registers and expecting
# those register values to be preserved across a Yield.
#
@@ -968,7 +968,7 @@ do_execsql_test select4-16.3 {
ORDER BY t3.a;
} {95 96 97 98 99}
-# Ticket https://www.sqlite.org/src/tktview/f7f8c97e975978d45 on 2016-04-25
+# Ticket https://sqlite.org/src/tktview/f7f8c97e975978d45 on 2016-04-25
#
# The where push-down optimization from 2015-06-02 is suppose to disable
# on aggregate subqueries. But if the subquery is a compound where the
diff --git a/test/select6.test b/test/select6.test
index f748ab47a4..301ec11c36 100644
--- a/test/select6.test
+++ b/test/select6.test
@@ -611,7 +611,7 @@ do_execsql_test 11.100 {
FROM ( SELECT count(*) AS cnt FROM t1 );
} {{}}
-# 2019-05-29 ticket https://www.sqlite.org/src/info/c41afac34f15781f
+# 2019-05-29 ticket https://sqlite.org/src/info/c41afac34f15781f
# A LIMIT clause in a subquery is incorrectly applied to a subquery.
#
do_execsql_test 12.100 {
diff --git a/test/shared.test b/test/shared.test
index 146830e56a..42292ab40f 100644
--- a/test/shared.test
+++ b/test/shared.test
@@ -161,7 +161,7 @@ do_test shared-$av.1.8 {
do_test shared-$av.2.1 {
# Open connection db3 to the database.
- if {$::tcl_platform(platform)=="unix"} {
+ if {$::tcl_platform(platform) eq "unix"} {
sqlite3 db3 "file:test.db?cache=private" -uri 1
} else {
sqlite3 db3 TEST.DB
@@ -797,7 +797,7 @@ do_test shared-$av.10.2 {
do_test shared-$av.10.3 {
# An external connection should be able to read the database, but not
# prepare a write operation.
- if {$::tcl_platform(platform)=="unix"} {
+ if {$::tcl_platform(platform) eq "unix"} {
sqlite3 db3 "file:test.db?cache=private" -uri 1
} else {
sqlite3 db3 TEST.DB
diff --git a/test/shared3.test b/test/shared3.test
index e313069990..2e32398cac 100644
--- a/test/shared3.test
+++ b/test/shared3.test
@@ -70,7 +70,7 @@ do_test shared3-2.5 {
# test case shared3-2.3 above). The goal of the following tests is to
# ensure that the cache-size really is 10 pages.
#
-#if {$::tcl_platform(platform)=="unix"} {
+#if {$::tcl_platform(platform) eq "unix"} {
# set alternative_name ./test.db
#} else {
# set alternative_name TEST.DB
diff --git a/test/shared6.test b/test/shared6.test
index 499cbb0eb5..18f9f537b6 100644
--- a/test/shared6.test
+++ b/test/shared6.test
@@ -139,7 +139,7 @@ do_test shared6-1.X {
# that connect to the same file using different VFS implementations do
# not share a cache.
#
-if {$::tcl_platform(platform) eq "unix"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
do_test shared6-2.1 {
sqlite3 db1 test.db -vfs unix
sqlite3 db2 test.db -vfs unix
diff --git a/test/shell1.test b/test/shell1.test
index f89d34d536..8cf11b2409 100644
--- a/test/shell1.test
+++ b/test/shell1.test
@@ -515,6 +515,7 @@ do_test shell1-3.15.3 {
} {1 {ERROR: extra parameter: "BAD". Usage:
.output ?FILE? Send output to FILE or stdout if FILE is omitted
If FILE begins with '|' then open it as a pipe.
+ If FILE is 'off' then output is disabled.
Options:
--bom Prefix output with a UTF8 byte-order mark
-e Send output to the system text editor
@@ -533,6 +534,7 @@ do_test shell1-3.16.2 {
} {1 {ERROR: extra parameter: "BAD". Usage:
.output ?FILE? Send output to FILE or stdout if FILE is omitted
If FILE begins with '|' then open it as a pipe.
+ If FILE is 'off' then output is disabled.
Options:
--bom Prefix output with a UTF8 byte-order mark
-e Send output to the system text editor
@@ -1064,20 +1066,20 @@ do_test shell1-5.0 {
# return character (and on Windows, the end-of-file character)
# cannot be used here.
#
- if {$i==0x0D || ($tcl_platform(platform)=="windows" && $i==0x1A)} {
+ if {$i==0x0D || ($tcl_platform(platform) eq "windows" && $i==0x1A)} {
continue
}
# Tcl 8.7 maps 0x80 through 0x9f into valid UTF8. So skip those tests.
if {$i>=0x80} {
if {$i<=0x9F || $tcl_version>=9.0} continue
- if {$tcl_platform(platform)=="windows"} continue
+ if {$tcl_platform(platform) eq "windows"} continue
}
- if {$i>=0xE0 && $tcl_platform(os)=="OpenBSD"} continue
- if {$i>=0xE0 && $i<=0xEF && $tcl_platform(os)=="Linux"} continue
+ if {$i>=0xE0 && $tcl_platform(os) eq "OpenBSD"} continue
+ if {$i>=0xE0 && $i<=0xEF && $tcl_platform(os) eq "Linux"} continue
set hex [format %02X $i]
set char [subst \\x$hex]; set oldChar $char
set escapes [list]
- if {$tcl_platform(platform)=="windows"} {
+ if {$tcl_platform(platform) eq "windows"} {
#
# NOTE: On Windows, we need to escape all the whitespace characters,
# the alarm (\a) character, and those with special meaning to
diff --git a/test/shell3.test b/test/shell3.test
index ef3ea784ff..6bb49f5c3d 100644
--- a/test/shell3.test
+++ b/test/shell3.test
@@ -36,7 +36,7 @@ sqlite3 db test.db
# different. This causes problems for the tests below. To avoid
# issues, these tests are disabled for windows.
#
-if {$::tcl_platform(platform)=="windows"} {
+if {$::tcl_platform(platform) eq "windows"} {
finish_test
return
}
diff --git a/test/shell8.test b/test/shell8.test
index ca37598e93..e555396365 100644
--- a/test/shell8.test
+++ b/test/shell8.test
@@ -55,7 +55,7 @@ proc dir_to_list {dirname {n -1}} {
set res [list]
foreach f [glob -nocomplain $dirname/*] {
set mtime [file mtime $f]
- if {$::tcl_platform(platform)!="windows"} {
+ if {$::tcl_platform(platform) ne "windows"} {
set perm [file attributes $f -perm]
} else {
set perm 0
diff --git a/test/shmlock.test b/test/shmlock.test
index 89b29fd7ac..fce0cf8f5e 100644
--- a/test/shmlock.test
+++ b/test/shmlock.test
@@ -114,7 +114,7 @@ sqlite3 db0 test.db
sqlite3 db1 test.db
do_test 3.1 { execsql { SELECT * FROM t1 } db0 } {1 2}
do_test 3.2 { execsql { SELECT * FROM t1 } db1 } {1 2}
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(os) eq "Windows NT"} {
set isWindows 1
} else {
set isWindows 0
diff --git a/test/speedtest1.c b/test/speedtest1.c
index b49c70098f..10cd30f1c7 100644
--- a/test/speedtest1.c
+++ b/test/speedtest1.c
@@ -35,6 +35,7 @@ static const char zHelp[] =
" --exclusive Enable locking_mode=EXCLUSIVE\n"
" --explain Like --sqlonly but with added EXPLAIN keywords\n"
" --fullfsync Enable fullfsync=TRUE\n"
+ " --hard-heap-limit N The hard limit on the maximum heap size\n"
" --heap SZ MIN Memory allocator uses SZ bytes & min allocation MIN\n"
" --incrvacuum Enable incremenatal vacuum mode\n"
" --journal M Set the journal_mode to M\n"
@@ -60,6 +61,7 @@ static const char zHelp[] =
" --sqlonly No-op. Only show the SQL that would have been run.\n"
" --shrink-memory Invoke sqlite3_db_release_memory() frequently.\n"
" --size N Relative test size. Default=100\n"
+ " --soft-heap-limit N The soft limit on the maximum heap size\n"
" --strict Use STRICT table where appropriate\n"
" --stats Show statistics at the end\n"
" --stmtscanstatus Activate SQLITE_DBCONFIG_STMT_SCANSTATUS\n"
@@ -542,6 +544,7 @@ char *speedtest1_once(const char *zFormat, ...){
char *zSql;
sqlite3_stmt *pStmt;
char *zResult = 0;
+ int rc;
va_start(ap, zFormat);
zSql = sqlite3_vmprintf(zFormat, ap);
va_end(ap);
@@ -561,6 +564,12 @@ char *speedtest1_once(const char *zFormat, ...){
const char *z = (const char*)sqlite3_column_text(pStmt, 0);
if( z ) zResult = sqlite3_mprintf("%s", z);
}
+ rc = sqlite3_reset(pStmt);
+ if( rc!=SQLITE_OK ){
+ fprintf(stderr, "%s\nError code %d: %s\n",
+ sqlite3_sql(pStmt), rc, sqlite3_errmsg(g.db));
+ exit(1);
+ }
sqlite3_finalize(pStmt);
}
sqlite3_free(zSql);
@@ -590,7 +599,7 @@ void speedtest1_prepare(const char *zFormat, ...){
/* Run an SQL statement previously prepared */
void speedtest1_run(void){
- int i, n, len;
+ int i, n, len, rc;
if( g.bSqlOnly ) return;
assert( g.pStmt );
g.nResult = 0;
@@ -649,12 +658,22 @@ void speedtest1_run(void){
if( g.bReprepare ){
sqlite3_stmt *pNew;
sqlite3_prepare_v2(g.db, sqlite3_sql(g.pStmt), -1, &pNew, 0);
- sqlite3_finalize(g.pStmt);
+ rc = sqlite3_finalize(g.pStmt);
+ if( rc!=SQLITE_OK ){
+ fprintf(stderr, "%s\nError code %d: %s\n",
+ sqlite3_sql(pNew), rc, sqlite3_errmsg(g.db));
+ exit(1);
+ }
g.pStmt = pNew;
}else
#endif
{
- sqlite3_reset(g.pStmt);
+ rc = sqlite3_reset(g.pStmt);
+ if( rc!=SQLITE_OK ){
+ fprintf(stderr, "%s\nError code %d: %s\n",
+ sqlite3_sql(g.pStmt), rc, sqlite3_errmsg(g.db));
+ exit(1);
+ }
}
speedtest1_shrink_memory();
}
@@ -2949,6 +2968,8 @@ int main(int argc, char **argv){
int doIncrvac = 0; /* True for --incrvacuum */
const char *zJMode = 0; /* Journal mode */
const char *zKey = 0; /* Encryption key */
+ int nHardHeapLmt = 0; /* The hard heap limit */
+ int nSoftHeapLmt = 0; /* The soft heap limit */
int nLook = -1, szLook = 0; /* --lookaside configuration */
int noSync = 0; /* True for --nosync */
int pageSize = 0; /* Desired page size. 0 means default */
@@ -3021,6 +3042,10 @@ int main(int argc, char **argv){
}else if( strcmp(z,"explain")==0 ){
g.bSqlOnly = 1;
g.bExplain = 1;
+ }else if( strcmp(z,"hard-heap-limit")==0 ){
+ ARGC_VALUE_CHECK(1);
+ nHardHeapLmt = integerValue(argv[i+1]);
+ i += 1;
}else if( strcmp(z,"heap")==0 ){
ARGC_VALUE_CHECK(2);
nHeap = integerValue(argv[i+1]);
@@ -3110,6 +3135,10 @@ int main(int argc, char **argv){
}else if( strcmp(z,"size")==0 ){
ARGC_VALUE_CHECK(1);
g.szTest = g.szBase = integerValue(argv[++i]);
+ }else if( strcmp(z,"soft-heap-limit")==0 ){
+ ARGC_VALUE_CHECK(1);
+ nSoftHeapLmt = integerValue(argv[i+1]);
+ i += 1;
}else if( strcmp(z,"stats")==0 ){
showStats = 1;
}else if( strcmp(z,"temp")==0 ){
@@ -3271,6 +3300,15 @@ int main(int argc, char **argv){
if( zJMode ){
speedtest1_exec("PRAGMA journal_mode=%s", zJMode);
}
+ if( nHardHeapLmt>0 ){
+ speedtest1_exec("PRAGMA hard_heap_limit=%d", nHardHeapLmt);
+ }
+ if( nSoftHeapLmt>0 ){
+ speedtest1_exec("PRAGMA soft_heap_limit=%d", nSoftHeapLmt);
+ }
+ if( zJMode ){
+ speedtest1_exec("PRAGMA journal_mode=%s", zJMode);
+ }
if( g.bExplain ) printf(".explain\n.echo on\n");
if( strcmp(zTSet,"mix1")==0 ) zTSet = zMix1Tests;
diff --git a/test/subquery.test b/test/subquery.test
index 17061d4b60..898c8f7560 100644
--- a/test/subquery.test
+++ b/test/subquery.test
@@ -650,6 +650,44 @@ do_eqp_test subquery-10.2 {
# |--SCAN v2
# `--SEARCH t1 USING INDEX x12 (aa=?)
#
+#---------------------------------------------------------------------------
+# Follow-up on 2025-04-14. Performance issue found while working
+# on Fossil (Fossil check-in 2025-04-13T19:54).
+#
+do_execsql_test 10.3 {
+ CREATE TABLE blob(
+ rid INTEGER PRIMARY KEY,
+ size INT,
+ uuid TEXT
+ );
+ CREATE TABLE delta(
+ rid INTEGER PRIMARY KEY,
+ srcid INT
+ );
+ CREATE INDEX delta_i1 ON delta(srcid);
+}
+do_eqp_test subquery-10.4 {
+ WITH RECURSIVE deltasof(rid) AS (
+ SELECT rid FROM delta WHERE srcid=125020
+ UNION
+ SELECT delta.rid FROM deltasof, delta
+ WHERE delta.srcid=deltasof.rid)
+ SELECT deltasof.rid, blob.uuid FROM deltasof, blob
+ WHERE blob.rid=deltasof.rid;
+} {
+ QUERY PLAN
+ |--CO-ROUTINE deltasof
+ | |--SETUP
+ | | `--SEARCH delta USING COVERING INDEX delta_i1 (srcid=?)
+ | `--RECURSIVE STEP
+ | |--SCAN deltasof
+ | `--SEARCH delta USING COVERING INDEX delta_i1 (srcid=?)
+ |--SCAN deltasof
+ `--SEARCH blob USING INTEGER PRIMARY KEY (rowid=?)
+}
+# ^^^^^^^^^^^^^^^^^^
+# deltasof should be the outer loop and blob the inner loop
+# Prior to the fix, SQLite was doing it the other way around.
#-----------------------------------------------------------------------------
# 2024-04-25 Column affinities for columns of compound subqueries
diff --git a/test/subquery2.test b/test/subquery2.test
index 0c1bdc6697..8513dc75c8 100644
--- a/test/subquery2.test
+++ b/test/subquery2.test
@@ -104,7 +104,7 @@ do_execsql_test 2.2 {
} {2 3 3 6 4 10}
############################################################################
-# Ticket http://www.sqlite.org/src/info/d11a6e908f (2014-09-20)
+# Ticket http://sqlite.org/src/info/d11a6e908f (2014-09-20)
# Query planner fault on three-way nested join with compound inner SELECT
#
do_execsql_test 3.0 {
diff --git a/test/symlink.test b/test/symlink.test
index 685cae5a41..fc78a04720 100644
--- a/test/symlink.test
+++ b/test/symlink.test
@@ -17,7 +17,7 @@ source $testdir/tester.tcl
set testprefix symlink
# This only runs on unix.
-if {$::tcl_platform(platform)!="unix"} {
+if {$::tcl_platform(os) eq "Windows NT"} {
finish_test
return
}
diff --git a/test/symlink2.test b/test/symlink2.test
index 9a2237e4c0..7305f6dd38 100644
--- a/test/symlink2.test
+++ b/test/symlink2.test
@@ -17,7 +17,7 @@ source $testdir/tester.tcl
set testprefix symlink2
# This only runs on Windows.
-if {$::tcl_platform(platform)!="windows"} {
+if {$::tcl_platform(platform) ne "windows"} {
finish_test
return
}
diff --git a/test/sync.test b/test/sync.test
index 023425e6b1..b24800d100 100644
--- a/test/sync.test
+++ b/test/sync.test
@@ -34,7 +34,7 @@ if {[atomic_batch_write test.db]} {
set sqlite_sync_count 0
proc cond_incr_sync_count {adj} {
global sqlite_sync_count
- if {$::tcl_platform(platform) == "windows"} {
+ if {$::tcl_platform(os) eq "Windows NT"} {
incr sqlite_sync_count $adj
} else {
ifcapable !dirsync {
diff --git a/test/sync2.test b/test/sync2.test
index 89e66c8455..ce8132c714 100644
--- a/test/sync2.test
+++ b/test/sync2.test
@@ -26,7 +26,7 @@ ifcapable !pager_pragmas||!attach||!dirsync {
finish_test
return
}
-if {$::tcl_platform(platform)!="unix"
+if {$::tcl_platform(os) eq "Windows NT"
|| [permutation] == "journaltest"
|| [permutation] == "inmemory_journal"
|| [atomic_batch_write test.db]
diff --git a/test/tabfunc01.test b/test/tabfunc01.test
index c16fb9bec2..0e29c35683 100644
--- a/test/tabfunc01.test
+++ b/test/tabfunc01.test
@@ -194,6 +194,63 @@ do_execsql_test tabfunc01-5.2 {
WHERE value=67;
} 67
+# 2025-03-22 forum post 0d5d63257e3ff4f6
+#
+do_execsql_test tabfunc01-6.1 {
+ SELECT value FROM generate_series(1,10) WHERE value<5.5;
+} {1 2 3 4 5}
+do_execsql_test tabfunc01-6.2 {
+ SELECT value FROM generate_series(1,10) WHERE value<5.0;
+} {1 2 3 4}
+do_execsql_test tabfunc01-6.3 {
+ SELECT value FROM generate_series(1,10) WHERE value<=5.5;
+} {1 2 3 4 5}
+do_execsql_test tabfunc01-6.4 {
+ SELECT value FROM generate_series(1,10) WHERE value<=5.0;
+} {1 2 3 4 5}
+do_execsql_test tabfunc01-6.5 {
+ SELECT value FROM generate_series(1,10) WHERE value>5.5;
+} {6 7 8 9 10}
+do_execsql_test tabfunc01-6.6 {
+ SELECT value FROM generate_series(1,10) WHERE value>5.0;
+} {6 7 8 9 10}
+do_execsql_test tabfunc01-6.7 {
+ SELECT value FROM generate_series(1,10) WHERE value>=5.5;
+} {6 7 8 9 10}
+do_execsql_test tabfunc01-6.8 {
+ SELECT value FROM generate_series(1,10) WHERE value>=5.0;
+} {5 6 7 8 9 10}
+do_execsql_test tabfunc01-6.9 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value<5.5;
+} {5 4 3 2 1}
+do_execsql_test tabfunc01-6.10 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value<5.0;
+} {4 3 2 1}
+do_execsql_test tabfunc01-6.11 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value<=5.5;
+} {5 4 3 2 1}
+do_execsql_test tabfunc01-6.12 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value<=5.0;
+} {5 4 3 2 1}
+do_execsql_test tabfunc01-6.13 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value>5.5;
+} {10 9 8 7 6}
+do_execsql_test tabfunc01-6.14 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value>5.0;
+} {10 9 8 7 6}
+do_execsql_test tabfunc01-6.15 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value>=5.5;
+} {10 9 8 7 6}
+do_execsql_test tabfunc01-6.16 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value>=5.0;
+} {10 9 8 7 6 5}
+do_execsql_test tabfunc01-6.17 {
+ SELECT value FROM generate_series(1,10) WHERE value==5.5;
+} {}
+do_execsql_test tabfunc01-6.18 {
+ SELECT value FROM generate_series(1,10) WHERE value==5.0;
+} {5}
+
# The next series of tests is verifying that virtual table are able
# to optimize the IN operator, even on terms that are not marked "omit".
# When the generate_series virtual table is compiled for the testfixture,
@@ -282,7 +339,7 @@ do_test tabfunc01-750 {
}
} {5.0 x5 | 7.0 x7 | 13.0 x13 | 17.0 x17 | 23.0 x23 |}
-# ticket https://www.sqlite.org/src/info/2ae0c599b735d59e
+# ticket https://sqlite.org/src/info/2ae0c599b735d59e
# Verification of testtag-20230227a
do_test tabfunc01-751 {
db eval {
diff --git a/test/table.test b/test/table.test
index b961207f8b..46ecd7d23b 100644
--- a/test/table.test
+++ b/test/table.test
@@ -792,7 +792,7 @@ do_catchsql_test table-16.7 {
INSERT INTO t16 DEFAULT VALUES;
} {1 {unknown function: string_agg()}}
-# Ticket [https://www.sqlite.org/src/info/094d39a4c95ee4abbc417f04214617675ba15c63]
+# Ticket [https://sqlite.org/src/info/094d39a4c95ee4abbc417f04214617675ba15c63]
# describes a assertion fault that occurs on a CREATE TABLE .. AS SELECT statement.
# the following test verifies that the problem has been fixed.
#
@@ -810,7 +810,7 @@ do_execsql_test table-17.1 {
} {1 1 | 2 2 |}
# 2015-06-16
-# Ticket [https://www.sqlite.org/src/tktview/873cae2b6e25b1991ce5e9b782f9cd0409b96063]
+# Ticket [https://sqlite.org/src/tktview/873cae2b6e25b1991ce5e9b782f9cd0409b96063]
# Make sure a CREATE TABLE AS statement correctly rolls back partial changes to the
# sqlite_master table when the SELECT on the right-hand side aborts.
#
@@ -825,7 +825,7 @@ do_execsql_test table-18.2 {
} {ok}
# 2015-09-09
-# Ticket [https://www.sqlite.org/src/info/acd12990885d9276]
+# Ticket [https://sqlite.org/src/info/acd12990885d9276]
# "CREATE TABLE ... AS SELECT ... FROM sqlite_master" fails because the row
# in the sqlite_master table for the next table is initially populated
# with a NULL instead of a record created by OP_Record.
diff --git a/test/tester.tcl b/test/tester.tcl
index 8f1f83e65b..fc8feda253 100644
--- a/test/tester.tcl
+++ b/test/tester.tcl
@@ -814,7 +814,7 @@ proc do_test {name cmd expected} {
# on Windows because of issues with ANSI and UTF8 I/O on Win11.
#
proc do_test_with_ansi_output {name cmd expected} {
- if {![info exists ::SLAVE] || $::tcl_platform(platform)!="windows"} {
+ if {![info exists ::SLAVE] || $::tcl_platform(platform) ne "windows"} {
uplevel 1 [list do_test $name $cmd $expected]
}
}
@@ -873,7 +873,7 @@ proc catchcmdex {db {cmd ""}} {
proc filepath_normalize {p} {
# test cases should be written to assume "unix"-like file paths
- if {$::tcl_platform(platform)!="unix"} {
+ if {$::tcl_platform(platform) ne "unix"} {
string map [list \\ / \{/ / .db\} .db] \
[regsub -nocase -all {[a-z]:[/\\]+} $p {/}]
} {
@@ -1833,7 +1833,7 @@ proc crashsql {args} {
# error message. We map that to the expected message
# so that we don't have to change all of the test
# cases.
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
if {$msg=="child killed: unknown signal"} {
set msg "child process exited abnormally"
}
@@ -1884,7 +1884,7 @@ proc crash_on_write {args} {
# error message. We map that to the expected message
# so that we don't have to change all of the test
# cases.
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
if {$msg=="child killed: unknown signal"} {
set msg "child process exited abnormally"
}
@@ -2548,7 +2548,7 @@ proc test_restore_config_pagecache {} {
}
proc test_binary_name {nm} {
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
set ret "$nm.exe"
} else {
set ret $nm
diff --git a/test/testrunner.tcl b/test/testrunner.tcl
index 6ff414c4bd..60c4627f92 100755
--- a/test/testrunner.tcl
+++ b/test/testrunner.tcl
@@ -38,7 +38,7 @@ proc find_interpreter {} {
}
if {$rc} {
puts "Cannot find tcl package sqlite3: Trying to build it now..."
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
set bat [open make-tcl-extension.bat w]
puts $bat "nmake /f Makefile.msc tclextension"
close $bat
@@ -170,7 +170,7 @@ proc guess_number_of_cores {} {
if {[catch {number_of_cores} ret]} {
set ret 4
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
catch { set ret $::env(NUMBER_OF_PROCESSORS) }
} else {
if {$::tcl_platform(os)=="Darwin"} {
@@ -263,6 +263,19 @@ switch -nocase -glob -- $tcl_platform(os) {
set TRG(shell) sqlite3.exe
set TRG(run) run.bat
set TRG(runcmd) "run.bat"
+ if {"unix" eq $tcl_platform(platform)} {
+ # Presumably cygwin. This block gets testrunner.tcl started on
+ # Cygwin but then downstream tests all fail, at least in part
+ # because of the discrepancies in build target names which need
+ # .exe on cygwin but not on other Unix-like platforms.
+ set TRG(platform) cygwin
+ set TRG(make) make.sh
+ set TRG(makecmd) "bash make.sh"
+ set TRG(testfixture) testfixture
+ set TRG(shell) sqlite3
+ set TRG(run) run.sh
+ set TRG(runcmd) "bash run.sh"
+ }
}
default {
puts "tcl_platform(os)=$::tcl_platform(os)"
@@ -804,7 +817,7 @@ for {set ii 0} {$ii < [llength $argv]} {incr ii} {
} elseif {[string match "$a*" --stop-on-coredump]} {
set TRG(stopOnCore) 1
} elseif {[string match "$a*" --status]} {
- if {$tcl_platform(platform)=="windows"} {
+ if {$tcl_platform(platform) eq "windows"} {
puts stdout \
"The --status option is not available on Windows. A suggested work-around"
puts stdout \
@@ -1487,7 +1500,7 @@ proc progress_report {} {
global TRG
if {$TRG(fullstatus)} {
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
exec [info nameofexe] $::argv0 status --cls
} else {
show_status trdb 1
diff --git a/test/testrunner_data.tcl b/test/testrunner_data.tcl
index 2597cbe478..ade126a64d 100644
--- a/test/testrunner_data.tcl
+++ b/test/testrunner_data.tcl
@@ -455,7 +455,7 @@ proc trd_fuzztest_data {} {
set lFuzzDb [glob [file join $::testdir fuzzdata*.db]]
set lSessionDb [glob [file join $::testdir sessionfuzz-data*.db]]
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
return [list fuzzcheck.exe $lFuzzDb]
}
@@ -527,7 +527,7 @@ proc make_script {cfg srcdir bMsvc} {
set configOpts [list] ;# Extra args for [configure]
# Define either SQLITE_OS_WIN or SQLITE_OS_UNIX, as appropriate.
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(os) eq "Windows NT"} {
lappend opts -DSQLITE_OS_WIN=1
} else {
lappend opts -DSQLITE_OS_UNIX=1
diff --git a/test/tkt3457.test b/test/tkt3457.test
index 0273494639..17b6c72cd4 100644
--- a/test/tkt3457.test
+++ b/test/tkt3457.test
@@ -15,10 +15,10 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-if {$tcl_platform(platform) != "unix"} {
+if {[llength [info commands test_syscall]]==0} {
finish_test
return
-}
+}
if {[atomic_batch_write test.db]} {
finish_test
return
diff --git a/test/trigger1.test b/test/trigger1.test
index afeb7ddccb..67943677f9 100644
--- a/test/trigger1.test
+++ b/test/trigger1.test
@@ -751,7 +751,7 @@ do_execsql_test trigger1-18.1 {
SELECT * FROM t18;
} {1 3 2} ;# Not: 1 1001 1000
-# 2018-04-26 ticket [https://www.sqlite.org/src/tktview/d85fffd6ffe856092e]
+# 2018-04-26 ticket [https://sqlite.org/src/tktview/d85fffd6ffe856092e]
# VDBE Program uses an expired value.
#
do_execsql_test trigger1-19.0 {
diff --git a/test/triggerG.test b/test/triggerG.test
index 8cf20b5ec9..b078fffb2e 100644
--- a/test/triggerG.test
+++ b/test/triggerG.test
@@ -19,7 +19,7 @@ ifcapable {!trigger} {
}
# Test cases for ticket
-# https://www.sqlite.org/src/tktview/06796225f59c057cd120f
+# https://sqlite.org/src/tktview/06796225f59c057cd120f
#
# The OP_Once opcode was not working correctly for recursive triggers.
#
diff --git a/test/unixexcl.test b/test/unixexcl.test
index 8e9c4644d1..c24945e5e3 100644
--- a/test/unixexcl.test
+++ b/test/unixexcl.test
@@ -18,7 +18,7 @@ source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
-if {$::tcl_platform(platform)!="unix" || [info commands test_syscall]==""} {
+if {[llength [info commands test_syscall]]==0} {
finish_test
return
}
diff --git a/test/update.test b/test/update.test
index bf7666662a..0a380fa030 100644
--- a/test/update.test
+++ b/test/update.test
@@ -616,7 +616,7 @@ do_test update-14.4 {
} ;# ifcapable {trigger}
-# Ticket [https://www.sqlite.org/src/tktview/43107840f1c02] on 2014-10-29
+# Ticket [https://sqlite.org/src/tktview/43107840f1c02] on 2014-10-29
# An assertion fault on UPDATE
#
ifcapable altertable {
@@ -703,7 +703,7 @@ do_execsql_test update-19.10 {
SELECT * FROM t1;
} {2 2}
-# 2019-12-29 ticket https://www.sqlite.org/src/info/314cc133e5ada126
+# 2019-12-29 ticket https://sqlite.org/src/info/314cc133e5ada126
# REPLACE conflict resolution during an UPDATE causes a DELETE trigger
# to fire. If that DELETE trigger subsequently modifies the row
# being updated, bad things can happen. Prevent this by prohibiting
@@ -711,8 +711,8 @@ do_execsql_test update-19.10 {
# REPLACE conflict resolution on the UPDATE.
#
# See also tickets:
-# https://www.sqlite.org/src/info/c1e19e12046d23fe 2019-10-25
-# https://www.sqlite.org/src/info/a8a4847a2d96f5de 2019-10-16
+# https://sqlite.org/src/info/c1e19e12046d23fe 2019-10-25
+# https://sqlite.org/src/info/a8a4847a2d96f5de 2019-10-16
#
reset_db
do_execsql_test update-20.10 {
diff --git a/test/upsert1.test b/test/upsert1.test
index 8af273a89a..49168f840b 100644
--- a/test/upsert1.test
+++ b/test/upsert1.test
@@ -129,7 +129,7 @@ do_execsql_test upsert1-610 {
} {ok}
# 2018-08-14
-# Ticket https://www.sqlite.org/src/info/908f001483982c43
+# Ticket https://sqlite.org/src/info/908f001483982c43
# If there are multiple uniqueness contraints, the UPSERT should fire
# if the one constraint it targets fails, regardless of whether or not
# the other constraints pass or fail. In other words, the UPSERT constraint
diff --git a/test/uri.test b/test/uri.test
index 863676f078..62090f46af 100644
--- a/test/uri.test
+++ b/test/uri.test
@@ -59,7 +59,7 @@ foreach {tn uri file} {
if {[string first %00 $uri]>=0} continue
}
- if {$tcl_platform(platform)=="windows"} {
+ if {$tcl_platform(platform) eq "windows"} {
#
# NOTE: Due to limits on legal characters for file names imposed by
# Windows, we must skip the final two tests here (i.e. the
@@ -306,7 +306,7 @@ foreach {tn uri res} {
6 "file://x/PWD/test.db" {invalid uri authority: x}
} {
- if {$tcl_platform(platform)=="windows"} {
+ if {$tcl_platform(platform) eq "windows"} {
set uri [string map [list PWD [string range [get_pwd] 3 end]] $uri]
} else {
set uri [string map [list PWD [string range [get_pwd] 1 end]] $uri]
diff --git a/test/vacuum-into.test b/test/vacuum-into.test
index d559b7fb39..c041ebe7a7 100644
--- a/test/vacuum-into.test
+++ b/test/vacuum-into.test
@@ -111,7 +111,7 @@ do_catchsql_test vacuum-into-420 {
# The ability to VACUUM INTO a read-only database
db close
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
file attributes test.db -readonly 1
} else {
file attributes test.db -permissions 292 ;# 292 == 0444
@@ -121,7 +121,7 @@ forcedelete test.db2
do_execsql_test vacuum-into-500 {
VACUUM INTO 'test.db2';
}
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
file attributes test.db -readonly 0
} else {
file attributes test.db -permissions 420 ;# 420 = 0644
diff --git a/test/vtabH.test b/test/vtabH.test
index cf3dcafd9a..07704cefb1 100644
--- a/test/vtabH.test
+++ b/test/vtabH.test
@@ -124,13 +124,13 @@ foreach ::tclvar_set_omit {0 1} {
#-------------------------------------------------------------------------
#
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
set drive [string range [pwd] 0 1]
set ::env(fstreeDrive) $drive
}
reset_db
register_fs_module db
-if {$tcl_platform(platform)!="windows" || \
+if {$tcl_platform(platform) ne "windows" || \
[regexp -nocase -- {^[A-Z]:} $drive]} {
do_execsql_test 3.0 {
SELECT name FROM fsdir WHERE dir = '.' AND name = 'test.db';
diff --git a/test/wal2.test b/test/wal2.test
index 5ef303edc6..064bed0b20 100644
--- a/test/wal2.test
+++ b/test/wal2.test
@@ -26,7 +26,7 @@ ifcapable !wal {finish_test ; return }
set sqlite_sync_count 0
proc cond_incr_sync_count {adj} {
global sqlite_sync_count
- if {$::tcl_platform(platform) == "windows"} {
+ if {$::tcl_platform(os) eq "Windows NT"} {
incr sqlite_sync_count $adj
} {
ifcapable !dirsync {
@@ -1038,7 +1038,7 @@ tvfs delete
# the new files with the same file-system permissions as the database
# file itself. Test this.
#
-if {$::tcl_platform(platform) == "unix"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
faultsim_delete_and_reopen
# Changed on 2012-02-13: umask is deliberately ignored for -wal files.
#set umask [exec /bin/sh -c umask]
@@ -1094,7 +1094,7 @@ if {$::tcl_platform(platform) == "unix"} {
# database, wal or shm files cannot be opened, or can only be opened
# read-only.
#
-if {$::tcl_platform(platform) == "unix"} {
+if {$::tcl_platform(os) ne "Windows NT"} {
proc perm {} {
set L [list]
foreach f {test.db test.db-wal test.db-shm} {
diff --git a/test/wal6.test b/test/wal6.test
index 9bbc58409d..081608cd30 100644
--- a/test/wal6.test
+++ b/test/wal6.test
@@ -46,7 +46,7 @@ foreach jmode $all_journal_modes {
# Under Windows, you'll get an error trying to delete
# a file this is already opened. Close the first connection
# so the other tests work.
-if {$tcl_platform(platform)=="windows"} {
+if {$::tcl_platform(os) eq "Windows NT"} {
if {$jmode=="persist" || $jmode=="truncate"} {
db close
}
@@ -61,7 +61,7 @@ if {$tcl_platform(platform)=="windows"} {
} db2
} {wal 1 2 3 4}
-if {$tcl_platform(platform)=="windows"} {
+if {$::tcl_platform(os) eq "Windows NT"} {
if {$jmode=="persist" || $jmode=="truncate"} {
sqlite3 db test.db
}
diff --git a/test/wal64k.test b/test/wal64k.test
index 8ff8e4b77c..bacb14328a 100644
--- a/test/wal64k.test
+++ b/test/wal64k.test
@@ -19,10 +19,10 @@ set testprefix wal64k
ifcapable !wal {finish_test ; return }
-if {$tcl_platform(platform) != "unix"} {
+if {[llength [info commands test_syscall]]==0} {
finish_test
return
-}
+}
db close
test_syscall pagesize 65536
diff --git a/test/walblock.test b/test/walblock.test
index 23167a8830..86a52b3f96 100644
--- a/test/walblock.test
+++ b/test/walblock.test
@@ -17,7 +17,7 @@ source $testdir/wal_common.tcl
finish_test; return; # Feature currently not implemented.
ifcapable !wal {finish_test ; return }
-if {$::tcl_platform(platform)!="unix"} { finish_test ; return }
+if {$::tcl_platform(platform) ne "unix"} { finish_test ; return }
set testprefix walblock
catch { db close }
diff --git a/test/walcrash4.test b/test/walcrash4.test
index 80839b39e5..43292def42 100644
--- a/test/walcrash4.test
+++ b/test/walcrash4.test
@@ -38,7 +38,7 @@ faultsim_save_and_close
# The error message is different on unix and windows
#
-if {$::tcl_platform(platform)=="windows"} {
+if {$::tcl_platform(platform) eq "windows"} {
set msg "child killed: unknown signal"
} else {
set msg "child process exited abnormally"
diff --git a/test/walmode.test b/test/walmode.test
index f760823c8d..1c3325acf2 100644
--- a/test/walmode.test
+++ b/test/walmode.test
@@ -47,7 +47,7 @@ do_test walmode-1.2 {
if {[atomic_batch_write test.db]==0} {
set expected_sync_count 3
- if {$::tcl_platform(platform)!="windows"} {
+ if {$::tcl_platform(os) ne "Windows NT"} {
ifcapable dirsync {
incr expected_sync_count
}
diff --git a/test/walnoshm.test b/test/walnoshm.test
index d4082178dd..f546c29b13 100644
--- a/test/walnoshm.test
+++ b/test/walnoshm.test
@@ -104,6 +104,7 @@ do_test 2.1.5 {
} {exclusive delete a b c d e f g h}
do_test 2.2.1 {
+ db2 close
forcecopy test.db test2.db
forcecopy test.db-wal test2.db-wal
sqlite3 db3 test2.db -vfs tvfsshm
diff --git a/test/walro.test b/test/walro.test
index cae52db6d3..a39b844d9d 100644
--- a/test/walro.test
+++ b/test/walro.test
@@ -19,7 +19,7 @@ set ::testprefix walro
# These tests are only going to work on unix.
#
-if {$::tcl_platform(platform) != "unix"} {
+if {$::tcl_platform(os) eq "Windows NT"} {
finish_test
return
}
diff --git a/test/walsetlk.test b/test/walsetlk.test
index b65eb9ab68..969bcaf465 100644
--- a/test/walsetlk.test
+++ b/test/walsetlk.test
@@ -204,10 +204,10 @@ do_multiclient_test tn {
#
set bSleep 1
if {$::sqlite_options(setlk_timeout)==1} {
- if {$::tcl_platform(platform)=="windows"} {
+ if {$::tcl_platform(platform) eq "windows"} {
set bSleep 0
}
- if {$::tcl_platform(platform)=="unix"} {
+ if {$::tcl_platform(platform) eq "unix"} {
set bSleep [expr $tn==2]
}
}
@@ -252,7 +252,7 @@ do_test 3.1b {
# Set bExpect to true if calls to xSleep() are expected. Such calls are
# expected unless this is an SQLITE_ENABLE_SETLK_TIMEOUT=1 build.
set bExpect 1
-if {$tcl_platform(platform)=="windows" && $::sqlite_options(setlk_timeout)==1} {
+if {$tcl_platform(platform) eq "windows" && $::sqlite_options(setlk_timeout)==1} {
set bExpect 0
}
do_test 3.2 {
diff --git a/test/where.test b/test/where.test
index 0a8cfd572b..c377006fb9 100644
--- a/test/where.test
+++ b/test/where.test
@@ -1388,7 +1388,7 @@ do_execsql_test where-19.0 {
SELECT t191.rowid FROM t192, t191 WHERE (a=y OR b=y) AND x=?1;
} {/.* sqlite_autoindex_t191_1 .* sqlite_autoindex_t191_2 .*/}
-# 2018-04-24 ticket [https://www.sqlite.org/src/info/4ba5abf65c5b0f9a]
+# 2018-04-24 ticket [https://sqlite.org/src/info/4ba5abf65c5b0f9a]
# Index on expressions leads to an incorrect answer for a LEFT JOIN
#
do_execsql_test where-20.0 {
@@ -1422,7 +1422,7 @@ do_execsql_test where-21.1 {
4 0 1
}
-# 2018-11-05: ticket [https://www.sqlite.org/src/tktview/65eb38f6e46de8c75e188a]
+# 2018-11-05: ticket [https://sqlite.org/src/tktview/65eb38f6e46de8c75e188a]
# Incorrect result in LEFT JOIN when STAT4 is enabled.
#
sqlite3 db :memory:
@@ -1435,7 +1435,7 @@ do_execsql_test where-22.1 {
} {5}
# 20190-02-22: A bug introduced by checkin
-# https://www.sqlite.org/src/info/fa792714ae62fa98.
+# https://sqlite.org/src/info/fa792714ae62fa98.
#
do_execsql_test where-23.0 {
DROP TABLE IF EXISTS t1;
@@ -1547,7 +1547,7 @@ do_catchsql_test where-25.5 {
ON CONFLICT(c) DO UPDATE SET b=NULL
} {1 {corrupt database}}
-# 2019-08-21 Ticket https://www.sqlite.org/src/info/d9f584e936c7a8d0
+# 2019-08-21 Ticket https://sqlite.org/src/info/d9f584e936c7a8d0
#
db close
sqlite3 db :memory:
diff --git a/test/where2.test b/test/where2.test
index 7a7e9b92ed..a38f6e54ba 100644
--- a/test/where2.test
+++ b/test/where2.test
@@ -767,7 +767,7 @@ do_execsql_test where2-13.1 {
SELECT * FROM t13 WHERE (1=2 AND a=3) OR a=4;
} {4 5}
-# https://www.sqlite.org/src/info/5e3c886796e5512e (2016-03-09)
+# https://sqlite.org/src/info/5e3c886796e5512e (2016-03-09)
# Correlated subquery on the RHS of an IN operator
#
do_execsql_test where2-14.1 {
diff --git a/test/whereG.test b/test/whereG.test
index c154058233..6ee8634817 100644
--- a/test/whereG.test
+++ b/test/whereG.test
@@ -237,7 +237,7 @@ do_eqp_test 5.3.3 {
} {SCAN t1}
# 2015-06-18
-# Ticket [https://www.sqlite.org/see/tktview/472f0742a1868fb58862bc588ed70]
+# Ticket [https://sqlite.org/see/tktview/472f0742a1868fb58862bc588ed70]
#
do_execsql_test 6.0 {
DROP TABLE IF EXISTS t1;
@@ -273,7 +273,7 @@ do_execsql_test 7.3 {
} {1 3 1 4 9 3 9 4}
# 2019-08-22
-# Ticket https://www.sqlite.org/src/info/7e07a3dbf5a8cd26
+# Ticket https://sqlite.org/src/info/7e07a3dbf5a8cd26
#
do_execsql_test 8.1 {
DROP TABLE IF EXISTS t0;
diff --git a/test/whereL.test b/test/whereL.test
index 2e9ae219e1..ffbae02b8d 100644
--- a/test/whereL.test
+++ b/test/whereL.test
@@ -254,4 +254,44 @@ do_execsql_test 810 {
SELECT * FROM v0 LEFT JOIN t0 ON c31} {
append LDFLAGS $OPTS
}
- if {$TCLMAJOR>8} {
- set OUT libtcl9sqlite$VERSION.$SUFFIX
+ if {$tcl_platform(os) eq "Windows NT"} {
+ set OUT cyg
} else {
- set OUT libsqlite$VERSION.$SUFFIX
+ set OUT lib
+ }
+ if {$TCLMAJOR>8} {
+ set OUT ${OUT}tcl9sqlite$VERSION.$SUFFIX
+ } else {
+ set OUT ${OUT}sqlite$VERSION.$SUFFIX
}
set @ $OUT; # Workaround for https://sqlite.org/forum/forumpost/0683a49cb02f31a1
# in which Gentoo edits their tclConfig.sh to include an soname
@@ -295,7 +300,7 @@ package ifneeded sqlite3 $VERSION \\
# Generate and execute the command with which to do the compilation.
#
- set cmd "$CMD tclsqlite3.c -o $OUT $LIBS"
+ set cmd "$CMD -DUSE_TCL_STUBS tclsqlite3.c -o $OUT $LIBS"
puts $cmd
file delete -force $OUT
catch {exec {*}$cmd} errmsg
diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh
index c26ac8c73c..35f8dbc8c6 100644
--- a/tool/mkautoconfamal.sh
+++ b/tool/mkautoconfamal.sh
@@ -25,18 +25,6 @@ VERSION=`cat $TOP/VERSION`
HASH=`cut -c1-10 $TOP/manifest.uuid`
DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12`
-# Inject the current version into the TEA autoconf file.
-#
-sed -e "s/@VERSION@/$VERSION/" \
- < $TOP/autoconf/tea/configure.ac.in \
- > $TOP/autoconf/tea/configure.ac
-# And then verify that that worked...
-#
-if grep $VERSION $TOP/autoconf/tea/configure.ac > /dev/null
-then echo "TEA version number ok"
-else echo "TEA version number mismatch. Should be $VERSION"; exit 1
-fi
-
# If this script is given an argument of --snapshot, then generate a
# snapshot tarball named for the current checkout SHA hash, rather than
# the version number.
@@ -85,6 +73,10 @@ rm -f ./*~
# find . -name '*~' -exec rm \{} \;
#fi
+mkdir -p autosetup/teaish
+mv tea/autosetup/*.tcl autosetup/teaish/.
+rm -fr tea/autosetup
+
mkdir -p tea/generic
cat < tea/generic/tclsqlite3.c
#ifdef USE_SYSTEM_SQLITE
@@ -95,12 +87,9 @@ cat < tea/generic/tclsqlite3.c
EOF
cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c
-cd tea
-rm -f configure.ac.in
-autoconf
-rm -rf autom4te.cache
+find . -type f -name '*~' -exec rm -f \{} \;
+find . -type f -name '#*#' -exec rm -f \{} \;
-cd ../
./configure && make dist
tar xzf sqlite-$VERSION.tar.gz
mv sqlite-$VERSION $TARBALLNAME
diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl
index 1d0f892363..7b6f57e426 100644
--- a/tool/mksqlite3c.tcl
+++ b/tool/mksqlite3c.tcl
@@ -111,7 +111,7 @@ puts $out [subst \
** separate file. This file contains only code for the core SQLite library.
**}]
set srcroot [file dirname [file dirname [info script]]]
-if {$tcl_platform(platform)=="windows"} {
+if {$tcl_platform(platform) eq "windows"} {
set vsrcprog src-verify.exe
} else {
set vsrcprog ./src-verify
diff --git a/tool/sqlite3_analyzer.c.in b/tool/sqlite3_analyzer.c.in
index 945c3c5b90..9860c0b0fc 100644
--- a/tool/sqlite3_analyzer.c.in
+++ b/tool/sqlite3_analyzer.c.in
@@ -55,7 +55,7 @@ static int subst_puts(
}else if( strcmp(zArg, "-nonewline")==0 ){
addNewLine = 0;
}else{
- Tcl_AppendResult(interp, "bad argument: ", zArg, 0);
+ Tcl_AppendResult(interp, "bad argument: ", zArg, NULL);
return TCL_ERROR;
}
}
diff --git a/tool/srcck1.c b/tool/srcck1.c
index 20084ac47f..5a1158beb9 100644
--- a/tool/srcck1.c
+++ b/tool/srcck1.c
@@ -13,7 +13,7 @@
** The aim of this utility is to prevent recurrences of errors such
** as the one fixed at:
**
-** https://www.sqlite.org/src/info/a2952231ac7abe16
+** https://sqlite.org/src/info/a2952231ac7abe16
**
** Note that another similar error was found by this utility when it was
** first written. That other error was fixed by the same check-in that
diff --git a/tool/tclConfigShToAutoDef.sh b/tool/tclConfigShToAutoDef.sh
deleted file mode 100755
index d12657063e..0000000000
--- a/tool/tclConfigShToAutoDef.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-#
-# A level of indirection for use soley by the configure script
-# (auto.def).
-#
-# Expects to be passed a full path to a tclConfig.sh. It sources it
-# and emits TCL code which sets some vars which are exported by
-# tclConfig.sh.
-#
-# This script expects that the caller has already validated that the
-# file exists, is not a directory, and is readable.
-#
-# If passed no filename, or an empty one, then it emits config code
-# suitable for the "config not found" case.
-if test x = "x$1"; then
- TCL_INCLUDE_SPEC=
- TCL_LIB_SPEC=
- TCL_STUB_LIB_SPEC=
- TCL_EXEC_PREFIX=
- TCL_VERSION=
-else
- . "$1"
-fi
-
-echo "define TCL_INCLUDE_SPEC {$TCL_INCLUDE_SPEC} ;"
-echo "define TCL_LIB_SPEC {$TCL_LIB_SPEC} ;"
-echo "define TCL_STUB_LIB_SPEC {$TCL_STUB_LIB_SPEC} ;"
-echo "define TCL_EXEC_PREFIX {$TCL_EXEC_PREFIX} ;"
-echo "define TCL_VERSION {$TCL_VERSION} ;"