mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +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:
@@ -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 <stdint.h>
|
||||
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);
|
||||
|
Reference in New Issue
Block a user