diff options
author | Bob Arnson <bob@firegiant.com> | 2021-04-18 21:09:37 -0400 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2021-04-18 21:12:50 -0400 |
commit | 594bb035b8f27d341c982dc0754589a447b9abd6 (patch) | |
tree | bb13b0a6d5e03fc5ff406a18682a1e9c0c170aa1 /src/ca | |
parent | babe3697ec562d6f93f209e23dc03ba77fa57805 (diff) | |
download | wix-594bb035b8f27d341c982dc0754589a447b9abd6.tar.gz wix-594bb035b8f27d341c982dc0754589a447b9abd6.tar.bz2 wix-594bb035b8f27d341c982dc0754589a447b9abd6.zip |
Add `Wix4` table prefixes.
Per https://github.com/wixtoolset/issues/issues/5933.
Diffstat (limited to 'src/ca')
-rw-r--r-- | src/ca/scadb.cpp | 39 | ||||
-rw-r--r-- | src/ca/scaexec.cpp | 2 | ||||
-rw-r--r-- | src/ca/scasql.cpp | 10 | ||||
-rw-r--r-- | src/ca/scasqlstr.cpp | 56 | ||||
-rw-r--r-- | src/ca/scasqlstr.h | 2 |
5 files changed, 55 insertions, 54 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 @@ | |||
5 | // sql queries | 5 | // sql queries |
6 | LPCWSTR vcsSqlDatabaseQuery = L"SELECT `SqlDb`, `Server`, `Instance`, `Database`, " | 6 | LPCWSTR vcsSqlDatabaseQuery = L"SELECT `SqlDb`, `Server`, `Instance`, `Database`, " |
7 | L"`Component_`, `User_`, `FileSpec_`, `FileSpec_Log`, `Attributes` " | 7 | L"`Component_`, `User_`, `FileSpec_`, `FileSpec_Log`, `Attributes` " |
8 | L"FROM `SqlDatabase`"; | 8 | L"FROM `Wix4SqlDatabase`"; |
9 | enum eSqlDatabaseQuery { sdqSqlDb = 1, sdqServer, sdqInstance, sdqDatabase, | 9 | enum eSqlDatabaseQuery { sdqSqlDb = 1, sdqServer, sdqInstance, sdqDatabase, |
10 | sdqComponent, sdqUser, sdqDbFileSpec, sdqLogFileSpec, sdqAttributes }; | 10 | sdqComponent, sdqUser, sdqDbFileSpec, sdqLogFileSpec, sdqAttributes }; |
11 | 11 | ||
12 | LPCWSTR vcsSqlFileSpecQuery = L"SELECT `FileSpec`, `Name`, `Filename`, `Size`, " | 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, | 14 | enum eSqlFileSpecQuery { sfsqFileSpec = 1, sfsqName, sfsqFilename, sfsqSize, |
15 | sfsqMaxSize, sfsqGrowth }; | 15 | sfsqMaxSize, sfsqGrowth }; |
16 | 16 | ||
@@ -63,21 +63,21 @@ HRESULT ScaDbsRead( | |||
63 | 63 | ||
64 | SCA_DB* psd = NULL; | 64 | SCA_DB* psd = NULL; |
65 | 65 | ||
66 | if (S_OK != WcaTableExists(L"SqlDatabase")) | 66 | if (S_OK != WcaTableExists(L"Wix4SqlDatabase")) |
67 | { | 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); | 69 | ExitFunction1(hr = S_FALSE); |
70 | } | 70 | } |
71 | 71 | ||
72 | if (S_OK == WcaTableExists(L"SqlFileSpec")) | 72 | if (S_OK == WcaTableExists(L"Wix4SqlFileSpec")) |
73 | { | 73 | { |
74 | hr = WcaOpenView(vcsSqlFileSpecQuery, &hViewFileSpec); | 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 | } | 76 | } |
77 | 77 | ||
78 | // loop through all the sql databases | 78 | // loop through all the sql databases |
79 | hr = WcaOpenExecuteView(vcsSqlDatabaseQuery, &hView); | 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))) | 81 | while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) |
82 | { | 82 | { |
83 | BOOL fHasComponent = FALSE; | 83 | BOOL fHasComponent = FALSE; |
@@ -85,7 +85,7 @@ HRESULT ScaDbsRead( | |||
85 | INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN; | 85 | INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN; |
86 | 86 | ||
87 | hr = WcaGetRecordString(hRec, sdqSqlDb, &pwzId); | 87 | hr = WcaGetRecordString(hRec, sdqSqlDb, &pwzId); |
88 | ExitOnFailure(hr, "Failed to get SqlDatabase.SqlDb"); | 88 | ExitOnFailure(hr, "Failed to get Wix4SqlDatabase.SqlDb"); |
89 | 89 | ||
90 | hr = WcaGetRecordString(hRec, sdqComponent, &pwzComponent); | 90 | hr = WcaGetRecordString(hRec, sdqComponent, &pwzComponent); |
91 | ExitOnFailure(hr, "Failed to get Component for database: '%ls'", psd->wzKey); | 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); | 110 | ExitOnFailure(hr, "Failed to allocate memory for new database: %D", pwzId); |
111 | 111 | ||
112 | hr = ::StringCchCopyW(psd->wzKey, countof(psd->wzKey), pwzId); | 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 | 114 | ||
115 | hr = ::StringCchCopyW(psd->wzComponent, countof(psd->wzComponent), pwzComponent); | 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 | 117 | ||
118 | psd->fHasComponent = fHasComponent; | 118 | psd->fHasComponent = fHasComponent; |
119 | psd->isInstalled = isInstalled; | 119 | psd->isInstalled = isInstalled; |
@@ -135,7 +135,7 @@ HRESULT ScaDbsRead( | |||
135 | ExitOnFailure(hr, "Failed to copy database string to database object:%ls", pwzData); | 135 | ExitOnFailure(hr, "Failed to copy database string to database object:%ls", pwzData); |
136 | 136 | ||
137 | hr = WcaGetRecordInteger(hRec, sdqAttributes, &psd->iAttributes); | 137 | hr = WcaGetRecordInteger(hRec, sdqAttributes, &psd->iAttributes); |
138 | ExitOnFailure(hr, "Failed to get SqlDatabase.Attributes"); | 138 | ExitOnFailure(hr, "Failed to get Wix4SqlDatabase.Attributes"); |
139 | 139 | ||
140 | hr = WcaGetRecordFormattedString(hRec, sdqUser, &pwzData); | 140 | hr = WcaGetRecordFormattedString(hRec, sdqUser, &pwzData); |
141 | ExitOnFailure(hr, "Failed to get User record for database: '%ls'", psd->wzKey); | 141 | ExitOnFailure(hr, "Failed to get User record for database: '%ls'", psd->wzKey); |
@@ -189,7 +189,7 @@ HRESULT ScaDbsRead( | |||
189 | { | 189 | { |
190 | hr = S_OK; | 190 | hr = S_OK; |
191 | } | 191 | } |
192 | ExitOnFailure(hr, "Failure occured while processing SqlDatabase table"); | 192 | ExitOnFailure(hr, "Failure occured while processing Wix4SqlDatabase table"); |
193 | 193 | ||
194 | LExit: | 194 | LExit: |
195 | if (psd) | 195 | if (psd) |
@@ -521,18 +521,18 @@ HRESULT GetFileSpec( | |||
521 | 521 | ||
522 | // get the FileSpec record | 522 | // get the FileSpec record |
523 | hr = WcaExecuteView(hViewFileSpec, hRecFileSpec); | 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); | 525 | hr = WcaFetchSingleRecord(hViewFileSpec, &hRec); |
526 | ExitOnFailure(hr, "failed to get record for filespec: %ls", wzKey); | 526 | ExitOnFailure(hr, "failed to get record for filespec: %ls", wzKey); |
527 | 527 | ||
528 | // read the data out of the filespec record | 528 | // read the data out of the filespec record |
529 | hr = WcaGetRecordFormattedString(hRec, sfsqName, &pwzData); | 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); | 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 | 533 | ||
534 | hr = WcaGetRecordFormattedString(hRec, sfsqFilename, &pwzData); | 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) | 536 | if (*pwzData) |
537 | { | 537 | { |
538 | hr = ::StringCchCopyW(psf->wzFilename, countof(psf->wzFilename), pwzData); | 538 | hr = ::StringCchCopyW(psf->wzFilename, countof(psf->wzFilename), pwzData); |
@@ -545,7 +545,7 @@ HRESULT GetFileSpec( | |||
545 | } | 545 | } |
546 | 546 | ||
547 | hr = WcaGetRecordFormattedString(hRec, sfsqSize, &pwzData); | 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) | 549 | if (*pwzData) |
550 | { | 550 | { |
551 | hr = ::StringCchCopyW(psf->wzSize, countof(psf->wzSize), pwzData); | 551 | hr = ::StringCchCopyW(psf->wzSize, countof(psf->wzSize), pwzData); |
@@ -557,7 +557,7 @@ HRESULT GetFileSpec( | |||
557 | } | 557 | } |
558 | 558 | ||
559 | hr = WcaGetRecordFormattedString(hRec, sfsqMaxSize, &pwzData); | 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) | 561 | if (*pwzData) |
562 | { | 562 | { |
563 | hr = ::StringCchCopyW(psf->wzMaxSize, countof(psf->wzMaxSize), pwzData); | 563 | hr = ::StringCchCopyW(psf->wzMaxSize, countof(psf->wzMaxSize), pwzData); |
@@ -569,7 +569,7 @@ HRESULT GetFileSpec( | |||
569 | } | 569 | } |
570 | 570 | ||
571 | hr = WcaGetRecordFormattedString(hRec, sfsqGrowth, &pwzData); | 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) | 573 | if (*pwzData) |
574 | { | 574 | { |
575 | hr = ::StringCchCopyW(psf->wzGrow, countof(psf->wzGrow), pwzData); | 575 | hr = ::StringCchCopyW(psf->wzGrow, countof(psf->wzGrow), pwzData); |
@@ -581,6 +581,7 @@ HRESULT GetFileSpec( | |||
581 | } | 581 | } |
582 | 582 | ||
583 | hr = S_OK; | 583 | hr = S_OK; |
584 | |||
584 | LExit: | 585 | LExit: |
585 | ReleaseStr(pwzData); | 586 | ReleaseStr(pwzData); |
586 | return hr; | 587 | 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) | |||
342 | hr = WcaReadStringFromCaData(&pwz, &pwzSql); | 342 | hr = WcaReadStringFromCaData(&pwz, &pwzSql); |
343 | ExitOnFailure(hr, "failed to read SQL string for key: %ls", pwzSqlKey); | 343 | ExitOnFailure(hr, "failed to read SQL string for key: %ls", pwzSqlKey); |
344 | 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)) | 346 | if ((iAttributesSQL & SCASQL_CONTINUE_ON_ERROR) && FAILED(hrDB)) |
347 | { | 347 | { |
348 | WcaLog(LOGMSG_STANDARD, "Error 0x%x: continuing after failure to connect to database: %ls", hrDB, pwzDatabase); | 348 | 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( | |||
67 | SCA_SQLSTR* psssList = NULL; | 67 | SCA_SQLSTR* psssList = NULL; |
68 | 68 | ||
69 | // check for the prerequsite tables | 69 | // check for the prerequsite tables |
70 | if (S_OK != WcaTableExists(L"SqlDatabase")) | 70 | if (S_OK != WcaTableExists(L"Wix4SqlDatabase")) |
71 | { | 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); | 73 | ExitFunction1(hr = S_FALSE); |
74 | } | 74 | } |
75 | 75 | ||
76 | // read tables | 76 | // read tables |
77 | hr = ScaDbsRead(&psdList, saAction); | 77 | hr = ScaDbsRead(&psdList, saAction); |
78 | ExitOnFailure(hr, "failed to read SqlDatabase table"); | 78 | ExitOnFailure(hr, "failed to read Wix4SqlDatabase table"); |
79 | 79 | ||
80 | hr = ScaSqlStrsRead(&psssList, saAction); | 80 | hr = ScaSqlStrsRead(&psssList, saAction); |
81 | ExitOnFailure(hr, "failed to read SqlStrings table"); | 81 | ExitOnFailure(hr, "failed to read Wix4SqlString table"); |
82 | 82 | ||
83 | hr = ScaSqlStrsReadScripts(&psssList, saAction); | 83 | hr = ScaSqlStrsReadScripts(&psssList, saAction); |
84 | ExitOnFailure(hr, "failed to read SqlScripts table"); | 84 | ExitOnFailure(hr, "failed to read Wix4SqlScript table"); |
85 | 85 | ||
86 | if (SCA_ACTION_UNINSTALL == saAction) | 86 | if (SCA_ACTION_UNINSTALL == saAction) |
87 | { | 87 | { |
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 @@ | |||
4 | 4 | ||
5 | // sql queries | 5 | // sql queries |
6 | LPCWSTR vcsSqlStringQuery = L"SELECT `String`, `SqlDb_`, `Component_`,`SQL`,`User_`,`Attributes`,`Sequence` " | 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 }; | 8 | enum eSqlStringQuery { ssqSqlString = 1, ssqSqlDb, ssqComponent, ssqSQL, ssqUser, ssqAttributes, ssqSequence }; |
9 | 9 | ||
10 | LPCWSTR vcsSqlScriptQuery = L"SELECT `ScriptBinary_`,`Script`, `SqlDb_`, `Component_`,`User_`,`Attributes`,`Sequence` " | 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 }; | 12 | enum eSqlScriptQuery { sscrqScriptBinary=1, sscrqSqlScript, sscrqSqlDb, sscrqComponent, sscrqUser, sscrqAttributes, sscrqSequence }; |
13 | 13 | ||
14 | LPCWSTR vcsSqlBinaryScriptQuery = L"SELECT `Data` FROM `Binary` WHERE `Name`=?"; | 14 | LPCWSTR vcsSqlBinaryScriptQuery = L"SELECT `Data` FROM `Binary` WHERE `Name`=?"; |
@@ -44,15 +44,15 @@ HRESULT ScaSqlStrsRead( | |||
44 | 44 | ||
45 | SCA_SQLSTR* psss = NULL; | 45 | SCA_SQLSTR* psss = NULL; |
46 | 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 | { | 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); | 50 | ExitFunction1(hr = S_FALSE); |
51 | } | 51 | } |
52 | 52 | ||
53 | // loop through all the sql strings | 53 | // loop through all the sql strings |
54 | hr = WcaOpenExecuteView(vcsSqlStringQuery, &hView); | 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))) | 56 | while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) |
57 | { | 57 | { |
58 | INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN; | 58 | INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN; |
@@ -80,30 +80,30 @@ HRESULT ScaSqlStrsRead( | |||
80 | psss->isAction = isAction; | 80 | psss->isAction = isAction; |
81 | 81 | ||
82 | hr = WcaGetRecordString(hRec, ssqSqlString, &pwzData); | 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); | 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 | 86 | ||
87 | // find the database information for this string | 87 | // find the database information for this string |
88 | hr = WcaGetRecordString(hRec, ssqSqlDb, &pwzData); | 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); | 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 | 92 | ||
93 | hr = WcaGetRecordInteger(hRec, ssqAttributes, &psss->iAttributes); | 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 | 95 | ||
96 | //get the sequence number for the string (note that this will be sequenced with scripts too) | 96 | //get the sequence number for the string (note that this will be sequenced with scripts too) |
97 | hr = WcaGetRecordInteger(hRec, ssqSequence, &psss->iSequence); | 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 | 99 | ||
100 | // execute SQL | 100 | // execute SQL |
101 | hr = WcaGetRecordFormattedString(hRec, ssqSQL, &pwzData); | 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 | 103 | ||
104 | Assert(!psss->pwzSql); | 104 | Assert(!psss->pwzSql); |
105 | hr = StrAllocString(&psss->pwzSql, pwzData, 0); | 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 | 107 | ||
108 | *ppsssList = AddSqlStrToList(*ppsssList, psss); | 108 | *ppsssList = AddSqlStrToList(*ppsssList, psss); |
109 | psss = NULL; // set the sss to NULL so it doesn't get freed below | 109 | psss = NULL; // set the sss to NULL so it doesn't get freed below |
@@ -113,7 +113,7 @@ HRESULT ScaSqlStrsRead( | |||
113 | { | 113 | { |
114 | hr = S_OK; | 114 | hr = S_OK; |
115 | } | 115 | } |
116 | ExitOnFailure(hr, "Failure occured while reading SqlString table"); | 116 | ExitOnFailure(hr, "Failure occured while reading Wix4SqlString table"); |
117 | 117 | ||
118 | LExit: | 118 | LExit: |
119 | // if anything was left over after an error clean it all up | 119 | // if anything was left over after an error clean it all up |
@@ -157,19 +157,19 @@ HRESULT ScaSqlStrsReadScripts( | |||
157 | SCA_SQLSTR sss; | 157 | SCA_SQLSTR sss; |
158 | SCA_SQLSTR* psss = NULL; | 158 | SCA_SQLSTR* psss = NULL; |
159 | 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 | { | 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); | 163 | ExitFunction1(hr = S_FALSE); |
164 | } | 164 | } |
165 | 165 | ||
166 | // open a view on the binary table | 166 | // open a view on the binary table |
167 | hr = WcaOpenView(vcsSqlBinaryScriptQuery, &hViewBinary); | 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 | 169 | ||
170 | // loop through all the sql scripts | 170 | // loop through all the sql scripts |
171 | hr = WcaOpenExecuteView(vcsSqlScriptQuery, &hView); | 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))) | 173 | while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) |
174 | { | 174 | { |
175 | INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN; | 175 | INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN; |
@@ -196,33 +196,33 @@ HRESULT ScaSqlStrsReadScripts( | |||
196 | sss.isAction = isAction; | 196 | sss.isAction = isAction; |
197 | 197 | ||
198 | hr = WcaGetRecordString(hRec, sscrqSqlScript, &pwzData); | 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); | 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 | 202 | ||
203 | // find the database information for this string | 203 | // find the database information for this string |
204 | hr = WcaGetRecordString(hRec, sscrqSqlDb, &pwzData); | 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); | 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 | 208 | ||
209 | hr = WcaGetRecordInteger(hRec, sscrqAttributes, &sss.iAttributes); | 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 | 211 | ||
212 | hr = WcaGetRecordInteger(hRec, sscrqSequence, &sss.iSequence); | 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 | 214 | ||
215 | // get the sql script out of the binary stream | 215 | // get the sql script out of the binary stream |
216 | hr = WcaExecuteView(hViewBinary, hRec); | 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); | 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 | 220 | ||
221 | // Note: We need to allocate an extra character on the stream to NULL terminate the SQL script. | 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 | 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". | 223 | // so we'll read the stream "the old fashioned way". |
224 | //hr = WcaGetRecordStream(hRecBinary, ssbsqData, (BYTE**)&pbScript, &cbScript); | 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); | 226 | er = ::MsiRecordReadStream(hRecBinary, ssbsqData, NULL, &cbRead); |
227 | hr = HRESULT_FROM_WIN32(er); | 227 | hr = HRESULT_FROM_WIN32(er); |
228 | ExitOnFailure(hr, "failed to get size of stream"); | 228 | ExitOnFailure(hr, "failed to get size of stream"); |
@@ -472,7 +472,7 @@ HRESULT ScaSqlStrsReadScripts( | |||
472 | { | 472 | { |
473 | hr = S_OK; | 473 | hr = S_OK; |
474 | } | 474 | } |
475 | ExitOnFailure(hr, "Failure occured while reading SqlString table"); | 475 | ExitOnFailure(hr, "Failure occured while reading Wix4SqlScript table"); |
476 | 476 | ||
477 | LExit: | 477 | LExit: |
478 | // if anything was left over after an error clean it all up | 478 | // 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 | |||
18 | 18 | ||
19 | LPWSTR pwzSql; | 19 | LPWSTR pwzSql; |
20 | int iAttributes; | 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 | 22 | ||
23 | SCA_SQLSTR* psssNext; | 23 | SCA_SQLSTR* psssNext; |
24 | }; | 24 | }; |