Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Patch to support the Unlock Notify feature for shared-cache mode: blocking prepare and step #36

Copy link
Copy link
@GoogleCodeExporter

Description

@GoogleCodeExporter
Issue body actions
I've just begun to investigate using sqlite4java as a database backend for a 
web application.

I noticed in shared cache mode that I was getting a lot SQLITE_LOCKED errors.

I realized I needed sqlite3_unlock_notify() to implement blocking prepare() and 
step() and that sqlite4java hadn't implemented it yet.

So here's a patch for it!

I implemented it based on the documentation/code presented at 
http://www.sqlite.org/unlock_notify.html.

Here's how to enable blocking prepare() and step() (I added Javadoc documention 
too):

SQLiteConnection db = new SQLiteConnection(new File("test.db"));

// must be in shared cache mode to use unlock notify blocking
db.openV2(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_SHAREDCACHE);

// call setBlocking(true) to turn on blocking of prepare() and step()
db.setBlocking(true);

// prepare() and step() will now attempt to block when locked in accordance 
with sqlite3_unlock_notify() documentation

I have tested on my web application in a test environment and I no longer get 
the SQLITE_LOCKED (or SQLITE_LOCKED_SHARECACHE) errors so it's looking good, 
but granted it hasn't been battle-tested yet in any kind of high-traffic 
production environment.

It's my hope you can merge this into the mainline after reviewing it.

Original issue reported on code.google.com by bko...@gmail.com on 22 Sep 2011 at 9:39

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.