惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - AK747

关于"Google限制Python"事件我的看法 - AK747 - 博客园 JsEasy简介 - AK747 - 博客园 Bjam简明教程 该Blog停止更新,新的blog地址http://www.cppblog.com/zuroc/ [原创]《程序员,在路上……》第1节——用OPENEL画出麦克斯维速率分布曲线 用程序画出麦克斯维速率分布曲线 在sourceforge看到的一段文字,由此联想到<<暴风影音>> 大一时写的诗,张沈鹏 学习SQlite-语法示例 转载-SQLite语法备忘录 作者:http://blog.csdn.net/ezdevelop/结构定义 学习+翻译《SQL As Understood By SQLite》--CREATE INDEX 【转载】事务处理的定义 [转载]SQlite 常用函数学习笔记 [转载]SQLite介绍 [转载]在 LCC 下怎样编译Sqlite 学习+翻译《SQL As Understood By SQLite》--INSERT 在程序中用SQlite.txt 初学SQLite数据库 我搞了一个开源的项目,网址http://akenxp.gro.clinux.org目前还是计划阶段,欢迎大家加盟。
学习+翻译《SQL As Understood By SQLite》--ON CONFLICT clause
AK747 · 2005-08-02 · via 博客园 - AK747

[Contents]

ON CONFLICT clause

conflict-clause ::= ON CONFLICT conflict-algorithm
conflict-algorithm ::= ROLLBACK | ABORT | FAIL | IGNORE | REPLACE

The ON CONFLICT clause is not a separate SQL command. It is a non-standard clause that can appear in many other SQL commands. It is given its own section in this document because it is not part of standard SQL and therefore might not be familiar.

ON CONFLICT(当出错时)语句不是单独的SQL指令。它可能出现在许多其他SQL语句中。它被单独提出是因为它不是标准SQL语言的一部分并且与标准SQL语言不相似。

The syntax for the ON CONFLICT clause is as shown above for the CREATE TABLE and CREATE INDEX commands. For the COPY, INSERT, and UPDATE commands, the keywords "ON CONFLICT" are replaced by "OR", to make the syntax seem more natural. But the meaning of the clause is the same either way.

ON CONFLICT关键字一般是在CREATE TABLE 和 CREATE INDEX命令中出现。在命令COPY, INSERT,和UPDATE中,我们用"OR"替代"ON CONFLICT"使语法更自然。

The ON CONFLICT clause specifies an algorithm used to resolve constraint conflicts. There are five choices: ROLLBACK, ABORT, FAIL, IGNORE, and REPLACE. The default algorithm is ABORT. This is what they mean:

ON CONFLICT定义了关键字来作为约束条件。它们是:ROLLBACK(撤销),ABORT(中止), FAIL(失败), IGNORE(忽略)和REPLACE(替换)

ROLLBACK

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.

撤销

当错误发生时会立即调用ROLLBACK事件,中止当前的事件,返回“SQLITE_CONSTRAINT”。如果ROLLBACK没有可用事件(other than the implied transaction that is created on every command这句怎么翻译?),它等效于ABORT。

 
ABORT

When a constraint violation occurs, the command backs out any prior changes it might have made and aborts with a return code of SQLITE_CONSTRAINT. But no ROLLBACK is executed so changes from prior commands within the same transaction are preserved. This is the default behavior.

中止

当错误发生,撤销先前所有可能发生的更改,返回SQLITE_CONSTRAINT,中止函数。但是没有ROLLBACK被执行,因此先前命令中有相同表达式的更改仍被保存(这句话是什么意思?)。这是默认的操作。

FAIL

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. For example, if an UPDATE statement encountered a constraint violation on the 100th row that it attempts to update, then the first 99 row changes are preserved but changes to rows 100 and beyond never occur.

失败

当错误发生,返回SQLITE_CONSTRAINT,中止函数。但是命令先前所作的更改将被保存并且不会被撤销。比如:如果一个UPDATE语句在第100行遇到错误,那么前99行的改变将被保存,100行与100行之后的的改变将不会发生。

IGNORE

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.

忽略

当错误发生,发生错误的行不会添加和更改。其后的命令将照常进行。一切依旧进行,不返回错误。

REPLACE

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.

When this conflict resolution strategy deletes rows in order to satisfy a constraint, it does not invoke delete triggers on those rows. But that may change in a future release.

替换

当唯一(UNIQUE是这样翻译吗?)的错误发生时,引起错误的行将被正确的行取代。语句继续正常执行,不返回错误。如果是“NOT NULL”错误(这是什么错误?),NULL的值将被默认值替代。如果列没有默认值,将调用ABORT。

当是奇怪的错误时会删除错误行(这是为了保证安全),但对于这些行没有触发delete事件。将来的版本可能改变这些特性。

The algorithm specified in the OR clause of a COPY, INSERT, or UPDATE overrides any algorithm specified in a CREATE TABLE or CREATE INDEX. If no algorithm is specified anywhere, the ABORT algorithm is used.

默认操作是ABORT

This page last modified on 2005/05/10 16:11:41