I am looking for an alternative for sqlite. I have an application that has lighttpd built into it and serves php scripts to interact with multiple instances of another application. All architectural questions aside, for some reason, the person who wrote this chose to use sqlite as the database for the php scripts -- to store and retrieve information for the scripts themselves. As such, it appears we have locking issues. To deal with that the programmer used stuff like this:
$executed = $storeDB->exec($updateSQL);
while($executed === FALSE && $i<10) {
$storeDB->close();
$storeDB = new SQLite3('C:/Path/path2/LightTPD/store.db');
$pragmaDB = "PRAGMA journal_mode=WAL";
($storeDB->exec($pragmaDB));
$executed = $storeDB->exec($updateSQL);
$i++;
}
I understand why sqlite was chosen as it can be copied over and over, does not need to installed as a server, and is very small. However, with multiple instances of an application hitting those php scripts, sometimes concurrently, I can see that it is causing some problems: some information retrieval operations fail and some data is not updated. I get Warnings in the log like this.
An UPDATE statement
[07-Mar-2015 21:03:44 UTC] PHP Warning: SQLite3::exec(): database is locked in C:\Path\path2\LightTPD\htdocs\ProcessRequest.php on line 194
and
A SELECT statement
[07-Mar-2015 21:22:25 UTC] PHP Warning: SQLite3::query(): Unable to prepare statement: 5, database is locked in C:\Path\path2\LightTPD\htdocs\ProcessRequest.php on line 151
I say all of that to ask, does anyone have any comparable alternatives to sqlite for this situation? I listed the reasons it was chosen to begin with, but the primary need is that it be able to be copied, though I can get around that if necessary.
Aucun commentaire:
Enregistrer un commentaire