Liking cljdoc? Tell your friends :D

ndevreeze.flexdb


*DEBUG*clj

source

alter-tableclj

(alter-table db-handle table columns)

Alter table, add column(s) table - keyword or string columns - vector of :keyword, string, vector (name, type) or map (:name, :type) Create table iff not exists. Return - void.

Alter table, add column(s)
table - keyword or string
columns - vector of :keyword, string, vector (name, type) or map (:name, :type)
Create table iff not exists.
Return - void.
sourceraw docstring

close-dbclj

(close-db db-handle)

Close a DB handle (SQLiteConnection or Postgres for now, could be changed) Could contain prepared statements and meta-data in the future

Close a DB handle (SQLiteConnection or Postgres for now, could be changed)
Could contain prepared statements and meta-data in the future
sourceraw docstring

column-exists?clj

(column-exists? db-handle table column)

Return true iff columns exists in table within db. table - keyword or string column - keyword or string

Return true iff columns exists in table within db.
table - keyword or string
column - keyword or string
sourceraw docstring

column-meta-dataclj

(column-meta-data db-handle table)

Return seq of column meta data, for table in db

Return seq of column meta data, for table in db
sourceraw docstring

column-nameclj

(column-name column)

Return column-name as keyword for column column - either a string/keyword (then default datatype: string), or seq-of [:name :type] return vector with name and type. Used for internal map with new tables/columns within transaction.

Return column-name as keyword for column
column - either a string/keyword (then default datatype: string),
        or seq-of [:name :type]
return vector with name and type.
Used for internal map with new tables/columns within transaction.
sourceraw docstring

column-with-datatypeclj

(column-with-datatype db-spec record column-name)

Determine SQL datatype of column within record. Return seq of columnname and SQL-datatype. datatype could be more than one :keyword

Determine SQL datatype of column within record.
Return seq of columnname and SQL-datatype.
datatype could be more than one :keyword
sourceraw docstring

columnsclj

(columns db-handle table)

Return set of column names (as keywords) in table in database table can be a string or keyword. Look in both DB metadata (with query) as well as newly added tables/columns (in cache)

Return set of column names (as keywords) in table in database
table can be a string or keyword.
Look in both DB metadata (with query) as well as newly added tables/columns (in cache)
sourceraw docstring

create-tableclj

(create-table db-handle table columns)

Create a table table: :keyword or string columns: vector of: :keyword, string, vector (name, type) or map (:name, :type). always include a generated 'id' column. return - void.

Create a table
table: :keyword or string
columns: vector of: :keyword, string, vector (name, type) or map (:name, :type).
always include a generated 'id' column.
return - void.
sourceraw docstring

current-connectionclj

(current-connection db-handle)

Return current connection/transaction handle, or the db-spec if none exists. Use for working within transactions.

Return current connection/transaction handle, or the db-spec if none exists.
Use for working within transactions.
sourceraw docstring

db-class-mapclj

Mapping of java-class to conversion function wrt sql types JSR310 LocalDate and LocalDateTime are supported, no need for conversion.

Mapping of java-class to conversion function wrt sql types
JSR310 LocalDate and LocalDateTime are supported, no need for conversion.
sourceraw docstring

db-valueclj

(db-value val)

Convert a value to a type understood by jdbc/sql. Can also be some JSR 310 types

Convert a value to a type understood by jdbc/sql.
Can also be some JSR 310 types
sourceraw docstring

db-valuesclj

(db-values record)

Convert values in record/map to SQL types

Convert values in record/map to SQL types
sourceraw docstring

dquotedclj

(dquoted par)

Convert par to a string and surround it with double quotes. With respect to bracketed table and column names for reserved words. This seems to work both in SQLite and Postgres (Postgres does not like brackets)

Convert par to a string and surround it with double quotes.
With respect to bracketed table and column names for reserved words.
This seems to work both in SQLite and Postgres (Postgres does not like brackets)
sourceraw docstring

dquoted-recordclj

(dquoted-record record)

Convert keys in record/map to string and surround with double quotes. Wrt using reserved words in the table. Maybe only do this for the list of 145 (SQlite) reserved words

Convert keys in record/map to string and surround with double quotes.
Wrt using reserved words in the table.
Maybe only do this for the list of 145 (SQlite) reserved words
sourceraw docstring

execclj

(exec db-handle sql)
(exec db-handle sql params)

Execute a DDL/DML query. Also handle optional params-sequence given.

Execute a DDL/DML query.
Also handle optional params-sequence given.
sourceraw docstring

get-first-idclj

(get-first-id db-handle res)

Return created id of first row of result-set. This is different for SQLite and Postgres

Return created id of first row of result-set.
This is different for SQLite and Postgres
sourceraw docstring

id-specclj

(id-spec handle)

Generate id-column spec for database type, given db handle

Generate id-column spec for database type, given db handle
sourceraw docstring

in-transactioncljmacro

(in-transaction handle & body)

Run nested expressions in a transaction based on handle. Works in conjunction with set-transaction and current-transaction. Returns result of last expression

Run nested expressions in a transaction based on handle.
Works in conjunction with set-transaction and current-transaction.
Returns result of last expression
sourceraw docstring

in-transaction?clj

(in-transaction? db-handle)

Return true if handle is currently within a transaction

Return true if handle is currently within a transaction
sourceraw docstring

insertclj

(insert db-handle table record)

