z_db_pool (zotonic_core v1.0.0-rc.10)

Database pool wrapper

Link to this section Summary

Functions

Optionally add the db pool connection
Merge the database options from the global config into the site config. If the site uses the default database and it has no schema defined then the site's name is used as the schema name. If the site uses its own database then the schema defaults to "public".
Get all configuration options for this site which are related to the database configuration.
Perform a connect to test if the database is working.

Link to this section Functions

Link to this function

child_spec(Site, SiteProps)

Optionally add the db pool connection
Link to this function

close_connections()

Link to this function

close_connections(Context)

Link to this function

database_options(Sitename, SiteProps)

-spec database_options(atom(), proplists:proplist()) -> proplists:proplist().
Merge the database options from the global config into the site config. If the site uses the default database and it has no schema defined then the site's name is used as the schema name. If the site uses its own database then the schema defaults to "public".
Link to this function

database_options(Sitename, SiteProps, GlobalProps)

-spec database_options(atom(), proplists:proplist(), proplists:proplist()) -> proplists:proplist().
Link to this function

db_driver(SiteProps)

Link to this function

db_driver_default()

Link to this function

db_pool_name(Site)

Link to this function

get_connection(Context)

-spec get_connection(z:context()) -> {ok, pid()} | {error, full | nodatabase}.
Link to this function

get_database_options(Context)

-spec get_database_options(z:context()) -> proplists:proplist().
Get all configuration options for this site which are related to the database configuration.
Link to this function

return_connection(Worker, Context)

-spec return_connection(pid(), z:context()) -> ok | {error, term()}.
Link to this function

status(Context)

Link to this function

test_connection(Context)

-spec test_connection(z:context()) -> ok | {error, nodatabase | noschema | term()}.
Link to this function

test_connection(Site, SiteProps)

-spec test_connection(atom(), proplists:proplist()) -> ok | {error, nodatabase | noschema | term()}.
Perform a connect to test if the database is working.