Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
edb fixes (#52) (#53)
Browse files Browse the repository at this point in the history
!Deploy
* StatusReport move from Last to Previous. Issue: #43 
* Registration and devices from from First to Next. Issue: #51
  • Loading branch information
bgelens authored Jan 16, 2019
1 parent f4138a7 commit 4ea78bc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 30 deletions.
8 changes: 3 additions & 5 deletions DSCPullServerAdmin/DSCPullServerAdmin.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = 'Cross Platform support (Only SQL is supported xPlat. MDB and ESE are not)
* Removed Microsoft.Isam.Esent.Interop from RequiredAssemblies
* Load Microsoft.Isam.Esent.Interop when available
* removed RetrieveColumnAsGuid and moved properties to RetrieveColumnAsString as something broke on latest w10 insiders
ReleaseNotes = 'EDB Fixes:
* Fix ad-hoc mdb database access did not process as PreProc was missing MDB logic'
* StatusReport move from Last to Previous. Issue: #43.
* Registration and devices from from First to Next. Issue: #51'

} # End of PSData hashtable

Expand Down
29 changes: 4 additions & 25 deletions DSCPullServerAdmin/private/Get-DSCPullServerESERecord.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,6 @@ function Get-DSCPullServerESERecord {
[uint16] $Top
)
begin {
$stringColumns = @(
'TargetName',
'ServerCheckSum',
'TargetChecksum',
'NodeName',
'OperationType',
'RefreshMode',
'Status',
'LCMVersion',
'ReportFormatVersion',
'ConfigurationVersion',
'RebootRequested',
'JobId',
'Id',
'ConfigurationID'
)

$boolColumns = @(
'NodeCompliant',
'Dirty'
Expand Down Expand Up @@ -94,7 +77,10 @@ function Get-DSCPullServerESERecord {
process {
try {
$recordCount = 0
while ([Microsoft.Isam.Esent.Interop.Api]::TryMoveNext($Connection.SessionId, $Connection.TableId)) {
$FirstMove = $true

while (Move-DSCPullServerESERecordPosition -Connection $Connection -Table $Table -FirstMove $FirstMove) {
$FirstMove = $false
if ($PSBoundParameters.ContainsKey('Top') -and $Top -eq $recordCount) {
break
}
Expand Down Expand Up @@ -125,13 +111,6 @@ function Get-DSCPullServerESERecord {
$_
} catch {}
}
} elseif ($column.Name -in $stringColumns) {
$result."$($column.Name)" = [Microsoft.Isam.Esent.Interop.Api]::RetrieveColumnAsString(
$Connection.SessionId,
$Connection.TableId,
$column.Columnid,
[System.Text.Encoding]::Unicode
)
} elseif ($column.Name -in $boolColumns) {
$result."$($column.Name)" = [Microsoft.Isam.Esent.Interop.Api]::RetrieveColumnAsBoolean(
$Connection.SessionId,
Expand Down
31 changes: 31 additions & 0 deletions DSCPullServerAdmin/private/Move-DSCPullServerESERecordPosition.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function Move-DSCPullServerESERecordPosition {
[OutputType([bool])]
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[DSCPullServerESEConnection] $Connection,

[Parameter(Mandatory)]
[string] $Table,

[Parameter(Mandatory)]
[bool] $FirstMove
)

switch ($Table) {
StatusReport {
if ($FirstMove) {
[Microsoft.Isam.Esent.Interop.Api]::TryMoveLast($Connection.SessionId, $Connection.TableId)
} else {
[Microsoft.Isam.Esent.Interop.Api]::TryMovePrevious($Connection.SessionId, $Connection.TableId)
}
}
default {
if ($FirstMove) {
[Microsoft.Isam.Esent.Interop.Api]::TryMoveFirst($Connection.SessionId, $Connection.TableId)
} else {
[Microsoft.Isam.Esent.Interop.Api]::TryMoveNext($Connection.SessionId, $Connection.TableId)
}
}
}
}

0 comments on commit 4ea78bc

Please sign in to comment.