rollback & commit

kakayuan 2004-11-11 11:23:12
rollback 和 commit 的实际作用是什么?
commit 是将从上次执行的 rollback or commit 开始到当前的SQL语句提交数据库(修改物理数据库),而rollback 是撤消从上次执行完的 rollback or commit 到当前的SQL语句。什么意思啊?
小弟我执行了SQL不用commit也修改了数据库中的数据啊。
不解!
...全文
113 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
churennan 2004-11-12
  • 打赏
  • 举报
回复
同意楼上的,commit为提交,rollback 为回滚,
lijian1008 2004-11-12
  • 打赏
  • 举报
回复
是你的pb中设置了自动commit属性呀
guhguh 2004-11-12
  • 打赏
  • 举报
回复
Commit后是提交
  • 打赏
  • 举报
回复
蛙色 我又长了个角角 咯咯咯咯3~~~~
  • 打赏
  • 举报
回复
sqlca.autoCommit = true 了就不用在程序中COMMIT了 !
hzhxxx 2004-11-12
  • 打赏
  • 举报
回复


上面的就是,最权威的就是 pb 的帮助
hzhxxx 2004-11-12
  • 打赏
  • 举报
回复
Description

Permanently updates all database operations since the previous COMMIT, ROLLBACK, or CONNECT for the specified transaction object.
Using COMMIT and ROLLBACK in a server component COMMIT and ROLLBACK commands embedded in a server component may have different effects depending on the setting of the UseContextObject DBParm parameter.

For information on the UseContextObject parameter see Connecting to Your Database. For information on deploying components to a transaction server, see Application Techniques.

Syntax

COMMIT {USING TransactionObject} ;

Parameter Description
TransactionObject The name of the transaction object for which you want to permanently update all database operations since the previous COMMIT, ROLLBACK, or CONNECT. This clause is required only for transaction objects other than the default (SQLCA)
Usage

COMMIT does not cause a disconnect, but it does close all open cursors or procedures. (But note that the DISCONNECT statement in PowerBuilder does issue a COMMIT.)
Error handling It is good practice to test the success/failure code after executing a COMMIT statement.
hzhxxx 2004-11-12
  • 打赏
  • 举报
回复
Cancels all database operations in the specified database since the last COMMIT, ROLLBACK, or CONNECT.
Using COMMIT and ROLLBACK in a server component COMMIT and ROLLBACK commands embedded in a server component may have different effects depending on the setting of the UseContextObject DBParm parameter.

For information on the UseContextObject parameter see Connecting to Your Database. For information on deploying components to a transaction server, see Application Techniques.

Syntax

ROLLBACK {USING TransactionObject} ;

Parameter Description
TransactionObject The name of the transaction object that identifies the database in which you want to cancel all operations since the last COMMIT, ROLLBACK, or CONNECT. This clause is required only for transaction objects other than the default (SQLCA)
Usage

ROLLBACK does not cause a disconnect, but it does close all open cursors and procedures.
Error handling It is good practice to test the success/failure code after executing a ROLLBACK statement.
青锋-SS 2004-11-12
  • 打赏
  • 举报
回复
在没有提交时可以用rollback撤消掉它.
kakayuan 2004-11-12
  • 打赏
  • 举报
回复
例:
insert into table (cloumn1,cloumn2,...) values (cloumn1.value,cloumn2.value,...) ;
是不是table中插入了一条记录,而硬盘数据中没有这条记录??
那么插入的数据存在哪里?如果说新记录存在于数据库中,这和存在于硬盘中有什么区别??
mittee 2004-11-11
  • 打赏
  • 举报
回复
这是数据库事务管理,数据库的提交要么同时提交成功;要么同时提交失败,那么就会回滚。
可以这样理解,commit;命令是让数据真正的保存到硬盘里,
dw_1.update()并没有真正保存数据。
rollback 命令是让你有出错之后返回到原来状况的机会。

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