mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Fix the windows OS layer so that it returns detailed IOERR error codes. (CVS 3583)
FossilOrigin-Name: 4b36de46c42e2e42d611b38ff18949bea55c803b
This commit is contained in:
12
src/os_win.c
12
src/os_win.c
@@ -1000,7 +1000,7 @@ static int winClose(OsFile **pId){
|
||||
static int winRead(OsFile *id, void *pBuf, int amt){
|
||||
DWORD got;
|
||||
assert( id!=0 );
|
||||
SimulateIOError(return SQLITE_IOERR);
|
||||
SimulateIOError(return SQLITE_IOERR_READ);
|
||||
TRACE3("READ %d lock=%d\n", ((winFile*)id)->h, ((winFile*)id)->locktype);
|
||||
if( !ReadFile(((winFile*)id)->h, pBuf, amt, &got, 0) ){
|
||||
return SQLITE_IOERR_READ;
|
||||
@@ -1021,7 +1021,7 @@ static int winWrite(OsFile *id, const void *pBuf, int amt){
|
||||
int rc = 0;
|
||||
DWORD wrote;
|
||||
assert( id!=0 );
|
||||
SimulateIOError(return SQLITE_IOERR);
|
||||
SimulateIOError(return SQLITE_IOERR_READ);
|
||||
SimulateDiskfullError(return SQLITE_FULL);
|
||||
TRACE3("WRITE %d lock=%d\n", ((winFile*)id)->h, ((winFile*)id)->locktype);
|
||||
assert( amt>0 );
|
||||
@@ -1081,7 +1081,7 @@ static int winSync(OsFile *id, int dataOnly){
|
||||
** than UNIX.
|
||||
*/
|
||||
int sqlite3WinSyncDirectory(const char *zDirname){
|
||||
SimulateIOError(return SQLITE_IOERR);
|
||||
SimulateIOError(return SQLITE_IOERR_READ);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@@ -1092,7 +1092,7 @@ static int winTruncate(OsFile *id, i64 nByte){
|
||||
LONG upperBits = nByte>>32;
|
||||
assert( id!=0 );
|
||||
TRACE3("TRUNCATE %d %lld\n", ((winFile*)id)->h, nByte);
|
||||
SimulateIOError(return SQLITE_IOERR);
|
||||
SimulateIOError(return SQLITE_IOERR_TRUNCATE);
|
||||
SetFilePointer(((winFile*)id)->h, nByte, &upperBits, FILE_BEGIN);
|
||||
SetEndOfFile(((winFile*)id)->h);
|
||||
return SQLITE_OK;
|
||||
@@ -1104,7 +1104,7 @@ static int winTruncate(OsFile *id, i64 nByte){
|
||||
static int winFileSize(OsFile *id, i64 *pSize){
|
||||
DWORD upperBits, lowerBits;
|
||||
assert( id!=0 );
|
||||
SimulateIOError(return SQLITE_IOERR);
|
||||
SimulateIOError(return SQLITE_IOERR_FSTAT);
|
||||
lowerBits = GetFileSize(((winFile*)id)->h, &upperBits);
|
||||
*pSize = (((i64)upperBits)<<32) + lowerBits;
|
||||
return SQLITE_OK;
|
||||
@@ -1365,7 +1365,7 @@ static int winUnlock(OsFile *id, int locktype){
|
||||
if( locktype==SHARED_LOCK && !getReadLock(pFile) ){
|
||||
/* This should never happen. We should always be able to
|
||||
** reacquire the read lock */
|
||||
rc = SQLITE_IOERR;
|
||||
rc = SQLITE_IOERR_UNLOCK;
|
||||
}
|
||||
}
|
||||
if( type>=RESERVED_LOCK ){
|
||||
|
||||
Reference in New Issue
Block a user