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

 ID:                 53562
 Updated by:         [email protected]
 Reported by:        bobjurman at yahoo dot se
 Summary:            Positioning of AUTOINCREMENT matters
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            SQLite related
 Operating System:   OSX 10.5.8
 PHP Version:        5.2.16
 Block user comment: N
 Private report:     N

 New Comment:

You are comparing sqlite2 vs sqlite3. Not a PHP problem.


Previous Comments:
------------------------------------------------------------------------
[2010-12-17 10:57:30] 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


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



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

Reply via email to