/ Check-in [ca4b7ffb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modified the xWrite() method on Windows to differentiate between IO and disk full error returns.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ca4b7ffbd44937a02ae62d606f9e1eb767075c22
User & Date: shaneh 2010-07-06 20:33:48
Context
2010-07-06
20:34
Changes to pager1.test to support Windows. check-in: fce689eb user: shaneh tags: trunk
20:33
Modified the xWrite() method on Windows to differentiate between IO and disk full error returns. check-in: ca4b7ffb user: shaneh tags: trunk
11:26
Do not do the *-closeallfiles test for notify2.test. It uses multiple threads. check-in: fb09152d user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

727
728
729
730
731
732
733

734



735
736
737
738
739
740
741
742
743
744
745
746

747



748
749
750
751
752
753
754
  assert( id!=0 );
  SimulateIOError(return SQLITE_IOERR_WRITE);
  SimulateDiskfullError(return SQLITE_FULL);
  OSTRACE(("WRITE %d lock=%d\n", pFile->h, pFile->locktype));
  rc = SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
  if( rc==INVALID_SET_FILE_POINTER && (error=GetLastError())!=NO_ERROR ){
    pFile->lastErrno = error;

    return SQLITE_FULL;



  }
  assert( amt>0 );
  while(
     amt>0
     && (rc = WriteFile(pFile->h, pBuf, amt, &wrote, 0))!=0
     && wrote>0
  ){
    amt -= wrote;
    pBuf = &((char*)pBuf)[wrote];
  }
  if( !rc || amt>(int)wrote ){
    pFile->lastErrno = GetLastError();

    return SQLITE_FULL;



  }
  return SQLITE_OK;
}

/*
** Truncate an open file to a specified size
*/







>
|
>
>
>












>
|
>
>
>







727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
  assert( id!=0 );
  SimulateIOError(return SQLITE_IOERR_WRITE);
  SimulateDiskfullError(return SQLITE_FULL);
  OSTRACE(("WRITE %d lock=%d\n", pFile->h, pFile->locktype));
  rc = SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
  if( rc==INVALID_SET_FILE_POINTER && (error=GetLastError())!=NO_ERROR ){
    pFile->lastErrno = error;
    if( pFile->lastErrno==ERROR_HANDLE_DISK_FULL ){
      return SQLITE_FULL;
    }else{
      return SQLITE_IOERR_WRITE;
    }
  }
  assert( amt>0 );
  while(
     amt>0
     && (rc = WriteFile(pFile->h, pBuf, amt, &wrote, 0))!=0
     && wrote>0
  ){
    amt -= wrote;
    pBuf = &((char*)pBuf)[wrote];
  }
  if( !rc || amt>(int)wrote ){
    pFile->lastErrno = GetLastError();
    if( pFile->lastErrno==ERROR_HANDLE_DISK_FULL ){
      return SQLITE_FULL;
    }else{
      return SQLITE_IOERR_WRITE;
    }
  }
  return SQLITE_OK;
}

/*
** Truncate an open file to a specified size
*/