Skip to content

Commit 193a227

Browse files
committed
removing odd variables
1 parent 1574110 commit 193a227

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

functions/Invoke-DBOQuery.ps1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,13 @@ function Invoke-DBOQuery {
173173
$totalLength = 0
174174
if ($Table) {
175175
for ($i = 0; $i -lt $Table.Columns.Count; $i++) {
176-
$maxLength = if ($Table.Rows.Count -eq 0) { 0 } else {
177-
$Table.Rows | Foreach-Object { $len = 0 } {
176+
$maxLength = 0
177+
if ($Table.Rows.Count -gt 0) {
178+
$Table.Rows | Foreach-Object {
178179
$itemLength = ([string]$_.ItemArray[$i]).Length
179-
if ($itemLength -gt $len) { $len = $itemLength }
180-
} { ($len + 2) }
180+
$maxLength = [Math]::Max($itemLength, $maxLength)
181+
}
182+
$maxLength += 2
181183
}
182184
if ($Table.Columns[$i].ColumnName.Length -gt $maxLength) { $maxLength = $Table.Columns[$i].ColumnName.Length }
183185
$format += " {$i, $maxLength} |"
@@ -250,8 +252,8 @@ function Invoke-DBOQuery {
250252
$queryText = $fileObjects | Get-Content -Raw
251253
}
252254
$delimiter = switch ($Type) {
253-
SqlServer { 'GO' }
254-
PostgreSQL { 'semicolon (;)' }
255+
SqlServer { '''GO'' on a new line' }
256+
PostgreSQL { 'semicolon (;) on a new line' }
255257
Oracle { 'semicolon (;)' }
256258
MySQL { 'semicolon (;)' }
257259
}

0 commit comments

Comments
 (0)