1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix for forum-post [/forum/forumpost/b5fde3596c|b5fde3596c]. Also fix encoding issue for non-ASCII characters.

Also includes a fix from Stephan Beal, about a missing <stdint.h> include.

FossilOrigin-Name: e60198001e12f85a5d6504ce72226dfceb8666fe5ec649237fa23ae20e8aa32d
This commit is contained in:
jan.nijtmans
2025-03-27 17:30:49 +00:00
parent 7b3477c776
commit 1f3207a52a
3 changed files with 23 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
C Fix\san\soff-by-one\sbug\sin\sthe\s".dbtotxt"\scommand\sfrom\sthe\sshell\sthat\sresults\nin\sincorrect\soutput. C Fix\sfor\sforum-post\s[/forum/forumpost/b5fde3596c|b5fde3596c].\sAlso\sfix\sencoding\sissue\sfor\snon-ASCII\scharacters.\nAlso\sincludes\sa\sfix\sfrom\sStephan\sBeal,\sabout\sa\smissing\s<stdint.h>\sinclude.
D 2025-03-27T10:59:18.433 D 2025-03-27T17:30:49.432
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -793,7 +793,7 @@ F src/sqliteInt.h 96133c5b4371629b30644a88108a0ca99e6a95a55509cdfc8de9961fba4bbd
F src/sqliteLimit.h 6d817c28a8f19af95e6f4921933b7fbbca48a962bce0eb0ec81e8bb3ef38e68b F src/sqliteLimit.h 6d817c28a8f19af95e6f4921933b7fbbca48a962bce0eb0ec81e8bb3ef38e68b
F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 254e69d6b4bc185ca2a3b186a92bda186aec9038063ebb9247b9b3181d4b4d4f F src/tclsqlite.c 767a11d470b031e85f51b8924a0e8929b2362ff1975aee3474a10eba3c2e0d36
F src/tclsqlite.h 65e2c761446e1c9fa0342b7d2612a703483643c8b6a316d12a65b745a4727395 F src/tclsqlite.h 65e2c761446e1c9fa0342b7d2612a703483643c8b6a316d12a65b745a4727395
F src/test1.c ba7b93478a6a7a3f48ec5507f28bc662636ac5d9f9791700d3648a8e788f0bb2 F src/test1.c ba7b93478a6a7a3f48ec5507f28bc662636ac5d9f9791700d3648a8e788f0bb2
F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3 F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3
@@ -2215,8 +2215,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P d25c8a6222d4e3f20c137b1490572ad491d9c404ff12947d5867c3e00fcb615c P 2345094e879c5538bfea005785ce0848e6d565a49bcb48b323c258d00ccbe9b8
R 7f1dc2197ed34b61300fd57f99c67793 R 4ff975de44798fc382336120e7cd3853
U drh T *branch * tclsqlite-db-copy-fix
Z 6f6d82890663e463e31bf8fc619d730c T *sym-tclsqlite-db-copy-fix *
T -sym-trunk *
U jan.nijtmans
Z b45977ee1b24660b9e02a9cdf40f95f6
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
2345094e879c5538bfea005785ce0848e6d565a49bcb48b323c258d00ccbe9b8 e60198001e12f85a5d6504ce72226dfceb8666fe5ec649237fa23ae20e8aa32d

View File

@@ -76,7 +76,9 @@
# define SQLITE_PTRSIZE 8 # define SQLITE_PTRSIZE 8
# endif # endif
# endif /* SQLITE_PTRSIZE */ # endif /* SQLITE_PTRSIZE */
# if defined(HAVE_STDINT_H) # if defined(HAVE_STDINT_H) || (defined(__STDC_VERSION__) && \
(__STDC_VERSION__ >= 199901L))
# include <stdint.h>
typedef uintptr_t uptr; typedef uintptr_t uptr;
# elif SQLITE_PTRSIZE==4 # elif SQLITE_PTRSIZE==4
typedef unsigned int uptr; typedef unsigned int uptr;
@@ -2525,7 +2527,7 @@ static int SQLITE_TCLAPI DbObjCmd(
Tcl_Channel in; /* The input file */ Tcl_Channel in; /* The input file */
int lineno = 0; /* Line number of input file */ int lineno = 0; /* Line number of input file */
char zLineNum[80]; /* Line number print buffer */ char zLineNum[80]; /* Line number print buffer */
Tcl_DString str; Tcl_Obj *str;
Tcl_Obj *pResult; /* interp result */ Tcl_Obj *pResult; /* interp result */
const char *zSep; const char *zSep;
@@ -2609,19 +2611,22 @@ static int SQLITE_TCLAPI DbObjCmd(
sqlite3_finalize(pStmt); sqlite3_finalize(pStmt);
return TCL_ERROR; return TCL_ERROR;
} }
Tcl_SetChannelOption(NULL, in, "-translation", "auto");
azCol = malloc( sizeof(azCol[0])*(nCol+1) ); azCol = malloc( sizeof(azCol[0])*(nCol+1) );
if( azCol==0 ) { if( azCol==0 ) {
Tcl_AppendResult(interp, "Error: can't malloc()", (char*)0); Tcl_AppendResult(interp, "Error: can't malloc()", (char*)0);
Tcl_Close(interp, in); Tcl_Close(interp, in);
return TCL_ERROR; return TCL_ERROR;
} }
Tcl_DStringInit(&str); str = Tcl_NewObj();
Tcl_IncrRefCount(str);
(void)sqlite3_exec(pDb->db, "BEGIN", 0, 0, 0); (void)sqlite3_exec(pDb->db, "BEGIN", 0, 0, 0);
zCommit = "COMMIT"; zCommit = "COMMIT";
while( Tcl_Gets(in, &str)>=0 ) { while( Tcl_GetsObj(in, str)>=0 ) {
char *z; char *z;
Tcl_Size byteLen;
lineno++; lineno++;
zLine = Tcl_DStringValue(&str); zLine = (char *)Tcl_GetByteArrayFromObj(str, &byteLen);
azCol[0] = zLine; azCol[0] = zLine;
for(i=0, z=zLine; *z; z++){ for(i=0, z=zLine; *z; z++){
if( *z==zSep[0] && strncmp(z, zSep, nSep)==0 ){ if( *z==zSep[0] && strncmp(z, zSep, nSep)==0 ){
@@ -2659,14 +2664,14 @@ static int SQLITE_TCLAPI DbObjCmd(
} }
sqlite3_step(pStmt); sqlite3_step(pStmt);
rc = sqlite3_reset(pStmt); rc = sqlite3_reset(pStmt);
Tcl_DStringSetLength(&str, 0); Tcl_SetObjLength(str, 0);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
Tcl_AppendResult(interp,"Error: ", sqlite3_errmsg(pDb->db), (char*)0); Tcl_AppendResult(interp,"Error: ", sqlite3_errmsg(pDb->db), (char*)0);
zCommit = "ROLLBACK"; zCommit = "ROLLBACK";
break; break;
} }
} }
Tcl_DStringFree(&str); Tcl_DecrRefCount(str);
free(azCol); free(azCol);
Tcl_Close(interp, in); Tcl_Close(interp, in);
sqlite3_finalize(pStmt); sqlite3_finalize(pStmt);