Copyright © 2009 Marc Worrell Date: 2009-04-07
Authors: Marc Worrell (marc@worrell.nl).
assert_table_name/1 | Check if a name is a valid SQL table name. |
assoc/2 | Return property lists of the results of a query on the database in the Context. |
assoc/3 | |
assoc_props/2 | |
assoc_props/3 | |
assoc_props_row/2 | |
assoc_props_row/3 | |
assoc_row/2 | |
assoc_row/3 | |
column_names/2 | Return a list with the column names of a table. |
columns/2 | Return a property list with all columns of the table. |
delete/3 | Delete a row from a table, the row must have a column with the name 'id'. |
drop_table/2 | Make sure that a table is dropped, only when the table exists. |
ensure_table/3 | Ensure that a table with the given columns exists, alter any existing table to add, modify or drop columns. |
equery/2 | |
equery/3 | |
flush/1 | Flush all cached information about the database. |
get/2 | |
get_parameter/2 | |
has_connection/1 | Check if we have database connection. |
insert/2 | Insert a new row in a table, use only default values. |
insert/3 | Insert a row, setting the fields to the props. |
prepare_cols/2 | Check if all cols are valid columns in the target table, move unknown properties to the props column (if exists). |
q/2 | |
q/3 | |
q1/2 | |
q1/3 | |
q_row/2 | |
q_row/3 | |
select/3 | Read a row from a table, the row must have a column with the name 'id'. |
set/3 | Simple get/set functions for db property lists. |
table_exists/2 | Check the information schema if a certain table exists in the context database. |
transaction/2 | Perform a function inside a transaction, do a rollback on exceptions. |
transaction_clear/1 | Clear any transaction in the context, useful when starting a thread with this context. |
update/4 | Update a row in a table, merging the props list with any new props values. |
update_sequence/3 | Update the sequence of the ids in the table. |
assert_table_name(T::String) -> true
Check if a name is a valid SQL table name. Crashes when invalid
assoc(Sql::SqlQuery, Context) -> Rows
Return property lists of the results of a query on the database in the Context
assoc(Sql, Parameters, Context) -> any()
assoc_props(Sql, Context) -> any()
assoc_props(Sql, Parameters, Context) -> any()
assoc_props_row(Sql, Context) -> any()
assoc_props_row(Sql, Parameters, Context) -> any()
assoc_row(Sql, Context) -> any()
assoc_row(Sql, Parameters, Context) -> any()
column_names(Table, Context) -> [atom()]
Return a list with the column names of a table. The names are sorted.
columns(Table, Context) -> [#column_def{}]
Return a property list with all columns of the table. (example: [{id,int4,modifier},...])
delete(Table, Id, Context) -> {ok, RowsDeleted}
Delete a row from a table, the row must have a column with the name 'id'
drop_table(Name, Context) -> any()
Make sure that a table is dropped, only when the table exists
ensure_table(Table, Cols, Context) -> any()
Ensure that a table with the given columns exists, alter any existing table to add, modify or drop columns. The 'id' (with type serial) column _must_ be defined when creating the table.
equery(Sql, Context) -> any()
equery(Sql, Parameters, Context) -> any()
flush(Context) -> any()
Flush all cached information about the database.
get(Key, Props) -> any()
get_parameter(Parameter, Context) -> any()
has_connection(Context) -> any()
Check if we have database connection
insert(Table, Context) -> {ok, Id}
Insert a new row in a table, use only default values.
insert(Table::atom(), Props::proplist(), Context) -> {ok, Id} | Error
Insert a row, setting the fields to the props. Unknown columns are serialized in the props column. When the table has an 'id' column then the new id is returned.
prepare_cols(Cols, Props) -> any()
Check if all cols are valid columns in the target table, move unknown properties to the props column (if exists)
q(Sql, Context) -> any()
q(Sql, Parameters, Context) -> any()
q1(Sql, Context) -> any()
q1(Sql, Parameters, Context) -> any()
q_row(Sql, Context) -> any()
q_row(Sql, Args, Context) -> any()
select(Table, Id, Context) -> {ok, Row}
Read a row from a table, the row must have a column with the name 'id'. The props column contents is merged with the other properties returned.
set(Key, Props, Value) -> any()
Simple get/set functions for db property lists
table_exists(Table::TableName, Context) -> bool()
Check the information schema if a certain table exists in the context database.
transaction(Function, Context) -> FunctionResult | {error, Reason}
Perform a function inside a transaction, do a rollback on exceptions
transaction_clear(Context) -> any()
Clear any transaction in the context, useful when starting a thread with this context.
update(Table, Id, Parameters, Context) -> {ok, RowsUpdated}
Update a row in a table, merging the props list with any new props values
update_sequence(Table, Ids::IdList, Context) -> void()
Update the sequence of the ids in the table. They will be renumbered according to their position in the id list.
Generated by EDoc, Feb 25 2011, 21:14:40.