I have a Perl program that we have successfully executed every day for almost the last 2 years, but which crashes today with an error message:
FATAL ERR: Failed to execute PRAGMA cache_size = 1000000: try to write a read-only database
The SQLite database that is in question is readonly and always has been, and the code always used PRAGMA cache_size = 1000000 on it immediately after opening its read-only connection.
Setting cache_size is not a write operation and does not interrupt if I access db directly through DBI, for example:
$ dbh-> do ("PRAGMA cache_size = 1000000")
However, the code makes SqliteH :: db a subclass of DBI :: db, then calls this function from a subclass:
$ self-> SUPER :: do ("PRAGMA cache_size = 1000000")
and now it dies with "DBD :: SQLite :: db do failed: try to write readonly database on / local / ifs _projects / prok / function / src / lib / SqliteH.pm line 329."
The code worked with CentOS 5, Perl 5.10.1, DBD :: SQLite 1.29, and DBI 1.611. It does not work CentOS 6, Perl 5.16, DBD :: SQLite 1.39 and DBI 1.627. However, I am surprised that he / did / worked last week on CentOS 6 and Perl 5.16. Over the weekend, IT professionals can upgrade to DBD :: SQLite or DBI.
Please do not change the title to "Suddenly getting an error in a program that worked for several months." This is a useless and non-specific headline.
source share