博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
postgres 事务
阅读量:2342 次
发布时间:2019-05-10

本文共 844 字,大约阅读时间需要 2 分钟。

Transactions

Transactions are a fundamental concept of all database system. The essential point of a transaction is that it bundles multiple steps into a single, all-or-nothing operation. The intermediate states between the steps are not visible to other concurrent transaction, and if some failure occurs that prevents the transaction from completing, the none of the steps affect the database at all.

In PostgreSQL, a transaction is set up by surrounding the SQL commands of the transaction with begin and commit commands.

BEGIN;UPDATE accounts SET balance = balance - 100.00    WHERE name = 'Alice';SAVEPOINT my_savepoint;UPDATE accounts SET balance = balance + 100.00    WHERE name = 'Bob';-- oops ... forget that and use Wally's accountROLLBACK TO my_savepoint;UPDATE accounts SET balance = balance + 100.00    WHERE name = 'Wally';COMMIT;

转载地址:http://zeyvb.baihongyu.com/

你可能感兴趣的文章
Eigen 3.2稀疏矩阵入门
查看>>
python和numpy的版本、安装位置
查看>>
python-igraph Manual地址
查看>>
python 查看opencv的安装路径
查看>>
鱼眼相机标定以及OpenCV实现
查看>>
OpenCV_contrib模块概述
查看>>
鱼眼摄像头标定与畸变校正(双OPENCV版本)
查看>>
OpenCV两种畸变校正模型源代码分析以及CUDA实现
查看>>
3A算法理解
查看>>
camera参数介绍及3A编程算法
查看>>
关于Android Camera2 API 的自动对焦的坑
查看>>
android camera2 拿到的yuv420数据到底是什么样的?
查看>>
Android: Image类浅析(结合YUV_420_888)
查看>>
Android6.0动态申请SD卡读写的权限
查看>>
throw和throws用法
查看>>
Android Activity 生命周期中onStart()和onResume()的区别
查看>>
Android Fragment的用法(一)
查看>>
Android 自定义控件
查看>>
Android 外部启动activity,自定义action,action常量大全
查看>>
Android之编写测试用例
查看>>