PostgreSQL large-object (lo) helpers over pgjdbc's LargeObjectManager.
Large objects are stored in pg_largeobject and addressed by an OID. Every
operation must run inside a transaction (set autocommit off, e.g. with
next.jdbc/with-transaction); pgjdbc raises otherwise. Each function accepts
the java.sql.Connection for manager operations, or an open LargeObject for
read/write/seek. The caller owns the connection and transaction lifecycle.
PostgreSQL large-object (`lo`) helpers over pgjdbc's `LargeObjectManager`. Large objects are stored in `pg_largeobject` and addressed by an OID. Every operation must run inside a transaction (set autocommit off, e.g. with `next.jdbc/with-transaction`); pgjdbc raises otherwise. Each function accepts the `java.sql.Connection` for manager operations, or an open `LargeObject` for read/write/seek. The caller owns the connection and transaction lifecycle.
(create! conn)Create a new, empty large object and return its OID (a long).
Create a new, empty large object and return its OID (a long).
(fetch conn oid)Read the entire contents of the large object OID as a byte array.
Read the entire contents of the large object OID as a byte array.
(input-stream lo)Return an InputStream reading LO from its current position.
Return an `InputStream` reading LO from its current position.
(lo-size lo)Return the size of LO in bytes.
Return the size of LO in bytes.
(manager conn)Return pgjdbc's LargeObjectManager for an open connection.
Return pgjdbc's `LargeObjectManager` for an open connection.
(open conn oid)(open conn oid mode)Open the large object OID and return a LargeObject. MODE is :read,
:write, or :read-write (default :read-write). Close it with close!.
Open the large object OID and return a `LargeObject`. MODE is `:read`, `:write`, or `:read-write` (default `:read-write`). Close it with `close!`.
(output-stream lo)Return an OutputStream writing to LO at its current position.
Return an `OutputStream` writing to LO at its current position.
(read-bytes lo n)Read up to N bytes from LO at the current position, as a byte array.
Read up to N bytes from LO at the current position, as a byte array.
(seek! lo pos)(seek! lo pos whence)Move LO's read/write position to POS bytes, relative to WHENCE (:set,
:cur, or :end; default :set).
Move LO's read/write position to POS bytes, relative to WHENCE (`:set`, `:cur`, or `:end`; default `:set`).
(store! conn data)Create a large object, write DATA (a byte array) into it, and return its OID. Runs against CONN's current transaction.
Create a large object, write DATA (a byte array) into it, and return its OID. Runs against CONN's current transaction.
(tell lo)Return LO's current byte position.
Return LO's current byte position.
(truncate! lo length)Truncate LO to LENGTH bytes.
Truncate LO to LENGTH bytes.
(unlink! conn oid)Delete the large object with OID.
Delete the large object with OID.
(write-bytes! lo data)(write-bytes! lo data offset length)Write a byte array to LO at the current position (optionally a sub-range).
Write a byte array to LO at the current position (optionally a sub-range).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |