QT SQLite3分页删除问题
terminal实验
如下的例子使用limit、offet SQL关键字来实现分页查询。 sqlite> select * from test;
1|10
2|20
3|30
sqlite> select * from test order by var2 desc;
3|30
2|20
1|10
sqlite> select * from test order by var2 desc limit 2 offset 2;
1|10
sqlite> select * from test order by var2 desc limit 2 offset 0;
3|30
2|20
删除第一条记录: sqlite> delete from test limit 1;
sqlite> select * from test;
2|20
3|30
现在,建立数据表test2,使用BIGINT 来存储time(NULL)计算出的从1970年0时0分0秒到现在的秒数。 sqlite> select * from test2;
hello|123124
abcse|223124
abc|323124
sqlite> delete from test2 order by num asc limit 1;
sqlite> select * from test2;
abcse|223124
abc|323124
以上均是正常的,没有出现问题。 QT下SQlite分页删除建立表格: CREATE TABLE IF NOT EXISTS Vocabulary (myWord text,translation text,secs INTEGER,PRIMARY KEY(myWord,secs))
分页删除: Optional LIMIT and ORDER BY clauses: If SQLite is compiled with the SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile-time option,then the syntax of the DELETE statement is extended by the addition of optional ORDER BY and LIMIT clause SQLITE_ENABLE_UPDATE_DELETE_LIMIT This option enables an optional ORDER BY and LIMIT clause on UPDATE and DELETE statements. If this option is defined,then it must also be defined when using the Lemon parser generator tool to generate a parse.c file. Because of this,this option may only be used when the library is built from source,not from the amalgamation or from the collection of pre-packaged C files provided for non-Unix like platforms on the website. 这解释了为啥terminal中的SQlite3是好用的,但是QT的查询失败了,应该是QT下的SQlite3没有使用 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |