Sqlite   发布时间:2022-05-22  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了sqlite3 使用大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_385_0@mDB提供了用o-c封装的访问sqlite3的方法,避免了在用O-c编程中夹杂C风格的代码(不是说不能使用,而是夹杂在一块代码风格不一致)。 以下记录使用过程中的一些心得: 1创建,插入,更新和删除:使用executeupdate方法,而查询则用executequery 2 插入的数据一律用oc中的对象类型:比如某列是double,插入的时候要用NSnumber对象 3 查询结果的显示:用StringForcolumn,dateForcolumn等等 4出错处理:[db hadError]来判断是否有错;[db lastErrorCode],[db lastErrormessage]来查看出错类型和说明 5时间:对于事件类型,可以制定为double 以上是迄今遇到的一些问题,权且记录。 另sqlite3中时间函数: datetiR_817_11845@e()/datetiR_817_11845@e('Now')显示的是零时区的时间,"YYYY-MM-DD HH:MM:SS" 如果要获得当前时区的可以 datetiR_817_11845@e('Now','localtime') 如果知道是哪个时区的:datetiR_817_11845@e('Now','-3 hours') 其它的时间函数:(摘自官网) date(timestring,modifIEr,...) time(timestring,...) julianday(timestring,...) strftime(format,timestring,...) Examples Compute the current date. SELECT date('Now'); Compute the last day of the current month. SELECT date('Now','start of month','+1 month','-1 day'); Compute the date and time given a unix timestamp 1092941466. SELECT datetiR_817_11845@e(1092941466,'unixepoch'); Compute the date and time given a unix timestamp 1092941466,and compensate for your local timezone. SELECT datetiR_817_11845@e(1092941466,'unixepoch','localtime'); Compute the current unix timestamp. SELECT strftime('%s','Now'); Compute the number of days since the signing of the US Declaration of Independence. SELECT julianday('Now') - julianday('1776-07-04'); Compute the number of seconds since a particular moment in 2004: SELECT strftime('%s','Now') - strftime('%s','2004-01-01 02:34:56'); Compute the date of the first Tuesday in October for the current year. SELECT date('Now','start of year','+9 months','weekday 2'); Compute the time since the unix epoch in seconds (like strftime('%s','Now') except includes fractional part): SELECT (julianday('Now') - 2440587.5)*86400.0;
 
转自:http://www.cnblogs.com/scorpiozj/archive/2011/01/20/1940220.HTML

大佬总结

以上是大佬教程为你收集整理的sqlite3 使用全部内容,希望文章能够帮你解决sqlite3 使用所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:插入