database table is locked

Print
PDF
If you write a program a little bit complicated in PHP using PDO SQLite3 and you have certainly been confronted with this problem.
An error like: 'database table is locked'

PDO requires absolutely empty query results.
For example, if you run a select query whose result contains 15 lines, so that you do not recover all these lines the table is 'locked'.

To avoid this problem, there are two solutions:
- The first is to use only 'fetchAll' to retrieve results.
$ res = $ connid-> query ( 'SELECT * FROM database;');
$ tabResult = $ res-> fetchAll ();


- The second, which is used in SQLiteManager 1.2.0! ; Before executing a new query, we check whether the result object exists, in which case it executes 'closeCursor' on it
if (is_object ($ res)) $ res-> closeCursor ();

 

Add comment

Security code
Refresh

database table is locked - SQLiteManager
Facebook MySpace Twitter Digg Delicious Stumbleupon Google Bookmarks 

Author

SQLiteManager now is managed by the corporation WebInfoPro in order to remake to live this project all while remaining under license GPL

Contact

Vous pouvez nous contacter par email sur sqlitemanager@gmail.com

Who's online?

We have 831 guests online