Re: Weird Error Using Euphoria Database System (EDS)

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...

Here's the test code I threw together. Using DB_LOCK_SHARED for db_open() causes it to crash with "wrong file mode for attempted operation" as you're getting. If you switch to DB_LOCK_EXCLUSIVE, it works fine.

 
    -- 
    -- DB_LOCK_NO        : works 
    -- DB_LOCK_SHARED    : fails 
    -- DB_LOCK_EXCLUSIVE : works 
    -- 

Same on Phix (thanks Greg for making that test super-easy).

The OE and Phix docs for db_open() both state:

Parameters: lock_method : DB_LOCK_SHARED : (shared lock for read-only access) 
 
DB_LOCK_SHARED is only supported on Unix platforms. It allows you to read the database, but not write anything to it.  

I don't know if the Unix-only bit is still true (I might try testing it tomorrow), but otherwise that agrees with this result.

However the docs (both OE and Phix) go on to say:

If you request DB_LOCK_SHARED on WINDOWS it will be treated as if you had asked for DB_LOCK_EXCLUSIVE. 

yet I cannot see anything to support that claim in the source code of db_open(), and this case, on Windows, it has patently not worked the same as DB_LOCK_EXCLUSIVE.

Are we all in agreement that last sentence should just be deleted?

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu