Fork me on GitHub

WRT next.jdbc: is there a way to attach some data to a datasource that would be within the implementation of the read-column-by-index method of the result-set/ReadableColumn protocol? Perhaps via the result-set-metadata that is passed in... What I am really trying to do is to compare the ColumnTypeName to a list that I obtain by querying the pg_type table the system catalog, (specifically select typname from pg_type where typtype='e'; I want to make that query soon after creating my long-lived connection pool, and put the resulting list/set "somewhere" that can be retrieved within a read-column-by-index method implementation. My overall goal is to automatically coerce between Clojure keywords and Postgres enums, as That implementation requires a set of defined ENUM types, which they hard-code (which they clearly mentioned as a limitation, and which I am attempting to improve upon)


@dcj You should be able to do this via one of the *-adapter builders, since you can pass an arbitrary "column reader" function in, which is invoked with the (current) ResultSet, ResultSetMetadata (returned by the builder), and the column index.


(you can't attach anything to the javax.sql.DataSource or java.sql.Connection because they are plain Java objects)


Your column reader could close over the specific column metadata you had queried earlier.


@seancorfield Cool, thank you! I will explore that direction...