sqlite replace失效的教训
来源:互联网 发布:大型网络竞技游戏 编辑:程序博客网 时间:2024/05/19 22:58
20140925 通宵加班解决 android版本企信 增量通讯录会有记录重复的问题,主要原因在于,旧版的创建表的脚本没有指定primary key,而在升级脚本中 使用 ALTER TABLE [testpri] ADD PRIMARY KEY id 来创建主键,实际上主键没有创建成功。而增量的代码中间,更新数据使用了 sqlite的 replace 来执行。新版建表脚本已经含了主键创建的内容,所以不会有问题;而sqlite的table一旦创建,就无法创建主键了 ,只能通过临时表来解决。,以下为原文:
replace根据主键确定被替换的是哪一条记录
You can't modify SQLite tables in any significant way after they have been created. The accepted suggested solution is to create a new table with the correct requirements and copy your data into it, then drop the old table.
here is the official documentation about this: http://sqlite.org/faq.html#q11
0 0
- sqlite replace失效的教训
- sqlite "replace into"的用法
- sqlite "replace into"的用法
- SQLite之replace语句的行为
- ios-SQLite的insert OR replace语法
- eclipse的热编译功(hot code replace)能失效
- SQLite语法 REPLACE
- sqlite replace into
- VS2008 Find and Replace功能失效
- 【SQLite】使用replace替换字段中的字符
- Android:Sqlite插入或更新--replace
- Sqlite插入或更新语句-Replace
- SQLite 使用replace into去重
- Android窗口 dimiss失效问题 惨痛教训啊
- 测试的教训
- 近日的教训
- 惨败的教训
- 烦人的无线-教训!
- 黑马程序员--Object-C和Swift内存管理机制
- 脱离屌丝422天
- 配置ssh免密码登录
- [LeetCode]Maximum Subarray
- How to set up a simple mail server on Debian in 5 easy steps
- sqlite replace失效的教训
- 第一部分 GeoGeo脚本基础 第4章 函数
- 仿大众点评商品详情悬浮框
- 第一部分 GeoGeo脚本基础 第5章 多线程
- Canvas画图
- [LeetCode]Maximum Product Subarray 新题152 最大乘积子序列
- 第一部分 GeoGeo脚本基础 第6章 分布式计算与进程控制
- 第一部分 GeoGeo脚本基础 第7章 文件
- CRectTracker(橡皮筋)类