On Thu, Jun 28, 2012 at 9:22 PM, Stephan Beal <sgb...@googlemail.com> wrote:

> i haven't yet narrowed down the problem, but wanted to point it out. If
> it's a known problem, let me know and i'll stop digging.
>

A couple more details:

schema:

CREATE TABLE t(
vInt INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
vDbl DOUBLE DEFAULT NULL,
vStr VARCHAR(64) DEFAULT NULL,
vTs CHAR(20) DEFAULT CURRENT_TIMESTAMP
);

insert which fails in v4 but not in v3:

INSERT INTO t (vInt,vDbl,vStr) VALUES(NULL,?,?)

If i refactor that to explicitly set vInt to some (unique) value then the
insert passes but last_insert_rowid() is returning 0. If i remove my rowid
assertion, the inserts can be shown to have succeeded:

stephan@tiny:~/cvs/fossil/cpdo$ echo '.dump' | sqlite4 4.db
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE t(vInt INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,vDbl DOUBLE
DEFAULT NULL,vStr VARCHAR(64) DEFAULT NULL,vTs CHAR(20) DEFAULT
CURRENT_TIMESTAMP);
INSERT INTO "t" VALUES(1,1132.37,'Hi, world #1','2012-06-28 19:37:44');
INSERT INTO "t" VALUES(2,2264.74,'Hi, world #2','2012-06-28 19:37:44');
INSERT INTO "t" VALUES(3,3397.11,'Hi, world #3','2012-06-28 19:37:44');
INSERT INTO "t" VALUES(4,4529.48,'Hi, world #4','2012-06-28 19:37:44');
COMMIT;


But sqlite4_last_insert_rowid() returns 0 in each case.

If i change my table def to remove NOT NULL from vInt and change my INSERT
such that i bind NULL to vInt (expecting autoincrement behaviour), i get a
"may not be null" constraint violation.

i hope this has informed more than confused...

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to