ios - 带有 iOS 5 问题的 sqlite
<p><p>好的,就是这样,我有以下查询</p>
<pre><code>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, '-', '-')
</code></pre>
<p>考虑到其他表上的任何其他插入查询在任何 iOS 上成功完成,此查询在 iOS 6.X 上成功执行,但在任何低于 5.X 的 iOS 上失败</p>
<p>我已经尝试了两个插入代码,这是其中之一</p>
<pre><code>if(sqlite3_prepare_v2(database, , -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)
</code></pre>
<p>两种情况下的结果都是</p>
<blockquote>
<p>Error while inserting 'near ",":syntax error'</p>
</blockquote>
<p>除 iOS < 6.0</p> 之外,此查询的老化功能适用于所有功能
<p>感谢任何线索</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>3.7.11 之前的SQLite 不支持多记录<code>INSERT</code> 语法。</p>
<p>使用多个 <code>INSERT</code> 命令,或使用 <code>INSERT ... SELECT ... UNION ALL ...</code> 插入记录。</p></p>
<p style="font-size: 20px;">关于ios - 带有 iOS 5 问题的 sqlite,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/15966165/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/15966165/
</a>
</p>
页:
[1]