SQLite

Check-in [d3d59261da]
Login

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

Overview
Comment:Enhancement to Windows "file-exists" function by Joel Lucsy. (CVS 374)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d3d59261da9bef3250e99444167ad6ef98764574
User & Date: drh 2002-02-18 12:48:46.000
Context
2002-02-18
13:35
Additional tests for the sub-query feature. (CVS 375) (check-in: a0019fce70 user: drh tags: trunk)
12:48
Enhancement to Windows "file-exists" function by Joel Lucsy. (CVS 374) (check-in: d3d59261da user: drh tags: trunk)
03:21
Test and documentation updates for sub-queries. (CVS 373) (check-in: 607c0c49b2 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os.c.
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
** Return TRUE if the named file exists.
*/
int sqliteOsFileExists(const char *zFilename){
#if OS_UNIX
  return access(zFilename, 0)==0;
#endif
#if OS_WIN
  HANDLE h;
  h = CreateFile(zFilename,
    GENERIC_READ,
    0,
    NULL,
    OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
    NULL
  );
  if( h!=INVALID_HANDLE_VALUE ){
    CloseHandle(h);
    return 1;
  }
  return 0;
#endif
}


/*
** Attempt to open a file for both reading and writing.  If that
** fails, try opening it read-only.  If the file does not exist,







<
<
<
<
<
<
<
<
<
<
<
|
<
<







206
207
208
209
210
211
212











213


214
215
216
217
218
219
220
** Return TRUE if the named file exists.
*/
int sqliteOsFileExists(const char *zFilename){
#if OS_UNIX
  return access(zFilename, 0)==0;
#endif
#if OS_WIN











  return GetFileAttributes(zFilename) != 0xffffffff;


#endif
}


/*
** Attempt to open a file for both reading and writing.  If that
** fails, try opening it read-only.  If the file does not exist,