C Driver API 3.0.0
API for the NuoDB C Driver Library
Loading...
Searching...
No Matches
connection.h File Reference

NuoDB Database Connection. More...

#include "nuodb/utils.h"
#include "nuodb/structs.h"
#include "nuodb/error.h"

Go to the source code of this file.

Data Structures

struct  NuoDB_Connection
 NuoDB Database Connection. More...
 

Typedefs

typedef enum NuoDB_TransactionIsolationLevel_enum NuoDB_TransactionIsolationLevel
 NuoDB Transaction Isolation Levels.
 

Enumerations

enum  NuoDB_TransactionIsolationLevel_enum {
  NUODB_TXN_ISOLATION_READ_COMMITTED = 2 ,
  NUODB_TXN_ISOLATION_WRITE_COMMITTED = 5 ,
  NUODB_TXN_ISOLATION_CONSISTENT_READ = 7 ,
  NUODB_TXN_ISOLATION_SERIALIZABLE = 8
}
 NuoDB Transaction Isolation Levels Enum. More...
 

Functions

NUODB_CAPI NuoDB_Connection *NUODB_CAPICALL NuoDB_Connection_create ()
 Create a NuoDB_Connection to the NuoDB database.
 
NUODB_CAPI NuoDB_Connection *NUODB_CAPICALL NuoDB_Connection_createUtf8 ()
 Create a NuoDB_Connection to the NuoDB database with UTF-8 string encoding.
 
NUODB_CAPI void NUODB_CAPICALL NuoDB_Connection_free (NuoDB_Connection *connection)
 Frees the connection to the database.
 
NUODB_CAPI void NUODB_CAPICALL NuoDB_Connection_freeLocal (const char *localBuffer)
 Frees the buffer returned from convertUtf8ToLocal()
 
NUODB_CAPI const char *NUODB_CAPICALL NuoDB_getDriverVersion (unsigned int *majorVersion, unsigned int *minorVersion)
 Return information about the driver version.
 

Detailed Description

NuoDB Database Connection.

Enumeration Type Documentation

◆ NuoDB_TransactionIsolationLevel_enum

NuoDB Transaction Isolation Levels Enum.

Enumerator
NUODB_TXN_ISOLATION_READ_COMMITTED 

Read Committed.

Each transaction always reads the most recently committed version of a record. See Transactions and Isolation Levels for more information.

NUODB_TXN_ISOLATION_WRITE_COMMITTED 

Write Committed.

For read operations, each transaction sees the state of the database as it was when the transaction started, plus its own changes, similar to CONSISTENT_READ. For write operations, including SELECT...FOR UPDATE, UPDATE and DELETE), each transaction reads the most recently committed version of a record, similar to READ_COMMITTED. See Transactions and Isolation Levels for more information.

NUODB_TXN_ISOLATION_CONSISTENT_READ 

Consistent Read.

This is the default NuoDB transaction isolation level. Each transaction sees a snapshot of the database as of the start of the transaction, plus changes made by that transaction only. See Transactions and Isolation Levels for more information.

NUODB_TXN_ISOLATION_SERIALIZABLE 

Serializable.

This is kept for backward compatibility and will also cause the same behavior as CONSISTENT_READ which is the default NuoDB transaction isolation level. Each transaction sees a snapshot of the database as of the start of the transaction, plus changes made by that transaction only. See Transactions and Isolation Levels for more information.

Function Documentation

◆ NuoDB_Connection_create()

NUODB_CAPI NuoDB_Connection *NUODB_CAPICALL NuoDB_Connection_create ( )

Create a NuoDB_Connection to the NuoDB database.

In order to perform operations on a NuoDB database, you need to create a NuoDB_Connection by calling NuoDB_Connection_create(), and then call the NuoDB_Connection::openDatabase() function to establish a connection to the specified database.

When clients are finished with the database connection, they should call NuoDB_Connection_free() to release the resources held by the NuoDB_Connection.

Returns
a pointer to a NuoDB_Connection data structure or NULL if there was any error.

◆ NuoDB_Connection_createUtf8()

NUODB_CAPI NuoDB_Connection *NUODB_CAPICALL NuoDB_Connection_createUtf8 ( )

Create a NuoDB_Connection to the NuoDB database with UTF-8 string encoding.

This overloading will assumes strings being passed from the client to the NuoDB TE will be UTF-8 despite the encoding set in the user's local environment.

Returns
a pointer to a NuoDB_Connection data structure or NULL if there was any error.

◆ NuoDB_Connection_free()

NUODB_CAPI void NUODB_CAPICALL NuoDB_Connection_free ( NuoDB_Connection * connection)

Frees the connection to the database.

Clients should call NuoDB_Connection_free() on the NuoDB_Connection data structure when the client is finished with the specified NuoDB_Connection.

Parameters
[in]connectiona pointer to the current (this) NuoDB_Connection data structure.

◆ NuoDB_Connection_freeLocal()

NUODB_CAPI void NUODB_CAPICALL NuoDB_Connection_freeLocal ( const char * localBuffer)

Frees the buffer returned from convertUtf8ToLocal()

Parameters
[in]localBuffera pointer returned from convertUtf8ToLocal()

◆ NuoDB_getDriverVersion()

NUODB_CAPI const char *NUODB_CAPICALL NuoDB_getDriverVersion ( unsigned int * majorVersion,
unsigned int * minorVersion )

Return information about the driver version.

Parameters
[out]majorVersionfilled in with the driver's major version (or NULL)
[out]minorVersionfilled in with the driver's minor version (or NULL)
Returns
a pointer to the driver product version string.