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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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 11:01:30 2024 UTC