/**
* When a constraint violation occurs, an immediate ROLLBACK occurs,
* thus ending the current transaction, and the command aborts with a
* return code of SQLITE_CONSTRAINT. If no transaction is active
* (other than the implied transaction that is created on every command)
* then this algorithm works the same as ABORT.
*/
public static final int CONFLICT_ROLLBACK = 1; /**
* When a constraint violation occurs,no ROLLBACK is executed
* so changes from prior commands within the same transaction
* are preserved. This is the default behavior.
*/
public static final int CONFLICT_ABORT = 2; /**
* When a constraint violation occurs, the command aborts with a return
* code SQLITE_CONSTRAINT. But any changes to the database that
* the command made prior to encountering the constraint violation
* are preserved and are not backed out.
*/
public static final int CONFLICT_FAIL = 3; /**
* When a constraint violation occurs, the one row that contains
* the constraint violation is not inserted or changed.
* But the command continues executing normally. Other rows before and
* after the row that contained the constraint violation continue to be
* inserted or updated normally. No error is returned.
*/
public static final int CONFLICT_IGNORE = 4; /**
* When a UNIQUE constraint violation occurs, the pre-existing rows that
* are causing the constraint violation are removed prior to inserting
* or updating the current row. Thus the insert or update always occurs.
* The command continues executing normally. No error is returned.
* If a NOT NULL constraint violation occurs, the NULL value is replaced
* by the default value for that column. If the column has no default
* value, then the ABORT algorithm is used. If a CHECK constraint
* violation occurs then the IGNORE algorithm is used. When this conflict
* resolution strategy deletes rows in order to satisfy a constraint,
* it does not invoke delete triggers on those rows.
* This behavior might change in a future release.
*/
public static final int CONFLICT_REPLACE = 5; /**
* Use the following when no conflict action is specified.
*/
public static final int CONFLICT_NONE = 0; private static final String[] CONFLICT_VALUES = new String[]
{"", " OR ROLLBACK ", " OR ABORT ", " OR FAIL ", " OR IGNORE ", " OR REPLACE "};

1、CONFLICT_ROLLBACK

  当发生约束冲突时,会立即回滚,从而结束当前事务,并且命令将终止,返回代码为SQLITE_CONSTRAINT。如果没有事务处于活动状态(每个命令上创建的隐式事务除外),则此算法的工作原理与ABORT相同。

2、CONFLICT_ABORT

  当发生约束冲突时,不会执行回滚,因此将保留同一事务中先前命令的更改。这是默认行为。

3、CONFLICT_FAIL

  当发生约束冲突时,该命令将使用返回代码SQLITE_CONSTRAINT中止。但是,命令在遇到违反约束之前对数据库所做的任何更改都将保留,不会被取消。

4、CONFLICT_IGNORE

  当发生约束违反时,不插入或更改包含约束违反的一行。但是命令仍然正常执行。包含违反约束的行之前和之后的其他行将继续正常插入或更新。没有返回错误。

5、CONFLICT_REPLACE

  当发生唯一约束违反时,在插入或更新当前行之前,将删除导致违反约束的现有行。因此,插入或更新总是发生。命令继续正常执行。没有返回错误。如果发生NOT NULL约束冲突,则该列的默认值将替换NULL值。如果列没有默认值,则使用ABORT算法。如果发生检查约束冲突,则使用忽略算法。当此冲突解决策略删除行以满足约束时,它不会对这些行调用delete触发器。这种行为在将来的版本中可能会改变。

6、CONFLICT_NONE

  当没有指定冲突操作时,请使用以下命令。

