QT sqlite 使用

非常适合QT本地的数据落地,基本语法和oracle mysql 有一定的差异,建议本地安装sqlite 客户端,一边操作,一边开发

下载页:http://www.sqlite.org/download.html

1。 删除数据 delete from in_store_code;

2.   删除表 drop table in_store_code;

3。创建表 create table in_store_code (item_no int not null,create_date int not null,memo text ,primary key(item_no,create_date));

4。插入数据 insert into in_store_code (item_no,create_date) values (123,date('now'));

5。查询数据 select * from in_store_code ;   

                    123|2023-06-19|

6. 日期格式 处理

    6.1  text 类型  可以直接展示使用  ,但是格式 必须为 '%Y-%m-%d %H:%M:%S'  

    6.2  int 类型  存入是按UTC时间存入,需要自己修正

 

 

7。因为sqlite 是默认每笔开启关闭事务,批量insert 时,需要手动开启事务和关闭事务,减少重复的开销,提供效率。

8。时间戳

9。时间计算

 

posted @ 2023-06-19 16:39  林文波  阅读(24)  评论(0编辑  收藏  举报