http://www.perlmonks.org?node_id=864309


in reply to Re^3: SQLite with mod_perl
in thread SQLite with mod_perl

Hi james2vegas, sorry for the delay in reply.

Well, I thought I had surmounted this problem, but no, it is back with a vengeance. Here is what is going on in a single web action --

SELECT col1 FROM table WHERE condition; if (col1 exists) { UPDATE table SET col2 = <new value> }

Well, I get the "db is locked" error at the UPDATE statement. Now, in my httpd.conf I started using

PerlModule Apache::DBI

and I thought my troubles were over. Except, this lock problem has started rearing up again. I have tried a few other things, such as starting every db action with $dbh->begin_work and ending with $dbh->commit, but I am already using AutoCommit => 1 so I am not sure if that even has any effect. I have even tried sqlite_use_immediate_transaction => 1, but that doesn't help either.

My application is being loaded in Apache conf file with

<Location /> SetHandler perl-script PerlHandler Plack::Handler::Apache2 PerlSetVar psgi_app /path/to/application.pl </Location>

So, I want all the perl modules to be loaded when Apache2 starts, and then a $dbh created for each user when the user comes to the web site, but not recreated for the same user on every reload. I am assuming that would be the correct way to work speedily.

--

when small people start casting long shadows, it is time to go to bed