#include <airdbc/drv_pg.h>
#include <airdbc/drv_oci.h>
Go to the source code of this file.
Defines | |
| #define | ADB_ERROR_DOMAIN g_quark_from_string("AirDBCError") |
| All AirDBC errors are returned within the ADB_ERROR_DOMAIN. | |
| #define | ADB_ERROR_RDBMS 1 |
| An underlying parse or execution error from the driver. | |
| #define | ADB_ERROR_CONNECT 2 |
| A connection error. | |
| #define | ADB_ERROR_ARGUMENT 3 |
| An argument passed to an AirDBC call had a bad format or value. | |
| #define | ADB_ERROR_RANGE 4 |
| An argument passed to an AirDBC call was out of range. | |
Typedefs | |
| typedef _AdbConnection | AdbConnection |
| An AirDBC connection. | |
| typedef _AdbStatement | AdbStatement |
| An AirDBC prepared statement. | |
| typedef _AdbResultSet | AdbResultSet |
| An AirDBC result set. | |
Functions | |
| AdbConnection * | adb_conn_create (const char *uri, GError **err) |
| Create a new, unopened AdbConnection. | |
| gboolean | adb_conn_open (AdbConnection *conn, GError **err) |
| Ensure that an AdbConnection is open. | |
| gboolean | adb_conn_close (AdbConnection *conn, GError **err) |
| Ensure that an AdbConnection is closed. | |
| gboolean | adb_conn_is_open (AdbConnection *conn) |
| Determine the state of a connection. | |
| void | adb_conn_free (AdbConnection *conn) |
| Destroy an AdbConnection, and free all storage associated with it. | |
| gboolean | adb_transaction_begin (AdbConnection *conn, GError **err) |
| Begin a transaction on a given AdbConnection. | |
| gboolean | adb_transaction_commit (AdbConnection *conn, GError **err) |
| Commit the current transaction on a given AdbConnection. | |
| gboolean | adb_transaction_rollback (AdbConnection *conn, GError **err) |
| Roll back the current transaction on a given AdbConnection. | |
| AdbStatement * | adb_stmt_prepare (AdbConnection *conn, char *sql, uint32_t param_maxlen, GError **err) |
| Prepare a statement for binding an execution on a given AdbConnection. | |
| void | adb_stmt_free (AdbStatement *stmt) |
| Destroy an AdbStatement, and free all storage associated with it. | |
| gboolean | adb_stmt_bind (AdbStatement *stmt, uint32_t pos, const char *val, GError **err) |
| Bind a parameter value to a given AdbStatement by parameter position. | |
| gboolean | adb_stmt_bind_named (AdbStatement *stmt, const char *name, const char *val, GError **err) |
| Bind a parameter value to a given AdbStatement by parameter name. | |
| gboolean | adb_stmt_execute (AdbStatement *stmt, GError **err) |
| Execute an AdbStatement that does not return an AdbResultSet. | |
| AdbResultSet * | adb_stmt_query (AdbStatement *stmt, GError **err) |
| Execute an AdbStatement that returns an AdbResultSet. | |
| void | adb_rs_free (AdbResultSet *rs) |
| Destroy an AdbResultSet, and free all storage associated with it. | |
| gboolean | adb_rs_next (AdbResultSet *rs, GError **err) |
| Advance a given AdbResultSet's cursor to the next row. | |
| uint32_t | adb_rs_column_count (AdbResultSet *rs, GError **err) |
| Return the number of columns in a given AdbResultSet. | |
| char * | adb_rs_column_name (AdbResultSet *rs, uint32_t col, GError **err) |
| Return the name of a given column in an AdbResultSet. | |
| gboolean | adb_rs_fetch (AdbResultSet *rs, uint32_t col, const char **val, GError **err) |
| Fetch a value from a given column of the current row of an AdbResultSet. | |
| gboolean | adb_rs_fetch_named (AdbResultSet *rs, const char *name, const char **val, GError **err) |
| Fetch a value from a named column of the current row of an AdbResultSet. | |
This file provides the client interface for AirDBC applications.
|
|
A connection error. The AdbConnection is closed. |
|
|
An AirDBC connection. Encapsulates a single restartable connection to a single RDBMS instance. Created by adb_conn_create(), and destroyed by adb_conn_free(). AdbConnections are created in disconnected state; adb_conn_open will open the connection. An AdbConnection may be closed by adb_conn_close(), or automatically if the underlying driver detects disconnection. |
|
|
An AirDBC result set. Encapsulates a single result set returned by the execution of an AdbStatement. Created by adb_stmt_query(), and destroyed by adb_rs_free().Some drivers may require that each statement have at most one active AdbResultSet. |
|
|
An AirDBC prepared statement. Encapsulates a single parameterized SQL statement, designed to be used multiple times. Each AdbStatement is scoped to an AdbConnection, which must be open when the statement is created with adb_stmt_prepare(). Statements are destroyed by adb_stmt_free(). |
|
||||||||||||
|
Ensure that an AdbConnection is closed. Closes the connection if it is open; otherwise, does nothing.
|
|
||||||||||||
|
Create a new, unopened AdbConnection. Connects to a database specified by a URI of the following format: driver://username:password@host:port/dbname/additional where username, password, port, and additional are optional. Supported drivers are "postgresql" (PostgreSQL 8.x+ via libpq 4.x) and "oci" (Oracle 9+ via Oracle Call Interface [libclntsh]). For postgresql URIs, port defaults to 5432. For oci URIs, host must always be localhost and port defaults to 0; because of the way Oracle Net Services works, all database connections are mediated by the local Oracle client software installation.
|
|
|
Destroy an AdbConnection, and free all storage associated with it. Ensure that all scoped AdbStatements and AdbResultSets have been freed before calling this. If the AdbConnection is open, closes the connection and ignores the result.
|
|
|
Determine the state of a connection.
|
|
||||||||||||
|
Ensure that an AdbConnection is open. Opens the connection if it is closed; otherwise, does nothing.
|
|
||||||||||||
|
Return the number of columns in a given AdbResultSet.
|
|
||||||||||||||||
|
Return the name of a given column in an AdbResultSet. The name's storage is managed by the AdbResultSet, and must be copied if intended to be used after the AdbResultSet is freed.
|
|
||||||||||||||||||||
|
Fetch a value from a given column of the current row of an AdbResultSet. Not valid on a newly executed query until adb_rs_next() has been called. The returned value's storage is managed by the AdbResultSet and scoped to the current row, and must be copied if intended to be used after the row cursor is advanced using adb_rs_next().
|
|
||||||||||||||||||||
|
Fetch a value from a named column of the current row of an AdbResultSet. Not valid on a newly executed query until adb_rs_next() has been called. The returned value's storage is managed by the AdbResultSet and scoped to the current row, and must be copied if intended to be used after the row cursor is advanced using adb_rs_next().
|
|
|
Destroy an AdbResultSet, and free all storage associated with it.
|
|
||||||||||||
|
Advance a given AdbResultSet's cursor to the next row. Must be called after a successful adb_stmt_query() to start fetching data. Returns FALSE and sets *err to NULL at the end of the result set. Designed to be called as follows:
rs = adb_stmt_query(stmt, &err); if (!rs) { ... handle adb_stmt_query() error ... } while (adb_rs_next(rs, &err) { ... fetch and process row ... } if (err) { ... handle adb_rs_next() error ... }
|
|
||||||||||||||||||||
|
Bind a parameter value to a given AdbStatement by parameter position. This parameter will copy the string value into the statement, so it is safe to free or reuse values between bind and execute.
|
|
||||||||||||||||||||
|
Bind a parameter value to a given AdbStatement by parameter name. This parameter will copy the string value into the statement, so it is safe to free or reuse values between bind and execute. If a given bind name appears multiple times in the statement, this will bind the given value to each such position.
|
|
||||||||||||
|
Execute an AdbStatement that does not return an AdbResultSet. This is intended for use with data manipulation or data definition statements, though it can be used for queries as well, to ignore the resulting result set.
|
|
|
Destroy an AdbStatement, and free all storage associated with it.
|
|
||||||||||||||||||||
|
Prepare a statement for binding an execution on a given AdbConnection. Bind parameters are specified using Oracle-style syntax (i.e., ":name") and translated into the driver's native positional bind parameter syntax. Since bind parameter buffers must be statically sized for some drivers (i.e., Oracle), bind parameter lengths are limited to a constant size given in param_maxlen. If param_maxlen is given as 0, the bind parameter buffer size defaults to 64 bytes per parameter.
|
|
||||||||||||
|
Execute an AdbStatement that returns an AdbResultSet. The result set's cursor will be positioned before the first row, so a call to adb_rs_next() is required before the first call to adb_rs_fetch(). Note that some drivers require only one AdbResultSet at once per AdbStatement to be active, so this call may fail if a previous AdbResultSet has not yet been freed.
|
|
||||||||||||
|
Begin a transaction on a given AdbConnection. If the connection fails or an error occurs before the transaction is committed, all changes within the transaction will be rolled back. Some drivers may not support nested transactions.
|
|
||||||||||||
|
Commit the current transaction on a given AdbConnection. Fails if no transaction is currently active.
|
|
||||||||||||
|
Roll back the current transaction on a given AdbConnection. Fails if no transaction is currently active.
|