Menu

Generate The Changes And Execute Them Later

I use DBvolution for a lot of scripting work and usually I use DBDatabase's update, insert, and delete methods to make changes. They're is quick and easy to use.

But what if I need to check what's going to happening before executing?

This use case is covered by static methods in DBUpdate, DBInsert, and DBDelete.

In particular DBUpdate provides the getUpdates(DBRow...) method which works out how to do the updates and then creates a DBActionList with the required actions.

With the DBActionList you can check the SQL, produce a revert script to undo the changes, and run the changes on a database. Since you have the actions are database independent you can even execute the changes on multiple databases if required.

Similar methods have just been added to trunk for DBInsert and DBDelete.

DBActionList also helps with batching the changes too.

The gotcha to remember is that getUpdates doesn't change the database so queries won't see the changes until you execute them.

Posted by Gregory Graham 2014-02-26

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.