/ 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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/fileio.c.

   266    266   #if defined(_WIN32)
   267    267       /* Windows */
   268    268       FILETIME lastAccess;
   269    269       FILETIME lastWrite;
   270    270       SYSTEMTIME currentTime;
   271    271       LONGLONG intervals;
   272    272       HANDLE hFile;
          273  +    LPWSTR zUnicodeName;
          274  +    extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
          275  +
   273    276       GetSystemTime(&currentTime);
   274    277       SystemTimeToFileTime(&currentTime, &lastAccess);
   275    278       intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
   276    279       lastWrite.dwLowDateTime = (DWORD)intervals;
   277    280       lastWrite.dwHighDateTime = intervals >> 32;
   278         -    hFile = CreateFile(
   279         -      zFile, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING,
          281  +    zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
          282  +    hFile = CreateFileW(
          283  +      zUnicodeName, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING,
   280    284         FILE_FLAG_BACKUP_SEMANTICS, NULL
   281    285       );
          286  +    sqlite3_free(zUnicodeName);
   282    287       if( hFile!=INVALID_HANDLE_VALUE ){
   283    288         BOOL bResult = SetFileTime(hFile, NULL, &lastAccess, &lastWrite);
   284    289         CloseHandle(hFile);
   285    290         return !bResult;
   286    291       }else{
   287    292         return 1;
   288    293       }