Liking cljdoc? Tell your friends :D

wagoe.platform.shell.adapters.database.common.introspection

Table introspection for every adapter.

PostgreSQL, MySQL and H2 all read information_schema and differ only in which schema predicate identifies "this database", which HoneySQL dialect formats the query, and whether the table name may be folded to lower case. SQLite has no information_schema and reads sqlite_master and PRAGMA table_xinfo instead.

Both forms return the same column maps — :name (lower case), :type, :not-null, :default, :primary-key, :generated, :generated-always, :max-length (a character column's declared length, nil on SQLite) — which is what the port promises and what the four separate copies did not consistently deliver.

Table introspection for every adapter.

PostgreSQL, MySQL and H2 all read `information_schema` and differ only in
which schema predicate identifies "this database", which HoneySQL dialect
formats the query, and whether the table name may be folded to lower case.
SQLite has no `information_schema` and reads `sqlite_master` and
`PRAGMA table_xinfo` instead.

Both forms return the same column maps — `:name` (lower case), `:type`,
`:not-null`, `:default`, `:primary-key`, `:generated`, `:generated-always`,
`:max-length` (a character column's declared length, nil on SQLite) —
which is what the port promises and what the four separate copies did not
consistently deliver.
raw docstring

information-schema-key-columnsclj

(information-schema-key-columns {:keys [schema honey] :as spec}
                                datasource
                                table-name
                                key-name)

The columns of index key-name on table-name, in key order, per information_schema.statistics (MySQL's). The table is matched ignoring case: MySQL 5.7's refusal names no table, so it is the statement's, lower cased, and the server may or may not fold case (lower_case_table_names). Nil when two tables match.

The columns of index `key-name` on `table-name`, in key order, per
`information_schema.statistics` (MySQL's). The table is matched ignoring
case: MySQL 5.7's refusal names no table, so it is the statement's, lower
cased, and the server may or may not fold case (lower_case_table_names).
Nil when two tables match.
sourceraw docstring

information-schema-table-exists?clj

(information-schema-table-exists? {:keys [schema honey] :as spec}
                                  datasource
                                  table-name)

Whether table-name exists, per information_schema.tables.

spec is {:schema <predicate-value or :search-path> :honey <sql/format opts or nil> :fold-table-name? bool}.

Whether `table-name` exists, per `information_schema.tables`.

`spec` is {:schema <predicate-value or :search-path> :honey <sql/format opts or nil>
           :fold-table-name? bool}.
sourceraw docstring

information-schema-table-infoclj

(information-schema-table-info {:keys [schema honey generated-columns
                                       type-column]
                                :or {type-column :data_type}
                                :as spec}
                               datasource
                               table-name)

Column information for table-name, per information_schema. See information-schema-table-exists? for spec; its :generated-columns are the columns this engine reports identity and generated columns in, and its :type-column the one with the full type (default data_type).

Column information for `table-name`, per `information_schema`. See
`information-schema-table-exists?` for `spec`; its `:generated-columns` are
the columns this engine reports identity and generated columns in, and its
`:type-column` the one with the full type (default `data_type`).
sourceraw docstring

jdbc-unique-keysclj

(jdbc-unique-keys datasource table-name)

The unique keys of table-name in the connection's own catalog and schema, from the JDBC metadata: the primary key and every unique index without a filter. H2 keeps names lower case (DATABASE_TO_LOWER), SQLite and MySQL as created.

The unique keys of `table-name` in the connection's own catalog and
schema, from the JDBC metadata: the primary key and every unique index
without a filter. H2 keeps names lower case (DATABASE_TO_LOWER), SQLite
and MySQL as created.
sourceraw docstring

pg-key-columnsclj

(pg-key-columns datasource table-name key-name)

The columns of index or constraint key-name on table-name, in key order, from PostgreSQL's catalog: its refusal names them only in a Detail that follows lc_messages. table-name namespaced with its schema, or else the table the search path resolves. Nil for a key on an expression.

The columns of index or constraint `key-name` on `table-name`, in key
order, from PostgreSQL's catalog: its refusal names them only in a Detail
that follows lc_messages. `table-name` namespaced with its schema, or else
the table the search path resolves. Nil for a key on an expression.
sourceraw docstring

pg-unique-keysclj

(pg-unique-keys datasource table-name)

The unique keys of the table the search path resolves table-name to, from PostgreSQL's catalog: a unique index is not in information_schema.

The unique keys of the table the search path resolves `table-name` to,
from PostgreSQL's catalog: a unique index is not in information_schema.
sourceraw docstring

sqlite-table-exists?clj

(sqlite-table-exists? datasource table-name)
source

sqlite-table-infoclj

(sqlite-table-info datasource table-name)
source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close