From 594bb035b8f27d341c982dc0754589a447b9abd6 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sun, 18 Apr 2021 21:09:37 -0400 Subject: Add `Wix4` table prefixes. Per https://github.com/wixtoolset/issues/issues/5933. --- src/ca/scadb.cpp | 39 +++++++-------- src/ca/scaexec.cpp | 2 +- src/ca/scasql.cpp | 10 ++-- src/ca/scasqlstr.cpp | 56 +++++++++++----------- src/ca/scasqlstr.h | 2 +- src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs | 12 +++-- .../TestData/UsingSql/PackageComponents.wxs | 12 ++++- src/wixext/SqlTableDefinitions.cs | 18 +++---- 8 files changed, 82 insertions(+), 69 deletions(-) diff --git a/src/ca/scadb.cpp b/src/ca/scadb.cpp index 68f7b10b..288b9efe 100644 --- a/src/ca/scadb.cpp +++ b/src/ca/scadb.cpp @@ -5,12 +5,12 @@ // sql queries LPCWSTR vcsSqlDatabaseQuery = L"SELECT `SqlDb`, `Server`, `Instance`, `Database`, " L"`Component_`, `User_`, `FileSpec_`, `FileSpec_Log`, `Attributes` " - L"FROM `SqlDatabase`"; + L"FROM `Wix4SqlDatabase`"; enum eSqlDatabaseQuery { sdqSqlDb = 1, sdqServer, sdqInstance, sdqDatabase, sdqComponent, sdqUser, sdqDbFileSpec, sdqLogFileSpec, sdqAttributes }; LPCWSTR vcsSqlFileSpecQuery = L"SELECT `FileSpec`, `Name`, `Filename`, `Size`, " - L"`MaxSize`, `GrowthSize` FROM `SqlFileSpec` WHERE `FileSpec`=?"; + L"`MaxSize`, `GrowthSize` FROM `Wix4SqlFileSpec` WHERE `FileSpec`=?"; enum eSqlFileSpecQuery { sfsqFileSpec = 1, sfsqName, sfsqFilename, sfsqSize, sfsqMaxSize, sfsqGrowth }; @@ -63,21 +63,21 @@ HRESULT ScaDbsRead( SCA_DB* psd = NULL; - if (S_OK != WcaTableExists(L"SqlDatabase")) + if (S_OK != WcaTableExists(L"Wix4SqlDatabase")) { - WcaLog(LOGMSG_VERBOSE, "Skipping ScaCreateDatabase() - SqlDatabase table not present"); + WcaLog(LOGMSG_VERBOSE, "Skipping ScaCreateDatabase() - Wix4SqlDatabase table not present"); ExitFunction1(hr = S_FALSE); } - if (S_OK == WcaTableExists(L"SqlFileSpec")) + if (S_OK == WcaTableExists(L"Wix4SqlFileSpec")) { hr = WcaOpenView(vcsSqlFileSpecQuery, &hViewFileSpec); - ExitOnFailure(hr, "failed to open view on SqlFileSpec table"); + ExitOnFailure(hr, "failed to open view on Wix4SqlFileSpec table"); } // loop through all the sql databases hr = WcaOpenExecuteView(vcsSqlDatabaseQuery, &hView); - ExitOnFailure(hr, "Failed to open view on SqlDatabase table"); + ExitOnFailure(hr, "Failed to open view on Wix4SqlDatabase table"); while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) { BOOL fHasComponent = FALSE; @@ -85,7 +85,7 @@ HRESULT ScaDbsRead( INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN; hr = WcaGetRecordString(hRec, sdqSqlDb, &pwzId); - ExitOnFailure(hr, "Failed to get SqlDatabase.SqlDb"); + ExitOnFailure(hr, "Failed to get Wix4SqlDatabase.SqlDb"); hr = WcaGetRecordString(hRec, sdqComponent, &pwzComponent); ExitOnFailure(hr, "Failed to get Component for database: '%ls'", psd->wzKey); @@ -110,10 +110,10 @@ HRESULT ScaDbsRead( ExitOnFailure(hr, "Failed to allocate memory for new database: %D", pwzId); hr = ::StringCchCopyW(psd->wzKey, countof(psd->wzKey), pwzId); - ExitOnFailure(hr, "Failed to copy SqlDatabase.SqlDbL: %ls", pwzId); + ExitOnFailure(hr, "Failed to copy Wix4SqlDatabase.SqlDbL: %ls", pwzId); hr = ::StringCchCopyW(psd->wzComponent, countof(psd->wzComponent), pwzComponent); - ExitOnFailure(hr, "Failed to copy SqlDatabase.Component_: %ls", pwzComponent); + ExitOnFailure(hr, "Failed to copy Wix4SqlDatabase.Component_: %ls", pwzComponent); psd->fHasComponent = fHasComponent; psd->isInstalled = isInstalled; @@ -135,7 +135,7 @@ HRESULT ScaDbsRead( ExitOnFailure(hr, "Failed to copy database string to database object:%ls", pwzData); hr = WcaGetRecordInteger(hRec, sdqAttributes, &psd->iAttributes); - ExitOnFailure(hr, "Failed to get SqlDatabase.Attributes"); + ExitOnFailure(hr, "Failed to get Wix4SqlDatabase.Attributes"); hr = WcaGetRecordFormattedString(hRec, sdqUser, &pwzData); ExitOnFailure(hr, "Failed to get User record for database: '%ls'", psd->wzKey); @@ -189,7 +189,7 @@ HRESULT ScaDbsRead( { hr = S_OK; } - ExitOnFailure(hr, "Failure occured while processing SqlDatabase table"); + ExitOnFailure(hr, "Failure occured while processing Wix4SqlDatabase table"); LExit: if (psd) @@ -521,18 +521,18 @@ HRESULT GetFileSpec( // get the FileSpec record hr = WcaExecuteView(hViewFileSpec, hRecFileSpec); - ExitOnFailure(hr, "failed to execute view on SqlFileSpec table for filespec: %ls", wzKey); + ExitOnFailure(hr, "failed to execute view on Wix4SqlFileSpec table for filespec: %ls", wzKey); hr = WcaFetchSingleRecord(hViewFileSpec, &hRec); ExitOnFailure(hr, "failed to get record for filespec: %ls", wzKey); // read the data out of the filespec record hr = WcaGetRecordFormattedString(hRec, sfsqName, &pwzData); - ExitOnFailure(hr, "Failed to get SqlFileSpec.Name for filespec: %ls", wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Name for filespec: %ls", wzKey); hr = ::StringCchCopyW(psf->wzName, countof(psf->wzName), pwzData); - ExitOnFailure(hr, "Failed to copy SqlFileSpec.Name string: %ls", pwzData); + ExitOnFailure(hr, "Failed to copy Wix4SqlFileSpec.Name string: %ls", pwzData); hr = WcaGetRecordFormattedString(hRec, sfsqFilename, &pwzData); - ExitOnFailure(hr, "Failed to get SqlFileSpec.Filename for filespec: %ls", wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Filename for filespec: %ls", wzKey); if (*pwzData) { hr = ::StringCchCopyW(psf->wzFilename, countof(psf->wzFilename), pwzData); @@ -545,7 +545,7 @@ HRESULT GetFileSpec( } hr = WcaGetRecordFormattedString(hRec, sfsqSize, &pwzData); - ExitOnFailure(hr, "Failed to get SqlFileSpec.Size for filespec: %ls", wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Size for filespec: %ls", wzKey); if (*pwzData) { hr = ::StringCchCopyW(psf->wzSize, countof(psf->wzSize), pwzData); @@ -557,7 +557,7 @@ HRESULT GetFileSpec( } hr = WcaGetRecordFormattedString(hRec, sfsqMaxSize, &pwzData); - ExitOnFailure(hr, "Failed to get SqlFileSpec.MaxSize for filespec: %ls", wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.MaxSize for filespec: %ls", wzKey); if (*pwzData) { hr = ::StringCchCopyW(psf->wzMaxSize, countof(psf->wzMaxSize), pwzData); @@ -569,7 +569,7 @@ HRESULT GetFileSpec( } hr = WcaGetRecordFormattedString(hRec, sfsqGrowth, &pwzData); - ExitOnFailure(hr, "Failed to get SqlFileSpec.GrowthSize for filespec: %ls", wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.GrowthSize for filespec: %ls", wzKey); if (*pwzData) { hr = ::StringCchCopyW(psf->wzGrow, countof(psf->wzGrow), pwzData); @@ -581,6 +581,7 @@ HRESULT GetFileSpec( } hr = S_OK; + LExit: ReleaseStr(pwzData); return hr; diff --git a/src/ca/scaexec.cpp b/src/ca/scaexec.cpp index 7a30f52a..b2648361 100644 --- a/src/ca/scaexec.cpp +++ b/src/ca/scaexec.cpp @@ -342,7 +342,7 @@ extern "C" UINT __stdcall ExecuteSqlStrings(MSIHANDLE hInstall) hr = WcaReadStringFromCaData(&pwz, &pwzSql); ExitOnFailure(hr, "failed to read SQL string for key: %ls", pwzSqlKey); - // If the SqlString row is set to continue on error and the DB connection failed, skip attempting to execute + // If the Wix4SqlString row is set to continue on error and the DB connection failed, skip attempting to execute if ((iAttributesSQL & SCASQL_CONTINUE_ON_ERROR) && FAILED(hrDB)) { WcaLog(LOGMSG_STANDARD, "Error 0x%x: continuing after failure to connect to database: %ls", hrDB, pwzDatabase); diff --git a/src/ca/scasql.cpp b/src/ca/scasql.cpp index 5e3edd1c..b0216950 100644 --- a/src/ca/scasql.cpp +++ b/src/ca/scasql.cpp @@ -67,21 +67,21 @@ static HRESULT ConfigureSqlData( SCA_SQLSTR* psssList = NULL; // check for the prerequsite tables - if (S_OK != WcaTableExists(L"SqlDatabase")) + if (S_OK != WcaTableExists(L"Wix4SqlDatabase")) { - WcaLog(LOGMSG_VERBOSE, "skipping SQL CustomAction, no SqlDatabase table"); + WcaLog(LOGMSG_VERBOSE, "skipping SQL CustomAction, no Wix4SqlDatabase table"); ExitFunction1(hr = S_FALSE); } // read tables hr = ScaDbsRead(&psdList, saAction); - ExitOnFailure(hr, "failed to read SqlDatabase table"); + ExitOnFailure(hr, "failed to read Wix4SqlDatabase table"); hr = ScaSqlStrsRead(&psssList, saAction); - ExitOnFailure(hr, "failed to read SqlStrings table"); + ExitOnFailure(hr, "failed to read Wix4SqlString table"); hr = ScaSqlStrsReadScripts(&psssList, saAction); - ExitOnFailure(hr, "failed to read SqlScripts table"); + ExitOnFailure(hr, "failed to read Wix4SqlScript table"); if (SCA_ACTION_UNINSTALL == saAction) { diff --git a/src/ca/scasqlstr.cpp b/src/ca/scasqlstr.cpp index 6ac526a6..c3ebd43d 100644 --- a/src/ca/scasqlstr.cpp +++ b/src/ca/scasqlstr.cpp @@ -4,11 +4,11 @@ // sql queries LPCWSTR vcsSqlStringQuery = L"SELECT `String`, `SqlDb_`, `Component_`,`SQL`,`User_`,`Attributes`,`Sequence` " -L"FROM `SqlString` ORDER BY `SqlDb_`,`Sequence`"; +L"FROM `Wix4SqlString` ORDER BY `SqlDb_`,`Sequence`"; enum eSqlStringQuery { ssqSqlString = 1, ssqSqlDb, ssqComponent, ssqSQL, ssqUser, ssqAttributes, ssqSequence }; LPCWSTR vcsSqlScriptQuery = L"SELECT `ScriptBinary_`,`Script`, `SqlDb_`, `Component_`,`User_`,`Attributes`,`Sequence` " -L"FROM `SqlScript` ORDER BY `SqlDb_`,`Sequence`"; +L"FROM `Wix4SqlScript` ORDER BY `SqlDb_`,`Sequence`"; enum eSqlScriptQuery { sscrqScriptBinary=1, sscrqSqlScript, sscrqSqlDb, sscrqComponent, sscrqUser, sscrqAttributes, sscrqSequence }; LPCWSTR vcsSqlBinaryScriptQuery = L"SELECT `Data` FROM `Binary` WHERE `Name`=?"; @@ -44,15 +44,15 @@ HRESULT ScaSqlStrsRead( SCA_SQLSTR* psss = NULL; - if (S_OK != WcaTableExists(L"SqlString") || S_OK != WcaTableExists(L"SqlDatabase")) + if (S_OK != WcaTableExists(L"Wix4SqlString") || S_OK != WcaTableExists(L"Wix4SqlDatabase")) { - WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsRead() - SqlString and/or SqlDatabase table not present"); + WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsRead() - Wix4SqlString and/or Wix4SqlDatabase table not present"); ExitFunction1(hr = S_FALSE); } // loop through all the sql strings hr = WcaOpenExecuteView(vcsSqlStringQuery, &hView); - ExitOnFailure(hr, "Failed to open view on SqlString table"); + ExitOnFailure(hr, "Failed to open view on Wix4SqlString table"); while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) { INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN; @@ -80,30 +80,30 @@ HRESULT ScaSqlStrsRead( psss->isAction = isAction; hr = WcaGetRecordString(hRec, ssqSqlString, &pwzData); - ExitOnFailure(hr, "Failed to get SqlString.String"); + ExitOnFailure(hr, "Failed to get Wix4SqlString.String"); hr = ::StringCchCopyW(psss->wzKey, countof(psss->wzKey), pwzData); - ExitOnFailure(hr, "Failed to copy SqlString.String: %ls", pwzData); + ExitOnFailure(hr, "Failed to copy Wix4SqlString.String: %ls", pwzData); // find the database information for this string hr = WcaGetRecordString(hRec, ssqSqlDb, &pwzData); - ExitOnFailure(hr, "Failed to get SqlString.SqlDb_ for SqlString '%ls'", psss->wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlString.SqlDb_ for SqlString '%ls'", psss->wzKey); hr = ::StringCchCopyW(psss->wzSqlDb, countof(psss->wzSqlDb), pwzData); - ExitOnFailure(hr, "Failed to copy SqlString.SqlDb_: %ls", pwzData); + ExitOnFailure(hr, "Failed to copy Wix4SqlString.SqlDb_: %ls", pwzData); hr = WcaGetRecordInteger(hRec, ssqAttributes, &psss->iAttributes); - ExitOnFailure(hr, "Failed to get SqlString.Attributes for SqlString '%ls'", psss->wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlString.Attributes for SqlString '%ls'", psss->wzKey); //get the sequence number for the string (note that this will be sequenced with scripts too) hr = WcaGetRecordInteger(hRec, ssqSequence, &psss->iSequence); - ExitOnFailure(hr, "Failed to get SqlString.Sequence for SqlString '%ls'", psss->wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlString.Sequence for SqlString '%ls'", psss->wzKey); // execute SQL hr = WcaGetRecordFormattedString(hRec, ssqSQL, &pwzData); - ExitOnFailure(hr, "Failed to get SqlString.SQL for SqlString '%ls'", psss->wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlString.SQL for SQL string '%ls'", psss->wzKey); Assert(!psss->pwzSql); hr = StrAllocString(&psss->pwzSql, pwzData, 0); - ExitOnFailure(hr, "Failed to alloc string for SqlString '%ls'", psss->wzKey); + ExitOnFailure(hr, "Failed to alloc string for SQL string '%ls'", psss->wzKey); *ppsssList = AddSqlStrToList(*ppsssList, psss); psss = NULL; // set the sss to NULL so it doesn't get freed below @@ -113,7 +113,7 @@ HRESULT ScaSqlStrsRead( { hr = S_OK; } - ExitOnFailure(hr, "Failure occured while reading SqlString table"); + ExitOnFailure(hr, "Failure occured while reading Wix4SqlString table"); LExit: // if anything was left over after an error clean it all up @@ -157,19 +157,19 @@ HRESULT ScaSqlStrsReadScripts( SCA_SQLSTR sss; SCA_SQLSTR* psss = NULL; - if (S_OK != WcaTableExists(L"SqlScript") || S_OK != WcaTableExists(L"SqlDatabase") || S_OK != WcaTableExists(L"Binary")) + if (S_OK != WcaTableExists(L"Wix4SqlScript") || S_OK != WcaTableExists(L"Wix4SqlDatabase") || S_OK != WcaTableExists(L"Binary")) { - WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsReadScripts() - SqlScripts and/or SqlDatabase table not present"); + WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsReadScripts() - Wix4SqlScript and/or Wix4SqlDatabase table not present"); ExitFunction1(hr = S_FALSE); } // open a view on the binary table hr = WcaOpenView(vcsSqlBinaryScriptQuery, &hViewBinary); - ExitOnFailure(hr, "Failed to open view on Binary table for SqlScripts"); + ExitOnFailure(hr, "Failed to open view on Binary table for SQL scripts"); // loop through all the sql scripts hr = WcaOpenExecuteView(vcsSqlScriptQuery, &hView); - ExitOnFailure(hr, "Failed to open view on SqlScript table"); + ExitOnFailure(hr, "Failed to open view on Wix4SqlScript table"); while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) { INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN; @@ -196,33 +196,33 @@ HRESULT ScaSqlStrsReadScripts( sss.isAction = isAction; hr = WcaGetRecordString(hRec, sscrqSqlScript, &pwzData); - ExitOnFailure(hr, "Failed to get SqlScript.Script"); + ExitOnFailure(hr, "Failed to get Wix4SqlScript.Script"); hr = ::StringCchCopyW(sss.wzKey, countof(sss.wzKey), pwzData); - ExitOnFailure(hr, "Failed to copy SqlScript.Script: %ls", pwzData); + ExitOnFailure(hr, "Failed to copy Wix4SqlScript.Script: %ls", pwzData); // find the database information for this string hr = WcaGetRecordString(hRec, sscrqSqlDb, &pwzData); - ExitOnFailure(hr, "Failed to get SqlScript.SqlDb_ for SqlScript '%ls'", sss.wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlScript.SqlDb_ for SqlScript '%ls'", sss.wzKey); hr = ::StringCchCopyW(sss.wzSqlDb, countof(sss.wzSqlDb), pwzData); - ExitOnFailure(hr, "Failed to copy SqlScritp.SqlDbb: %ls", pwzData); + ExitOnFailure(hr, "Failed to copy Wix4SqlScript.SqlDbb: %ls", pwzData); hr = WcaGetRecordInteger(hRec, sscrqAttributes, &sss.iAttributes); - ExitOnFailure(hr, "Failed to get SqlScript.Attributes for SqlScript '%ls'", sss.wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlScript.Attributes for SqlScript '%ls'", sss.wzKey); hr = WcaGetRecordInteger(hRec, sscrqSequence, &sss.iSequence); - ExitOnFailure(hr, "Failed to get SqlScript.Sequence for SqlScript '%ls'", sss.wzKey); + ExitOnFailure(hr, "Failed to get Wix4SqlScript.Sequence for SqlScript '%ls'", sss.wzKey); // get the sql script out of the binary stream hr = WcaExecuteView(hViewBinary, hRec); - ExitOnFailure(hr, "Failed to open SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey); + ExitOnFailure(hr, "Failed to open Wix4SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey); hr = WcaFetchSingleRecord(hViewBinary, &hRecBinary); - ExitOnFailure(hr, "Failed to fetch SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey); + ExitOnFailure(hr, "Failed to fetch Wix4SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey); // Note: We need to allocate an extra character on the stream to NULL terminate the SQL script. // The WcaGetRecordStream() function won't let us add extra space on the end of the stream // so we'll read the stream "the old fashioned way". //hr = WcaGetRecordStream(hRecBinary, ssbsqData, (BYTE**)&pbScript, &cbScript); - //ExitOnFailure(hr, "Failed to read SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey); + //ExitOnFailure(hr, "Failed to read Wix4SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey); er = ::MsiRecordReadStream(hRecBinary, ssbsqData, NULL, &cbRead); hr = HRESULT_FROM_WIN32(er); ExitOnFailure(hr, "failed to get size of stream"); @@ -472,7 +472,7 @@ HRESULT ScaSqlStrsReadScripts( { hr = S_OK; } - ExitOnFailure(hr, "Failure occured while reading SqlString table"); + ExitOnFailure(hr, "Failure occured while reading Wix4SqlScript table"); LExit: // if anything was left over after an error clean it all up diff --git a/src/ca/scasqlstr.h b/src/ca/scasqlstr.h index a6f6df1c..72c1d770 100644 --- a/src/ca/scasqlstr.h +++ b/src/ca/scasqlstr.h @@ -18,7 +18,7 @@ struct SCA_SQLSTR LPWSTR pwzSql; int iAttributes; - int iSequence; //used to sequence SqlString and SqlScript tables together + int iSequence; //used to sequence Wix4SqlString and Wix4SqlScript tables together SCA_SQLSTR* psssNext; }; diff --git a/src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs b/src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs index 7d51c0fb..aa9d7a1f 100644 --- a/src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs +++ b/src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs @@ -11,15 +11,19 @@ namespace WixToolsetTest.Sql public class SqlExtensionFixture { [Fact] - public void CanBuildUsingSqlString() + public void CanBuildUsingSqlStuff() { var folder = TestData.Get(@"TestData\UsingSql"); var build = new Builder(folder, typeof(SqlExtensionFactory), new[] { folder }); - var results = build.BuildAndQuery(Build, "SqlString"); - Assert.Equal(new[] + var results = build.BuildAndQuery(Build, "Wix4SqlDatabase", "Wix4SqlFileSpec", "Wix4SqlScript", "Wix4SqlString"); + WixAssert.CompareLineByLine(new[] { - "SqlString:TestString\tTestDB\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tCREATE TABLE TestTable1(name varchar(20), value varchar(20))\t\t1\t", + "Wix4SqlDatabase:TestDB\tMySQLHostName\tMyInstanceName\tMyDB\tDatabaseComponent\t\tTestFileSpecId\tTestLogFileSpecId\t35", + "Wix4SqlFileSpec:TestFileSpecId\tTestFileSpecLogicalName\tTestFileSpec\t10MB\t100MB\t10%", + "Wix4SqlFileSpec:TestLogFileSpecId\tTestLogFileSpecLogicalName\tTestLogFileSpec\t1MB\t10MB\t1%", + "Wix4SqlScript:TestScript\tTestDB\tDatabaseComponent\tScriptBinary\t\t1\t", + "Wix4SqlString:TestString\tTestDB\tDatabaseComponent\tCREATE TABLE TestTable1(name varchar(20), value varchar(20))\t\t1\t", }, results.ToArray()); } diff --git a/src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs b/src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs index 653f7e02..f7626926 100644 --- a/src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs +++ b/src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs @@ -2,12 +2,20 @@ + + - - + + + + + + + + diff --git a/src/wixext/SqlTableDefinitions.cs b/src/wixext/SqlTableDefinitions.cs index 0ab6f989..029a092e 100644 --- a/src/wixext/SqlTableDefinitions.cs +++ b/src/wixext/SqlTableDefinitions.cs @@ -7,7 +7,7 @@ namespace WixToolset.Sql public static class SqlTableDefinitions { public static readonly TableDefinition SqlDatabase = new TableDefinition( - "SqlDatabase", + "Wix4SqlDatabase", SqlSymbolDefinitions.SqlDatabase, new[] { @@ -17,15 +17,15 @@ namespace WixToolset.Sql new ColumnDefinition("Database", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "Primary key, name of database in a SQL Server"), new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key, Component used to determine install state ", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("User_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "User", keyColumn: 1, description: "Foreign key, User used to log into database", modularizeType: ColumnModularizeType.Column), - new ColumnDefinition("FileSpec_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "SqlFileSpec", keyColumn: 1, description: "Foreign key referencing SqlFileSpec.", modularizeType: ColumnModularizeType.Column), - new ColumnDefinition("FileSpec_Log", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "SqlFileSpec", keyColumn: 1, description: "Foreign key referencing SqlFileSpec.", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("FileSpec_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "Wix4SqlFileSpec", keyColumn: 1, description: "Foreign key referencing SqlFileSpec.", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("FileSpec_Log", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "Wix4SqlFileSpec", keyColumn: 1, description: "Foreign key referencing SqlFileSpec.", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("Attributes", ColumnType.Number, 2, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 255, description: "1 == create on install, 2 == drop on uninstall, 4 == continue on error, 8 == drop on install, 16 == create on uninstall, 32 == confirm update existing table, 64 == create on reinstall, 128 == drop on reinstall"), }, symbolIdIsPrimaryKey: true ); public static readonly TableDefinition SqlFileSpec = new TableDefinition( - "SqlFileSpec", + "Wix4SqlFileSpec", SqlSymbolDefinitions.SqlFileSpec, new[] { @@ -40,12 +40,12 @@ namespace WixToolset.Sql ); public static readonly TableDefinition SqlScript = new TableDefinition( - "SqlScript", + "Wix4SqlScript", SqlSymbolDefinitions.SqlScript, new[] { new ColumnDefinition("Script", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Primary key, non-localized token"), - new ColumnDefinition("SqlDb_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "SqlDatabase", keyColumn: 1, description: "Foreign key, SQL Server key", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("SqlDb_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Wix4SqlDatabase", keyColumn: 1, description: "Foreign key, SQL Server key", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key, Component used to determine install state", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("ScriptBinary_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Binary", keyColumn: 1, description: "Foreign key, Binary stream that contains SQL Script to execute", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("User_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "User", keyColumn: 1, description: "Foreign key, User used to log into database", modularizeType: ColumnModularizeType.Column), @@ -56,12 +56,12 @@ namespace WixToolset.Sql ); public static readonly TableDefinition SqlString = new TableDefinition( - "SqlString", + "Wix4SqlString", SqlSymbolDefinitions.SqlString, new[] { - new ColumnDefinition("String", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Id for the SqlString", modularizeType: ColumnModularizeType.Column), - new ColumnDefinition("SqlDb_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "SqlDatabase", keyColumn: 1, description: "Foreign key, SQL Server key", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("String", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Id for the Wix4SqlString", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("SqlDb_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Wix4SqlDatabase", keyColumn: 1, description: "Foreign key, SQL Server key", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key, Component used to determine install state", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("SQL", ColumnType.String, 0, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "SQL query to execute"), new ColumnDefinition("User_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "User", keyColumn: 1, description: "Foreign key, User used to log into database", modularizeType: ColumnModularizeType.Column), -- cgit v1.2.3-55-g6feb