[Haskell-cafe] HDBC SQLite error
Jurriën Stutterheim
j.stutterheim at me.com
Wed Nov 2 10:31:08 CET 2011
I have just tried your suggestion (I explicitly committed right after opening a connection), but unfortunately it did not solve my problem. I've also tried compiling my app without threading, but it didn't seem to have any effect either.
On 1 Nov 2011, at 19:03, Alexander Danilov wrote:
> 01.11.2011 20:30, Jurriën Stutterheim пишет:
>> Hi all,
>>
>>
>> I have recently switched one of my web applications to SQLite via HDBC. I use it to store some user credentials and data. Initially it seemed to work fine, until I tried logging in from two different browsers. That's when I got the following error when trying to log in:
>>
>> SqlError {seState = "", seNativeError = 5, seErrorMsg = "step: database is locked"}
>>
>> My application only uses two functions (query and query', see [1]) directly, and the authentication code[2] uses HDBC directly. I'm not sure why I'm getting this error, because as far as I can see, I'm not keeping any transactions open longer than I have to in the auth code. Does anyone have an idea what might be wrong and how to fix it?
>>
>>
>> Cheers,
>>
>>
>
> This is a problem of hdbc-sqlite package, author think, than it can't work correctly without open transaction, so just commit after open database or modify hdbc-sqlite like this:
>
> --- a/Database/HDBC/Sqlite3/Connection.hs
> +++ b/Database/HDBC/Sqlite3/Connection.hs
> @@ -75,7 +75,7 @@ genericConnect strAsCStrFunc fp =
> mkConn :: FilePath -> Sqlite3 -> IO Impl.Connection
> mkConn fp obj =
> do children <- newMVar []
> - begin_transaction obj children
> +-- begin_transaction obj children
> ver <- (sqlite3_libversion >>= peekCString)
> return $ Impl.Connection {
> Impl.disconnect = fdisconnect obj children,
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list