From:
Operating system: OSX 10.5.8
PHP version: 5.2.16
Package: SQLite related
Bug Type: Bug
Bug description:Positioning of AUTOINCREMENT matters
Description:
------------
sqlite3 file.db ".dump"
produces on the first line
CREATE TABLE "historia" ("nr" INTEGER PRIMARY KEY AUTOINCREMENT NOT
NULL ,
"jahr" TEXT);
This string produces a table in sqlite> (a sqlite3 started on command
line)
but, as $query="CREATE TABLE historia (nr INTEGER PRIMARY KEY
AUTOINCREMENT
NOT NULL , jahr TEXT);";
and sent with sqlite_exec($dbhandle, $query, $error);
or $base->queryexec($query);
doesn't work.
Is fixed by moving AUTOINCREMENT in front of PRIMARY KEY
Can be a parsing error in the parsers used by sqlite_exec() and $base-
>queryexec()
Test script:
---------------
$dbhandle = sqlite_open(minfil, 0666, $error);
if (!$dbhandle) die ($error);
$query = "CREATE TABLE hist (nr INTEGER PRIMARY KEY AUTOINCREMENT NOT
NULL , jahr TEXT);";
$ok = sqlite_exec($dbhandle, $query, $error);
if (!$ok) die("Cannot execute query. $error");
echo "OK!";
Expected result:
----------------
new TABLE in the database file
Actual result:
--------------
error message
--
Edit bug report at http://bugs.php.net/bug.php?id=53562&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53562&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53562&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53562&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53562&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53562&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53562&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53562&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53562&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53562&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53562&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53562&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53562&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53562&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53562&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53562&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53562&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53562&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53562&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53562&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53562&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53562&r=mysqlcfg