read-column-thunk method, which is used to determine how to read values of columns in results, and default
implementations
[[read-column-thunk]] method, which is used to determine how to read values of columns in results, and default implementations
(get-object-of-class-thunk rset i klass)Return a thunk that will be used to fetch values at column index i from ResultSet rset as a given class. Calling
this thunk is equivalent to
(.getObject rset i klass)
but includes extra logging.
Return a thunk that will be used to fetch values at column index `i` from ResultSet `rset` as a given class. Calling this thunk is equivalent to ```clj (.getObject rset i klass) ``` but includes extra logging.
(read-column-thunk conn₁ model₂ rset rsmeta₍₃₎ i)Return a zero-arg function that, when called, will fetch the value of the column from the current row.
Dispatches on java.sql.Connection class, model, and the java.sql.Types mapping for the column, e.g.
java.sql.Types/TIMESTAMP.
The java.sql.Types column type should be an explicit parameter. A little weird to dispatch off of something
that's not even one of the parameters
Should this also dispatch off of the actual underlying column name? So you can read a column in different ways for different models.
Should this dispatch off of the underlying database column type name string, e.g. timestamp or timestamptz? It
seems like a lot of the time we need to do different things based on that type name.
read-column-thunk is defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:27).
It caches methods using a methodical.impl.cache.watching.WatchingCache.
It uses the method combination methodical.impl.combo.threaded.ThreadingMethodCombination
with the threading strategy :thread-last.
It uses the dispatcher methodical.impl.dispatcher.multi_default.MultiDefaultDispatcher
with hierarchy #'clojure.core/global-hierarchy
and prefs {[:toucan2.jdbc.mysql-mariadb/connection :default 93] #{[java.sql.Connection :default 93]}, [:toucan2.jdbc.postgres/connection :default 93] #{[java.sql.Connection :default 93]}}.
The default value is :default.
It uses the method table methodical.impl.method_table.standard.StandardMethodTable.
These primary methods are known:
:default, defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:58)
[:default :default 92], defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:113)
[:default :default 2005], defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:96)
[:toucan2.jdbc.mysql-mariadb/connection :default 93], defined in [[toucan2.jdbc.mysql-mariadb]] (toucan2/jdbc/mysql_mariadb.clj:27)
It has the following documentation:
MySQL/MariaDB timestamp is normalized to UTC, so return it as an OffsetDateTime rather than a LocalDateTime.
datetime columns should be returned as LocalDateTime. Both timestamp and datetime seem to come back as
java.sql.Types/TIMESTAMP, so check the actual database column type name so we can fetch objects as the correct
class.
[:toucan2.jdbc.postgres/connection :default 93], defined in [[toucan2.jdbc.postgres]] (toucan2/jdbc/postgres.clj:18)
It has the following documentation:
Both Postgres timestamp and timestamp with time zone come back as java.sql.Types/TIMESTAMP; check the actual
database column type name so we can fetch objects as the correct class.
[:default :default 2014], defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:105)
[:default :default 93], defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:101)
[:default :default 91], defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:109)
[:default :default 2013], defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:117)
These aux methods are known:
:after methods:
:default, defined in toucan2.jdbc.read (toucan2/jdbc/read.clj:65)Return a zero-arg function that, when called, will fetch the value of the column from the current row.
Dispatches on `java.sql.Connection` class, `model`, and the `java.sql.Types` mapping for the column, e.g.
`java.sql.Types/TIMESTAMP`.
### TODO -- dispatch for this method is busted.
1. The `java.sql.Types` column type should be an explicit parameter. A little weird to dispatch off of something
that's not even one of the parameters
2. Should this also dispatch off of the actual underlying column name? So you can read a column in different ways for
different models.
3. Should this dispatch off of the underlying database column type name string, e.g. `timestamp` or `timestamptz`? It
seems like a lot of the time we need to do different things based on that type name.
read-column-thunk is defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:27).
It caches methods using a `methodical.impl.cache.watching.WatchingCache`.
It uses the method combination `methodical.impl.combo.threaded.ThreadingMethodCombination`
with the threading strategy `:thread-last`.
It uses the dispatcher `methodical.impl.dispatcher.multi_default.MultiDefaultDispatcher`
with hierarchy `#'clojure.core/global-hierarchy`
and prefs `{[:toucan2.jdbc.mysql-mariadb/connection :default 93] #{[java.sql.Connection :default 93]}, [:toucan2.jdbc.postgres/connection :default 93] #{[java.sql.Connection :default 93]}}`.
The default value is `:default`.
It uses the method table `methodical.impl.method_table.standard.StandardMethodTable`.
These primary methods are known:
* `:default`, defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:58)
* `[:default :default 92]`, defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:113)
* `[:default :default 2005]`, defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:96)
* `[:toucan2.jdbc.mysql-mariadb/connection :default 93]`, defined in [[toucan2.jdbc.mysql-mariadb]] (toucan2/jdbc/mysql_mariadb.clj:27)
It has the following documentation:
MySQL/MariaDB `timestamp` is normalized to UTC, so return it as an `OffsetDateTime` rather than a `LocalDateTime`.
`datetime` columns should be returned as `LocalDateTime`. Both `timestamp` and `datetime` seem to come back as
`java.sql.Types/TIMESTAMP`, so check the actual database column type name so we can fetch objects as the correct
class.
* `[:toucan2.jdbc.postgres/connection :default 93]`, defined in [[toucan2.jdbc.postgres]] (toucan2/jdbc/postgres.clj:18)
It has the following documentation:
Both Postgres `timestamp` and `timestamp with time zone` come back as `java.sql.Types/TIMESTAMP`; check the actual
database column type name so we can fetch objects as the correct class.
* `[:default :default 2014]`, defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:105)
* `[:default :default 93]`, defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:101)
* `[:default :default 91]`, defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:109)
* `[:default :default 2013]`, defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:117)
These aux methods are known:
`:after` methods:
* `:default`, defined in [[toucan2.jdbc.read]] (toucan2/jdbc/read.clj:65) (type-name i)(type-name i not-found)Map of java.sql.Types enum integers (e.g. java.sql.Types/FLOAT, whose value is 6) to the string type name e.g.
FLOAT.
(type-name java.sql.Types/FLOAT) -> (type-name 6) -> "FLOAT"
Map of `java.sql.Types` enum integers (e.g. `java.sql.Types/FLOAT`, whose value is `6`) to the string type name e.g. `FLOAT`. ```clj (type-name java.sql.Types/FLOAT) -> (type-name 6) -> "FLOAT" ```
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 |