Insert record into table, adding table/columns if needed. Default/pessimistic version: first check if table and columns exist and create/alter table where needed; then insert record. Also call db-values on record.

Insert record into table, adding table/columns if needed.
Default/pessimistic version: first check if table and columns exist and create/alter
table where needed; then insert record.
Also call db-values on record.
sourceraw docstring

insert-no-checkclj

(insert-no-check db-handle table record)

Insert record into table, no checks if table/columns exist. Return generated id.

Insert record into table, no checks if table/columns exist.
Return generated id.
sourceraw docstring

insert-optclj

(insert-opt db-handle table record)

Insert record into table, adding table/columns if needed. Optimistic version: first try to insert; if fails, add table/column(s) and try again. This version might be faster, need some tests.

Insert record into table, adding table/columns if needed.
Optimistic version: first try to insert; if fails, add table/column(s) and try again.
This version might be faster, need some tests.
sourceraw docstring

log!clj

(log! arg)
(log! msg arg)

Log argument to stdout and return it

Log argument to stdout and return it
sourceraw docstring

map-kvclj

(map-kv f coll)

Apply f to very val in coll, return result

Apply f to very val in coll, return result
sourceraw docstring

map-kv-keyclj

(map-kv-key f coll)

Apply f to every key in coll, return result

Apply f to every key in coll, return result
sourceraw docstring

new-columnsclj

(new-columns db-spec cols record)

Determine new columns (including types) for table based on record. cols - the current columns of table (seq of keywords) record - the hashmap with needed columns of table (columns als keywords) return - seq of new columns

Determine new columns (including types) for table based on record.
cols - the current columns of table (seq of keywords)
record - the hashmap with needed columns of table (columns als keywords)
return - seq of new columns
sourceraw docstring

open-dbclj

Deprecated, use open-db-sqlite

Deprecated, use open-db-sqlite
sourceraw docstring

open-db-specclj

(open-db-spec db-spec)

Open DB connection given a spec, could be SQLite or Postgresql, maybe others

Open DB connection given a spec, could be SQLite or Postgresql, maybe others
sourceraw docstring

open-db-sqliteclj

(open-db-sqlite db-name)

Open SQLite DB and return handle (SQLiteConnection for now, could be changed. Return connection both directly in map as within returned db-spec within map. db-name - path to DB, existing or new, as string

Open SQLite DB and return handle (SQLiteConnection for now, could be changed.
Return connection both directly in map as within returned db-spec within map.
db-name - path to DB, existing or new, as string
sourceraw docstring

queryclj

(query db-handle sql)
(query db-handle sql params)

Perform a SQL (select) query, return sequence of maps. Also handle optional params-sequence given.

Perform a SQL (select) query, return sequence of maps.
Also handle optional params-sequence given.
sourceraw docstring

set-init-functionclj

(set-init-function db-handle f)

Set a function to be executed on each new connection/transaction. Function should accept one parameter, the db handle.

Set a function to be executed on each new connection/transaction.
Function should accept one parameter, the db handle.
sourceraw docstring

set-transactionclj

(set-transaction db-handle t-con)

Mark transaction handle given by with-db-transaction in this handle. Also exec init-function on this transaction iff it is set. Keep list of new tables/columns created in this transaction. Also call :init-function when given (eg. for percentile function). Fail if transaction already started

Mark transaction handle given by with-db-transaction in this handle.
Also exec init-function on this transaction iff it is set.
Keep list of new tables/columns created in this transaction.
Also call :init-function when given (eg. for percentile function).
Fail if transaction already started
sourceraw docstring

sql-db-typeclj

(sql-db-type db-spec value)

Determine sql type of a value For now only integer, float, string and date-time types for Postgres. Default to varchar if no match. sql-type dependent on db-spec, eg with date/time values. throws an exception if type cannot be determined. (maybe should return varchar in that case)

Determine sql type of a value
For now only integer, float, string and date-time types for Postgres.
Default to varchar if no match.
sql-type dependent on db-spec, eg with date/time values.
throws an exception if type cannot be determined.
(maybe should return varchar in that case)
sourceraw docstring

sql-db-typesclj

SQL types for combinations of database and Clojure/Java values Includes defaults per datatype and also per database type.

SQL types for combinations of database and Clojure/Java values
Includes defaults per datatype and also per database type.
sourceraw docstring

surround-bracketsclj

(surround-brackets par)

Convert par to a string and surround it with brackets. Wrt bracketed table and column names for reserved words

Convert par to a string and surround it with brackets.
Wrt bracketed table and column names for reserved words
sourceraw docstring

table-exists?clj

(table-exists? db-handle table)

Given db-handle and table, returns true iff table exists within DB, false otherwise. Table can be keyword or string.

Given db-handle and table, returns true iff table exists within DB, false otherwise.
Table can be keyword or string.
sourceraw docstring

table-meta-dataclj

(table-meta-data db-handle)

Return seq of table meta data, but for now without column info

Return seq of table meta data, but for now without column info
sourceraw docstring

tablesclj

(tables db-handle)

Return sequence of table names (as keywords) in database.

Return sequence of table names (as keywords) in database.
sourceraw docstring

unset-transactionclj

(unset-transaction db-handle)

Unmark transaction handle given by with-db-transaction in this handle. Reset new columns/tables, should be available als meta-data after commit. Fail if no transaction started

Unmark transaction handle given by with-db-transaction in this handle.
Reset new columns/tables, should be available als meta-data after commit.
Fail if no transaction started
sourceraw docstring

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