mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Expand passing of a last error argument to the getLastErrorMsg function. Also, remove unused SQLITE_W32_THREADS define.
FossilOrigin-Name: 8f28797984c1d4700357a75815ca4b324c3ebf5c
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C In\swinAccess,\ssave\sthe\sWin32\slast\serror\svalue\sprior\sto\sinvoking\suser\slogging\scallback.\s\sAlso,\sexplicitly\spass\sthe\sWin32\slast\serror\svalue\sto\swinLogError\sin\sorder\sto\skeep\sit\saccurate.\s\sFixes\sa\sproblem\sreported\son\sthe\smailing\slist.
|
C Expand\spassing\sof\sa\slast\serror\sargument\sto\sthe\sgetLastErrorMsg\sfunction.\s\sAlso,\sremove\sunused\sSQLITE_W32_THREADS\sdefine.
|
||||||
D 2011-11-10T20:21:20.308
|
D 2011-11-10T21:45:06.907
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
|
F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -167,7 +167,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
|
|||||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||||
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
||||||
F src/os_unix.c 4fbb91726165e105c1679a2660f49a3f4c376e4f
|
F src/os_unix.c 4fbb91726165e105c1679a2660f49a3f4c376e4f
|
||||||
F src/os_win.c a9190cb70e5071776e0064f7a04778c594c2afad
|
F src/os_win.c d6cf718667c4d89d930f30caa6cdc7f7753e259a
|
||||||
F src/pager.c db33d4bf1e3e019c34c220971cc6c3aa07c30f54
|
F src/pager.c db33d4bf1e3e019c34c220971cc6c3aa07c30f54
|
||||||
F src/pager.h 9f81b08efb06db4ba8be69446e10b005c351373d
|
F src/pager.h 9f81b08efb06db4ba8be69446e10b005c351373d
|
||||||
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
||||||
@@ -974,7 +974,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
|||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
|
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
|
||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
P 0c951a970436725b6bbd64568de500f7a4e6460b
|
P 32ab365715e2c50f30aa2f92a323857b9d917bf6
|
||||||
R 07fcb0ebb49fcaa5a3b1285d87c90ade
|
R d5d8a9a49f50a40940976e300037af02
|
||||||
U mistachkin
|
U mistachkin
|
||||||
Z 984e599e94c8add22fe67965d6d580c6
|
Z a0f426067c598247950f7d47f9af3362
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
32ab365715e2c50f30aa2f92a323857b9d917bf6
|
8f28797984c1d4700357a75815ca4b324c3ebf5c
|
||||||
30
src/os_win.c
30
src/os_win.c
@@ -48,13 +48,6 @@
|
|||||||
# include <sys/cygwin.h>
|
# include <sys/cygwin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
** Macros used to determine whether or not to use threads.
|
|
||||||
*/
|
|
||||||
#if defined(THREADSAFE) && THREADSAFE
|
|
||||||
# define SQLITE_W32_THREADS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Include code that is common to all os_*.c files
|
** Include code that is common to all os_*.c files
|
||||||
*/
|
*/
|
||||||
@@ -558,20 +551,21 @@ char *sqlite3_win32_utf8_to_mbcs(const char *zFilename){
|
|||||||
** is zero if the error message fits in the buffer, or non-zero
|
** is zero if the error message fits in the buffer, or non-zero
|
||||||
** otherwise (if the message was truncated).
|
** otherwise (if the message was truncated).
|
||||||
*/
|
*/
|
||||||
static int getLastErrorMsg(int nBuf, char *zBuf){
|
static int getLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){
|
||||||
/* FormatMessage returns 0 on failure. Otherwise it
|
/* FormatMessage returns 0 on failure. Otherwise it
|
||||||
** returns the number of TCHARs written to the output
|
** returns the number of TCHARs written to the output
|
||||||
** buffer, excluding the terminating null char.
|
** buffer, excluding the terminating null char.
|
||||||
*/
|
*/
|
||||||
DWORD error = GetLastError();
|
|
||||||
DWORD dwLen = 0;
|
DWORD dwLen = 0;
|
||||||
char *zOut = 0;
|
char *zOut = 0;
|
||||||
|
|
||||||
if( isNT() ){
|
if( isNT() ){
|
||||||
WCHAR *zTempWide = NULL;
|
WCHAR *zTempWide = NULL;
|
||||||
dwLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
dwLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL,
|
NULL,
|
||||||
error,
|
lastErrno,
|
||||||
0,
|
0,
|
||||||
(LPWSTR) &zTempWide,
|
(LPWSTR) &zTempWide,
|
||||||
0,
|
0,
|
||||||
@@ -589,9 +583,11 @@ static int getLastErrorMsg(int nBuf, char *zBuf){
|
|||||||
#if SQLITE_OS_WINCE==0
|
#if SQLITE_OS_WINCE==0
|
||||||
}else{
|
}else{
|
||||||
char *zTemp = NULL;
|
char *zTemp = NULL;
|
||||||
dwLen = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
dwLen = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL,
|
NULL,
|
||||||
error,
|
lastErrno,
|
||||||
0,
|
0,
|
||||||
(LPSTR) &zTemp,
|
(LPSTR) &zTemp,
|
||||||
0,
|
0,
|
||||||
@@ -605,7 +601,7 @@ static int getLastErrorMsg(int nBuf, char *zBuf){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if( 0 == dwLen ){
|
if( 0 == dwLen ){
|
||||||
sqlite3_snprintf(nBuf, zBuf, "OsError 0x%x (%u)", error, error);
|
sqlite3_snprintf(nBuf, zBuf, "OsError 0x%x (%u)", lastErrno, lastErrno);
|
||||||
}else{
|
}else{
|
||||||
/* copy a maximum of nBuf chars to output buffer */
|
/* copy a maximum of nBuf chars to output buffer */
|
||||||
sqlite3_snprintf(nBuf, zBuf, "%s", zOut);
|
sqlite3_snprintf(nBuf, zBuf, "%s", zOut);
|
||||||
@@ -642,7 +638,7 @@ static int winLogErrorAtLine(
|
|||||||
int i; /* Loop counter */
|
int i; /* Loop counter */
|
||||||
|
|
||||||
zMsg[0] = 0;
|
zMsg[0] = 0;
|
||||||
getLastErrorMsg(sizeof(zMsg), zMsg);
|
getLastErrorMsg(lastErrno, sizeof(zMsg), zMsg);
|
||||||
assert( errcode!=SQLITE_OK );
|
assert( errcode!=SQLITE_OK );
|
||||||
if( zPath==0 ) zPath = "";
|
if( zPath==0 ) zPath = "";
|
||||||
for(i=0; zMsg[i] && zMsg[i]!='\r' && zMsg[i]!='\n'; i++){}
|
for(i=0; zMsg[i] && zMsg[i]!='\r' && zMsg[i]!='\n'; i++){}
|
||||||
@@ -2998,7 +2994,7 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
|
|||||||
}
|
}
|
||||||
static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
|
static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
|
||||||
UNUSED_PARAMETER(pVfs);
|
UNUSED_PARAMETER(pVfs);
|
||||||
getLastErrorMsg(nBuf, zBufOut);
|
getLastErrorMsg(GetLastError(), nBuf, zBufOut);
|
||||||
}
|
}
|
||||||
static void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){
|
static void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){
|
||||||
UNUSED_PARAMETER(pVfs);
|
UNUSED_PARAMETER(pVfs);
|
||||||
@@ -3172,7 +3168,7 @@ static int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
|
|||||||
*/
|
*/
|
||||||
static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
|
static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
|
||||||
UNUSED_PARAMETER(pVfs);
|
UNUSED_PARAMETER(pVfs);
|
||||||
return getLastErrorMsg(nBuf, zBuf);
|
return getLastErrorMsg(GetLastError(), nBuf, zBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user