php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53562 Positioning of AUTOINCREMENT matters
Submitted: 2010-12-17 10:57 UTC Modified: 2010-12-17 12:01 UTC
From: bobjurman at yahoo dot se Assigned:
Status: Not a bug Package: SQLite related
PHP Version: 5.2.16 OS: OSX 10.5.8
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bobjurman at yahoo dot se
New email:
PHP Version: OS:

 

 [2010-12-17 10:57 UTC] bobjurman at yahoo dot se
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-17 12:01 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2010-12-17 12:01 UTC] felipe@php.net
You are comparing sqlite2 vs sqlite3. Not a PHP problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC