BDD Scenarios: Automating Application Deployment

Scenario 2: Using Default Gateway Values to Query a Database by Site

Published: March 8, 2005

When using the CustomSettings.ini file, it is possible to map multiple default gateways to one settings section in order to use the same settings for each. The previous example does not support this though, so the package list needs to be duplicated for each default gateway. This can be avoided by creating a more complex database structure.

use [BDDAdminDB]
go

if exists (select * from dbo.sysobjects where id = 
 object_id(N'[dbo].[SitePackages]') and 
 OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SitePackages]
go
if exists (select * from dbo.sysobjects where id = 
 object_id(N'[dbo].[GatewayToSite]') and 
 OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GatewayToSite]
go
if exists (select * from dbo.sysobjects where id = 
 object_id(N'[dbo].[LocationPackages]') and 
 OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[LocationPackages]
go

CREATE TABLE [dbo].[SitePackages] (
	[Site] [nvarchar] (50),
	[Packages] [nvarchar] (50)
)
go

CREATE TABLE [dbo].[GatewayToSite] (
	[DefaultGateway] [nvarchar] (50),
	[Site] [nvarchar] (50)
)
go

CREATE VIEW [dbo].[LocationPackages] AS
SELECT a.Site, Packages, DefaultGateway FROM SitePackages a, GatewayToSite b
WHERE a.Site = b.Site
go

Now, you can populate that table with rows for each location.

use [BDDAdminDB]
go

insert into GatewayToSite(DefaultGateway, Site) 
 values ('192.168.0.1', 'HOUSTON')
go
insert into GatewayToSite(DefaultGateway, Site) 
 values ('11.1.1.11', 'REDMOND')
go
insert into GatewayToSite(DefaultGateway, Site) 
 values ('172.28.20.1', 'REDMOND')
go

insert into SitePackages(Site, Packages) 
 values('REDMOND', 'XXX00004-Program name 4')
go
insert into SitePackages(Site, Packages) 
 values('REDMOND', 'XXX00005-Program name 5')
go

insert into SitePackages(Site, Packages) 
 values('HOUSTON', 'XXX00006-Program name 6')
go
insert into SitePackages(Site, Packages) 
 values('HOUSTON', 'XXX00007-Program name 7')
go
insert into SitePackages(Site, Packages) 
 values('HOUSTON', 'XXX00008-Program name 8')
go

The same CustomSettings.ini configuration described in the previous section can be used with this data structure as well, as the LocationPackages view has the same basic structure as the LocationPackages table in the previous section.


Top of pageTop of pagePrevious11 of 20Next
**
In This Article
**