有关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 |
到底哪个是正常的呢?
作者:Asion Tang
凡是没有注明[转载]的文章,本Blog发表的文章版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。