Classes
Wix::Extensions::DataSource Namespace Reference

Classes

class  ODBCConnection
 
class  MSSQLDatabaseConnection
 
class  MSSQLDatabase
 
class  MSSQLDatabaseOption
 
class  MSSQLDatabaseFileSpec
 
class  MSSQLDataBinaryFile
 
class  MSSQLDataFile
 
class  MSSQLDataFileParameter
 
class  AccessDatabaseConnection
 
class  AccessDatabase
 
class  ODBCExecute
 
class  ODBCExecuteFile
 
class  ODBCExecuteBinary
 
class  ODBCDataSource
 
class  MSSQLDataSource
 
class  AccessDataSource
 

Detailed Description

Windows Installer XML DataSource Extension

This extension significantly simplifies authoring of data source connection points, creating databases at install time and dropping databases during uninstall. Unlike the wix Sql extensions it is constructed on top of pure ODBC and built to support other database types in the near future.

Example: Executing Statements on a Generic ODBC Connection
<AppSecInc:ODBCConnection Id="LocalGenericConnection" ConnectionString="Driver={SQL Server};Server=localhost,1433;Database=master;Trusted_Connection=Yes;" />
<Component Id="MasterDatabaseSysDatabases" Guid="0399235A-BFF3-41ef-993C-8FA9C0E354D6" KeyPath="yes">
<AppSecInc:ODBCExecute Id="SelectSysDatabases" ConnectionId="LocalGenericConnection" Sql="SELECT * FROM sysdatabases" OutputFilename="[INSTALLLOCATION]SysDatabases.xml" ExecuteOnInstall="yes" />
</Component>
Example: Creating an MSSQL Database and Executing SQL Statements
<AppSecInc:MSSQLDatabaseConnection Id="LocalSQLServerConnection" IpAddress="localhost" Port="1433" Protocol="Tcp" WindowsAuthentication="yes" />
<Binary Id="CreateBinaryTable_sql" SourceFile="CreateBinaryTable.sql" />
...
<File Id="CreateFileTable_sql" Name="CreateTable.sql" Source="CreateTable.sql" />
...
<AppSecInc:MSSQLDatabase Id="MSSQLDemoDatabase" Name="[MSSQL_DATABASE_NAME]" Connection="LocalSQLServerConnection" CreateOnInstall="yes" DropOnUnInstall="yes">
<AppSecInc:MSSQLDatabaseOption Id="MSSQLDemoDatabase_QuotedIdentifierOn" Value="QUOTED_IDENTIFIER ON" />
<AppSecInc:MSSQLDatabaseFileSpec Id="MSSQLDemoDatabase_PRIMARY" Name="Demo_mdf" Filename="[INSTALLLOCATION]Demo.mdf" Size="10MB" Type="PRIMARY" />
<AppSecInc:MSSQLDatabaseFileSpec Id="MSSQLDemoDatabase_LOG" Name="Demo_ldf" Filename="[INSTALLLOCATION]Demo.ldf" Size="12MB" Type="LOG ON" />
<AppSecInc:ODBCExecute Id="MSSQLDemoDatabase_CreateOptionalTable1" Sql="CREATE TABLE [\[][MSSQL_DATABASE_NAME]Optional[\]].[\[]dbo[\]].[\[]OptionalTable1[\]] ( [\[]OptionalTable1_Id[\]] [\[]int[\]] IDENTITY(1,1) NOT NULL )" ExecuteOnInstall="yes" />
<AppSecInc:ODBCExecute Id="MSSQLDemoDatabase_DropOptionalTable1" Sql="DROP TABLE [\[][MSSQL_DATABASE_NAME]Optional[\]].[\[]dbo[\]].[\[]OptionalTable1[\]]" ExecuteOnUnInstall="yes" />
<AppSecInc:ODBCExecuteBinary Id="MSSQLDemoDatabase_Binary" ExecuteOnInstall="yes" BinaryId="CreateBinaryTable_sql" />
<AppSecInc:ODBCExecuteFile Id="[#CreateFileTable_sql]" ExecuteOnInstall="yes" />
</AppSecInc:MSSQLDatabase>
Example: Inserting BULK Data into an MSSQL Database
<AppSecInc:MSSQLDatabase Id="MSSQLDemoDatabase" Name="[MSSQL_DATABASE_NAME]" ConnectionId="LocalSQLServerConnection" CreateOnInstall="yes" DropOnUnInstall="yes">
<AppSecInc:MSSQLDataFile Id="MSSQLDemoDatabase_BulkInsert_CSV" Filename="[INSTALLLOCATION]BinaryTable.csv" ExecuteOnInstall="yes" Schema="dbo" Table="BinaryTableEncoded">
<AppSecInc:MSSQLDataFileParameter Id="MSSQLDemoDatabase_BulkInsert_CSV_KEEPIDENTITY" Value="KEEPIDENTITY" />
<AppSecInc:MSSQLDataFileParameter Id="MSSQLDemoDatabase_BulkInsert_CSV_DATAFILETYPE" Value="DATAFILETYPE = 'char'" />
<AppSecInc:MSSQLDataFileParameter Id="MSSQLDemoDatabase_BulkInsert_CSV_FIELDTERMINATOR" Value="FIELDTERMINATOR = ','" />
</AppSecInc:MSSQLDataFile>
<AppSecInc:MSSQLDataBinaryFile Id="MSSQLDemoDatabase_BulkInsert_Binary_CSV" BinaryId="BinaryTable_csv" ExecuteOnInstall="yes" Schema="dbo" Table="BinaryTableNotEncoded">
<AppSecInc:MSSQLDataFileParameter Id="MSSQLDemoDatabase_BulkInsert_Binary_CSV_KEEPIDENTITY" Value="KEEPIDENTITY" />
<AppSecInc:MSSQLDataFileParameter Id="MSSQLDemoDatabase_BulkInsert_Binary_CSV_DATAFILETYPE" Value="DATAFILETYPE = 'char'" />
<AppSecInc:MSSQLDataFileParameter Id="MSSQLDemoDatabase_BulkInsert_Binary_CSV_FIELDTERMINATOR" Value="FIELDTERMINATOR = ','" />
</AppSecInc:MSSQLDataBinaryFile>
</AppSecInc:MSSQLDatabase>
Example: Creating Generic, Access and MSSQL Data Sources
<AppSecInc:ODBCDataSource Id="MSSQLDatabaseDataSource_DemoDatabase_ODBC" CreateOnInstall="yes" DeleteOnUnInstall="yes" Driver="SQL Server"
Name="DemoODBCGenericSystemDSN" Type="system" Value="Server=localhost;Description=[MSSQL_DATABASE_NAME] DSN created by ODBCDataSource;Database=[MSSQL_DATABASE_NAME];Trusted_Connection=yes" />
<AppSecInc:MSSQLDataSource Id="MSSQLDatabaseDataSource_DemoDatabase_MSSQL" CreateOnInstall="yes" DeleteOnUnInstall="yes"
Name="DemoMSSQLDatabaseUserDSN" Type="user" Address="localhost" Description="[MSSQL_DATABASE_NAME] DSN created by MSSQLDataSource"
Database="[MSSQL_DATABASE_NAME]" TrustedConnection="yes" Server="localhost" Network="DBMSSOCN" />
<AppSecInc:AccessDataSource Id="AccessDemoDatabase_DataSource" CreateOnInstall="yes" DBQ="[INSTALLLOCATION]Database.mdf"
Name="DemoAccessDatabaseSystemDSN" Type="system" Description="Access Demo DSN" DeleteOnUnInstall="yes" />
Example: Creating a Microsoft Access Database
<Property Id="ACCESS_DATABASE_DBQ" Value="[INSTALLLOCATION]AccessDemoDatabase.mdf">
<!-- database name saved for uninstall -->
<RegistrySearch Id="AccessDatabaseDBQSearch" Root="HKLM" Type="raw" Key="SOFTWARE\AppSecInc\AccessDatabaseMsi" Name="ACCESS_DATABASE_DBQ" />
</Property>
<Component Id="AccessDatabaseMsiComponent" Guid="D2CF0414-4650-4192-8A6F-41F1FB31C290">
...
<AppSecInc:AccessDatabase Id="AccessDemoDatabase" DBQ="[ACCESS_DATABASE_DBQ]" ConnectionId="AccessConnection" CreateOnInstall="yes" DropOnUnInstall="yes">
<AppSecInc:ODBCExecute Id="AccessDemoDatabase_CreateTable1" Sql="CREATE TABLE Table1 ( Table1_Id INTEGER NOT NULL )" ExecuteOnInstall="yes" OutputFilename="[INSTALLLOCATION]CreateTable1.xml" />
<AppSecInc:ODBCExecute Id="AccessDemoDatabase_DropTable1" Sql="DROP TABLE Table1" ExecuteOnUnInstall="yes" />
</AppSecInc:AccessDatabase>
</Component>
<!-- save the database name for uninstall -->
<Component Id="AccessDatabaseMsiRegistry" Guid="9B3E538F-8C30-4c68-8C00-97B1FA14522A">
<RegistryKey Id="AccessDatabaseMsiRegistryKey" Root="HKLM" Key="Software\AppSecInc\AccessDatabaseMsi" Action="createAndRemoveOnUninstall">
<RegistryValue Id="AccessDatabaseMsiRegistryKey_Access_DATABASE_DBQ" Name="ACCESS_DATABASE_DBQ" Value="[ACCESS_DATABASE_DBQ]" Type="string" />
</RegistryKey>
</Component>


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com