#46212 [Asn->Fbk]: SQLite3::exec() with a valid CREATE TABLE fails

From: Date: Mon, 20 Oct 2008 23:58:37 +0000
Subject: #46212 [Asn->Fbk]: SQLite3::exec() with a valid CREATE TABLE fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129902@lists.php.net to get a copy of this message
 ID:               46212
 Updated by:       scottmac@php.net
 Reported By:      kristof dot coomans at telenet dot be
-Status:           Assigned
+Status:           Feedback
 Bug Type:         SQLite related
 Operating System: Windows XP
 PHP Version:      5.3CVS-2008-10-01 (snap)
 Assigned To:      scottmac
 New Comment:

Can you try a 5.3 snapshot from http://windows.php.net/snapshots/

I think this could be optimisation related and recently fixed.


Previous Comments:
------------------------------------------------------------------------

[2008-10-01 16:25:40] kristof dot coomans at telenet dot be

Yes, the user has permission to read & write to the directory & file.

------------------------------------------------------------------------

[2008-10-01 15:58:12] scottmac@php.net

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 15:56:11] scottmac@php.net

This works on Linux and Mac but not Windows.

------------------------------------------------------------------------

[2008-10-01 15:37:08] kristof dot coomans at telenet dot be

Description:
------------
SQLite3::exec with valid query fails with the error message "SQL logic
error or missing database".

Actually testing with
http://snaps.php.net/win32/php5.3-win32-200809251104.zip
since there is
no snapshot for win32 yet for today.

Reproduce code:
---------------
<?php

@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 '',
  id INTEGER,
  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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46212&edit=1



Thread (7 messages)

« previous php.bugs (#129902) next »