File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -173,11 +173,13 @@ function Invoke-DBOQuery {
173
173
$totalLength = 0
174
174
if ($Table ) {
175
175
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 {
178
179
$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
181
183
}
182
184
if ($Table.Columns [$i ].ColumnName.Length -gt $maxLength ) { $maxLength = $Table.Columns [$i ].ColumnName.Length }
183
185
$format += " {$i , $maxLength } |"
@@ -250,8 +252,8 @@ function Invoke-DBOQuery {
250
252
$queryText = $fileObjects | Get-Content - Raw
251
253
}
252
254
$delimiter = switch ($Type ) {
253
- SqlServer { ' GO ' }
254
- PostgreSQL { ' semicolon (;)' }
255
+ SqlServer { ' '' GO '' on a new line ' }
256
+ PostgreSQL { ' semicolon (;) on a new line ' }
255
257
Oracle { ' semicolon (;)' }
256
258
MySQL { ' semicolon (;)' }
257
259
}
You can’t perform that action at this time.
0 commit comments