Available
amalgame-postgresql
Dynamic-link binding to system libpq. First of the pattern.
Overview
First Amalgame package to adopt the dynamic-link pattern: the lib is not vendored — the binary references the system's libpq.so. Lighter, more security-current, and more natural for server deployments where PostgreSQL is already installed.
Features
- ✓Direct binding to
libpq: installlibpq-devto build - ✓
PostgreSQL.Open,Exec,QueryAll,Changes,ServerVersion - ✓
$1,$2parameters withExecBind/QueryBindAll,Begin/Commit/Rollbacktransactions - ✓TLS handled by
libpq, set in the connection string (sslmode=require)
Planned
- ◐Prepared-statement reuse
- ◐Typed column accessors: today every cell comes back as text
- ◐
COPYfor bulk imports - ◐
LISTEN/NOTIFY, async queries, cursors
Example
Minimal usage example — copy-paste runnable after install.
import Amalgame.Database.PostgreSQL
public class Program {
public static void Main() {
let db = PostgreSQL.Open("host=localhost dbname=app user=app")
if (!PostgreSQL.IsOpen(db)) {
Console.WriteLine("connect failed: " + PostgreSQL.LastError(db))
return
}
let params = new List<string>()
params.Add("true")
let rows = PostgreSQL.QueryBindAll(db, "SELECT id, name FROM users WHERE active = $1", params)
for row in rows {
Console.WriteLine(row.Get(0) + " : " + row.Get(1))
}
PostgreSQL.Close(db)
}
}
At a glance
- License: Apache-2.0
- Install:
amc package add postgresql - Source: amalgame-lang/amalgame-database-postgresql
- Official index: amalgame-lang/packages-index