diff options
Diffstat (limited to 'src/ca/scadb.cpp')
| -rw-r--r-- | src/ca/scadb.cpp | 39 |
1 files changed, 20 insertions, 19 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; |
