Skip to content

Commit 1574110

Browse files
committed
the rest of the Oracle tests
1 parent 0e0ada9 commit 1574110

File tree

6 files changed

+836
-31
lines changed

6 files changed

+836
-31
lines changed

appveyor.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ for:
2828
#scenario: all
2929
environment:
3030
mssql_instance: localhost\SQL2017
31+
scenario: windows
3132
services:
3233
- mssql2017
3334
- mysql
@@ -37,13 +38,11 @@ for:
3738
- psql -c "CREATE USER sa WITH PASSWORD 'Password12!';" -U postgres
3839
- psql -c "ALTER USER sa WITH SUPERUSER;" -U postgres
3940
- ps: .\tests\appveyor.prep.ps1
40-
- docker-switch-linux
41-
- docker run --name dbops-oracle -d -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g
4241

4342
- matrix:
4443
only:
4544
- image: Ubuntu1804
46-
#scenario: default
45+
scenario: all
4746
environment:
4847
mssql_instance: localhost
4948
services:

functions/Invoke-DBOQuery.ps1

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,38 @@ function Invoke-DBOQuery {
165165
)
166166

167167
begin {
168+
function Write-HostTable {
169+
Param (
170+
$Table
171+
)
172+
$format = ""
173+
$totalLength = 0
174+
if ($Table) {
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 } {
178+
$itemLength = ([string]$_.ItemArray[$i]).Length
179+
if ($itemLength -gt $len) { $len = $itemLength }
180+
} { ($len + 2) }
181+
}
182+
if ($Table.Columns[$i].ColumnName.Length -gt $maxLength) { $maxLength = $Table.Columns[$i].ColumnName.Length }
183+
$format += " {$i, $maxLength} |"
184+
$totalLength += ($maxLength + 3)
185+
}
186+
$format = "|$format"
187+
$totalLength += 1
188+
189+
Write-Host ([string]::new('-', $totalLength))
190+
Write-Host ($format -f $Table.Columns.ColumnName)
191+
Write-Host ([string]::new('-', $totalLength))
192+
foreach ($row in $Table.Rows) {
193+
Write-Host ($format -f $row.ItemArray)
194+
}
195+
Write-Host ([string]::new('-', $totalLength))
196+
# totals
197+
Write-Host ("{0, $totalLength}" -f "($($Table.Rows.Count) rows)")
198+
}
199+
}
168200
}
169201
process {
170202
$config = New-DBOConfig -Configuration $Configuration
@@ -275,7 +307,10 @@ function Invoke-DBOQuery {
275307
$command.CommandText = $splitQuery
276308
foreach ($key in $Parameter.Keys) {
277309
$null = switch ($Type) {
278-
Oracle { $command.Parameters.Add($key, $Parameter[$key]) }
310+
Oracle {
311+
$command.BindByName = $true
312+
$command.Parameters.Add($key, $Parameter[$key])
313+
}
279314
default { $command.Parameters.AddWithValue($key, $Parameter[$key]) }
280315
}
281316
}
@@ -347,33 +382,7 @@ function Invoke-DBOQuery {
347382
}
348383
if ($Interactive) {
349384
# output right to the screen
350-
$format = ""
351-
$totalLength = 0
352-
$t = $ds.Tables[0]
353-
for ($i = 0; $i -lt $t.Columns.Count; $i++) {
354-
$maxLength = if ($t.Rows.Count -eq 0) { 0 } else {
355-
$t.Rows | Foreach-Object { $len = 0 } {
356-
$itemLength = ([string]$_.ItemArray[$i]).Length
357-
if ($itemLength -gt $len) { $len = $itemLength }
358-
} { ($len + 2) }
359-
}
360-
if ($t.Columns[$i].ColumnName.Length -gt $maxLength) { $maxLength = $t.Columns[$i].ColumnName.Length }
361-
$format += " {$i, $maxLength} |"
362-
$totalLength += ($maxLength + 3)
363-
}
364-
$format = "|$format"
365-
$totalLength += 1
366-
if ($t) {
367-
Write-Host ([string]::new('-', $totalLength))
368-
Write-Host ($format -f $t.Columns.ColumnName)
369-
Write-Host ([string]::new('-', $totalLength))
370-
foreach ($row in $t.Rows) {
371-
Write-Host ($format -f $row.ItemArray)
372-
}
373-
Write-Host ([string]::new('-', $totalLength))
374-
# totals
375-
Write-Host ("{0, $totalLength}" -f "($($t.Rows.Count) rows)")
376-
}
385+
Write-HostTable -Table $ds.Tables[0]
377386
}
378387
else {
379388
# output as object

0 commit comments

Comments
 (0)