Skip to content

Commit

Permalink
Correction - wrong error handling removed during SQL line insertion c…
Browse files Browse the repository at this point in the history
…ommand (#3665)

Mea Culpa - Despite the fact I confirmed it works correctly, A few days
ago I provided wrong code from incorrect branch in my repository. Sorry
for that. Never will happen again.
  • Loading branch information
KM-JAD authored Sep 12, 2024
1 parent 151e8ab commit 2995fcd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Misc/Set-BcContainerFeatureKeys.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,10 @@ try {
$SQLRecord = Invoke-Sqlcmd -Database $databaseName -Query "SELECT * FROM [dbo].[Tenant Feature Key] where ID = '$featureKey'"
if ([String]::IsNullOrEmpty($SQLRecord))
{
Write-host -NoNewline "Creating record for feature ID '$featureKey' - "
Write-host "Creating record for feature ID '$featureKey'"
$SQLcolumns = "ID, Enabled"
$SQLvalues = "'$featureKey',0"
Invoke-Sqlcmd -Database $databaseName -Query "INSERT INTO [CRONUS].[dbo].[Tenant Feature Key]($SQLcolumns) VALUES ($SQLvalues)"
if ($result[0] -eq "1") {
Write-Host " Created"
}
Invoke-Sqlcmd -Database $databaseName -Query "INSERT INTO [CRONUS].[dbo].[Tenant Feature Key] ($SQLcolumns) VALUES ($SQLvalues)" -Verbose
}
Write-Host -NoNewline "Setting feature key $featureKey to $enabledStr - "
$result = Invoke-Sqlcmd -Database $databaseName -Query "UPDATE [dbo].[Tenant Feature Key] set Enabled = $enabled where ID = '$featureKey';Select @@ROWCOUNT"
Expand Down

0 comments on commit 2995fcd

Please sign in to comment.