SQLiteDatabase执行update、insert操作的时候,conflictAlgorithm参数的含义区别的更多相关文章

  1. 执行update, insert,delete 语句, 不返回结果集,(类型化参数)

    /// <summary> /// 执行update, insert,delete 语句, 不返回结果集,(类型化参数) /// </summary> /// <para ...

  2. Spring源码分析——JdbcTemplate执行批量insert操作

    最近用到一个方法: @Override public int[] batchUpdate(String sql, final BatchPreparedStatementSetter pss) thr ...

  3. jdbc批量执行SQL insert 操作

    package com.file; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayLi ...

  4. Jeecg 如何执行批量insert或者update操作,高效率

    方法:org.jeecgframework.core.common.dao.jdbc.SimpleJdbcTemplate.batchUpdate     原理: 基于springjdbc封装,批量提 ...

  5. LINQ体验(9)——LINQ to SQL语句之Insert/Update/Delete操作

    我们继续讲解LINQ to SQL语句,这篇我们来讨论Insert/Update/Delete操作.这个在我们的程序中最为常用了.我们直接看例子. Insert/Update/Delete操作 插入( ...

  6. Mysql执行Update操作时会锁住表

    update tableA a,(select a.netbar_id,sum(a.reward_amt) reward_amt from tableB a group by a.netbar_id) ...

  7. java for循环里面执行sql语句操作,有效结果只有一次,只执行了一次sql mybatis 循环执行update生效一次 实际只执行一次

    java后台controller中,for循环执行数据库操作,但是发现实际仅仅执行了一次,或者说提交成功了一次,并没有实际的个数循环 有可能是同一个对象导致的 可以仔细看一下下面两段代码有什么区别 p ...

  8. svn执行update操作后出现:Error : Previous operation has not finished; run 'cleanup' if it was interrupted.

    svn执行update操作后出现:      Error : Previous operation has not finished; run 'cleanup' if it was interrup ...

  9. 基于SQL Server日志链查看数据库insert/update/delete操作(一)

    在MSSQLServer2008下的语句 不同版本可能语句会有微小差别 SELECT [Slot ID], [Transaction ID], Operation, AllocUnitName, [C ...

随机推荐

  1. EasyUI动态展示用户信息

    业务需求:用户登录后展示用户名.用户对应的角色.EasyUI只不过是一个前端的框架,封装了一些组件和样式,你可以用jsp直接调后台获取到用户信息展示,但我这里想用html页面,用目前流行的说法:前后端 ...

  2. 阶段5 3.微服务项目【学成在线】_day09 课程预览 Eureka Feign_16-课程预览功能开发-接口测试

    cms和课程的微服务重启 从数据库内找一条数据 进入到了断点 拼装课程信息 ,然后进行远程调用 抛出异常 可能是开了两个cms服务的事,负载均衡 到了另外一个服务里面 ,关掉一个 把02关掉,重启cm ...

  3. Mybase解决保存文件后再打开不能修改编辑

    1.问题复现 2.解决方式 3.可以修改编辑

  4. python面试必备-基础篇

    一.python中and, or, and-or语法 1.and   有假先出假 在Python 中,and 和 or 执行布尔逻辑演算,如你所期待的一样,但是它们并不返回布尔值:而是,返回它们实际进 ...

  5. mysql 对应数据库服务器配置 所能承受的tps和qps

    总结: 吞吐量实际涵盖了TPS 和 QPS TPS 是指产生事物的请求,比如对数据库 增.删.改 QTP 是对数据库查询动作,无逻辑非事物,比如 查询 假如脚本里面都是get请求,那么出来的吞吐量就是 ...

  6. Spring Boot中在程序中获得application.properties中的值

    方法是使用@Value注解的方式注解一个值. 首先,在我们的application.properties中添加一个值如下: zifeiy.tmpfile.location=D:/duty 然后在我们的 ...

  7. linux下无法启动webdriver问题

    linux下无法启动webdriver问题: 查看是否有足够多的webdriver进程: ps -ef | grep chromedriver kill -9 `ps -ef |grepchromed ...

  8. 纯js脚本操作excel

    纯js脚本解析excel,并渲染为htm表格,投放大屏并滚动! 代码:https://github.com/tianbogit/js_excel

  9. linux一行命令查杀进程

    https://blog.csdn.net/primeprime/article/details/52415273 ps -efww | grep -w 'helloworld' | grep -v ...

  10. 【c# 学习笔记】继承

    在c#中,一个类可以继承另外一个已有的类(密封类除外),被继承的类称为基类(或父类),继承的类称为派生类(或子类),子类将获得基类 除构造函数和析构函数以外的所有成员.此外,静态类是密封的,也不能被继 ...