The dbi interface is designed for creating access to different SQL databases. It presents a generic api to open, query, and change databases.
arg .. usually consists of one or more of the following optional parameters:
sql contains the commands to be executed. When sql contains placeholders (indicated by ?), extra parameters must be given (param, that will be used to fill in the gaps. If an sql error occurs, all changes made in the current transaction will be rolled back. If no explicit has been explicitly started by the user using "objectName begin", this means all changes made in the current exec.
The following options can be present:
example:
db exec {select "value" from "test_table" where "id" = ?} 100
When calling exec again, the results are cleared, and cannot be fetched any longer using the fetch method. If you want to use the exec method while keeping the resultset available, use a clone (see further) of the dbi object.
If present, line is an an integer >= 0 indicating which line of the result to fetch. If line is "current", the current line will be fetched. Not all databases allow backward positioning in a result set, so not all objects that support the dbi interface will be able to fetch lines earlier than the current line. field is also an integer >= 0 indicating the field of the result to fetch.
If option is present, information about the result is returned instead of the result data itself. It can have any of the following values:
The following options can be present:
examples:
db fetch
db fetch isnull current 1
If possible, a clone also shares transactions with its parent. Since this is not always possible; You can check if it actually does this using "objectName supports sharedtransactions".
Peter De Rijk | hosted at |