System.Data.SQLite package for FarNet and PowerShell.
The package is designed for FarNet. To install FarNet and FarNet.SQLite, follow these steps.
The NuGet package FarNet.SQLite
is installed to %FARHOME%\FarNet\Lib\FarNet.SQLite.
Included assets:
-
System.Data.SQLite.dllThe original .NET API from the SQLite team.
-
FarNet.SQLite.dllHelper methods to simplify typical tasks routine coding.
They are designed for C# and F# and used in PowerShell. -
FarNet.SQLite.psd1, ...The PowerShell module with
FarNet.SQLite.dllhelpers.
Consider using the module in scripts, this way is much easier. -
FarNet.SQLite.iniThe configuration file for F# scripts (FarNet.FSharpFar).
The installed package includes the PowerShell module. Its cmdlets make work with FarNet.SQLite in PowerShell easier, especially in interactive sessions.
The module may be used right out of the box, i.e. imported as:
Import-Module $env:FARHOME\FarNet\Lib\FarNet.SQLiteBut it is better to install this module in PowerShell, so that you can:
Import-Module FarNet.SQLiteThis is not just about the shorter command:
- For scripts outside Far Manager, this way does not need the variable
FARHOMEdefined. - In many cases you do not need to import the module, PowerShell discovers module commands.
Use the steps below to "install" the module as a symbolic link or junction.
(1) Choose one of the module directories, see $env:PSModulePath. For example:
-
C:\Program Files\WindowsPowerShell\ModulesThis folder is used by PowerShell Core and Windows PowerShell. If you have rights, this is the recommended location.
-
C:\Users\<user>\Documents\PowerShell\ModulesThis folder is used by PowerShell Core.
-
C:\Users\<user>\Documents\WindowsPowerShell\ModulesThis folder is used by Windows PowerShell.
(2) Change to the selected directory, and create the symbolic link
FarNet.SQLite to the original FarNet.SQLite folder:
New-Item -Path FarNet.SQLite -ItemType SymbolicLink -Value $env:FARHOME\FarNet\Lib\FarNet.SQLiteEnsure you have the environment variable
FARHOMEdefined or adjust the above command.
Alternatively, you may manually create the similar folder junction point in Far
Manager using AltF6.
Now you have the PowerShell module installed. You may update the FarNet package as usual. The symbolic link or junction do not have to be updated, they point to the same location.
# import the module
Import-Module FarNet.SQLite
# get its commands
Get-Command -Module FarNet.SQLite
# see command help
help Open-SQLiteReading data
Import-Module FarNet.SQLite
Open-SQLite db.sqlite -ReadOnly
try {
# work with Get-SQLite
...
}
finally {
Close-SQLite
}Writing data
Import-Module FarNet.SQLite
Open-SQLite db.sqlite -Transaction
try {
# work with Get-SQLite and Set-SQLite
...
# commit work
Complete-SQLite
}
finally {
Close-SQLite
}