H2 database helper functions.
H2 database helper functions.
(adjust! a-name update-fn)
Run given update-fn on a-name in connections. Advanced use.
Run given update-fn on a-name in connections. Advanced use.
(bulk-insert-mode! conn)
Set H2 into bulk insert mode recommended in docs.
Set H2 into bulk insert mode recommended in docs.
(columnlist? conn)
Are we being asked for columnlist spec?
This will return true if inside a function being used as stored procedure by H2 engine. It means that we are requested to return java.sql.ResultSet, like org.h2.tools.SimpleResultSet (for queries) or Java type mapped by H2 for functions.
Are we being asked for columnlist spec? This will return true if inside a function being used as stored procedure by H2 engine. It means that we are requested to return java.sql.ResultSet, like org.h2.tools.SimpleResultSet (for queries) or Java type mapped by H2 for functions.
(conn!)
(conn! a-name)
Select named connection or :default. Throws ex-info if no such connection.
Select named connection or :default. Throws ex-info if no such connection.
Database connection storage. Map of name: (delay conn)
Database connection storage. Map of name: (delay conn)
(copy! source target compression?)
(copy! source target dump-file compression?)
Will dump! source, raze! target, pump! target.
If dump-file not given uses temporary file and deletes it afterwards.
Will dump! source, raze! target, pump! target. If dump-file not given uses temporary file and deletes it afterwards.
(de-clob a-map)
(de-clob a-map touch-keys)
CLOB to String conversion in a-map returned from the database.
Warning: database connection must be open -- run in transaction.
CLOB to String conversion in a-map returned from the database. Warning: database connection must be open -- run in transaction.
(dispose!)
(dispose! a-name)
(dispose! a-name finalizer)
Remove named connection. Finalizer is a callable for side-effects.
Remove named connection. Finalizer is a callable for side-effects.
(dump! conn dump-file compression?)
Exports database into a SQL file (server side).
Exports database into a SQL file (server side).
(in-memory! path)
(in-memory! path a-name)
Create a database spec for in-memory, JVM runtime persistent database.
Create a database spec for in-memory, JVM runtime persistent database.
(local! path)
(local! path a-name)
Create a database spec for locally stored database.
Create a database spec for locally stored database.
(make! spec-or-pool)
(make! spec-or-pool a-name)
Create pool entry using given spec. Name defaults to :default.
If spec-or-pool is nil, then this pool is released from storage. Instead of that you should probably use dispose!
If spec-or-pool is a Delay, then it's stored directly and returned. Otherwise it's packed into a Delay, stored and returend.
Create pool entry using given spec. Name defaults to :default. If spec-or-pool is nil, then this pool is released from storage. Instead of that you should probably use dispose! If spec-or-pool is a Delay, then it's stored directly and returned. Otherwise it's packed into a Delay, stored and returend.
(pump! conn dump-file compression?)
Imports database from SQL file (server side).
Imports database from SQL file (server side).
(raze! conn)
Drops all objects and, if no connections are open, deletes database files.
Usually in embedded mode executing this removed the database files.
Drops all objects and, if no connections are open, deletes database files. Usually in embedded mode executing this removed the database files.
(retrieval-mode! conn)
Set H2 into settings closer to defaults (logging etc.).
Set H2 into settings closer to defaults (logging etc.).
(shutdown! conn)
Executes SHUTDOWN in connections.
Executes SHUTDOWN in connections.
(spec path)
(spec path opts)
Create H2 spec for given path (required argument).
Store depends on method parameter of opts:
Other opts are :user, :password, :server & :port. Self explanatory.
For split filesystem use :split? flag and (2 ** :part) bytes for size.
:flags should be a map of {String String}, like {COMPRESS TRUE}, it will overwrite flags set by default so YMMV.
All in-memory stores are opened with DB_CLOSE_DELAY=-1, which means they will be available until JVM shuts down. You can close them with SHUTDOWN command.
Create H2 spec for given path (required argument). Store depends on method parameter of opts: * :raw sets :subname to given path verbose (best of luck!) * :tcp uses server, port and path for :subname * :mem sets database to in-memory storage, JVM runtime persistent * :nio-mem-fs is the new in-memory storage, JVM runtime persistent * :nio-mem-lzf for new in-memory compressing storage, JVM runtime persistent * :raf sets database to embedded, RandomAccessFile local storage * :default or anything else means local embedded (nio) file storage. Other opts are :user, :password, :server & :port. Self explanatory. For split filesystem use :split? flag and (2 ** :part) bytes for size. :flags should be a map of {String String}, like {COMPRESS TRUE}, it will overwrite flags set by default so YMMV. All in-memory stores are opened with DB_CLOSE_DELAY=-1, which means they will be available until JVM shuts down. You can close them with SHUTDOWN command.
(spec->datasource a-spec)
Eats spec, returns {:datasource org.h2.jdbcx.JdbcDataSource}.
Requires :subname, :user and :password.
Eats spec, returns {:datasource org.h2.jdbcx.JdbcDataSource}. Requires :subname, :user and :password.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close