-
Notifications
You must be signed in to change notification settings - Fork 0
Connect SQLite
Marco van Gaal edited this page Aug 5, 2015
·
23 revisions
Connect-SQLite
Connect to SQLite Database file
-Database <String>
Required? false
Position? 1
Default value $(Join-path -Path $MyInvocation.PSScriptRoot -ChildPath "database.db")
Accept pipeline input? false
Accept wildcard characters? false
-Open [<SwitchParameter>]
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
None. You cannot pipe objects to Connect-SQLite
<SQLiteConnection>
Author: Proxx
Web: www.Proxx.nl
Date: 10-06-2015
-------------------------- EXAMPLE 1 --------------------------
PS C:\>$conn = Connect-SQLite -Database <FilePath>
-------------------------- EXAMPLE 2 --------------------------
PS C:\>$conn = Connect-SQLite -Database <FilePath> -Open
PS C:\> $conn
PoolCount : 0
ConnectionString : Data Source = D:\database.db
DataSource : database
Database : main
DefaultTimeout : 30
ParseViaFramework : False
Flags : Default
DefaultDbType :
DefaultTypeName :
OwnHandle : True
ServerVersion : 3.8.6
LastInsertRowId : 0
Changes : 0
AutoCommit : True
MemoryUsed : 69631
MemoryHighwater : 69673
State : Open
ConnectionTimeout : 15
Site :
Container :
-------------------------- EXAMPLE 3 --------------------------
PS C:\>$conn = Connect-SQLite -Open
When run in Script the database file is located in $PSscriptRoot with the name: database.db
But if you run this from Console the database file is located in $pwd location
-------------------------- EXAMPLE 4 --------------------------
PS C:\>$conn = Connect-SQLite -Database :MEMORY:
(creates a SQLite database in memory)