database table is locked

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

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


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


Vous pouvez nous contacter par email sur

Who's online?

We have 1412 guests online