Re: [Haskell-cafe] HDBC SQLite error

2011-11-02 Thread Jurriën Stutterheim
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@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HDBC SQLite error

2011-11-01 Thread 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,


Jurriën


[1] 
https://github.com/norm2782/snaplet-hdbc/blob/master/src/Snap/Snaplet/Hdbc.hs#L155
[2] 
https://github.com/norm2782/snaplet-hdbc/blob/master/src/Snap/Snaplet/Auth/Backends/Hdbc.hs
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HDBC SQLite error

2011-11-01 Thread Alexander Danilov

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@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe