Information Technology Reference
In-Depth Information
and NDbUnit 4 can help seed the data that is inserted into and deleted
from a database as well.
LISTING 5-5 data-manipulation.sql: Sample Database Manipulation
Script for MySQL
INSERT INTO beer(id, beer_name, brewer, date_received) VALUES (1,
'Liberty Ale','Anchor Brewing Company','2006-12-09');
INSERT INTO beer(id, beer_name, brewer, date_received) VALUES (2,
'Guinness Stout','St. James Gate Brewery','2006-10-23');
INSERT INTO state (state, description) VALUES('VT','Vermont');
INSERT INTO state (state, description) VALUES('VA','Virginia');
INSERT INTO state (state, description) VALUES('VI','Virgin Islands');
To achieve the benefits of automated database integration, you'll
need to provide scripts for inserting, updating, and deleting data.
These data manipulation scripts execute as part of an overall build pro-
cess. Next, we discuss how to tie these scripts together with the
orchestration script.
Creating a Build Database Orchestration Script
A database integration orchestration script executes the DDL and Data
Manipulation Language (DML) statements. Listing 5-6 shows an Ant
script that uses the sql task to call the data-definition.sql and data-
manipulation.sql files we created in Listing 5-3 and Listing 5-5. You'll
incorporate this orchestration into your higher-level build and integra-
tion processes.
LISTING 5-6 build-database.xml: Database Integration Orchestration
Script Using Ant
<target name="db:prepare" depends="db:create, db:insert"/>
<target name="db:create">
<target name="db:insert" depends="filterSqlFiles">
4. DbUnit is available at www.dbunit.org/ and NDbUnit is available at
www.ndbunit.org/.
Search WWH ::




Custom Search