Add `Wix4` table prefixes.
Per https://github.com/wixtoolset/issues/issues/5933.
Bob Arnson committed
Apr 18, 2021 at 21:09 UTC
594bb035b8f27d341c982dc0754589a447b9abd6
8 files changed
+82
-69
src/ca/scadb.cpp
+20
-19
@@ -5,12 +5,12 @@
5
// sql queries
6
LPCWSTR vcsSqlDatabaseQuery = L"SELECT `SqlDb`, `Server`, `Instance`, `Database`, "
7
L"`Component_`, `User_`, `FileSpec_`, `FileSpec_Log`, `Attributes` "
8
- L"FROM `SqlDatabase`";
8
+ L"FROM `Wix4SqlDatabase`";
9
enum eSqlDatabaseQuery { sdqSqlDb = 1, sdqServer, sdqInstance, sdqDatabase,
10
sdqComponent, sdqUser, sdqDbFileSpec, sdqLogFileSpec, sdqAttributes };
11
12
LPCWSTR vcsSqlFileSpecQuery = L"SELECT `FileSpec`, `Name`, `Filename`, `Size`, "
13
- L"`MaxSize`, `GrowthSize` FROM `SqlFileSpec` WHERE `FileSpec`=?";
13
+ L"`MaxSize`, `GrowthSize` FROM `Wix4SqlFileSpec` WHERE `FileSpec`=?";
14
enum eSqlFileSpecQuery { sfsqFileSpec = 1, sfsqName, sfsqFilename, sfsqSize,
15
sfsqMaxSize, sfsqGrowth };
16
@@ -63,21 +63,21 @@ HRESULT ScaDbsRead(
63
64
SCA_DB* psd = NULL;
65
66
- if (S_OK != WcaTableExists(L"SqlDatabase"))
66
+ if (S_OK != WcaTableExists(L"Wix4SqlDatabase"))
67
{
68
- WcaLog(LOGMSG_VERBOSE, "Skipping ScaCreateDatabase() - SqlDatabase table not present");
68
+ WcaLog(LOGMSG_VERBOSE, "Skipping ScaCreateDatabase() - Wix4SqlDatabase table not present");
69
ExitFunction1(hr = S_FALSE);
70
}
71
72
- if (S_OK == WcaTableExists(L"SqlFileSpec"))
72
+ if (S_OK == WcaTableExists(L"Wix4SqlFileSpec"))
73
{
74
hr = WcaOpenView(vcsSqlFileSpecQuery, &hViewFileSpec);
75
- ExitOnFailure(hr, "failed to open view on SqlFileSpec table");
75
+ ExitOnFailure(hr, "failed to open view on Wix4SqlFileSpec table");
76
}
77
78
// loop through all the sql databases
79
hr = WcaOpenExecuteView(vcsSqlDatabaseQuery, &hView);
80
- ExitOnFailure(hr, "Failed to open view on SqlDatabase table");
80
+ ExitOnFailure(hr, "Failed to open view on Wix4SqlDatabase table");
81
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
82
{
83
BOOL fHasComponent = FALSE;
@@ -85,7 +85,7 @@ HRESULT ScaDbsRead(
85
INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN;
86
87
hr = WcaGetRecordString(hRec, sdqSqlDb, &pwzId);
88
- ExitOnFailure(hr, "Failed to get SqlDatabase.SqlDb");
88
+ ExitOnFailure(hr, "Failed to get Wix4SqlDatabase.SqlDb");
89
90
hr = WcaGetRecordString(hRec, sdqComponent, &pwzComponent);
91
ExitOnFailure(hr, "Failed to get Component for database: '%ls'", psd->wzKey);
@@ -110,10 +110,10 @@ HRESULT ScaDbsRead(
110
ExitOnFailure(hr, "Failed to allocate memory for new database: %D", pwzId);
111
112
hr = ::StringCchCopyW(psd->wzKey, countof(psd->wzKey), pwzId);
113
- ExitOnFailure(hr, "Failed to copy SqlDatabase.SqlDbL: %ls", pwzId);
113
+ ExitOnFailure(hr, "Failed to copy Wix4SqlDatabase.SqlDbL: %ls", pwzId);
114
115
hr = ::StringCchCopyW(psd->wzComponent, countof(psd->wzComponent), pwzComponent);
116
- ExitOnFailure(hr, "Failed to copy SqlDatabase.Component_: %ls", pwzComponent);
116
+ ExitOnFailure(hr, "Failed to copy Wix4SqlDatabase.Component_: %ls", pwzComponent);
117
118
psd->fHasComponent = fHasComponent;
119
psd->isInstalled = isInstalled;
@@ -135,7 +135,7 @@ HRESULT ScaDbsRead(
135
ExitOnFailure(hr, "Failed to copy database string to database object:%ls", pwzData);
136
137
hr = WcaGetRecordInteger(hRec, sdqAttributes, &psd->iAttributes);
138
- ExitOnFailure(hr, "Failed to get SqlDatabase.Attributes");
138
+ ExitOnFailure(hr, "Failed to get Wix4SqlDatabase.Attributes");
139
140
hr = WcaGetRecordFormattedString(hRec, sdqUser, &pwzData);
141
ExitOnFailure(hr, "Failed to get User record for database: '%ls'", psd->wzKey);
@@ -189,7 +189,7 @@ HRESULT ScaDbsRead(
189
{
190
hr = S_OK;
191
}
192
- ExitOnFailure(hr, "Failure occured while processing SqlDatabase table");
192
+ ExitOnFailure(hr, "Failure occured while processing Wix4SqlDatabase table");
193
194
LExit:
195
if (psd)
@@ -521,18 +521,18 @@ HRESULT GetFileSpec(
521
522
// get the FileSpec record
523
hr = WcaExecuteView(hViewFileSpec, hRecFileSpec);
524
- ExitOnFailure(hr, "failed to execute view on SqlFileSpec table for filespec: %ls", wzKey);
524
+ ExitOnFailure(hr, "failed to execute view on Wix4SqlFileSpec table for filespec: %ls", wzKey);
525
hr = WcaFetchSingleRecord(hViewFileSpec, &hRec);
526
ExitOnFailure(hr, "failed to get record for filespec: %ls", wzKey);
527
528
// read the data out of the filespec record
529
hr = WcaGetRecordFormattedString(hRec, sfsqName, &pwzData);
530
- ExitOnFailure(hr, "Failed to get SqlFileSpec.Name for filespec: %ls", wzKey);
530
+ ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Name for filespec: %ls", wzKey);
531
hr = ::StringCchCopyW(psf->wzName, countof(psf->wzName), pwzData);
532
- ExitOnFailure(hr, "Failed to copy SqlFileSpec.Name string: %ls", pwzData);
532
+ ExitOnFailure(hr, "Failed to copy Wix4SqlFileSpec.Name string: %ls", pwzData);
533
534
hr = WcaGetRecordFormattedString(hRec, sfsqFilename, &pwzData);
535
- ExitOnFailure(hr, "Failed to get SqlFileSpec.Filename for filespec: %ls", wzKey);
535
+ ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Filename for filespec: %ls", wzKey);
536
if (*pwzData)
537
{
538
hr = ::StringCchCopyW(psf->wzFilename, countof(psf->wzFilename), pwzData);
@@ -545,7 +545,7 @@ HRESULT GetFileSpec(
545
}
546
547
hr = WcaGetRecordFormattedString(hRec, sfsqSize, &pwzData);
548
- ExitOnFailure(hr, "Failed to get SqlFileSpec.Size for filespec: %ls", wzKey);
548
+ ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Size for filespec: %ls", wzKey);
549
if (*pwzData)
550
{
551
hr = ::StringCchCopyW(psf->wzSize, countof(psf->wzSize), pwzData);
@@ -557,7 +557,7 @@ HRESULT GetFileSpec(
557
}
558
559
hr = WcaGetRecordFormattedString(hRec, sfsqMaxSize, &pwzData);
560
- ExitOnFailure(hr, "Failed to get SqlFileSpec.MaxSize for filespec: %ls", wzKey);
560
+ ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.MaxSize for filespec: %ls", wzKey);
561
if (*pwzData)
562
{
563
hr = ::StringCchCopyW(psf->wzMaxSize, countof(psf->wzMaxSize), pwzData);
@@ -569,7 +569,7 @@ HRESULT GetFileSpec(
569
}
570
571
hr = WcaGetRecordFormattedString(hRec, sfsqGrowth, &pwzData);
572
- ExitOnFailure(hr, "Failed to get SqlFileSpec.GrowthSize for filespec: %ls", wzKey);
572
+ ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.GrowthSize for filespec: %ls", wzKey);
573
if (*pwzData)
574
{
575
hr = ::StringCchCopyW(psf->wzGrow, countof(psf->wzGrow), pwzData);
@@ -581,6 +581,7 @@ HRESULT GetFileSpec(
581
}
582
583
hr = S_OK;
584
+
585
LExit:
586
ReleaseStr(pwzData);
587
return hr;
src/ca/scaexec.cpp
+1
-1
@@ -342,7 +342,7 @@ extern "C" UINT __stdcall ExecuteSqlStrings(MSIHANDLE hInstall)
342
hr = WcaReadStringFromCaData(&pwz, &pwzSql);
343
ExitOnFailure(hr, "failed to read SQL string for key: %ls", pwzSqlKey);
344
345
- // If the SqlString row is set to continue on error and the DB connection failed, skip attempting to execute
345
+ // If the Wix4SqlString row is set to continue on error and the DB connection failed, skip attempting to execute
346
if ((iAttributesSQL & SCASQL_CONTINUE_ON_ERROR) && FAILED(hrDB))
347
{
348
WcaLog(LOGMSG_STANDARD, "Error 0x%x: continuing after failure to connect to database: %ls", hrDB, pwzDatabase);
src/ca/scasql.cpp
+5
-5
@@ -67,21 +67,21 @@ static HRESULT ConfigureSqlData(
67
SCA_SQLSTR* psssList = NULL;
68
69
// check for the prerequsite tables
70
- if (S_OK != WcaTableExists(L"SqlDatabase"))
70
+ if (S_OK != WcaTableExists(L"Wix4SqlDatabase"))
71
{
72
- WcaLog(LOGMSG_VERBOSE, "skipping SQL CustomAction, no SqlDatabase table");
72
+ WcaLog(LOGMSG_VERBOSE, "skipping SQL CustomAction, no Wix4SqlDatabase table");
73
ExitFunction1(hr = S_FALSE);
74
}
75
76
// read tables
77
hr = ScaDbsRead(&psdList, saAction);
78
- ExitOnFailure(hr, "failed to read SqlDatabase table");
78
+ ExitOnFailure(hr, "failed to read Wix4SqlDatabase table");
79
80
hr = ScaSqlStrsRead(&psssList, saAction);
81
- ExitOnFailure(hr, "failed to read SqlStrings table");
81
+ ExitOnFailure(hr, "failed to read Wix4SqlString table");
82
83
hr = ScaSqlStrsReadScripts(&psssList, saAction);
84
- ExitOnFailure(hr, "failed to read SqlScripts table");
84
+ ExitOnFailure(hr, "failed to read Wix4SqlScript table");
85
86
if (SCA_ACTION_UNINSTALL == saAction)
87
{
src/ca/scasqlstr.cpp
+28
-28
@@ -4,11 +4,11 @@
4
5
// sql queries
6
LPCWSTR vcsSqlStringQuery = L"SELECT `String`, `SqlDb_`, `Component_`,`SQL`,`User_`,`Attributes`,`Sequence` "
7
-L"FROM `SqlString` ORDER BY `SqlDb_`,`Sequence`";
7
+L"FROM `Wix4SqlString` ORDER BY `SqlDb_`,`Sequence`";
8
enum eSqlStringQuery { ssqSqlString = 1, ssqSqlDb, ssqComponent, ssqSQL, ssqUser, ssqAttributes, ssqSequence };
9
10
LPCWSTR vcsSqlScriptQuery = L"SELECT `ScriptBinary_`,`Script`, `SqlDb_`, `Component_`,`User_`,`Attributes`,`Sequence` "
11
-L"FROM `SqlScript` ORDER BY `SqlDb_`,`Sequence`";
11
+L"FROM `Wix4SqlScript` ORDER BY `SqlDb_`,`Sequence`";
12
enum eSqlScriptQuery { sscrqScriptBinary=1, sscrqSqlScript, sscrqSqlDb, sscrqComponent, sscrqUser, sscrqAttributes, sscrqSequence };
13
14
LPCWSTR vcsSqlBinaryScriptQuery = L"SELECT `Data` FROM `Binary` WHERE `Name`=?";
@@ -44,15 +44,15 @@ HRESULT ScaSqlStrsRead(
44
45
SCA_SQLSTR* psss = NULL;
46
47
- if (S_OK != WcaTableExists(L"SqlString") || S_OK != WcaTableExists(L"SqlDatabase"))
47
+ if (S_OK != WcaTableExists(L"Wix4SqlString") || S_OK != WcaTableExists(L"Wix4SqlDatabase"))
48
{
49
- WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsRead() - SqlString and/or SqlDatabase table not present");
49
+ WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsRead() - Wix4SqlString and/or Wix4SqlDatabase table not present");
50
ExitFunction1(hr = S_FALSE);
51
}
52
53
// loop through all the sql strings
54
hr = WcaOpenExecuteView(vcsSqlStringQuery, &hView);
55
- ExitOnFailure(hr, "Failed to open view on SqlString table");
55
+ ExitOnFailure(hr, "Failed to open view on Wix4SqlString table");
56
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
57
{
58
INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN;
@@ -80,30 +80,30 @@ HRESULT ScaSqlStrsRead(
80
psss->isAction = isAction;
81
82
hr = WcaGetRecordString(hRec, ssqSqlString, &pwzData);
83
- ExitOnFailure(hr, "Failed to get SqlString.String");
83
+ ExitOnFailure(hr, "Failed to get Wix4SqlString.String");
84
hr = ::StringCchCopyW(psss->wzKey, countof(psss->wzKey), pwzData);
85
- ExitOnFailure(hr, "Failed to copy SqlString.String: %ls", pwzData);
85
+ ExitOnFailure(hr, "Failed to copy Wix4SqlString.String: %ls", pwzData);
86
87
// find the database information for this string
88
hr = WcaGetRecordString(hRec, ssqSqlDb, &pwzData);
89
- ExitOnFailure(hr, "Failed to get SqlString.SqlDb_ for SqlString '%ls'", psss->wzKey);
89
+ ExitOnFailure(hr, "Failed to get Wix4SqlString.SqlDb_ for SqlString '%ls'", psss->wzKey);
90
hr = ::StringCchCopyW(psss->wzSqlDb, countof(psss->wzSqlDb), pwzData);
91
- ExitOnFailure(hr, "Failed to copy SqlString.SqlDb_: %ls", pwzData);
91
+ ExitOnFailure(hr, "Failed to copy Wix4SqlString.SqlDb_: %ls", pwzData);
92
93
hr = WcaGetRecordInteger(hRec, ssqAttributes, &psss->iAttributes);
94
- ExitOnFailure(hr, "Failed to get SqlString.Attributes for SqlString '%ls'", psss->wzKey);
94
+ ExitOnFailure(hr, "Failed to get Wix4SqlString.Attributes for SqlString '%ls'", psss->wzKey);
95
96
//get the sequence number for the string (note that this will be sequenced with scripts too)
97
hr = WcaGetRecordInteger(hRec, ssqSequence, &psss->iSequence);
98
- ExitOnFailure(hr, "Failed to get SqlString.Sequence for SqlString '%ls'", psss->wzKey);
98
+ ExitOnFailure(hr, "Failed to get Wix4SqlString.Sequence for SqlString '%ls'", psss->wzKey);
99
100
// execute SQL
101
hr = WcaGetRecordFormattedString(hRec, ssqSQL, &pwzData);
102
- ExitOnFailure(hr, "Failed to get SqlString.SQL for SqlString '%ls'", psss->wzKey);
102
+ ExitOnFailure(hr, "Failed to get Wix4SqlString.SQL for SQL string '%ls'", psss->wzKey);
103
104
Assert(!psss->pwzSql);
105
hr = StrAllocString(&psss->pwzSql, pwzData, 0);
106
- ExitOnFailure(hr, "Failed to alloc string for SqlString '%ls'", psss->wzKey);
106
+ ExitOnFailure(hr, "Failed to alloc string for SQL string '%ls'", psss->wzKey);
107
108
*ppsssList = AddSqlStrToList(*ppsssList, psss);
109
psss = NULL; // set the sss to NULL so it doesn't get freed below
@@ -113,7 +113,7 @@ HRESULT ScaSqlStrsRead(
113
{
114
hr = S_OK;
115
}
116
- ExitOnFailure(hr, "Failure occured while reading SqlString table");
116
+ ExitOnFailure(hr, "Failure occured while reading Wix4SqlString table");
117
118
LExit:
119
// if anything was left over after an error clean it all up
@@ -157,19 +157,19 @@ HRESULT ScaSqlStrsReadScripts(
157
SCA_SQLSTR sss;
158
SCA_SQLSTR* psss = NULL;
159
160
- if (S_OK != WcaTableExists(L"SqlScript") || S_OK != WcaTableExists(L"SqlDatabase") || S_OK != WcaTableExists(L"Binary"))
160
+ if (S_OK != WcaTableExists(L"Wix4SqlScript") || S_OK != WcaTableExists(L"Wix4SqlDatabase") || S_OK != WcaTableExists(L"Binary"))
161
{
162
- WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsReadScripts() - SqlScripts and/or SqlDatabase table not present");
162
+ WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsReadScripts() - Wix4SqlScript and/or Wix4SqlDatabase table not present");
163
ExitFunction1(hr = S_FALSE);
164
}
165
166
// open a view on the binary table
167
hr = WcaOpenView(vcsSqlBinaryScriptQuery, &hViewBinary);
168
- ExitOnFailure(hr, "Failed to open view on Binary table for SqlScripts");
168
+ ExitOnFailure(hr, "Failed to open view on Binary table for SQL scripts");
169
170
// loop through all the sql scripts
171
hr = WcaOpenExecuteView(vcsSqlScriptQuery, &hView);
172
- ExitOnFailure(hr, "Failed to open view on SqlScript table");
172
+ ExitOnFailure(hr, "Failed to open view on Wix4SqlScript table");
173
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
174
{
175
INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN;
@@ -196,33 +196,33 @@ HRESULT ScaSqlStrsReadScripts(
196
sss.isAction = isAction;
197
198
hr = WcaGetRecordString(hRec, sscrqSqlScript, &pwzData);
199
- ExitOnFailure(hr, "Failed to get SqlScript.Script");
199
+ ExitOnFailure(hr, "Failed to get Wix4SqlScript.Script");
200
hr = ::StringCchCopyW(sss.wzKey, countof(sss.wzKey), pwzData);
201
- ExitOnFailure(hr, "Failed to copy SqlScript.Script: %ls", pwzData);
201
+ ExitOnFailure(hr, "Failed to copy Wix4SqlScript.Script: %ls", pwzData);
202
203
// find the database information for this string
204
hr = WcaGetRecordString(hRec, sscrqSqlDb, &pwzData);
205
- ExitOnFailure(hr, "Failed to get SqlScript.SqlDb_ for SqlScript '%ls'", sss.wzKey);
205
+ ExitOnFailure(hr, "Failed to get Wix4SqlScript.SqlDb_ for SqlScript '%ls'", sss.wzKey);
206
hr = ::StringCchCopyW(sss.wzSqlDb, countof(sss.wzSqlDb), pwzData);
207
- ExitOnFailure(hr, "Failed to copy SqlScritp.SqlDbb: %ls", pwzData);
207
+ ExitOnFailure(hr, "Failed to copy Wix4SqlScript.SqlDbb: %ls", pwzData);
208
209
hr = WcaGetRecordInteger(hRec, sscrqAttributes, &sss.iAttributes);
210
- ExitOnFailure(hr, "Failed to get SqlScript.Attributes for SqlScript '%ls'", sss.wzKey);
210
+ ExitOnFailure(hr, "Failed to get Wix4SqlScript.Attributes for SqlScript '%ls'", sss.wzKey);
211
212
hr = WcaGetRecordInteger(hRec, sscrqSequence, &sss.iSequence);
213
- ExitOnFailure(hr, "Failed to get SqlScript.Sequence for SqlScript '%ls'", sss.wzKey);
213
+ ExitOnFailure(hr, "Failed to get Wix4SqlScript.Sequence for SqlScript '%ls'", sss.wzKey);
214
215
// get the sql script out of the binary stream
216
hr = WcaExecuteView(hViewBinary, hRec);
217
- ExitOnFailure(hr, "Failed to open SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey);
217
+ ExitOnFailure(hr, "Failed to open Wix4SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey);
218
hr = WcaFetchSingleRecord(hViewBinary, &hRecBinary);
219
- ExitOnFailure(hr, "Failed to fetch SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey);
219
+ ExitOnFailure(hr, "Failed to fetch Wix4SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey);
220
221
// Note: We need to allocate an extra character on the stream to NULL terminate the SQL script.
222
// The WcaGetRecordStream() function won't let us add extra space on the end of the stream
223
// so we'll read the stream "the old fashioned way".
224
//hr = WcaGetRecordStream(hRecBinary, ssbsqData, (BYTE**)&pbScript, &cbScript);
225
- //ExitOnFailure(hr, "Failed to read SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey);
225
+ //ExitOnFailure(hr, "Failed to read Wix4SqlScript.BinaryScript_ for SqlScript '%ls'", sss.wzKey);
226
er = ::MsiRecordReadStream(hRecBinary, ssbsqData, NULL, &cbRead);
227
hr = HRESULT_FROM_WIN32(er);
228
ExitOnFailure(hr, "failed to get size of stream");
@@ -472,7 +472,7 @@ HRESULT ScaSqlStrsReadScripts(
472
{
473
hr = S_OK;
474
}
475
- ExitOnFailure(hr, "Failure occured while reading SqlString table");
475
+ ExitOnFailure(hr, "Failure occured while reading Wix4SqlScript table");
476
477
LExit:
478
// if anything was left over after an error clean it all up
src/ca/scasqlstr.h
+1
-1
@@ -18,7 +18,7 @@ struct SCA_SQLSTR
18
19
LPWSTR pwzSql;
20
int iAttributes;
21
- int iSequence; //used to sequence SqlString and SqlScript tables together
21
+ int iSequence; //used to sequence Wix4SqlString and Wix4SqlScript tables together
22
23
SCA_SQLSTR* psssNext;
24
};
src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs
+8
-4
@@ -11,15 +11,19 @@ namespace WixToolsetTest.Sql
11
public class SqlExtensionFixture
12
{
13
[Fact]
14
- public void CanBuildUsingSqlString()
14
+ public void CanBuildUsingSqlStuff()
15
{
16
var folder = TestData.Get(@"TestData\UsingSql");
17
var build = new Builder(folder, typeof(SqlExtensionFactory), new[] { folder });
18
19
- var results = build.BuildAndQuery(Build, "SqlString");
20
- Assert.Equal(new[]
19
+ var results = build.BuildAndQuery(Build, "Wix4SqlDatabase", "Wix4SqlFileSpec", "Wix4SqlScript", "Wix4SqlString");
20
+ WixAssert.CompareLineByLine(new[]
21
{
22
- "SqlString:TestString\tTestDB\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tCREATE TABLE TestTable1(name varchar(20), value varchar(20))\t\t1\t",
22
+ "Wix4SqlDatabase:TestDB\tMySQLHostName\tMyInstanceName\tMyDB\tDatabaseComponent\t\tTestFileSpecId\tTestLogFileSpecId\t35",
23
+ "Wix4SqlFileSpec:TestFileSpecId\tTestFileSpecLogicalName\tTestFileSpec\t10MB\t100MB\t10%",
24
+ "Wix4SqlFileSpec:TestLogFileSpecId\tTestLogFileSpecLogicalName\tTestLogFileSpec\t1MB\t10MB\t1%",
25
+ "Wix4SqlScript:TestScript\tTestDB\tDatabaseComponent\tScriptBinary\t\t1\t",
26
+ "Wix4SqlString:TestString\tTestDB\tDatabaseComponent\tCREATE TABLE TestTable1(name varchar(20), value varchar(20))\t\t1\t",
27
}, results.ToArray());
28
}
29
src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs
+10
-2
@@ -2,12 +2,20 @@
2
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
3
xmlns:sql="http://wixtoolset.org/schemas/v4/wxs/sql">
4
<Fragment>
5
+ <Binary Id="ScriptBinary" SourceFile="example.txt" />
6
+
7
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
6
- <Component>
7
- <File Source="example.txt" />
8
+ <Component Id="DatabaseComponent" Guid="{322802E7-D65E-4C91-924F-FC6D30FEEB34}">
9
+ <File Id="TestFileSpec" Source="example.txt" />
10
+ <File Id="TestLogFileSpec" Source="example.txt" />
11
+
12
<sql:SqlDatabase Id="TestDB" Database="MyDB" Server="MySQLHostName" Instance="MyInstanceName" CreateOnInstall="yes" DropOnUninstall="yes" ConfirmOverwrite="yes">
13
<sql:SqlString Id="TestString" SQL="CREATE TABLE TestTable1(name varchar(20), value varchar(20))" ExecuteOnInstall="yes" />
14
+ <sql:SqlFileSpec Id="TestFileSpecId" Filename="TestFileSpec" Name="TestFileSpecLogicalName" Size="10MB" GrowthSize="10%" MaxSize="100MB" />
15
+ <sql:SqlLogFileSpec Id="TestLogFileSpecId" Filename="TestLogFileSpec" Name="TestLogFileSpecLogicalName" Size="1MB" GrowthSize="1%" MaxSize="10MB" />
16
</sql:SqlDatabase>
17
+
18
+ <sql:SqlScript Id="TestScript" BinaryRef="ScriptBinary" SqlDb="TestDB" ExecuteOnInstall="yes" />
19
</Component>
20
</ComponentGroup>
21
</Fragment>
src/wixext/SqlTableDefinitions.cs
+9
-9
@@ -7,7 +7,7 @@ namespace WixToolset.Sql
7
public static class SqlTableDefinitions
8
{
9
public static readonly TableDefinition SqlDatabase = new TableDefinition(
10
- "SqlDatabase",
10
+ "Wix4SqlDatabase",
11
SqlSymbolDefinitions.SqlDatabase,
12
new[]
13
{
@@ -17,15 +17,15 @@ namespace WixToolset.Sql
17
new ColumnDefinition("Database", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "Primary key, name of database in a SQL Server"),
18
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),
19
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),
20
- new ColumnDefinition("FileSpec_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "SqlFileSpec", keyColumn: 1, description: "Foreign key referencing SqlFileSpec.", modularizeType: ColumnModularizeType.Column),
21
- 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),
20
+ new ColumnDefinition("FileSpec_", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "Wix4SqlFileSpec", keyColumn: 1, description: "Foreign key referencing SqlFileSpec.", modularizeType: ColumnModularizeType.Column),
21
+ 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),
22
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"),
23
},
24
symbolIdIsPrimaryKey: true
25
);
26
27
public static readonly TableDefinition SqlFileSpec = new TableDefinition(
28
- "SqlFileSpec",
28
+ "Wix4SqlFileSpec",
29
SqlSymbolDefinitions.SqlFileSpec,
30
new[]
31
{
@@ -40,12 +40,12 @@ namespace WixToolset.Sql
40
);
41
42
public static readonly TableDefinition SqlScript = new TableDefinition(
43
- "SqlScript",
43
+ "Wix4SqlScript",
44
SqlSymbolDefinitions.SqlScript,
45
new[]
46
{
47
new ColumnDefinition("Script", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Primary key, non-localized token"),
48
- 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),
48
+ 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),
49
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),
50
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),
51
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
56
);
57
58
public static readonly TableDefinition SqlString = new TableDefinition(
59
- "SqlString",
59
+ "Wix4SqlString",
60
SqlSymbolDefinitions.SqlString,
61
new[]
62
{
63
- new ColumnDefinition("String", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Id for the SqlString", modularizeType: ColumnModularizeType.Column),
64
- 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),
63
+ new ColumnDefinition("String", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Id for the Wix4SqlString", modularizeType: ColumnModularizeType.Column),
64
+ 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),
65
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),
66
new ColumnDefinition("SQL", ColumnType.String, 0, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "SQL query to execute"),
67
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),