Skip to content

cbsch/cbsch-pgsql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Powershell wrapper for Npgsql

Install-Module cbsch-pgsql -Scope CurrentUser
$credential = Get-Credential
$connection = Connect-PgSql -Credential $credential

Invoke-PgSql -Connection $connection -Query @"
CREATE TABLE test(
    id int,
    guid uuid,
    date timestamp with time zone,
    smallint integer,
    bigint bigint,
    double double precision
)
"@

Invoke-PgSql -Connection $connection -Query @"
INSERT INTO test(id, guid, date, smallint, bigint, double)
VALUES(@id, @guid, @date, @smallint, @bigint, @double)
"@ -Parameters @{
    "@id" = 1
    "@guid" = [Guid]::NewGuid()
    "@date" = Get-Date
    "@smallint" = 42
    "@bigint" = [Int64]::MaxValue
    "@double" = 0.23
}

Invoke-PgSql -Connection $connection -Query "SELECT * FROM test"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published