/ Check-in [f785b904]
Login

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

Overview
Comment:Fix the modification-time setting logic in the fileio.c extension on Windows so that it works with utf8 filenames.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:f785b9041556912edbacdbfb3dfc38705058d7c10d874544295c25db54628bc2
User & Date: drh 2018-01-23 15:26:30
Context
2018-01-23
16:38
Fix a bug causing spurious "sub-select returns N columns expected 1" errors in join queries with a term like "(a, b) IN (SELECT ...)" in the WHERE clause. Ticket [7310e2fb3d046a5f5]. check-in: 14dfd96f user: dan tags: trunk
15:26
Fix the modification-time setting logic in the fileio.c extension on Windows so that it works with utf8 filenames. check-in: f785b904 user: drh tags: trunk
14:01
In SQLITE_ENABLE_BATCH_ATOMIC_WRITE builds on F2FS file-systems, invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE if an SQLITE_FCNTL_COMMIT_ATOMIC_WRITE call fails. Also, do not use an atomic transaction to create the initial database. This is because if an error occurs while writing to the db file, any changes to the file-size do not seem to be rolled back automatically. The only time this matters is when the file was 0 bytes in size to start with. check-in: b3122db1 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/misc/fileio.c.

266
267
268
269
270
271
272



273
274
275
276
277

278
279
280
281

282
283
284
285
286
287
288
#if defined(_WIN32)
    /* Windows */
    FILETIME lastAccess;
    FILETIME lastWrite;
    SYSTEMTIME currentTime;
    LONGLONG intervals;
    HANDLE hFile;



    GetSystemTime(&currentTime);
    SystemTimeToFileTime(&currentTime, &lastAccess);
    intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
    lastWrite.dwLowDateTime = (DWORD)intervals;
    lastWrite.dwHighDateTime = intervals >> 32;

    hFile = CreateFile(
      zFile, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING,
      FILE_FLAG_BACKUP_SEMANTICS, NULL
    );

    if( hFile!=INVALID_HANDLE_VALUE ){
      BOOL bResult = SetFileTime(hFile, NULL, &lastAccess, &lastWrite);
      CloseHandle(hFile);
      return !bResult;
    }else{
      return 1;
    }







>
>
>





>
|
|


>







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#if defined(_WIN32)
    /* Windows */
    FILETIME lastAccess;
    FILETIME lastWrite;
    SYSTEMTIME currentTime;
    LONGLONG intervals;
    HANDLE hFile;
    LPWSTR zUnicodeName;
    extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);

    GetSystemTime(&currentTime);
    SystemTimeToFileTime(&currentTime, &lastAccess);
    intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
    lastWrite.dwLowDateTime = (DWORD)intervals;
    lastWrite.dwHighDateTime = intervals >> 32;
    zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
    hFile = CreateFileW(
      zUnicodeName, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING,
      FILE_FLAG_BACKUP_SEMANTICS, NULL
    );
    sqlite3_free(zUnicodeName);
    if( hFile!=INVALID_HANDLE_VALUE ){
      BOOL bResult = SetFileTime(hFile, NULL, &lastAccess, &lastWrite);
      CloseHandle(hFile);
      return !bResult;
    }else{
      return 1;
    }