DATASTAR supports two types of components as described below. These can be created in DATASTAR by navigating to the Configuration tab and select the New Template option. You will be prompted with a dialog asking you to choose the type of component you wish to create, select the desired component and you will be taken to an XML document editor initially populated with a starter template. Details about the configuration options for each component type are detailed the the sections that follow. The editor also provides some basic code assist which can be shown using CTRL+SPACE.


Object Components

These are components such as tables, views, triggers, functions, stored procedures. The scripts generated allow you version control the code and includes features such as permissions. The example below is used to create table extracts from MS SQL Server.

<?xml version="1.0" encoding="utf-8"?>
<ObjectComponent Schema="${schema}" Category="tables" Name="${filename}">
  <Option Name="Permissions" Value="True"/>
  <Option Name="Indexes" Value="True"/>
  <SchemaObject Name="${name}" Type="Table"/>
        SELECT TABLE_SCHEMA AS '${schema}', 
        '[' + LOWER(TABLE_SCHEMA) + '].[' + LOWER(TABLE_NAME) + ']' AS '${filename}',           TABLE_NAME AS '${name}'
  <Deployment Weight="280"/>

Data Components

A data component captures the data or subsets of data across one or more tables in re-runnable SQL scripts in an environment agnostic way. The level of granularity and make-up of these components is controlled by templates which you define, this provides a high degree of flexibility giving you full control over the tables, columns and granularity of the scripts. The example below shows a simple parent child relationship where each parent row is extracted as a separate script.

<?xml version="1.0" encoding="utf-8"?>
<DataComponent Category="example" Name="${name}" DeleteEnabled="true">
  <Option Name="ANSI_WARNINGS" Value="OFF"/>
  <Option Name="NOCOUNT" Value="ON"/>
  <Option Name="DATEFORMAT" Value="ymd"/>
  <Table Id="1" Name="PARENT_TABLE">
    <Column Name="ITEM_CD" PrimaryKey="true" Transient="false"/>
      <Value Column="ITEM_CD" Value="${name}"/>
  <Table Id="2" Name="CHILD_TABLE">
    <Column Name="ITEM_CD" PrimaryKey="true" Transient="false" SortOrder="1"/>
    <Column Name="CHILD_CD" PrimaryKey="true" Transient="false" SortOrder="2"/>
    <JoinTable ReferenceId="1" Relationship="ManyToOne">
      <JoinColumn Column="ITEM_CD" ReferenceColumn="ITEM_CD"/>
        select ITEM_CD as '${name}'
        from PARENT_TABLE
  <Deployment Weight="404">
    <Script Path="templates/scripts/example-constraints-disable.sql" Weight="-1"/>
    <Script Path="templates/scripts/example-constraints-enable.sql" Weight="+1"/>