ios - 带有 iOS 5 问题的 sqlite

标签 ios ios5 sqlite

OK 是这样的,我有下面的查询

INSERT INTO 'FoodListTBL' ('AutoNo','CHOCals','PrtCals', 'FatCals','CHOgram','PrtGram','FatGram','CatId', 'TimeTypeId','TotalCals','Visibl', 'IsActive','NameAr','NameEn','CountryId', 'TotalPerUnit','UnitId','PreferedBread1', 'PreferedMilk1','PreferedVeg1','PreferedFat1', 'PreferedFruit1','CauseAllergy','AllergyCatId', 'TotalLikes','NameDescEn','NameDescAr','ChoPerUnit','PrtPerUnit','FatPerUnit','Quantity','PreferedBread2','PreferedMilk2', 'PreferedVeg2','PreferedFat2', 'PreferedFruit2','IV','UV','InsertDate','InsertUser') VALUES (818,0,0, 45, 0, 0, 5, 17, 1, 45,1, 1, 'زبدة قليلة الدسم', 'Butter reduced fat', 0, 45, 14, 0, 0, 0, 0, 0, 0, 0, 0, 'Butter reduced fat', 'زبدة قليلة الدسم', 0, 0, 45, 1, 0, 0, 0, 0, 0, 492, 0, '-', '-' ),(819,0,0, 45, 0, 0, 5, 17, 1, 45,1, 1, 'زبدة', 'Butter regular', 0, 45, 4, 0, 0, 0, 0, 0, 0, 0, 0, 'Butter regular', 'زبدة', 0, 0, 45, 1, 0, 0, 0, 0, 0, 493, 1475, '-', '-')

此查询在 iOS 6.X 上成功执行并在低于 5.X 的任何 iOS 上失败,考虑到其他表上的任何其他插入查询在任何 iOS 上成功完成

我已经尝试了两种插入代码,这是其中之一

if(sqlite3_prepare_v2(database, [query UTF8String], -1, &compiledStatement, NULL) == SQLITE_OK) 
{   
    if(SQLITE_DONE != sqlite3_step(compiledStatement))
        NSLog( @"Error while inserting data: '%s'", sqlite3_errmsg(database));
    else NSLog(@"New data inserted");

    sqlite3_reset(compiledStatement);       
}else
{
    NSLog( @"Error while inserting '%s'", sqlite3_errmsg(database));
}
sqlite3_finalize(compiledStatement)

两种情况的结果都是

Error while inserting 'near ",":syntax error'

老化这个查询在除 iOS < 6.0 之外的所有东西上都有效

感谢任何线索

最佳答案

SQLite 3.7.11 之前版本不支持多记录INSERT语法。

使用多个 INSERT 命令,或使用 INSERT ... SELECT ... UNION ALL ... 插入记录。

关于ios - 带有 iOS 5 问题的 sqlite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15966165/

相关文章:

iphone - 哪里可以找到iOS框架的.m文件

ios - 如何在不调用的情况下从另一个应用程序中打开电话应用程序?

sql - 选择所有字段总和在指定范围内的项目

ios - 多行 UILabel 未正确换行

iOS 贝塞尔曲线路径显示为之字形

ios - 无法计算约束的确切值

iphone - UISegmentedControl 不检测 iOS5 中的段更改

java - 使用 SQLite 数据库修复 NullPointerException

java - 如何通过 SQLite 在 Android 中使用 double

ios - 允许GET请求中的所有mimetype