有关SQLite的substr函数的笔记

 

官方参考文档:SQLite Query Language: Core Functions http://www.sqlite.org/lang_corefunc.html

测试SQL语句:

SELECT substr('2012-12-12 10:11:12 fff',0,20) AS substr_0_20,
substr('2012-12-12 10:11:12 fff',0,19) AS substr_0_19,
substr('2012-12-12 10:11:12 fff',1,19) AS substr_1_19,
substr('2012-12-12 10:11:12 fff',19) AS substr_19

WINDOW上的Navicat、Mac上的MesaSQLite、Android上SQLite上测试语句结果:substr_0_20 和 substr_1_19结果保持一致;substr_0_19不知道为啥会少一位?

substr_0_20 substr_0_19 substr_1_19 substr_19
2012-12-12 10:11:12 2012-12-12 10:11:1 2012-12-12 10:11:12 2 fff

IOS的FMDB上测试结果:substr_0_20不知道为啥会多一位?

substr_0_20 substr_0_19 substr_1_19 substr_19
2012-12-12 10:11:12  2012-12-12 10:11:12 2012-12-12 10:11:12 2 fff

到底哪个是正常的呢?

posted @ 2015-04-07 11:24  Asion Tang  阅读(659)  评论(0编辑  收藏  举报