Merge recent trunk enhancements and fixes into the jsonb branch.
FossilOrigin-Name: 091a5f058dfe2115fb9213655b34f00bcec80aebb299b571975cfe4ecd5ec206
This commit is contained in:
commit
e8d4fd59e4
@ -35,6 +35,8 @@ $(dir.bld.c):
|
||||
|
||||
javac.flags ?= -Xlint:unchecked -Xlint:deprecation
|
||||
java.flags ?=
|
||||
javac.flags += -encoding utf8
|
||||
# -------------^^^^^^^^^^^^^^ required for Windows builds
|
||||
jnicheck ?= 1
|
||||
ifeq (1,$(jnicheck))
|
||||
java.flags += -Xcheck:jni
|
||||
@ -110,6 +112,7 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/annotation/%,\
|
||||
WindowFunction.java \
|
||||
XDestroyCallback.java \
|
||||
sqlite3.java \
|
||||
sqlite3_blob.java \
|
||||
sqlite3_context.java \
|
||||
sqlite3_stmt.java \
|
||||
sqlite3_value.java \
|
||||
@ -160,12 +163,13 @@ endif
|
||||
CLASS_FILES :=
|
||||
define CLASSFILE_DEPS
|
||||
all: $(1).class
|
||||
$(1).class: $(1).java
|
||||
CLASS_FILES += $(1).class
|
||||
endef
|
||||
$(foreach B,$(basename \
|
||||
$(JAVA_FILES.main) $(JAVA_FILES.unittest) $(JAVA_FILES.tester)),\
|
||||
$(eval $(call CLASSFILE_DEPS,$(B))))
|
||||
$(CLASS_FILES): $(JAVA_FILES) $(MAKEFILE)
|
||||
$(CLASS_FILES): $(MAKEFILE)
|
||||
$(bin.javac) $(javac.flags) -h $(dir.bld.c) -cp $(classpath) $(JAVA_FILES)
|
||||
|
||||
#.PHONY: classfiles
|
||||
|
@ -185,6 +185,8 @@
|
||||
**
|
||||
** This use of intptr_t is the _only_ reason we require <stdint.h>
|
||||
** which, in turn, requires building with -std=c99 (or later).
|
||||
**
|
||||
** See also: the notes for LongPtrGet_T.
|
||||
*/
|
||||
#define S3JniCast_L2P(JLongAsPtr) (void*)((intptr_t)(JLongAsPtr))
|
||||
#define S3JniCast_P2L(PTR) (jlong)((intptr_t)(PTR))
|
||||
@ -1493,6 +1495,15 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph,
|
||||
** the C side, because it's reportedly significantly faster. The
|
||||
** intptr_t part here is necessary for compatibility with (at least)
|
||||
** ARM32.
|
||||
**
|
||||
** 2023-11-09: testing has not revealed any measurable performance
|
||||
** difference between the approach of passing type T to C compared to
|
||||
** passing pointer-to-T to C, and adding support for the latter
|
||||
** everywhere requires sigificantly more code. As of this writing, the
|
||||
** older/simpler approach is being applied except for (A) where the
|
||||
** newer approach has already been applied and (B) hot-spot APIs where
|
||||
** a difference of microseconds (i.e. below our testing measurement
|
||||
** threshold) might add up.
|
||||
*/
|
||||
#define LongPtrGet_T(T,JLongAsPtr) (T*)((intptr_t)(JLongAsPtr))
|
||||
#define LongPtrGet_sqlite3(JLongAsPtr) LongPtrGet_T(sqlite3,JLongAsPtr)
|
||||
@ -4674,9 +4685,9 @@ S3JniApi(sqlite3_sql(),jstring,1sql)(
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_step(),jint,1step)(
|
||||
JniArgsEnvClass,jobject jStmt
|
||||
JniArgsEnvClass, jlong jpStmt
|
||||
){
|
||||
sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jStmt);
|
||||
sqlite3_stmt * const pStmt = LongPtrGet_sqlite3_stmt(jpStmt);
|
||||
return pStmt ? (jint)sqlite3_step(pStmt) : (jint)SQLITE_MISUSE;
|
||||
}
|
||||
|
||||
|
@ -705,8 +705,12 @@ extern "C" {
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_DETERMINISTIC 2048L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_DIRECTONLY
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_DIRECTONLY 524288L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_SUBTYPE
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_SUBTYPE 1048576L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_INNOCUOUS
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_INNOCUOUS 2097152L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_RESULT_SUBTYPE
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_RESULT_SUBTYPE 16777216L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_SCAN_UNIQUE
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_SCAN_UNIQUE 1L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_EQ
|
||||
@ -1872,10 +1876,10 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1status64
|
||||
/*
|
||||
* Class: org_sqlite_jni_capi_CApi
|
||||
* Method: sqlite3_step
|
||||
* Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)I
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1step
|
||||
(JNIEnv *, jclass, jobject);
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_capi_CApi
|
||||
|
@ -18,12 +18,12 @@ package org.sqlite.jni.annotation;
|
||||
null or point to closed/finalized C-side resources.
|
||||
|
||||
<p>In the case of Java types which map directly to C struct types
|
||||
(e.g. {@link org.sqlite.jni.sqlite3}, {@link
|
||||
org.sqlite.jni.sqlite3_stmt}, and {@link
|
||||
org.sqlite.jni.sqlite3_context}), a closed/finalized resource is
|
||||
also considered to be null for purposes this annotation because the
|
||||
C-side effect of passing such a handle is the same as if null is
|
||||
passed.</p>
|
||||
(e.g. {@link org.sqlite.jni.capi.sqlite3}, {@link
|
||||
org.sqlite.jni.capi.sqlite3_stmt}, and {@link
|
||||
org.sqlite.jni.capi.sqlite3_context}), a closed/finalized resource
|
||||
is also considered to be null for purposes this annotation because
|
||||
the C-side effect of passing such a handle is the same as if null
|
||||
is passed.</p>
|
||||
|
||||
<p>When used in the context of Java interfaces which are called
|
||||
from the C APIs, this annotation communicates that the C API will
|
||||
@ -31,12 +31,23 @@ package org.sqlite.jni.annotation;
|
||||
|
||||
<p>Passing a null, for this annotation's definition of null, for
|
||||
any parameter marked with this annoation specifically invokes
|
||||
undefined behavior.</p>
|
||||
undefined behavior (see below).</p>
|
||||
|
||||
<p>Passing 0 (i.e. C NULL) or a negative value for any long-type
|
||||
parameter marked with this annoation specifically invokes undefined
|
||||
behavior. Such values are treated as C pointers in the JNI
|
||||
layer.</p>
|
||||
behavior (see below). Such values are treated as C pointers in the
|
||||
JNI layer.</p>
|
||||
|
||||
<p><b>Undefined behaviour:</b> the JNI build uses the {@code
|
||||
SQLITE_ENABLE_API_ARMOR} build flag, meaning that the C code
|
||||
invoked with invalid NULL pointers and the like will not invoke
|
||||
undefined behavior in the conventional C sense, but may, for
|
||||
example, return result codes which are not documented for the
|
||||
affected APIs or may otherwise behave unpredictably. In no known
|
||||
cases will such arguments result in C-level code dereferencing a
|
||||
NULL pointer or accessing out-of-bounds (or otherwise invalid)
|
||||
memory. In other words, they may cause unexpected behavior but
|
||||
should never cause an outright crash or security issue.</p>
|
||||
|
||||
<p>Note that the C-style API does not throw any exceptions on its
|
||||
own because it has a no-throw policy in order to retain its C-style
|
||||
@ -48,7 +59,7 @@ package org.sqlite.jni.annotation;
|
||||
code.</p>
|
||||
|
||||
<p>This annotation is solely for the use by the classes in the
|
||||
org.sqlite package and subpackages, but is made public so that
|
||||
org.sqlite.jni package and subpackages, but is made public so that
|
||||
javadoc will link to it from the annotated functions. It is not
|
||||
part of the public API and client-level code must not rely on
|
||||
it.</p>
|
||||
|
@ -1734,20 +1734,24 @@ public final class CApi {
|
||||
@NotNull OutputPointer.Int64 pHighwater, boolean reset
|
||||
);
|
||||
|
||||
public static native int sqlite3_step(@NotNull sqlite3_stmt stmt);
|
||||
private static native int sqlite3_step(@NotNull long ptrToStmt);
|
||||
|
||||
public static int sqlite3_step(@NotNull sqlite3_stmt stmt){
|
||||
return null==stmt ? SQLITE_MISUSE : sqlite3_step(stmt.getNativePointer());
|
||||
}
|
||||
|
||||
public static native boolean sqlite3_stmt_busy(@NotNull sqlite3_stmt stmt);
|
||||
|
||||
private static native int sqlite3_stmt_explain(@NotNull long ptrToStmt, int op);
|
||||
|
||||
public static int sqlite3_stmt_explain(@NotNull sqlite3_stmt stmt, int op){
|
||||
return sqlite3_stmt_explain(stmt.getNativePointer(), op);
|
||||
return null==stmt ? SQLITE_MISUSE : sqlite3_stmt_explain(stmt.getNativePointer(), op);
|
||||
}
|
||||
|
||||
private static native int sqlite3_stmt_isexplain(@NotNull long ptrToStmt);
|
||||
|
||||
public static int sqlite3_stmt_isexplain(@NotNull sqlite3_stmt stmt){
|
||||
return sqlite3_stmt_isexplain(stmt.getNativePointer());
|
||||
return null==stmt ? 0 : sqlite3_stmt_isexplain(stmt.getNativePointer());
|
||||
}
|
||||
|
||||
public static native boolean sqlite3_stmt_readonly(@NotNull sqlite3_stmt stmt);
|
||||
@ -1768,7 +1772,7 @@ public final class CApi {
|
||||
signature is the public-facing one.
|
||||
*/
|
||||
private static native int sqlite3_strglob(
|
||||
@NotNull byte[] glob, @NotNull byte[] nullTerminatedUtf8
|
||||
@NotNull byte[] glob, @NotNull byte[] nulTerminatedUtf8
|
||||
);
|
||||
|
||||
public static int sqlite3_strglob(
|
||||
@ -1782,7 +1786,7 @@ public final class CApi {
|
||||
The LIKE counterpart of the private sqlite3_strglob() method.
|
||||
*/
|
||||
private static native int sqlite3_strlike(
|
||||
@NotNull byte[] glob, @NotNull byte[] nullTerminatedUtf8,
|
||||
@NotNull byte[] glob, @NotNull byte[] nulTerminatedUtf8,
|
||||
int escChar
|
||||
);
|
||||
|
||||
@ -2441,9 +2445,11 @@ public final class CApi {
|
||||
public static final int SQLITE_TXN_WRITE = 2;
|
||||
|
||||
// udf flags
|
||||
public static final int SQLITE_DETERMINISTIC = 0x000000800;
|
||||
public static final int SQLITE_DIRECTONLY = 0x000080000;
|
||||
public static final int SQLITE_INNOCUOUS = 0x000200000;
|
||||
public static final int SQLITE_DETERMINISTIC = 0x000000800;
|
||||
public static final int SQLITE_DIRECTONLY = 0x000080000;
|
||||
public static final int SQLITE_SUBTYPE = 0x000100000;
|
||||
public static final int SQLITE_INNOCUOUS = 0x000200000;
|
||||
public static final int SQLITE_RESULT_SUBTYPE = 0x001000000;
|
||||
|
||||
// virtual tables
|
||||
public static final int SQLITE_INDEX_SCAN_UNIQUE = 1;
|
||||
|
@ -25,7 +25,6 @@ public final class sqlite3_blob extends NativePointerHolder<sqlite3_blob>
|
||||
private sqlite3_blob(){}
|
||||
|
||||
@Override public void close(){
|
||||
CApi.sqlite3_blob_close(this.clearNativePointer());
|
||||
CApi.sqlite3_blob_close(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,13 +25,10 @@ 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;
|
||||
// /**
|
||||
// For Window functions only and is not currently bound because
|
||||
// doing so may require exposing sqlite3_value for effective use.
|
||||
// */
|
||||
// public static final int SUBTYPE = CApi.SQLITE_SUBTYPE;
|
||||
|
||||
/**
|
||||
The Arguments type is an abstraction on top of the lower-level
|
||||
@ -167,7 +164,7 @@ public interface SqlFunction {
|
||||
}
|
||||
|
||||
/**
|
||||
Wrapper for a single SqlFunction argument. Primarily intended
|
||||
Represents a single SqlFunction argument. Primarily intended
|
||||
for use with the Arguments class's Iterable interface.
|
||||
*/
|
||||
public final static class Arg {
|
||||
|
@ -877,7 +877,7 @@ const char * sqlite3_wasm_enum_json(void){
|
||||
DefInt(SQLITE_STMTSTATUS_FILTER_HIT);
|
||||
DefInt(SQLITE_STMTSTATUS_MEMUSED);
|
||||
} _DefGroup;
|
||||
|
||||
|
||||
DefGroup(syncFlags) {
|
||||
DefInt(SQLITE_SYNC_NORMAL);
|
||||
DefInt(SQLITE_SYNC_FULL);
|
||||
@ -901,6 +901,8 @@ const char * sqlite3_wasm_enum_json(void){
|
||||
DefInt(SQLITE_DETERMINISTIC);
|
||||
DefInt(SQLITE_DIRECTONLY);
|
||||
DefInt(SQLITE_INNOCUOUS);
|
||||
DefInt(SQLITE_SUBTYPE);
|
||||
DefInt(SQLITE_RESULT_SUBTYPE);
|
||||
} _DefGroup;
|
||||
|
||||
DefGroup(version) {
|
||||
|
54
manifest
54
manifest
@ -1,5 +1,5 @@
|
||||
C Merge\srecent\strunk\senhancements\sinto\sthe\sjsonb\sbranch,\sand\sespecially\sthe\nfiner-grain\scharacterization\sof\sJSON\sfunction\sproperties.
|
||||
D 2023-11-08T17:11:13.302
|
||||
C Merge\srecent\strunk\senhancements\sand\sfixes\sinto\sthe\sjsonb\sbranch.
|
||||
D 2023-11-10T18:59:23.439
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -238,12 +238,12 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
|
||||
F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9
|
||||
F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282
|
||||
F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
|
||||
F ext/jni/GNUmakefile df91212d772011e3d39712a0e38586856c42528b6ee3d507a5bb3b3248c0ecbc
|
||||
F ext/jni/GNUmakefile f2f3a31923293659b95225e932a286af1f2287d75bf88ad6c0fd1b9d9cd020d4
|
||||
F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4
|
||||
F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
|
||||
F ext/jni/src/c/sqlite3-jni.c 6b95974189d7cc394afbe15507050f1d174170a65be5a4dad201ab11f0a9777a
|
||||
F ext/jni/src/c/sqlite3-jni.h 18925c56d6664fdec081c56daf3b2ffa0e0ff6b9b128b9f39b84862f34ba0601
|
||||
F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2
|
||||
F ext/jni/src/c/sqlite3-jni.c 3774703e5865e7ff776b762de5386af8aa703e569bbb3a85c423c3f8473a3c26
|
||||
F ext/jni/src/c/sqlite3-jni.h 891444578550a7aa69fe5e0dedb3e6dedad752501ba99801f17797be51796934
|
||||
F ext/jni/src/org/sqlite/jni/annotation/NotNull.java 02091a8112e33389f1c160f506cd413168c8dfacbeda608a4946c6e3557b7d5a
|
||||
F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba
|
||||
F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca
|
||||
F ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java 1afa90d3f236f79cc7fcd2497e111992644f7596fbc8e8bcf7f1908ae00acd6c
|
||||
@ -251,7 +251,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63
|
||||
F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java c045a5b47e02bb5f1af91973814a905f12048c428a3504fbc5266d1c1be3de5a
|
||||
F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759
|
||||
F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca
|
||||
F ext/jni/src/org/sqlite/jni/capi/CApi.java 16a28138c3c25f33356193970644389ff8ebc0720499549653934b2529c8d1dd
|
||||
F ext/jni/src/org/sqlite/jni/capi/CApi.java 92d443b08175c798e132a312f71b1a42140c60d473d35c149e3d95a45b6550f3
|
||||
F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b
|
||||
F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a
|
||||
F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab
|
||||
@ -278,7 +278,7 @@ F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba90943
|
||||
F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3.java c6a5c555d163d76663534f2b2cce7cab15325b9852d0f58c6688a85e73ae52f0
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java 6742b431cd4d77e8000c1f92ec66265a58414c86bf3b0b5fbcb1164e08477227
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java f204ab6ab1263e119fe43730141a00662d80972129a5351dfb11aae5d282df36
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java 59e26ca5254cd4771f467237bcfe2d8deed30a77152fabcd4574fd406c301d63
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java f0ef982009c335c4393ffcb68051809ca1711e4f47bcb8d1d46952f22c01bc22
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java 293b5fa7d5b5724c87de544654aca1103d76f3092bc2c8f4360102a65ba25dff
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java e1d62a257c13504b46d39d5c21c49cf157ad73fda00cc5f34c931aa008c37049
|
||||
@ -295,7 +295,7 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ad
|
||||
F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 27b141f5914c7cb0e40e90a301d5e05b77f3bd42236834a68031b7086381fafd
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 0ef62b43b1d6a9f044e106b56c9ea42bc7150b82ebeb79cff58f5be08cb9a435
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 982538ddb4c0719ef87dfa664cd137b09890b546029a7477810bd64d4c47ee35
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 40806dbbf8e120f115e33255d1813db13b40f0a598869e299a947a580429939b
|
||||
@ -591,7 +591,7 @@ F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256
|
||||
F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25
|
||||
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 595953994aa3ae2287c889c4da39ab3d6f17b6461ecf4bec334b7a3faafddb02
|
||||
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 46c4afa6c50d7369252c104f274ad977a97e91ccfafc38b400fe36e90bdda88e
|
||||
F ext/wasm/api/sqlite3-wasm.c 038de1b6d40b2cc0f41a143a0451db60b2a6f1b5bc06de67da255c54ea1661b7
|
||||
F ext/wasm/api/sqlite3-wasm.c d0e09eb5ed3743c00294e30019e591c3aa150572ae7ffe8a8994568a7377589f
|
||||
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f
|
||||
F ext/wasm/api/sqlite3-worker1.c-pp.js a541112aa51e16705f13a99bb943c64efe178aa28c86704a955f8fd9afe4ba37
|
||||
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
|
||||
@ -684,10 +684,10 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
|
||||
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
|
||||
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
|
||||
F src/json.c e745701b9859a0940f8314eb59e913685a98a606506deef004675b43129da840
|
||||
F src/json.c 01644dc0c33b331fd5f294eddb1e4e02a4057535193f5f38161ee75047dd7177
|
||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||
F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36
|
||||
F src/main.c e1bc8864834697503d370d94613be945d05ca1c5ebdda43e7d5c8ee8c48d433c
|
||||
F src/main.c 1b89f3de98d1b59fec5bac1d66d6ece21f703821b8eaa0d53d9604c35309f6f9
|
||||
F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
|
||||
@ -711,7 +711,7 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210
|
||||
F src/os_unix.c 0a33005e6426702c7e76f3d451f296c088693a95b2be28ba9ef59c8d8529ce6b
|
||||
F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 699aab8dfc88056d796b03b40c0ab979040d58dfc3ae9db207f1be91e4880bbf
|
||||
F src/pager.c 987ab3a2cd9065d62e9955474470ff733445e2357432a67e3d0f5a8f9313e334
|
||||
F src/pager.h f4d33fec8052603758792045493423b8871a996da2d0973927b7d36cd6070473
|
||||
F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec
|
||||
F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75
|
||||
@ -724,12 +724,12 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750
|
||||
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c d017bad7ba8e778617701a0e986fdeb393d67d6afa84fb28ef4e8b8ad2acf916
|
||||
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
|
||||
F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515
|
||||
F src/shell.c.in 7312c571ebf518fc8927bbb5aeb4fa67e5b0dfb2adae4258dcd1ccae42c11e1f
|
||||
F src/sqlite.h.in a0fce680a40fe81b13eae3749d001134d9fe0a43aecc09a8986520d5119acfcd
|
||||
F src/select.c 47797c57c5ee2ad183b34a2e5d643ec7519366686bbe44a9a81df9fe304f28a7
|
||||
F src/shell.c.in 297625a1ba6ea1c08bc2ea1b838b646cad309b62bf08df0e379355629404f140
|
||||
F src/sqlite.h.in 4f841d3d117b830ee5ee45e8d89ceff1195f3ebb72d041ace8d116ba4c103b35
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
|
||||
F src/sqliteInt.h 1412a692dfb5d615e416f3ddb9b33e5b6bd39f70432bb84046c50574fc604b51
|
||||
F src/sqliteInt.h 6b82eb99a9d2887e873fb29e56befb7c50cf4624df615d23a28f071dc8abf5f6
|
||||
F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6
|
||||
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
|
||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||
@ -794,10 +794,10 @@ F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242
|
||||
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
|
||||
F src/util.c b22cc9f203a8c0b9ee5338a67f8860347d14845864c10248bebe84518a781677
|
||||
F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104
|
||||
F src/vdbe.c 5f7432b22b66a09503caab15e86f582f7b55299e1d366799896ae3e354192f09
|
||||
F src/vdbe.c 44bccc33ff8864b4b937be4d67ebb244e4f4e5ebc6d44832298954df6b7d6a78
|
||||
F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0
|
||||
F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c
|
||||
F src/vdbeapi.c 22a2661a2886f6b142fce91e95533a1841135e8217f65297d7df353a0eddf650
|
||||
F src/vdbeapi.c 8f57d60c89da0b60e6d4e272358c511f6bae4e24330bdb11f8b42f986d1bf21b
|
||||
F src/vdbeaux.c f3997b5956c8d97bd2fc3392db42caecddfa6549e9df82e0a7e5804653ca475a
|
||||
F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5
|
||||
F src/vdbemem.c 0012d5f01cc866833847c2f3ae4c318ac53a1cb3d28acad9c35e688039464cf0
|
||||
@ -809,11 +809,11 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c bba7db5dae3ffe2c6b9c173fc10be4b570b125e985cb5b95a6c22716213adde4
|
||||
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
|
||||
F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2
|
||||
F src/where.c 313ce81270d2a414672370e1ee74e65949ad620519193d4cac2986d073cbc8a0
|
||||
F src/where.c 5b14ccd10ed4cfa3d62fa83bfa623aeda4d26dbc9f451c895a21797f0a024436
|
||||
F src/whereInt.h 4b38c5889514e3aead3f27d0ee9a26e47c3f150efc59e2a8b4e3bc8835e4d7a1
|
||||
F src/wherecode.c 5d77db30a2a3dd532492ae882de114edba2fae672622056b1c7fd61f5917a8f1
|
||||
F src/whereexpr.c dc5096eca5ed503999be3bdee8a90c51361289a678d396a220912e9cb73b3c00
|
||||
F src/window.c ad21e2b73ec75acc79dde2576c573f54a338b0c49e9de847ce984f9b9595b5e2
|
||||
F src/window.c 5b1387d59df30d481ed14cceef5f4d1dab1f8752aa106ba72c8b62777bd139d2
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
|
||||
F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9
|
||||
@ -1269,7 +1269,7 @@ F test/index8.test caa097735c91dbc23d8a402f5e63a2a03c83840ba3928733ed7f9a03f8a91
|
||||
F test/index9.test 2ac891806a4136ef3e91280477e23114e67575207dc331e6797fa0ed9379f997
|
||||
F test/indexA.test 11d84f6995e6e5b9d8315953fb1b6d29772ee7c7803ee9112715e7e4dd3e4974
|
||||
F test/indexedby.test f21eca4f7a6ffe14c8500a7ad6cd53166666c99e5ccd311842a28bc94a195fe0
|
||||
F test/indexexpr1.test 62558b1cfd7ccbe7bc015849cc6d1a13ef124e80cbd5b3a98dc66c3c9cce0cf4
|
||||
F test/indexexpr1.test 833f511213a5e26549186813f0566bd72f978177a7e6e98a2d2dd695de3c670d
|
||||
F test/indexexpr2.test 1c382e81ef996d8ae8b834a74f2a9013dddf59214c32201d7c8a656d739f999a
|
||||
F test/indexfault.test 98d78a8ff1f5335628b62f886a1cb7c7dac1ef6d48fa39c51ec871c87dce9811
|
||||
F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
|
||||
@ -1309,7 +1309,7 @@ F test/joinC.test 1f1a602c2127f55f136e2cbd3bf2d26546614bf8cffe5902ec1ac9c07f87f2
|
||||
F test/joinD.test 2ce62e7353a0702ca5e70008faf319c1d4686aa19fba34275c6d1da0e960be28
|
||||
F test/joinE.test d5d182f3812771e2c0d97c9dcf5dbe4c41c8e21c82560e59358731c4a3981d6b
|
||||
F test/joinF.test 53dd66158806823ea680dd7543b5406af151b5aafa5cd06a7f3231cd94938127
|
||||
F test/joinH.test 84198ea42bf78b79fe399c0567218cd6df36c50c6dd27d9c4aab221acaad929e
|
||||
F test/joinH.test c4301c738b05b845f273b0d94de74e953626d809dc945352909aedb199b42e5f
|
||||
F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497
|
||||
F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4
|
||||
F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ffa140e
|
||||
@ -1326,7 +1326,7 @@ F test/json102.test 557a46e16df1aa9bdbc4076a71a45814ea0e7503d6621d87d42a8c04cbc2
|
||||
F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe
|
||||
F test/json104.test 1b844a70cddcfa2e4cd81a5db0657b2e61e7f00868310f24f56a9ba0114348c1
|
||||
F test/json105.test 11670a4387f4308ae0318cadcbd6a918ea7edcd19fbafde020720a073952675d
|
||||
F test/json501.test f71710f60fa45b19dc336fbaac9e8362f70f80cf81badefdb845ed3f7c7c2ccc
|
||||
F test/json501.test c419deb835b70c1a2c8532936927bcc1146730328edd2052276715bfd209724d
|
||||
F test/json502.test 98c38e3c4573841028a1381dfb81d4c3f9b105d39668167da10d055e503f6d0b
|
||||
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
|
||||
F test/kvtest.c 6e0228409ea7ca0497dad503fbd109badb5e59545d131014b6aaac68b56f484a
|
||||
@ -2140,8 +2140,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P b12110276fc15d1b6b0cc455f89747ace7a09650d5ba433d8bb431bb4e5bc951 b2b62546c4a5e9dccb8aa0cb8eda228d662c69159e320b01a377317bc909e89f
|
||||
R d8efa19343b75dfdaa31ac930f849ac1
|
||||
P 72393b003f9f8675e4a124dddd09607b5b34ddefe56716b283c68c0982fb3d96 ac39800bb2685fa287c7d834faed75f0bc61320ef986de314392d6eadb574d30
|
||||
R 6d3d51033686bbc98309c106a216587b
|
||||
U drh
|
||||
Z 8a4148addede5d91729ce4e74e65d8c3
|
||||
Z 403b43107da0aaabcdd1c627364824ec
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
72393b003f9f8675e4a124dddd09607b5b34ddefe56716b283c68c0982fb3d96
|
||||
091a5f058dfe2115fb9213655b34f00bcec80aebb299b571975cfe4ecd5ec206
|
123
src/json.c
123
src/json.c
@ -593,7 +593,7 @@ static void jsonAppendNormalizedString(JsonString *p, const char *zIn, u32 N){
|
||||
u32 i;
|
||||
jsonAppendChar(p, '"');
|
||||
while( N>0 ){
|
||||
for(i=0; i<N && zIn[i]!='\\'; i++){}
|
||||
for(i=0; i<N && zIn[i]!='\\' && zIn[i]!='"'; i++){}
|
||||
if( i>0 ){
|
||||
jsonAppendRawNZ(p, zIn, i);
|
||||
if( i>=N ) break;
|
||||
@ -604,6 +604,12 @@ static void jsonAppendNormalizedString(JsonString *p, const char *zIn, u32 N){
|
||||
p->eErr |= JSTRING_MALFORMED;
|
||||
break;
|
||||
}
|
||||
if( zIn[0]=='"' ){
|
||||
jsonAppendRawNZ(p, "\\\"", 2);
|
||||
zIn++;
|
||||
N--;
|
||||
continue;
|
||||
}
|
||||
assert( zIn[0]=='\\' );
|
||||
switch( (u8)zIn[1] ){
|
||||
case '\'':
|
||||
@ -1031,7 +1037,8 @@ static void jsonReturnNodeAsJson(
|
||||
JsonParse *pParse, /* The complete JSON */
|
||||
JsonNode *pNode, /* Node to return */
|
||||
sqlite3_context *pCtx, /* Return value for this function */
|
||||
int bGenerateAlt /* Also store the rendered text in zAlt */
|
||||
int bGenerateAlt, /* Also store the rendered text in zAlt */
|
||||
int omitSubtype /* Do not call sqlite3_result_subtype() */
|
||||
){
|
||||
int flags;
|
||||
JsonString s;
|
||||
@ -1061,7 +1068,7 @@ static void jsonReturnNodeAsJson(
|
||||
pParse->nAlt = s.nUsed;
|
||||
}
|
||||
jsonReturnString(&s);
|
||||
sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
|
||||
if( !omitSubtype ) sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1105,7 +1112,8 @@ static u32 jsonHexToInt4(const char *z){
|
||||
static void jsonReturnFromNode(
|
||||
JsonParse *pParse, /* Complete JSON parse tree */
|
||||
JsonNode *pNode, /* Node to return */
|
||||
sqlite3_context *pCtx /* Return value for this function */
|
||||
sqlite3_context *pCtx, /* Return value for this function */
|
||||
int omitSubtype /* Do not call sqlite3_result_subtype() */
|
||||
){
|
||||
switch( pNode->eType ){
|
||||
default: {
|
||||
@ -1259,7 +1267,7 @@ static void jsonReturnFromNode(
|
||||
}
|
||||
case JSON_ARRAY:
|
||||
case JSON_OBJECT: {
|
||||
jsonReturnNodeAsJson(pParse, pNode, pCtx, 0);
|
||||
jsonReturnNodeAsJson(pParse, pNode, pCtx, 0, omitSubtype);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4318,7 +4326,7 @@ static void jsonParseFunc(
|
||||
printf("iSubst = %u\n", p->iSubst);
|
||||
printf("iHold = %u\n", p->iHold);
|
||||
jsonDebugPrintNodeEntries(p->aNode, p->nNode);
|
||||
jsonReturnNodeAsJson(p, p->aNode, ctx, 1);
|
||||
jsonReturnNodeAsJson(p, p->aNode, ctx, 1, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4570,15 +4578,14 @@ static void jsonExtractFunc(
|
||||
}
|
||||
if( pNode ){
|
||||
if( flags & JSON_JSON ){
|
||||
jsonReturnNodeAsJson(p, pNode, ctx, 0);
|
||||
jsonReturnNodeAsJson(p, pNode, ctx, 0, 0);
|
||||
}else{
|
||||
jsonReturnFromNode(p, pNode, ctx);
|
||||
sqlite3_result_subtype(ctx, 0);
|
||||
jsonReturnFromNode(p, pNode, ctx, 1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
pNode = jsonLookup(p, zPath, 0, ctx);
|
||||
if( p->nErr==0 && pNode ) jsonReturnFromNode(p, pNode, ctx);
|
||||
if( p->nErr==0 && pNode ) jsonReturnFromNode(p, pNode, ctx, 0);
|
||||
}
|
||||
}else{
|
||||
/* Two or more PATH arguments results in a JSON array with each
|
||||
@ -4710,7 +4717,7 @@ static void jsonPatchFunc(
|
||||
}else if( pResult ){
|
||||
jsonDebugPrintParse(pX);
|
||||
jsonDebugPrintNode(pResult);
|
||||
jsonReturnNodeAsJson(pX, pResult, ctx, 0);
|
||||
jsonReturnNodeAsJson(pX, pResult, ctx, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4787,7 +4794,7 @@ static void jsonRemoveFunc(
|
||||
}
|
||||
}
|
||||
if( (pParse->aNode[0].jnFlags & JNODE_REMOVE)==0 ){
|
||||
jsonReturnNodeAsJson(pParse, pParse->aNode, ctx, 1);
|
||||
jsonReturnNodeAsJson(pParse, pParse->aNode, ctx, 1, 0);
|
||||
}
|
||||
remove_done:
|
||||
jsonDebugPrintParse(p);
|
||||
@ -4923,7 +4930,7 @@ static void jsonReplaceFunc(
|
||||
jsonReplaceNode(ctx, pParse, (u32)(pNode - pParse->aNode), argv[i+1]);
|
||||
}
|
||||
}
|
||||
jsonReturnNodeAsJson(pParse, pParse->aNode, ctx, 1);
|
||||
jsonReturnNodeAsJson(pParse, pParse->aNode, ctx, 1, 0);
|
||||
replace_err:
|
||||
jsonDebugPrintParse(pParse);
|
||||
jsonParseFree(pParse);
|
||||
@ -4978,7 +4985,7 @@ static void jsonSetFunc(
|
||||
}
|
||||
}
|
||||
jsonDebugPrintParse(pParse);
|
||||
jsonReturnNodeAsJson(pParse, pParse->aNode, ctx, 1);
|
||||
jsonReturnNodeAsJson(pParse, pParse->aNode, ctx, 1, 0);
|
||||
jsonSetDone:
|
||||
jsonParseFree(pParse);
|
||||
}
|
||||
@ -5526,7 +5533,7 @@ static int jsonEachColumn(
|
||||
case JEACH_KEY: {
|
||||
if( p->i==0 ) break;
|
||||
if( p->eType==JSON_OBJECT ){
|
||||
jsonReturnFromNode(&p->sParse, pThis, ctx);
|
||||
jsonReturnFromNode(&p->sParse, pThis, ctx, 0);
|
||||
}else if( p->eType==JSON_ARRAY ){
|
||||
u32 iKey;
|
||||
if( p->bRecursive ){
|
||||
@ -5542,7 +5549,7 @@ static int jsonEachColumn(
|
||||
}
|
||||
case JEACH_VALUE: {
|
||||
if( pThis->jnFlags & JNODE_LABEL ) pThis++;
|
||||
jsonReturnFromNode(&p->sParse, pThis, ctx);
|
||||
jsonReturnFromNode(&p->sParse, pThis, ctx, 0);
|
||||
break;
|
||||
}
|
||||
case JEACH_TYPE: {
|
||||
@ -5553,7 +5560,7 @@ static int jsonEachColumn(
|
||||
case JEACH_ATOM: {
|
||||
if( pThis->jnFlags & JNODE_LABEL ) pThis++;
|
||||
if( pThis->eType>=JSON_ARRAY ) break;
|
||||
jsonReturnFromNode(&p->sParse, pThis, ctx);
|
||||
jsonReturnFromNode(&p->sParse, pThis, ctx, 0);
|
||||
break;
|
||||
}
|
||||
case JEACH_ID: {
|
||||
@ -5859,56 +5866,58 @@ static sqlite3_module jsonTreeModule = {
|
||||
void sqlite3RegisterJsonFunctions(void){
|
||||
#ifndef SQLITE_OMIT_JSON
|
||||
static FuncDef aJsonFunc[] = {
|
||||
/* Might return JSON text (subtype J) */
|
||||
/* | */
|
||||
/* Uses cache ------, | ,---- Returns JSONB */
|
||||
/* | | | */
|
||||
/* Number of arguments ---, | | | ,--- Flags */
|
||||
/* | | | | | */
|
||||
JFUNCTION(json, 1, 1, 1, 0, 0, jsonRemoveFunc),
|
||||
JFUNCTION(jsonb, 1, 1, 0, 1, 0, jsonbFunc),
|
||||
JFUNCTION(json_array, -1, 0, 1, 0, 0, jsonArrayFunc),
|
||||
JFUNCTION(jsonb_array, -1, 0, 0, 1, 0, jsonArrayFunc),
|
||||
JFUNCTION(json_array_length, 1, 1, 0, 0, 0, jsonArrayLengthFunc),
|
||||
JFUNCTION(json_array_length, 2, 1, 0, 0, 0, jsonArrayLengthFunc),
|
||||
JFUNCTION(json_error_position,1, 1, 0, 0, 0, jsonErrorFunc),
|
||||
JFUNCTION(json_extract, -1, 1, 1, 0, 0, jsonExtractFunc),
|
||||
JFUNCTION(jsonb_extract, -1, 1, 0, 1, 0, jsonExtractFunc),
|
||||
JFUNCTION(->, 2, 1, 1, 0, JSON_JSON, jsonExtractFunc),
|
||||
JFUNCTION(->>, 2, 1, 0, 0, JSON_SQL, jsonExtractFunc),
|
||||
JFUNCTION(json_insert, -1, 1, 1, 0, 0, jsonSetFunc),
|
||||
JFUNCTION(jsonb_insert, -1, 1, 0, 1, 0, jsonSetFunc),
|
||||
JFUNCTION(json_object, -1, 0, 1, 0, 0, jsonObjectFunc),
|
||||
JFUNCTION(jsonb_object, -1, 0, 0, 1, 0, jsonObjectFunc),
|
||||
JFUNCTION(json_patch, 2, 1, 1, 0, 0, jsonPatchFunc),
|
||||
JFUNCTION(jsonb_patch, 2, 1, 0, 1, 0, jsonPatchFunc),
|
||||
JFUNCTION(json_quote, 1, 0, 1, 0, 0, jsonQuoteFunc),
|
||||
JFUNCTION(json_remove, -1, 1, 1, 0, 0, jsonRemoveFunc),
|
||||
JFUNCTION(jsonb_remove, -1, 1, 0, 1, 0, jsonRemoveFunc),
|
||||
JFUNCTION(json_replace, -1, 1, 1, 0, 0, jsonReplaceFunc),
|
||||
JFUNCTION(jsonb_replace, -1, 1, 0, 1, 0, jsonReplaceFunc),
|
||||
JFUNCTION(json_set, -1, 1, 1, 0, JSON_ISSET, jsonSetFunc),
|
||||
JFUNCTION(jsonb_set, -1, 1, 0, 1, JSON_ISSET, jsonSetFunc),
|
||||
JFUNCTION(json_type, 1, 1, 0, 0, 0, jsonTypeFunc),
|
||||
JFUNCTION(json_type, 2, 1, 0, 0, 0, jsonTypeFunc),
|
||||
JFUNCTION(json_valid, 1, 1, 0, 0, 0, jsonValidFunc),
|
||||
/* sqlite3_result_subtype() ----, ,--- sqlite3_value_subtype() */
|
||||
/* | | */
|
||||
/* Uses cache ------, | | ,---- Returns JSONB */
|
||||
/* | | | | */
|
||||
/* Number of arguments ---, | | | | ,--- Flags */
|
||||
/* | | | | | | */
|
||||
JFUNCTION(json, 1,1,1, 0,0,0, jsonRemoveFunc),
|
||||
JFUNCTION(jsonb, 1,1,0, 0,1,0, jsonbFunc),
|
||||
JFUNCTION(json_array, -1,0,1, 1,0,0, jsonArrayFunc),
|
||||
JFUNCTION(jsonb_array, -1,0,1, 1,1,0, jsonArrayFunc),
|
||||
JFUNCTION(json_array_length, 1,1,0, 0,0,0, jsonArrayLengthFunc),
|
||||
JFUNCTION(json_array_length, 2,1,0, 0,0,0, jsonArrayLengthFunc),
|
||||
JFUNCTION(json_error_position,1,1,0, 0,0,0, jsonErrorFunc),
|
||||
JFUNCTION(json_extract, -1,1,1, 0,0,0, jsonExtractFunc),
|
||||
JFUNCTION(jsonb_extract, -1,1,0, 0,1,0, jsonExtractFunc),
|
||||
JFUNCTION(->, 2,1,1, 0,0,JSON_JSON, jsonExtractFunc),
|
||||
JFUNCTION(->>, 2,1,0, 0,0,JSON_SQL, jsonExtractFunc),
|
||||
JFUNCTION(json_insert, -1,1,1, 1,0,0, jsonSetFunc),
|
||||
JFUNCTION(jsonb_insert, -1,1,0, 1,1,0, jsonSetFunc),
|
||||
JFUNCTION(json_object, -1,0,1, 1,0,0, jsonObjectFunc),
|
||||
JFUNCTION(jsonb_object, -1,0,1, 1,1,0, jsonObjectFunc),
|
||||
JFUNCTION(json_patch, 2,1,1, 0,0,0, jsonPatchFunc),
|
||||
JFUNCTION(jsonb_patch, 2,1,0, 0,1,0, jsonPatchFunc),
|
||||
JFUNCTION(json_quote, 1,0,1, 1,0,0, jsonQuoteFunc),
|
||||
JFUNCTION(json_remove, -1,1,1, 0,0,0, jsonRemoveFunc),
|
||||
JFUNCTION(jsonb_remove, -1,1,0, 0,1,0, jsonRemoveFunc),
|
||||
JFUNCTION(json_replace, -1,1,1, 1,0,0, jsonReplaceFunc),
|
||||
JFUNCTION(jsonb_replace, -1,1,0, 1,1,0, jsonReplaceFunc),
|
||||
JFUNCTION(json_set, -1,1,1, 1,0,JSON_ISSET, jsonSetFunc),
|
||||
JFUNCTION(jsonb_set, -1,1,0, 1,1,JSON_ISSET, jsonSetFunc),
|
||||
JFUNCTION(json_type, 1,1,0, 0,0,0, jsonTypeFunc),
|
||||
JFUNCTION(json_type, 2,1,0, 0,0,0, jsonTypeFunc),
|
||||
JFUNCTION(json_valid, 1,1,0, 0,0,0, jsonValidFunc),
|
||||
#if SQLITE_DEBUG
|
||||
JFUNCTION(json_parse, 1, 1, 0, 0, 0, jsonParseFunc),
|
||||
JFUNCTION(json_test1, 1, 1, 0, 0, 0, jsonTest1Func),
|
||||
JFUNCTION(jsonb_test2, 1, 1, 0, 1, 0, jsonbTest2),
|
||||
JFUNCTION(json_parse, 1,1,0, 0,0,0, jsonParseFunc),
|
||||
JFUNCTION(json_test1, 1,1,0, 1,0,0, jsonTest1Func),
|
||||
JFUNCTION(jsonb_test2, 1,1,0, 0,1,0, jsonbTest2),
|
||||
#endif
|
||||
WAGGREGATE(json_group_array, 1, 0, 0,
|
||||
jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse,
|
||||
SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC),
|
||||
SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8|
|
||||
SQLITE_DETERMINISTIC),
|
||||
WAGGREGATE(jsonb_group_array, 1, JSON_BLOB, 0,
|
||||
jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse,
|
||||
SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC),
|
||||
SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC),
|
||||
WAGGREGATE(json_group_object, 2, 0, 0,
|
||||
jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse,
|
||||
SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC),
|
||||
SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC),
|
||||
WAGGREGATE(jsonb_group_object,2, JSON_BLOB, 0,
|
||||
jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse,
|
||||
SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC)
|
||||
SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8|
|
||||
SQLITE_DETERMINISTIC)
|
||||
};
|
||||
sqlite3InsertBuiltinFuncs(aJsonFunc, ArraySize(aJsonFunc));
|
||||
#endif
|
||||
|
@ -1914,7 +1914,7 @@ int sqlite3CreateFunc(
|
||||
assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC );
|
||||
assert( SQLITE_FUNC_DIRECT==SQLITE_DIRECTONLY );
|
||||
extraFlags = enc & (SQLITE_DETERMINISTIC|SQLITE_DIRECTONLY|
|
||||
SQLITE_SUBTYPE|SQLITE_INNOCUOUS);
|
||||
SQLITE_SUBTYPE|SQLITE_INNOCUOUS|SQLITE_RESULT_SUBTYPE);
|
||||
enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY);
|
||||
|
||||
/* The SQLITE_INNOCUOUS flag is the same bit as SQLITE_FUNC_UNSAFE. But
|
||||
|
@ -5062,10 +5062,13 @@ act_like_temp_file:
|
||||
*/
|
||||
sqlite3_file *sqlite3_database_file_object(const char *zName){
|
||||
Pager *pPager;
|
||||
const char *p;
|
||||
while( zName[-1]!=0 || zName[-2]!=0 || zName[-3]!=0 || zName[-4]!=0 ){
|
||||
zName--;
|
||||
}
|
||||
pPager = *(Pager**)(zName - 4 - sizeof(Pager*));
|
||||
p = zName - 4 - sizeof(Pager*);
|
||||
assert( EIGHT_BYTE_ALIGNMENT(p) );
|
||||
pPager = *(Pager**)p;
|
||||
return pPager->fd;
|
||||
}
|
||||
|
||||
|
@ -7397,6 +7397,7 @@ int sqlite3Select(
|
||||
TREETRACE(0x1000,pParse,p,
|
||||
("LEFT-JOIN simplifies to JOIN on term %d\n",i));
|
||||
pItem->fg.jointype &= ~(JT_LEFT|JT_OUTER);
|
||||
unsetJoinExpr(p->pWhere, pItem->iCursor, 0);
|
||||
}
|
||||
}
|
||||
if( pItem->fg.jointype & JT_LTORJ ){
|
||||
@ -7411,6 +7412,7 @@ int sqlite3Select(
|
||||
TREETRACE(0x1000,pParse,p,
|
||||
("RIGHT-JOIN simplifies to JOIN on term %d\n",j));
|
||||
pI2->fg.jointype &= ~(JT_RIGHT|JT_OUTER);
|
||||
unsetJoinExpr(p->pWhere, pI2->iCursor, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7419,9 +7421,6 @@ int sqlite3Select(
|
||||
if( pTabList->a[j].fg.jointype & JT_RIGHT ) break;
|
||||
}
|
||||
}
|
||||
assert( pItem->iCursor>=0 );
|
||||
unsetJoinExpr(p->pWhere, pItem->iCursor,
|
||||
pTabList->a[0].fg.jointype & JT_LTORJ);
|
||||
}
|
||||
|
||||
/* No further action if this term of the FROM clause is not a subquery */
|
||||
|
@ -1311,7 +1311,11 @@ static void shellDtostr(
|
||||
char z[400];
|
||||
if( n<1 ) n = 1;
|
||||
if( n>350 ) n = 350;
|
||||
#if defined(_MSC_VER)
|
||||
_snprintf(z, sizeof(z)-2, "%#+.*e", n, r);
|
||||
#else
|
||||
snprintf(z, sizeof(z)-1, "%#+.*e", n, r);
|
||||
#endif
|
||||
sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
|
@ -5573,13 +5573,27 @@ int sqlite3_create_window_function(
|
||||
** </dd>
|
||||
**
|
||||
** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
|
||||
** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call
|
||||
** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
|
||||
** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
|
||||
** Specifying this flag makes no difference for scalar or aggregate user
|
||||
** functions. However, if it is not specified for a user-defined window
|
||||
** function, then any sub-types belonging to arguments passed to the window
|
||||
** function may be discarded before the window function is called (i.e.
|
||||
** sqlite3_value_subtype() will always return 0).
|
||||
** This flag instructs SQLite to omit some corner-case optimizations that
|
||||
** might disrupt the operation of the [sqlite3_value_subtype()] function,
|
||||
** causing it to return zero rather than the correct subtype().
|
||||
** SQL functions that invokes [sqlite3_value_subtype()] should have this
|
||||
** property. If the SQLITE_SUBTYPE property is omitted, then the return
|
||||
** value from [sqlite3_value_subtype()] might sometimes be zero even though
|
||||
** a non-zero subtype was specified by the function argument expression.
|
||||
**
|
||||
** [[SQLITE_RESULT_SUBTYPE]] <dt>SQLITE_RESULT_SUBTYPE</dt><dd>
|
||||
** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
|
||||
** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
|
||||
** result.
|
||||
** Every function that invokes [sqlite3_result_subtype()] should have this
|
||||
** property. If it does not, then the call to [sqlite3_result_subtype()]
|
||||
** might become a no-op if the function is used as term in an
|
||||
** [expression index]. On the other hand, SQL functions that never invoke
|
||||
** [sqlite3_result_subtype()] should avoid setting this property, as the
|
||||
** purpose of this property is to disable certain optimizations that are
|
||||
** incompatible with subtypes.
|
||||
** </dd>
|
||||
** </dl>
|
||||
*/
|
||||
@ -5587,6 +5601,7 @@ int sqlite3_create_window_function(
|
||||
#define SQLITE_DIRECTONLY 0x000080000
|
||||
#define SQLITE_SUBTYPE 0x000100000
|
||||
#define SQLITE_INNOCUOUS 0x000200000
|
||||
#define SQLITE_RESULT_SUBTYPE 0x001000000
|
||||
|
||||
/*
|
||||
** CAPI3REF: Deprecated Functions
|
||||
@ -5783,6 +5798,12 @@ int sqlite3_value_encoding(sqlite3_value*);
|
||||
** information can be used to pass a limited amount of context from
|
||||
** one SQL function to another. Use the [sqlite3_result_subtype()]
|
||||
** routine to set the subtype for the return value of an SQL function.
|
||||
**
|
||||
** Every [application-defined SQL function] that invoke this interface
|
||||
** should include the [SQLITE_SUBTYPE] property in the text
|
||||
** encoding argument when the function is [sqlite3_create_function|registered].
|
||||
** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
|
||||
** might return zero instead of the upstream subtype in some corner cases.
|
||||
*/
|
||||
unsigned int sqlite3_value_subtype(sqlite3_value*);
|
||||
|
||||
@ -6202,6 +6223,20 @@ int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
|
||||
** higher order bits are discarded.
|
||||
** The number of subtype bytes preserved by SQLite might increase
|
||||
** in future releases of SQLite.
|
||||
**
|
||||
** Every [application-defined SQL function] that invokes this interface
|
||||
** should include the [SQLITE_RESULT_SUBTYPE] property in its
|
||||
** text encoding argument when the SQL function is
|
||||
** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
|
||||
** property is omitted from the function that invokes sqlite3_result_subtype(),
|
||||
** then in some cases the sqlite3_result_subtype() might fail to set
|
||||
** the result subtype.
|
||||
**
|
||||
** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
|
||||
** SQL function that invokes the sqlite3_result_subtype() interface
|
||||
** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
|
||||
** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
|
||||
** by default.
|
||||
*/
|
||||
void sqlite3_result_subtype(sqlite3_context*,unsigned int);
|
||||
|
||||
|
@ -2018,10 +2018,11 @@ struct FuncDestructor {
|
||||
#define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */
|
||||
#define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */
|
||||
#define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */
|
||||
#define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */
|
||||
/* SQLITE_SUBTYPE 0x00100000 // Consumer of subtypes */
|
||||
#define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */
|
||||
#define SQLITE_FUNC_INLINE 0x00400000 /* Functions implemented in-line */
|
||||
#define SQLITE_FUNC_BUILTIN 0x00800000 /* This is a built-in function */
|
||||
/* SQLITE_RESULT_SUBTYPE 0x01000000 // Generator of subtypes */
|
||||
#define SQLITE_FUNC_ANYORDER 0x08000000 /* count/min/max aggregate */
|
||||
|
||||
/* Identifier numbers for each in-line function */
|
||||
@ -2113,9 +2114,10 @@ struct FuncDestructor {
|
||||
#define MFUNCTION(zName, nArg, xPtr, xFunc) \
|
||||
{nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
|
||||
xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
|
||||
#define JFUNCTION(zName, nArg, bUseCache, bSubtype, bJsonB, iArg, xFunc) \
|
||||
#define JFUNCTION(zName, nArg, bUseCache, bWS, bRS, bJsonB, iArg, xFunc) \
|
||||
{nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_FUNC_CONSTANT|\
|
||||
SQLITE_UTF8|((bUseCache)*SQLITE_FUNC_RUNONLY)|((bSubtype)*SQLITE_SUBTYPE), \
|
||||
SQLITE_UTF8|((bUseCache)*SQLITE_FUNC_RUNONLY)|\
|
||||
((bRS)*SQLITE_SUBTYPE)|((bWS)*SQLITE_RESULT_SUBTYPE), \
|
||||
SQLITE_INT_TO_PTR(iArg|((bJsonB)*JSON_BLOB)),0,xFunc,0, 0, 0, #zName, {0} }
|
||||
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
|
||||
{nArg, SQLITE_FUNC_BUILTIN|\
|
||||
|
@ -8340,6 +8340,7 @@ case OP_VColumn: { /* ncycle */
|
||||
sContext.pOut = pDest;
|
||||
sContext.enc = encoding;
|
||||
nullFunc.pUserData = 0;
|
||||
nullFunc.funcFlags = SQLITE_RESULT_SUBTYPE;
|
||||
sContext.pFunc = &nullFunc;
|
||||
assert( pOp->p5==OPFLAG_NOCHNG || pOp->p5==0 );
|
||||
if( pOp->p5 & OPFLAG_NOCHNG ){
|
||||
|
@ -539,6 +539,18 @@ void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
if( pCtx==0 ) return;
|
||||
#endif
|
||||
#if defined(SQLITE_STRICT_SUBTYPE) && SQLITE_STRICT_SUBTYPE+0!=0
|
||||
if( pCtx->pFunc!=0
|
||||
&& (pCtx->pFunc->funcFlags & SQLITE_RESULT_SUBTYPE)==0
|
||||
){
|
||||
char zErr[200];
|
||||
sqlite3_snprintf(sizeof(zErr), zErr,
|
||||
"misuse of sqlite3_result_subtype() by %s()",
|
||||
pCtx->pFunc->zName);
|
||||
sqlite3_result_error(pCtx, zErr, -1);
|
||||
return;
|
||||
}
|
||||
#endif /* SQLITE_STRICT_SUBTYPE */
|
||||
pOut = pCtx->pOut;
|
||||
assert( sqlite3_mutex_held(pOut->db->mutex) );
|
||||
pOut->eSubtype = eSubtype & 0xff;
|
||||
|
14
src/where.c
14
src/where.c
@ -5810,6 +5810,20 @@ static SQLITE_NOINLINE void whereAddIndexedExpr(
|
||||
continue;
|
||||
}
|
||||
if( sqlite3ExprIsConstant(pExpr) ) continue;
|
||||
if( pExpr->op==TK_FUNCTION ){
|
||||
/* Functions that might set a subtype should not be replaced by the
|
||||
** value taken from an expression index since the index omits the
|
||||
** subtype. https://sqlite.org/forum/forumpost/68d284c86b082c3e */
|
||||
int n;
|
||||
FuncDef *pDef;
|
||||
sqlite3 *db = pParse->db;
|
||||
assert( ExprUseXList(pExpr) );
|
||||
n = ALWAYS(pExpr->x.pList) ? pExpr->x.pList->nExpr : 0;
|
||||
pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
|
||||
if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
p = sqlite3DbMallocRaw(pParse->db, sizeof(IndexedExpr));
|
||||
if( p==0 ) break;
|
||||
p->pIENext = pParse->pIdxEpr;
|
||||
|
@ -1038,7 +1038,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
|
||||
assert( ExprUseXList(pWin->pOwner) );
|
||||
assert( pWin->pWFunc!=0 );
|
||||
pArgs = pWin->pOwner->x.pList;
|
||||
if( pWin->pWFunc->funcFlags & SQLITE_FUNC_SUBTYPE ){
|
||||
if( pWin->pWFunc->funcFlags & SQLITE_SUBTYPE ){
|
||||
selectWindowRewriteEList(pParse, pMWin, pSrc, pArgs, pTab, &pSublist);
|
||||
pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
|
||||
pWin->bExprArgs = 1;
|
||||
|
@ -616,4 +616,18 @@ do_execsql_test indexexpr1-2200 {
|
||||
) v ON v.type = 0 AND v.tag = u.tag;
|
||||
} {7 100 8 101}
|
||||
|
||||
# 2023-11-08 Forum post https://sqlite.org/forum/forumpost/68d284c86b082c3e
|
||||
#
|
||||
# Functions that return subtypes and that are indexed cannot be used to
|
||||
# cover function calls from the main table, since the indexed value does
|
||||
# not know the subtype.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test indexexpr1-2300 {
|
||||
CREATE TABLE t1(x INT, y TEXT);
|
||||
INSERT INTO t1(x,y) VALUES(1,'{b:5}');
|
||||
CREATE INDEX t1j ON t1(json(y));
|
||||
SELECT json_insert('{}', '$.a', json(y)) FROM t1;
|
||||
} {{{"a":{"b":5}}}}
|
||||
|
||||
finish_test
|
||||
|
@ -250,5 +250,45 @@ do_catchsql_test 9.11 {
|
||||
SELECT oid FROM wo2 JOIN (wo3 JOIN x3)
|
||||
} {0 99}
|
||||
|
||||
reset_db
|
||||
do_execsql_test 10.0 {
|
||||
CREATE TABLE rt0 (c0 INTEGER, c1 INTEGER, c2 INTEGER, c3 INTEGER, c4 INTEGER);
|
||||
CREATE TABLE rt3 (c3 INTEGER);
|
||||
|
||||
INSERT INTO rt0(c3, c1) VALUES (x'', '1');
|
||||
INSERT INTO rt0(c3, c1) VALUES ('-1', -1e500);
|
||||
INSERT INTO rt0(c3, c1) VALUES (1, x'');
|
||||
|
||||
CREATE VIEW v6(c0, c1, c2) AS SELECT 0, 0, 0;
|
||||
}
|
||||
|
||||
do_execsql_test 10.1 {
|
||||
SELECT COUNT(*) FROM rt0 LEFT JOIN rt3 JOIN v6 ON ((CASE v6.c0 WHEN rt0.c4 THEN rt3.c3 END) NOT BETWEEN (rt0.c4) AND (NULL)) WHERE (rt0.c1); -- 2
|
||||
} {0}
|
||||
|
||||
do_execsql_test 10.2 {
|
||||
SELECT COUNT(*) FROM rt0 LEFT JOIN rt3 RIGHT OUTER JOIN v6 ON ((CASE v6.c0 WHEN rt0.c4 THEN rt3.c3 END) NOT BETWEEN (rt0.c4) AND (NULL)) WHERE (rt0.c1); -- 2
|
||||
} {0}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
do_execsql_test 11.1 {
|
||||
CREATE TABLE t1(a, b);
|
||||
CREATE TABLE t2(c, d);
|
||||
CREATE TABLE t3(e, f);
|
||||
|
||||
INSERT INTO t1 VALUES(1, 1);
|
||||
INSERT INTO t2 VALUES(2, 2);
|
||||
INSERT INTO t3 VALUES(3, 3);
|
||||
}
|
||||
|
||||
do_execsql_test 11.2 {
|
||||
SELECT * FROM t1 LEFT JOIN t2 RIGHT JOIN t3 ON (t2.c=10)
|
||||
} {{} {} {} {} 3 3}
|
||||
|
||||
do_execsql_test 11.3 {
|
||||
SELECT * FROM t1 LEFT JOIN t2 RIGHT JOIN t3 ON (t2.c=10) WHERE t1.a=1
|
||||
} {}
|
||||
|
||||
|
||||
finish_test
|
||||
|
@ -300,5 +300,10 @@ do_execsql_test 12.4 {
|
||||
|| ' "xyz"}')->>'a';
|
||||
} xyz
|
||||
|
||||
# 2023-11-08 forum/forumpost/ddcad3e884
|
||||
#
|
||||
do_execsql_test 13.1 {
|
||||
SELECT json('{x:''a "b" c''}');
|
||||
} {{{"x":"a \"b\" c"}}}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user