diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2022-03-30 20:27:25 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2022-03-30 20:27:25 -0600 |
commit | 63cdbc7891a25e378d17ccb21979d042710a452d (patch) | |
tree | a1e853f9d4bc9c7636c4c66c46cb5d2fe2a27450 | |
parent | 8714065408b8e92cad7c85994dc6e02b78e3243d (diff) |
README
-rw-r--r-- | README.md | 25 | ||||
-rw-r--r-- | server.go | 13 |
2 files changed, 37 insertions, 1 deletions
@@ -2,7 +2,20 @@ Postlite ======== Postlite is a network proxy to allow access to remote SQLite databases over the -Postgres wire protocol. +Postgres wire protocol. This allows GUI tools to be used on remote SQLite +databases which can make administration easier. + +The proxy works by translating Postgres frontend wire messages into SQLite +transactions and converting results back into Postgres response wire messages. +Many Postgres clients also inspect the `pg_catalog` to determine system +information so Postlite mirrors this catalog by using an attached in-memory +database with virtual tables. The proxy also performs minor rewriting on these +system queries to convert them to usable SQLite syntax. + +_Note: This software is in alpha. Please report bugs. Postlite doesn't alter +your database unless you issue INSERT, UPDATE, DELETE commands so it's probably +safe. If anything, the Postlite process may die but it shouldn't affect your +database._ ## Usage @@ -22,3 +35,13 @@ $ psql --host HOSTNAME my.db This will connect you to a SQLite database at the path `/data/my.db`. + +## Development + +Postlite uses virtual tables to simulate the `pg_catalog` so you will need to +enable the `vtable` tag when building: + +```sh +$ go install -tags vtable ./cmd/postlite +``` + @@ -499,6 +499,19 @@ func newConn(conn net.Conn) *Conn { } } +func (c *Conn) Close() (err error) { + if c.db != nil { + if e := c.db.Close(); err == nil { + err = e + } + } + + if e := c.Conn.Close(); err == nil { + err = e + } + return err +} + func getParameter(m map[string]string, k string) string { if m == nil { return "" |