调用executeUpdate,屏蔽Could not find index for XXX信息
来源:互联网 发布:java多线程并发测试 编辑:程序博客网 时间:2024/05/16 08:10
我们的app使用FMDatabase操作sqlite3,其中有段代码:
NSString *sql = @"update tb_users set baseInfo_name = :baseInfo_name, contact_email = :contact_email, baseInfo_image = :baseInfo_image;NSDictionary *data = [datas objectAtIndex:0]; BOOL result = [db executeUpdate:sql withParameterDictionary:mutable];
这句sql执行的时候,控制台报了很多Could not find index for XXX。发现如果执行的是insert语句则没有这个现象,只有update语句才会出现
查看了一下FMDatabase的源码:
// If dictionaryArgs is passed in, that means we are using sqlite's named parameter support if (dictionaryArgs) { for (NSString *dictionaryKey in [dictionaryArgs allKeys]) { // Prefix the key with a colon. NSString *parameterName = [[NSString alloc] initWithFormat:@":%@", dictionaryKey]; // Get the index for the parameter name. int namedIdx = sqlite3_bind_parameter_index(pStmt, [parameterName UTF8String]); FMDBRelease(parameterName); if (namedIdx > 0) { // Standard binding from here. [self bindObject:[dictionaryArgs objectForKey:dictionaryKey] toColumn:namedIdx inStatement:pStmt]; // increment the binding count, so our check below works out idx++; } else { NSLog(@"Could not find index for %@", dictionaryKey); } } }
调用executeUpdate:WithParameterDictionary:方法时,会查找索引,没找到则会打印日志
0 0
- 调用executeUpdate,屏蔽Could not find index for XXX信息
- eclipse中could not find symbol "XXX" in index
- Eclipse: Could not find symbol "XXX" in index
- org.hibernate.PropertyNotFoundException: Could not find a getter for XXX
- org.hibernate.PropertyNotFoundException: Could not find a getter for XXX
- could not find 'xxx.program' specified for main method
- Could not find XXX.apk!的解决方法
- Could not find XXX.apk的解决方法
- Could not find XXX.apk!的解决方法
- Could not find result map XXX 解决办法
- Could not find result map XXX 解决办法
- 关于JNI配置Error: Could not find class file for 'XXX'问题(MAC Andriod Studio)
- xfire客户端调用远程服务出现:org.codehaus.xfire.XFireRuntimeException: Could not find operation xxx方法
- Could not resolve dependencies for project . Could not find artifact
- 报错信息:Could not find artifact
- Could not find conduit initiator for address
- Could not find method compile() for arguments
- Could not find method compile() for arguments
- c++ reference pointer
- 贝叶斯分类器
- c/c++经典面试题
- 第二十八章续:任意(N-1)个数的组合中乘积最大的一组
- HTTP协议详解
- 调用executeUpdate,屏蔽Could not find index for XXX信息
- netperf安装以及使用方法
- xcode 类编辑区显示出了空格字符
- svn 主干合并
- 子墨对酒《三国杀》里论模式(肆)单例模式
- iOS 消息推送原理及实现总结
- C++面试题及解释
- 在iOS开发中利用GCD进行多线程编程
- 整理之c++笔试