|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46212 SQLite3::exec() with a valid CREATE TABLE fails
Submitted: 2008-10-01 15:37 UTC Modified: 2008-10-23 08:34 UTC
From: kristof dot coomans at telenet dot be Assigned: scottmac (profile)
Status: Closed Package: SQLite related
PHP Version: 5.3CVS-2008-10-01 (snap) OS: Windows XP
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.
Bug Type:
From: kristof dot coomans at telenet dot be
New email:
PHP Version: OS:


 [2008-10-01 15:37 UTC] kristof dot coomans at telenet dot be
SQLite3::exec with valid query fails with the error message "SQL logic error or missing database".

Actually testing with since there is no snapshot for win32 yet for today.

Reproduce code:

@unlink( 'test.sqlite3.db' );
$cn = new SQLite3( 'test.sqlite3.db' );

$sql = "CREATE TABLE ezcontentclass_attribute (
  can_translate INTEGER(11) DEFAULT '1',
  contentclass_id INTEGER(11) NOT NULL DEFAULT '0',
  data_float1 float DEFAULT NULL,
  data_float2 float DEFAULT NULL,
  data_float3 float DEFAULT NULL,
  data_float4 float DEFAULT NULL,
  data_int1 INTEGER(11) DEFAULT NULL,
  data_int2 INTEGER(11) DEFAULT NULL,
  data_int3 INTEGER(11) DEFAULT NULL,
  data_text1 varchar(50) DEFAULT NULL,
  data_text2 varchar(50) DEFAULT NULL,
  data_text3 varchar(50) DEFAULT NULL,
  data_text5 longtext,
  data_type_string varchar(50) NOT NULL DEFAULT '',
  identifier varchar(50) NOT NULL DEFAULT '',
  is_information_collector INTEGER(11) NOT NULL DEFAULT '0',
  is_required INTEGER(11) NOT NULL DEFAULT '0',
  is_searchable INTEGER(11) NOT NULL DEFAULT '0',
  placement INTEGER(11) NOT NULL DEFAULT '0',
  serialized_name_list longtext NOT NULL,
  version INTEGER(11) NOT NULL DEFAULT '0',
  PRIMARY KEY ( id, version )

$succes = @$cn->exec( $sql );

if ( !$succes )
    print( "Error " . $cn->lastErrorCode() . ": " . $cn->lastErrorMsg() . PHP_EOL );


Expected result:
The script should finish without any warnings.

Executing the sql with the sqlite3 command line client works fine.

Actual result:
Error 1: SQL logic error or missing database


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-01 15:56 UTC]
This works on Linux and Mac but not Windows.
 [2008-10-01 15:58 UTC]
Does the user you're running the script as have permission to write the database file and the directory the script is in?

That's usually the reason for this sort of error.
 [2008-10-01 16:25 UTC] kristof dot coomans at telenet dot be
Yes, the user has permission to read & write to the directory & file.
 [2008-10-20 23:58 UTC]
Can you try a 5.3 snapshot from

I think this could be optimisation related and recently fixed.
 [2008-10-23 07:59 UTC] kristof dot coomans at telenet dot be
Yes, it works again as expected with the last snapshot I downloaded. Thanks!
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 11:01:32 2024 UTC