问题标签 [rollback]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
22311 浏览

sql - 回滚插入语句

我在我的一张表中插入了一些记录,最多 5000 条。

但现在我意识到这些记录不应该插入到这个表中。我无法一一删除记录。或者无法区分表中先前记录的插入记录。

我怎样才能回滚这个插入语句,以便我的表恢复到原来的形式。

(我认为这是一种使用日志的方式。但我不知道该怎么做。)

谢谢。

0 投票
1 回答
1095 浏览

sql - 使用提交和回滚访问代码中的事务

如果出现错误,我被要求尝试回滚一些数据库更改。

在我开始尝试使用带有 COMMIT 或 ROLLBACK 的 TRANSACTION 之前,有人可以告诉我是否可以在 MS Access 中执行以下操作吗?

语法很糟糕,但你应该明白这一点:代码中的例程可以启动事务,调用其他几个例程,然后提交或回滚整个事情,还是这个想法让人相信?

谢谢,乔

0 投票
3 回答
5598 浏览

c# - 自定义安装程序类,从不调用回滚方法

我有一个安装程序类,这是一个片段:

现在我以全 GUI 模式开始安装,然后在过程中间单击“取消”按钮,导致安装回滚。问题是没有调用 RollBack 方法。我在事件日志中没有看到预期的条目。

我想提一下,如果我让安装完成,我会在事件日志中看到“安装”消息,如果我随后卸载,我会在事件日志中看到“卸载”消息。但是如果中途停止安装过程,按“取消”按钮,我确实看到进度条向后退,但没有调用回滚方法。

我究竟做错了什么 ?提前感谢您的帮助。

编辑:

提供更多细节...

安装程序是一个 MSI 软件包。

该软件包是使用安装项目在 vs2009 中构建的。安装程序类用作安装项目的自定义操作。

由于这是一个 MSI 包,我可以选择在静默模式或用户交互模式下运行它。当我写“全 GUI 模式”时,我提到了用户交互模式。

0 投票
2 回答
499 浏览

.net - Implement data rollback in existing CRUD app

I have an existing CRUD app that I have been tasked with implementing "tomb stoning". I need a way to allow a user to roll a given page of data back to the previous state.

Say I have First Name, Last Name, and Social Security Number on a page in this app. User A updates the Last Name field. Later, User B notices that the New Last Name is different and wants to see Who changed it and roll it back if neccessary.

I am unfamilar with this so if I am missing or misusing some terms, forgive me.

This app has a MS SQL backend and the DAL is mostly SPROCS. Right now there isn't any archiving or tomb stoning to speak of.

I had thought to just make a table for each existing table called tblPerson --> tblPersonTombstone and then the roll back portion would read from that table. Unfortunately, the original DB designers designed it in such a way that a Single page in the App might contain info from 2 or 3 different tables. Thus, I would imagine, I need a more Transaction based approach.

Any direction or pointers will be greatly appreciated. Am I on the right track with my thinking? Maybe I am over complicating it? How have others done it?

I see this post How to implement ‘undo’ operation in .net windows application? and also this one New CodePlex project: a simple Undo/Redo framework but I am concered that neither fit my actual situaiton. I am not looking to let the users click ctl+z. I need to let them roll a whole page back to a previous state. If I am misunderstanding the use of those two examples then please say so.

Thanks for the time.

0 投票
1 回答
1193 浏览

python - 允许用户使用 SQLAlchemy 从数据库审计跟踪回滚

我开始将 SQLAlchemy 用于一个新项目,我计划在该项目中实施类似于在这个问题上提出的审计跟踪:

由于我已经拥有“有趣”对象的完整历史,我正在考虑允许用户回滚到给定版本,让他们有可能拥有无限的undo.

这可以用 SQLAlchemy 以干净的方式完成吗?

在内部 API(业务逻辑和 ORM)中公开此功能的正确方法是什么?

我是一些东西user.rollback(ver=42)

0 投票
1 回答
2515 浏览

java - 从在线页面向数据库添加数据时出现 NullPointerException

从在线 JSP 页面添加数据时,我收到 NullPointerException 异常。

错误描述如下:

我正在使用 Websphere 服务器“IBM WebSphere Application Server - ND,6.0.2.35”。

但是,当我使用“IBM WebSphere Application Server - ND, 6.0.2.17”时没有问题

有什么想法为什么会发生这种情况。

感谢您在这方面所做的所有努力。

谢谢,马诺亚。

0 投票
4 回答
1294 浏览

c# - 在 C# 中回滚 linq2sql 插入事务的问题

我正在尝试使用 linq2SQL 将 CSV 文件的内容插入到数据库表中。

如果任何插入失败,我希望能够回滚事务但是当我尝试使用此代码时,我在 - db.Transaction.Commit()处收到以下错误

System.InvalidOperationException 未处理:此 SqlTransaction 已完成;它不再可用。

有谁知道我做错了什么?

0 投票
2 回答
254 浏览

linux - 版本回滚

我正在 linux 中做一个概念,我想为安装在 linux 中的应用程序进行版本回滚。可能吗??

例如,我有一个名为 X 的应用程序,版本为 1.1,我得到了更新。它将其更改为 1.2 版 我注意到应用程序中的所有包都将被修改。然后我保存它们并应用更改。现在,由于某些问题,我想切换回 1.1 版。如果我撤消更改并完成整个解决方案,是否会完成回滚?

0 投票
5 回答
2377 浏览

ruby-on-rails - 当 Rails ActiveRecord before_create 过滤器返回 false 时,如何防止数据库更改被回滚?

我在我的 Rails ActiveRecord 模型之一中添加了 before_create 过滤器,并且在该过滤器中我正在执行一些数据库更新。

有时我从过滤器返回 false 以防止创建目标模型,但这会导致我所做的所有其他数据库更改(在过滤器内)被回滚。

我怎样才能防止这种情况?

更新#1:这是一些解释我的问题的伪代码:

更新#2:下面有一些很好的答案,但每个都有其缺点。我最终像这样覆盖了 create 方法:

0 投票
1 回答
729 浏览

hibernate - 休眠约束违反/错误回滚

我遇到了一个奇怪的休眠错误,很可能是由于使用不当造成的,但我想知道是否有任何方法可以找到它的根本原因并进行补救。

目前我有一个类层次结构,如下所示:

我已经广泛测试了所有三个类的对象的持久性和删除,并且一切似乎都正常执行,直到我考虑对属性的约束,特别是。关于坚持。

现在我实例化一个 C 类的对象 newObj,它的 propB 值等于所有就绪的持久对象,所有就绪对象的 propB 都具有该值。我尝试将其持久化,并且正如预期的那样,引发了违反约束并且我尝试回滚事务。我希望 newObj 的所有痕迹都会被删除,但是会发生一些非常奇怪的事情。确实删除了 C 类和 B 类表中对 newObj 的所有引用,但 A 类表中的属性仍然存在,并且据我所知无法恢复。为什么??