From b5c83bb4d4d9890692c6c8919384179e507318ec Mon Sep 17 00:00:00 2001 From: Erik Renes Date: Tue, 27 Mar 2018 10:13:59 +0200 Subject: [PATCH 1/2] Pass ParseViaFramework via constructor --- PSSQLite/Invoke-SqliteQuery.ps1 | 3 +-- PSSQLite/New-SqliteConnection.ps1 | 3 +-- Tests/Invoke-SQLiteQuery.Tests.ps1 | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/PSSQLite/Invoke-SqliteQuery.ps1 b/PSSQLite/Invoke-SqliteQuery.ps1 index 83a704f..d796358 100644 --- a/PSSQLite/Invoke-SqliteQuery.ps1 +++ b/PSSQLite/Invoke-SqliteQuery.ps1 @@ -408,8 +408,7 @@ $ConnectionString = "Data Source={0}" -f $Database - $conn = New-Object System.Data.SQLite.SQLiteConnection -ArgumentList $ConnectionString - $conn.ParseViaFramework = $true #Allow UNC paths, thanks to Ray Alex! + $conn = New-Object System.Data.SQLite.SQLiteConnection -ArgumentList $ConnectionString,$true #Allow UNC paths, thanks to Ray Alex! Write-Debug "ConnectionString $ConnectionString" Try diff --git a/PSSQLite/New-SqliteConnection.ps1 b/PSSQLite/New-SqliteConnection.ps1 index 9da0d9d..51228bd 100644 --- a/PSSQLite/New-SqliteConnection.ps1 +++ b/PSSQLite/New-SqliteConnection.ps1 @@ -116,8 +116,7 @@ $ConnectionString += "Read Only=True;" } - $conn = New-Object System.Data.SQLite.SQLiteConnection -ArgumentList $ConnectionString - $conn.ParseViaFramework = $true #Allow UNC paths, thanks to Ray Alex! + $conn = New-Object System.Data.SQLite.SQLiteConnection -ArgumentList $ConnectionString,$true Write-Debug "ConnectionString $ConnectionString" if($Open) diff --git a/Tests/Invoke-SQLiteQuery.Tests.ps1 b/Tests/Invoke-SQLiteQuery.Tests.ps1 index 9c9fd9c..780df66 100644 --- a/Tests/Invoke-SQLiteQuery.Tests.ps1 +++ b/Tests/Invoke-SQLiteQuery.Tests.ps1 @@ -52,13 +52,13 @@ Describe "Invoke-SQLiteQuery PS$PSVersion" { It 'should support parameterized queries' { $Out = @( Invoke-SQLiteQuery @Verbose -Database $SQLiteFile -Query "SELECT * FROM NAMES WHERE BirthDate >= @Date" -SqlParameters @{ - Date = (Get-Date 3/13/2012) + Date = (Get-Date -Year 2012 -Month 3 -Day 13) } -ErrorAction Stop ) $Out.count | Should Be 1 $Out[0].fullname | Should Be "Cookie Monster" $Out = @( Invoke-SQLiteQuery @Verbose -Database $SQLiteFile -Query "SELECT * FROM NAMES WHERE BirthDate >= @Date" -SqlParameters @{ - Date = (Get-Date 3/15/2012) + Date = (Get-Date -Year 2012 -Month 3 -Day 15) } -ErrorAction Stop ) $Out.count | Should Be 0 } From 63c41dcbc5e4c98f5c0460cfe54ae5756e5c09f8 Mon Sep 17 00:00:00 2001 From: Erik Renes Date: Tue, 27 Mar 2018 10:16:26 +0200 Subject: [PATCH 2/2] Return comment credit --- PSSQLite/New-SqliteConnection.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSSQLite/New-SqliteConnection.ps1 b/PSSQLite/New-SqliteConnection.ps1 index 51228bd..f85c4f8 100644 --- a/PSSQLite/New-SqliteConnection.ps1 +++ b/PSSQLite/New-SqliteConnection.ps1 @@ -116,7 +116,7 @@ $ConnectionString += "Read Only=True;" } - $conn = New-Object System.Data.SQLite.SQLiteConnection -ArgumentList $ConnectionString,$true + $conn = New-Object System.Data.SQLite.SQLiteConnection -ArgumentList $ConnectionString,$true #Allow UNC paths, thanks to Ray Alex! Write-Debug "ConnectionString $ConnectionString" if($Open)