/ Check-in [1cca9a49]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Add retry logic to GetFileAttributesEx() on windows.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | experimental
Files: files | file ages | folders
SHA1: 1cca9a49f2612c0c2695e63a429ce4bc1703d802
User & Date: drh 2011-04-15 13:29:45
Context
2011-04-15
13:29
Add retry logic to GetFileAttributesEx() on windows. Closed-Leaf check-in: 1cca9a49 user: drh tags: experimental
12:36
Make sure the unix backend returns SQLITE_FULL if write() fails with an ENOSPC error code. check-in: 721e3c16 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

2377
2378
2379
2380
2381
2382
2383


2384
2385


2386
2387
2388


2389
2390
2391
2392
2393
2394
2395

  SimulateIOError( return SQLITE_IOERR_ACCESS; );
  zConverted = convertUtf8Filename(zFilename);
  if( zConverted==0 ){
    return SQLITE_NOMEM;
  }
  if( isNT() ){


    WIN32_FILE_ATTRIBUTE_DATA sAttrData;
    memset(&sAttrData, 0, sizeof(sAttrData));


    if( GetFileAttributesExW((WCHAR*)zConverted,
                             GetFileExInfoStandard, 
                             &sAttrData) ){


      /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
      ** as if it does not exist.
      */
      if(    flags==SQLITE_ACCESS_EXISTS
          && sAttrData.nFileSizeHigh==0 
          && sAttrData.nFileSizeLow==0 ){
        attr = INVALID_FILE_ATTRIBUTES;







>
>


>
>
|
|
|
>
>







2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401

  SimulateIOError( return SQLITE_IOERR_ACCESS; );
  zConverted = convertUtf8Filename(zFilename);
  if( zConverted==0 ){
    return SQLITE_NOMEM;
  }
  if( isNT() ){
    DWORD rc;
    int retryCnt = 0;
    WIN32_FILE_ATTRIBUTE_DATA sAttrData;
    memset(&sAttrData, 0, sizeof(sAttrData));
    do{
      if( retryCnt>0 ) Sleep(10*(retryCnt-1));
      rc = GetFileAttributesExW((WCHAR*)zConverted,
                                GetFileExInfoStandard, 
                                &sAttrData);
    }while( rc!=0 && (retryCnt++)<3 && GetLastError()==ERROR_ACCESS_DENIED );
    if( rc ){
      /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
      ** as if it does not exist.
      */
      if(    flags==SQLITE_ACCESS_EXISTS
          && sAttrData.nFileSizeHigh==0 
          && sAttrData.nFileSizeLow==0 ){
        attr = INVALID_FILE_ATTRIBUTES;