php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56921 database table is locked
Submitted: 2006-03-27 09:49 UTC Modified: 2006-03-28 02:50 UTC
From: danhen at web dot de Assigned:
Status: Closed Package: PDO_SQLITE (PECL)
PHP Version: 5.1.1 OS: WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: danhen at web dot de
New email:
PHP Version: OS:

 

 [2006-03-27 09:49 UTC] danhen at web dot de
Description:
------------
A queryqueue like this produces Errormessages when used with PDO::query():

SQLite Version 2 Databases:

SELECT sql FROM sqlite_master WHERE name = 'test' AND type = 
'table'
--OK
BEGIN TRANSACTION
--OK
CREATE TEMPORARY TABLE test_backup AS SELECT * FROM test
--OK

DROP TABLE test
Array
(
    [0] => HY000
    [1] => 1
    [2] => SQL logic error or missing database
)

CREATE TABLE test (foo VARCHAR(123), bar VARCHAR(125), baz VARCHAR(142))

Array
(
    [0] => HY000
    [1] => 1
    [2] => table test already exists
)

INSERT INTO test (foo, bar, baz) SELECT foo, bar, baz FROM test_backup
--OK because table has no PRIMARY KEY
COMMIT
--OK

SQLite Version 3 reports:

SELECT sql FROM sqlite_master WHERE name = 'test' AND type = 
'table'
--OK
BEGIN TRANSACTION
--OK
CREATE TEMPORARY TABLE test_backup AS SELECT * FROM test
--OK

DROP TABLE test
Array
(
    [0] => HY000
    [1] => 1
    [2] => Database table is locked
)

CREATE TABLE test (foo VARCHAR(123), bar VARCHAR(125), baz VARCHAR(142))

Array
(
    [0] => HY000
    [1] => 1
    [2] => table test already exists
)

INSERT INTO test (foo, bar, baz) SELECT foo, bar, baz FROM test_backup
--OK because table has no PRIMARY KEY
COMMIT
--OK

The 'old' sqlite extensions works fine with this code also pdo_sqlite does when the connection is closed and reopened right before beginning the transaction. Running this code on the same connection causes the written messages. closeCursor() is called between the different statements and the Statement-objects are unset()'ed.

PHP-Version is 5.1.2 (it isn't in the dropdown)

I dont now if it is a PDO_SQLite Bug or a bug in SQlite itself. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-27 11:05 UTC] wez@php.net
Please supply self-contained test scripts.
 [2006-03-28 02:50 UTC] danhen at web dot de
No need any more. Sorry. There seems to be a system side problem which caused the behavior. It looks like the harddrive starts to give up... After testing everything on a other machine with the same read/write rights it just worked fine.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC