有趣的是,如果出现错误,这可能是分析器中的错误,我们将对其进行测试并尽快修复它。
但是你想实现这个方法:
- (void)databaseError:(DBError *)error {
if (error) {
NSLog(@"%@",error.errorMessage);
}
}
查找任何类型的语法错误。此外,您可以只注销配置文件以输出格式化的查询分析,如下所示:
- (void)queryPerformedWithProfile:(DBQueryProfile *)profile {
if (profile.queryTime > 1000) {
NSLog(@"%@",profile);
}
}
输出如下:
DB Query Profiler
------------------------------------------------------------------------------------------
Query Time:1212 ms Lock Wait:0 ms Parse Time:0 ms Seek Time:1211 ms Row Count:1
------------------------------------------------------------------------------------------
SQL Query
------------------------------------------------------------------------------------------
SELECT DataForm.Id as result$Id, DataForm.completedDateTimeUTC as result$completedDateTimeUTC, DataForm.contentSetId as result$contentSetId, DataForm.submitted as result$submitted, DataForm.loginId as result$loginId, DataForm.resourceId as result$resourceId, DataForm.formData as result$formData, DataForm.submitGuid as result$submitGuid FROM DataForm WHERE submitGuid = ? LIMIT 1
------------------------------------------------------------------------------------------
SQLITE3 QUERY PLAN
------------------------------------------------------------------------------------------
Order:0 From:0 Usage: SCAN TABLE DataForm
------------------------------------------------------------------------------------------
现在:为了帮助使用 LIKE 命令,最好使用 outdbMakeLike(string)
函数。像这样使用。
whereWithFormat:@"lower(text) LIKE %@“, dbMakeLike(searchString.lowercaseString)
这样,LIKE
条件作为对象传入,我们可以将其视为正确分隔的参数,而无需您猜测我们如何在内部重新排列查询。