Skip to content
Marco van Gaal edited this page Aug 5, 2015 · 23 revisions

.NAME

Connect-SQLite

.SYNOPSIS

Connect to SQLite Database file

.PARAMETERS

 -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

.INPUTS

None. You cannot pipe objects to Connect-SQLite

.OUTPUTS

<SQLiteConnection>

.NOTES

 Author: Proxx
 Web:    www.Proxx.nl 
 Date:    10-06-2015

.EXAMPLES

 -------------------------- 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)

.RELATED LINKS

http://www.proxx.nl/Wiki/Connect-SQLite

Clone this wiki locally