Complete shell transition to using {f,o,e}put{f,z}() emit functions. This fails test 13.1 in json501.test, but so does trunk in the same way.

FossilOrigin-Name: 923c6b8b3a508c715b816c6bcd2ae9ac519bc37a62afc4ef813085c00f1e7cb6
This commit is contained in:
larrybr 2023-11-11 20:46:12 +00:00
commit 1bcb7c4902
7 changed files with 754 additions and 763 deletions

View File

@ -503,6 +503,34 @@ SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z){
#endif
}
#if 0
/* Next 3 functions could be optimized to avoid console mode futzing. */
SQLITE_INTERNAL_LINKAGE int fPutcUtf8(int ch, FILE *pfO){
if( (ch & ~0x7f) != 0 ) return 0;
else{
char ac[2] = "?";
ac[0] = (char)ch;
return (fPutsUtf8(ac, pfO) > 0);
}
}
SQLITE_INTERNAL_LINKAGE int oPutcUtf8(int ch){
if( (ch & ~0x7f) != 0 ) return 0;
else{
char ac[2] = "?";
ac[0] = (char)ch;
return (oPutsUtf8(ac) > 0);
}
}
SQLITE_INTERNAL_LINKAGE int ePutcUtf8(int ch){
if( (ch & ~0x7f) != 0 ) return 0;
else{
char ac[2] = "?";
ac[0] = (char)ch;
return (ePutsUtf8(ac) > 0);
}
}
#endif
#if SHELL_CON_TRANSLATE==2
static int mbcsToUtf8InPlaceIfValid(char *pc, int nci, int nco, UINT codePage){
WCHAR wcOneCode[2];

View File

@ -136,6 +136,21 @@ SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z);
/* Like fPutsUtf8 except stream is always the designated error. */
SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z);
#if 0
/*
** Emit output like fputc(), with appropriate translation(s).
** This is not strictly needed on fully UTF-8-aware platforms.
** It exists for sake of orthogonality and output designation.
**
** The routine returns an error for non-ASCII character input.
*/
SQLITE_INTERNAL_LINKAGE int fPutcUtf8(int ch, FILE *pfO);
/* Like fPutcUtf8 except stream is always the designated output. */
SQLITE_INTERNAL_LINKAGE int oPutcUtf8(int ch);
/* Like fPutcUtf8 except stream is always the designated error. */
SQLITE_INTERNAL_LINKAGE int ePutcUtf8(int ch);
#endif
/*
** Collect input like fgets(...) with special provisions for input
** from the console on platforms that require same. Defers to the

View File

@ -69,7 +69,7 @@ import java.util.Arrays;
NUL-terminated, and conversion to a Java byte array must sometimes
be careful to add one. Functions which take a length do not require
this so long as the length is provided. Search the CApi class
for "\0" for many examples.
for "\0" for examples.
</ul>

View File

@ -937,21 +937,11 @@ public final class Sqlite implements AutoCloseable {
public static final class Stmt implements AutoCloseable {
private Sqlite _db = null;
private sqlite3_stmt stmt = null;
/**
We save the result column count in order to prevent having to
call into C to fetch that value every time we need to check
that value for the columnXyz() methods.
Design note: if this is final then we cannot zero it in
finalizeStmt().
*/
private int resultColCount;
/** Only called by the prepare() factory functions. */
Stmt(Sqlite db, sqlite3_stmt stmt){
this._db = db;
this.stmt = stmt;
this.resultColCount = CApi.sqlite3_column_count(stmt);
synchronized(nativeToWrapper){
nativeToWrapper.put(this.stmt, this);
}
@ -986,10 +976,10 @@ public final class Sqlite implements AutoCloseable {
return stmt;
}
/** Throws if n is out of range of this.resultColCount. Intended
to be used by the columnXyz() methods. */
/** Throws if n is out of range of this statement's result column
count. Intended to be used by the columnXyz() methods. */
private sqlite3_stmt checkColIndex(int n){
if(n<0 || n>=this.resultColCount){
if(n<0 || n>=columnCount()){
throw new IllegalArgumentException("Column index "+n+" is out of range.");
}
return thisStmt();
@ -1013,7 +1003,6 @@ public final class Sqlite implements AutoCloseable {
CApi.sqlite3_finalize(stmt);
stmt = null;
_db = null;
resultColCount = 0;
}
return rc;
}
@ -1184,8 +1173,18 @@ public final class Sqlite implements AutoCloseable {
public String columnDeclType(int ndx){
return CApi.sqlite3_column_decltype( checkColIndex(ndx), ndx );
}
/**
Analog to sqlite3_column_count() but throws if this statement
has been finalized.
*/
public int columnCount(){
return resultColCount;
/* We cannot reliably cache the column count in a class
member because an ALTER TABLE from a separate statement
can invalidate that count and we have no way, short of
installing a COMMIT handler or the like, of knowing when
to re-read it. We cannot install such a handler without
interfering with a client's ability to do so. */
return CApi.sqlite3_column_count(thisStmt());
}
public int columnDataCount(){
return CApi.sqlite3_data_count( thisStmt() );

View File

@ -1,5 +1,5 @@
C Fix\smalf\swith\sredirected\sinput\sdue\sto\sbad\sassumption\sthat\sstdin\sis\sa\sconsole\sin\sthe\sfgets()\sreplacement.
D 2023-11-11T13:09:09.686
C Complete\sshell\stransition\sto\susing\s{f,o,e}put{f,z}()\semit\sfunctions.\sThis\sfails\stest\s13.1\sin\sjson501.test,\sbut\sso\sdoes\strunk\sin\sthe\ssame\sway.
D 2023-11-11T20:46:12.670
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -50,8 +50,8 @@ F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd
F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94
F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
F ext/consio/console_io.c c1e16d6c41a04952784abc4b055c5739c1ee3163aa475859725b66d1ccc656bd x
F ext/consio/console_io.h c64d51d9f4e387679027d3b0977893390652f40c2e50a3c797506a9abb4856dc
F ext/consio/console_io.c 0b07826bc3cceb10b12f5a3701fc1540154916a845de003d87c447c8a68c5ba7 x
F ext/consio/console_io.h ec611fe8f08645d69cb18d46ab2a09c4653f2fc13ecb04c18e6012d8ea89c463
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
F ext/expert/expert1.test 0dd5cb096d66bed593e33053a3b364f6ef52ed72064bf5cf298364636dbf3cd6
@ -253,7 +253,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 92d443b08175c798e132a312f71b1a42140c60d473d35c149e3d95a45b6550f3
F ext/jni/src/org/sqlite/jni/capi/CApi.java bd4a6490548f913bf9719443dee3d8a233f920ed1614b622738527d746e00f5d
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
@ -298,7 +298,7 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe
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 27b141f5914c7cb0e40e90a301d5e05b77f3bd42236834a68031b7086381fafd
F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 0ef62b43b1d6a9f044e106b56c9ea42bc7150b82ebeb79cff58f5be08cb9a435
F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java aeaec95323a8186d0b8e741affff067fe893849a2d862acd443373035c7b73a0
F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 982538ddb4c0719ef87dfa664cd137b09890b546029a7477810bd64d4c47ee35
F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 40806dbbf8e120f115e33255d1813db13b40f0a598869e299a947a580429939b
F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af
@ -727,7 +727,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c d017bad7ba8e778617701a0e986fdeb393d67d6afa84fb28ef4e8b8ad2acf916
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 503331aca8785254a7bf3d74ab338a99118fa297e1184a4dde33b3cdf7a9d341
F src/shell.c.in 2bbff1e18baafccf312c622ce966792f6a70ec77b642d92b0c0df4885df76722
F src/shell.c.in 1d689534130f9c242564b820726e4af37a8e1a347025355eb5a7e67a3c1a5306
F src/sqlite.h.in 4f841d3d117b830ee5ee45e8d89ceff1195f3ebb72d041ace8d116ba4c103b35
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
@ -2141,8 +2141,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 14762a004cdf37d1e12f26aadff8ed3824893278f22ff141de86dd44d9b250f3
R 5b544ddbaeeb17ecd11dc0a538d27e36
P 79d1f2c1019964dd154fbdd3f349822cb946a2600883994523ed145047f0a9ea 0832f9a8e9f574b157c791c5cddc73aff7b2ff403509f5d78f310494d4a7f93d
R fd4407aafdd7492d23f3b236cddd5186
U larrybr
Z d3728cfdee8358558d79b5ead14c0ffb
Z cce7495ad383169e7382f36018db3c19
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
79d1f2c1019964dd154fbdd3f349822cb946a2600883994523ed145047f0a9ea
923c6b8b3a508c715b816c6bcd2ae9ac519bc37a62afc4ef813085c00f1e7cb6

File diff suppressed because it is too large Load Diff