![]() |
C Driver API 3.0.0
API for the NuoDB C Driver Library
|
NuoDB Database Connection. More...
#include <connection.h>
Data Fields | |
_NuoDB_Connection_state_t * | _state |
NuoDB_Status(* | commit )(NuoDB_Connection *connection) |
Commit any outstanding SQL statements. | |
char *(* | convertUtf8ToLocal )(NuoDB_Connection *connection, const char *s, size_t sLen) |
Convert the given, presumably UTF-8 string, to the local encoding using the NuoDB_Connection's active encoding. | |
const char *(* | getActiveEncoding )(NuoDB_Connection *connection) |
Return the name of the active encoding for this NuoDB_connection which may not be the same as the default encoding for this NuoDB_Connection. | |
NuoDB_Status(* | getAutoCommit )(NuoDB_Connection *connection, nuodb_bool_t *autoCommit) |
Determine if the NuoDB_Connection has the auto-commit flag set. | |
const char *(* | getConnectionURL )(NuoDB_Connection *connection) |
Returns the connection URL string. | |
int(* | getConnectionVersion )(NuoDB_Connection *connection) |
Returns the connection version. | |
const char *(* | getDefaultEncoding )(NuoDB_Connection *connection) |
Return the name of the default encoding for this NuoDB_Connection. | |
NuoDB_EngineHandle *(* | getEngineHandle )(NuoDB_Connection *connection) |
Get a handle to the NuoDB Engine. | |
NuoDB_DatabaseMetaData *(* | getMetaData )(NuoDB_Connection *connection) |
Retrieve metadata for the database associated to this NuoDB_Connection. | |
NuoDB_Status(* | getNextSequenceValue )(NuoDB_Connection *connection, const char *schema, const char *sequenceName, int64_t *sequence) |
Returns next sequence value. | |
int(* | getProtocolVersion )(NuoDB_Connection *connection) |
NuoDB_Status(* | getSchema )(NuoDB_Connection *connection, char **schemaName, size_t *length) |
Retrieves this connection's current schema name. | |
NuoDB_Status(* | getTransactionIsolation )(NuoDB_Connection *connection, NuoDB_TransactionIsolationLevel *isolationLevel) |
Retrieves this NuoDB_Connection data structure's current transaction isolation level. | |
nuodb_bool_t(* | isConnected )(NuoDB_Connection *connection) |
Determine if the client has a valid connection to a NuoDB TE. | |
nuodb_bool_t(* | isReadOnly )(NuoDB_Connection *connection) |
Retrieves whether this NuoDB_Connection data structure is in read-only mode. | |
nuodb_bool_t(* | isUtf8 )(NuoDB_Connection *connection) |
Retrieves whether this NuoDB_Connection data structure is using UTF-8 strings. | |
NuoDB_Status(* | openDatabase )(NuoDB_Connection *connection, const char *dbname, const char *user, const char *password, NuoDB_Options *options) |
Open a database. | |
NuoDB_Status(* | openDatabaseEngine )(NuoDB_Connection *connection, void *nuoEngine, const char *user, const char *password, NuoDB_Options *options) |
Open a database with an NuoEngine. | |
NuoDB_Status(* | ping )(NuoDB_Connection *connection) |
Send a ping message to the server. | |
NuoDB_Status(* | rollback )(NuoDB_Connection *connection) |
Roll back any outstanding SQL statements. | |
NuoDB_Status(* | setAutoCommit )(NuoDB_Connection *connection, nuodb_bool_t autoCommit) |
Specify if statements related to this NuoDB_Connection should be auto-committed. | |
NuoDB_Status(* | setConverter )(NuoDB_Connection *connection, const char *encoding) |
Specify a non-default encoding for this client NuoDB_Connection. | |
NuoDB_Status(* | setDefaultConverter )(NuoDB_Connection *connection, const char *encoding) |
Specify a non-default encoding for this client NuoDB_Connection and set it as the default for the connection. | |
NuoDB_Status(* | setReadOnly )(NuoDB_Connection *connection, nuodb_bool_t readOnly) |
Puts this NuoDB_Connection in read-only mode as a hint to enable database optimizations. | |
NuoDB_Status(* | setTransactionIsolation )(NuoDB_Connection *connection, NuoDB_TransactionIsolationLevel level) |
Change the transaction isolation level for this NuoDB_Connection data structure to the one specified. | |
NuoDB Database Connection.
NuoDB_Connection is a data structure that represents a connection to a NuoDB Database. Clients should call the NuoDB_Connection_create() function to create this data structure and then call the openDatabase() function to open a connection to a NuoDB database. Clients should call the NuoDB_Connection_free() function to release the NuoDB_Connection when the client application no longer needs the connection.
NuoDB_Status(* NuoDB_Connection::commit) (NuoDB_Connection *connection) |
Commit any outstanding SQL statements.
Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by this NuoDB_Connection data structure. This function should be used only when auto-commit mode has been disabled.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
char *(* NuoDB_Connection::convertUtf8ToLocal) (NuoDB_Connection *connection, const char *s, size_t sLen) |
Convert the given, presumably UTF-8 string, to the local encoding using the NuoDB_Connection's active encoding.
See: NuoDB_Connection::getActiveEncoding().
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[in] | s | a pointer to the string. |
[in] | sLen | length of the string. |
const char *(* NuoDB_Connection::getActiveEncoding) (NuoDB_Connection *connection) |
Return the name of the active encoding for this NuoDB_connection which may not be the same as the default encoding for this NuoDB_Connection.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
NuoDB_Status(* NuoDB_Connection::getAutoCommit) (NuoDB_Connection *connection, nuodb_bool_t *autoCommit) |
Determine if the NuoDB_Connection has the auto-commit flag set.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[out] | autoCommit | pointer to nuodb_bool_t to set auto-commit value. |
const char *(* NuoDB_Connection::getConnectionURL) (NuoDB_Connection *connection) |
Returns the connection URL string.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
int(* NuoDB_Connection::getConnectionVersion) (NuoDB_Connection *connection) |
Returns the connection version.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
const char *(* NuoDB_Connection::getDefaultEncoding) (NuoDB_Connection *connection) |
Return the name of the default encoding for this NuoDB_Connection.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
NuoDB_EngineHandle *(* NuoDB_Connection::getEngineHandle) (NuoDB_Connection *connection) |
Get a handle to the NuoDB Engine.
Return the NuoDBEngine handle, or NULL if not available.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
NuoDB_DatabaseMetaData *(* NuoDB_Connection::getMetaData) (NuoDB_Connection *connection) |
Retrieve metadata for the database associated to this NuoDB_Connection.
The metadata includes information about the database's tables, its supported SQL grammar, its stored procedures, the capabilities of this NuoDB_Connection, and so on.
The NuoDB_Connection functions manage the memory allocated in the DatabaseMetaData data structure and the caller does not have to do so.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
NuoDB_Status(* NuoDB_Connection::getNextSequenceValue) (NuoDB_Connection *connection, const char *schema, const char *sequenceName, int64_t *sequence) |
Returns next sequence value.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[in] | schema | a pointer to a char for database schema |
[in] | sequenceName | a pointer to a char for sequence name |
[out] | sequence | a pointer to a int64_t for retrieved sequence value |
NuoDB_Status(* NuoDB_Connection::getSchema) (NuoDB_Connection *connection, char **schemaName, size_t *length) |
Retrieves this connection's current schema name.
[in] | connection | a pointer to the connection to get the current schema for |
[out] | schemaName | on return contains the schema name |
[out] | length | on return contains the length (in bytes) of the schema name |
NuoDB_Status(* NuoDB_Connection::getTransactionIsolation) (NuoDB_Connection *connection, NuoDB_TransactionIsolationLevel *isolationLevel) |
Retrieves this NuoDB_Connection data structure's current transaction isolation level.
The transction isolation level will be one of:
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[out] | isolationLevel | a pointer to a NuoDB_TransactionIsolationLevel. |
nuodb_bool_t(* NuoDB_Connection::isConnected) (NuoDB_Connection *connection) |
Determine if the client has a valid connection to a NuoDB TE.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
nuodb_bool_t(* NuoDB_Connection::isReadOnly) (NuoDB_Connection *connection) |
Retrieves whether this NuoDB_Connection data structure is in read-only mode.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
nuodb_bool_t(* NuoDB_Connection::isUtf8) (NuoDB_Connection *connection) |
Retrieves whether this NuoDB_Connection data structure is using UTF-8 strings.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
NuoDB_Status(* NuoDB_Connection::openDatabase) (NuoDB_Connection *connection, const char *dbname, const char *user, const char *password, NuoDB_Options *options) |
Open a database.
Given an already existing NuoDB_Connection data structure, clients must call this function to open a database.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[in] | dbname | a pointer to a const char string representing the database name. |
[in] | user | a pointer to a const char string that contains the database username. |
[in] | password | a pointer to a const char string that contains the database password. |
[in] | options | a pointer to optional NuoDB_Options. If no specific options are needed, the caller can pass a NULL. |
NuoDB_Status(* NuoDB_Connection::openDatabaseEngine) (NuoDB_Connection *connection, void *nuoEngine, const char *user, const char *password, NuoDB_Options *options) |
Open a database with an NuoEngine.
Given an already existing NuoDB_Connection data structure, clients may call this to open a database.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[in] | nuoEngine | a pointer to an NuoEngine. |
[in] | user | a pointer to a const char string that contains the database username. |
[in] | password | a pointer to a const char string that contains the database password. |
[in] | options | a pointer to optional NuoDB_Options. If no specific options are needed, the caller can pass a NULL. |
NuoDB_Status(* NuoDB_Connection::ping) (NuoDB_Connection *connection) |
Send a ping message to the server.
If no error occurs, the server is alive.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
NuoDB_Status(* NuoDB_Connection::rollback) (NuoDB_Connection *connection) |
Roll back any outstanding SQL statements.
Undoes all changes made in the current transaction and releases any database locks currently held by this NuoDB_Connection data structure. This function should be used only when auto-commit mode has been disabled.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
NuoDB_Status(* NuoDB_Connection::setAutoCommit) (NuoDB_Connection *connection, nuodb_bool_t autoCommit) |
Specify if statements related to this NuoDB_Connection should be auto-committed.
If a NuoDB_Connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either the function commit() or the function rollback(). By default, new NuoDB_Connections are in auto-commit mode.
[in] | autoCommit | If true, set autoCommit on and if false, turn autoCommit off |
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
NuoDB_Status(* NuoDB_Connection::setConverter) (NuoDB_Connection *connection, const char *encoding) |
Specify a non-default encoding for this client NuoDB_Connection.
NuoDB uses ICU (International Components for Unicode) for converting strings from the local client environment to UTF-8. NuoDB Transaction Engines require all strings to be UTF-8. setConverter() allows you to specify a non-default character set table (encoding) that is being used by the client. This may have options appended to the string. IANA alias character set names, IBM CCSIDs starting with "ibm-", Windows codepage numbers starting with "windows-" are frequently ' used for this parameter. See ICU ucnv_open() for more information.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[in] | encoding | ICU name of a non-default character set table. If this parameter is NULL, the default converter will be used. |
NuoDB_Status(* NuoDB_Connection::setDefaultConverter) (NuoDB_Connection *connection, const char *encoding) |
Specify a non-default encoding for this client NuoDB_Connection and set it as the default for the connection.
NuoDB uses ICU (International Components for Unicode) for converting strings from the local client environment to UTF-8. NuoDB Transaction Engines require all strings to be UTF-8. setDefaultConverter() allows you to specify a non-default character set table (encoding) that is being used by the client. This may have options appended to the string. IANA alias character set names, IBM CCSIDs starting with "ibm-", Windows codepage numbers starting with "windows-" are frequently used for this parameter. See ICU ucnv_open() for more information.
setDefaultConverter() will set the NuoDB_Connections default converter to that for the given encoding. Future calls to getDefaultEncoding() will return this new default encoding.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[in] | encoding | ICU name of a non-default character set table. If this parameter is NULL, the default converter will be used. |
NuoDB_Status(* NuoDB_Connection::setReadOnly) (NuoDB_Connection *connection, nuodb_bool_t readOnly) |
Puts this NuoDB_Connection in read-only mode as a hint to enable database optimizations.
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |
[in] | readOnly | a boolean that indicates the read-only mode. |
NuoDB_Status(* NuoDB_Connection::setTransactionIsolation) (NuoDB_Connection *connection, NuoDB_TransactionIsolationLevel level) |
Change the transaction isolation level for this NuoDB_Connection data structure to the one specified.
Valid transaction isolation levels are:
[in] | connection | a pointer to the current (this) NuoDB_Connection data structure. |