>-----Message d'origine----- >De : [email protected] [mailto:sqlite-users- >[email protected]] De la part de P Kishor >Envoyé : samedi, 9. octobre 2010 17:10 >I am just trying to solve the above. It may well be that sqlite and >mod_perl may not be good companions (in which case, I am up a **** >creek without a db, and will have to look for an alternative storage >solution). >
Sqlite and mod_perl are definitely good companions, as long as one doesn't mess up with transactions. Upon startup, Apache starts a collection of servers, which may be either processes or threads, depending on the MPM (multi-process module, see http://httpd.apache.org/docs/2.2/mpm.html ); but this doesn't matter much. Under mod_perl, each of those servers has an embedded perl interpreter, so indeed they work concurrently. Each server has a loop, listening for requests, and then producing the answer ... but the server may hold data that is persistent between requests, and within such data it is often a very good idea to keep a persistent connection to the database, avoiding the cost of opening/closing the connection at each request. Therefore we may have a collection of concurrent Apache/mod_perl servers, where each server has an open connection to the database, and that is not a problem. The important point, however, is to properly open and close a transaction whenever updating the database, using the begin_work(), commit() and rollback() methods (see L<DBI/Transactions>). This sequence should ALWAYS happen within a single http request, i.e. do not start the transaction in one request, expecting the next request to close that transaction : this will lock your database, because the next request might never arrive, or it might be served by a different process or thread than the one that served the initial request. Good luck, Laurent Dami _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

