sqlite中自动增量的问题

时间:2016-12-13 14:06:29

标签: sqlite

在linux中,在命令行(sqlite3)上,我使用以下版本的Sqlite:

SQLite version 3.7.6.3

在sqlite教程(http://sqlite.org/autoinc.html)中,我已阅读以下声明:

On an INSERT, if the ROWID or INTEGER PRIMARY KEY column is not explicitly 
given a value, then it will be filled automatically with an unused integer,
usually one more than the largest ROWID currently in use. 

我有下表(.schema地址):

CREATE TABLE addresses (
id int primary key not null,
ipaddr text not null,
locked int,
date text not null,
quater int,
count not null);
CREATE INDEX addresses_index1 on addresses (ipaddr);

现在,如果我按照上面提到的那样插入以下行(没有id的值),它就不起作用了:

insert into addresses (ipaddr, locked, date, quater, count) values
('0.0.0.0', 0, '2016/12/13', 0, 1);

我收到错误消息

Error: addresses.id may not be NULL

但教程说我可以这样做。

我做错了什么?

1 个答案:

答案 0 :(得分:2)

它是filterContext.Result = new HttpUnauthorizedResult();,而不是integer primary keyint primary key多余为not null