]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
os_win.c, winOpen(), changed to handle the SQLITE_OPEN_EXCLUSIVE flag and sharing...
authorshane <shane@noemail.net>
Thu, 23 Apr 2009 19:08:32 +0000 (19:08 +0000)
committershane <shane@noemail.net>
Thu, 23 Apr 2009 19:08:32 +0000 (19:08 +0000)
FossilOrigin-Name: 18fef3fcf61c137a89a83352f6769ed06845434a

manifest
manifest.uuid
src/os_win.c

index 94f822ac54c40b072d820e606b4db431b77981bb..ea67f1fa0aa3f1ca80944b49caf264f18f28f62b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Updated\smisc.\stest\sscripts\sfor\sWindows\stesting\swith\sgcc/cygwin;\s(CVS\s6541)
-D 2009-04-23T18:42:05
+C os_win.c,\swinOpen(),\schanged\sto\shandle\sthe\sSQLITE_OPEN_EXCLUSIVE\sflag\sand\ssharing\smodes\sin\sthe\ssame\smanner\sas\sos_unix.c.\sTicket\s#3821.\s(CVS\s6542)
+D 2009-04-23T19:08:33
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -144,7 +144,7 @@ F src/os.h fa3f4aa0119ff721a2da4b47ffd74406ac864c05
 F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc
 F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
 F src/os_unix.c 9ad9f45049a3c9eb0b0713b162ff0d7024ff7259
-F src/os_win.c c3d0354b9a7ae75e3e993e6c17f5deb061acbc36
+F src/os_win.c 725c38a524d168ce280446ad8761d731bc516405
 F src/pager.c adfdf98f92bcab88246aaa5079df49f9441ebd81
 F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f
 F src/parse.y b7e4341b21736a90b952aa6bb663ec98529b778e
@@ -722,7 +722,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 03af25b3ee001c1bf3e7a3218fad6ed311c7c259
-R 30700e10f6c34e71c71283b7d63f7a33
+P 1e2c71596e3f7a69afc5b745c20b2e4e81bffda5
+R 76d5774a4fbfd2590aa81cedc88a2f67
 U shane
-Z 3c397054349ec943746136fd831f258c
+Z ae8755c671bd4929f4c005dcef86f4c8
index a48ab63d7febd365bf174da7181cd87ac81c9dc6..d0313ab81c64548a0a35809b87f1e069b3be97e2 100644 (file)
@@ -1 +1 @@
-1e2c71596e3f7a69afc5b745c20b2e4e81bffda5
\ No newline at end of file
+18fef3fcf61c137a89a83352f6769ed06845434a
\ No newline at end of file
index cb4c4ce3b338f86c6494aa3aa1fd4eb14388630e..3bc769bd732615625f0cb0585462ec1806ba568c 100644 (file)
@@ -12,7 +12,7 @@
 **
 ** This file contains code that is specific to windows.
 **
-** $Id: os_win.c,v 1.155 2009/04/15 14:36:26 shane Exp $
+** $Id: os_win.c,v 1.156 2009/04/23 19:08:33 shane Exp $
 */
 #include "sqliteInt.h"
 #if SQLITE_OS_WIN               /* This file is used for windows only */
@@ -1312,16 +1312,23 @@ static int winOpen(
   }else{
     dwDesiredAccess = GENERIC_READ;
   }
-  if( flags & SQLITE_OPEN_CREATE ){
+  /* SQLITE_OPEN_EXCLUSIVE is used to make sure that a new file is 
+  ** created. SQLite doesn't use it to indicate "exclusive access" 
+  ** as it is usually understood.
+  */
+  assert(!(flags & SQLITE_OPEN_EXCLUSIVE) || (flags & SQLITE_OPEN_CREATE));
+  if( flags & SQLITE_OPEN_EXCLUSIVE ){
+    /* Creates a new file, only if it does not already exist. */
+    /* If the file exists, it fails. */
+    dwCreationDisposition = CREATE_NEW;
+  }else if( flags & SQLITE_OPEN_CREATE ){
+    /* Open existing file, or create if it doesn't exist */
     dwCreationDisposition = OPEN_ALWAYS;
   }else{
+    /* Opens a file, only if it exists. */
     dwCreationDisposition = OPEN_EXISTING;
   }
-  if( flags & SQLITE_OPEN_MAIN_DB ){
-    dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
-  }else{
-    dwShareMode = 0;
-  }
+  dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
   if( flags & SQLITE_OPEN_DELETEONCLOSE ){
 #if SQLITE_OS_WINCE
     dwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN;