libdrizzle Public API Documentation

Enumerations | Functions
Drizzle Declarations
Drizzle Client Interface | Drizzle Server Interface

Enumerations

enum  drizzle_options_t {
  DRIZZLE_NONE = 0, DRIZZLE_ALLOCATED = (1 << 0), DRIZZLE_NON_BLOCKING = (1 << 1), DRIZZLE_FREE_OBJECTS = (1 << 2),
  DRIZZLE_ASSERT_DANGLING = (1 << 3)
}

Functions

const char * drizzle_version (void)
const char * drizzle_bugreport (void)
const char * drizzle_verbose_name (drizzle_verbose_t verbose)
drizzle_stdrizzle_create (drizzle_st *drizzle)
drizzle_stdrizzle_clone (drizzle_st *drizzle, const drizzle_st *from)
void drizzle_free (drizzle_st *drizzle)
const char * drizzle_error (const drizzle_st *drizzle)
int drizzle_errno (const drizzle_st *drizzle)
uint16_t drizzle_error_code (const drizzle_st *drizzle)
const char * drizzle_sqlstate (const drizzle_st *drizzle)
drizzle_options_t drizzle_options (const drizzle_st *drizzle)
void drizzle_set_options (drizzle_st *drizzle, drizzle_options_t options)
void drizzle_add_options (drizzle_st *drizzle, drizzle_options_t options)
void drizzle_remove_options (drizzle_st *drizzle, drizzle_options_t options)
void * drizzle_context (const drizzle_st *drizzle)
void drizzle_set_context (drizzle_st *drizzle, void *context)
void drizzle_set_context_free_fn (drizzle_st *drizzle, drizzle_context_free_fn *function)
int drizzle_timeout (const drizzle_st *drizzle)
void drizzle_set_timeout (drizzle_st *drizzle, int timeout)
drizzle_verbose_t drizzle_verbose (const drizzle_st *drizzle)
void drizzle_set_verbose (drizzle_st *drizzle, drizzle_verbose_t verbose)
void drizzle_set_log_fn (drizzle_st *drizzle, drizzle_log_fn *function, void *context)
void drizzle_set_event_watch_fn (drizzle_st *drizzle, drizzle_event_watch_fn *function, void *context)
drizzle_con_stdrizzle_con_create (drizzle_st *drizzle, drizzle_con_st *con)
drizzle_con_stdrizzle_con_clone (drizzle_st *drizzle, drizzle_con_st *con, const drizzle_con_st *from)
void drizzle_con_free (drizzle_con_st *con)
void drizzle_con_free_all (drizzle_st *drizzle)
drizzle_return_t drizzle_con_wait (drizzle_st *drizzle)
drizzle_con_stdrizzle_con_ready (drizzle_st *drizzle)

Detailed Description

This is the core library structure that other structures (such as connections) are created from.

There is no locking within a single drizzle_st structure, so for threaded applications you must either ensure isolation in the application or use multiple drizzle_st structures (for example, one for each thread).


Enumeration Type Documentation

Options for drizzle_st.

Enumerator:
DRIZZLE_NONE 
DRIZZLE_ALLOCATED 
DRIZZLE_NON_BLOCKING 
DRIZZLE_FREE_OBJECTS 
DRIZZLE_ASSERT_DANGLING 

Definition at line 118 of file constants.h.


Function Documentation

const char* drizzle_version ( void  )

Get library version string.

Returns:
Pointer to static buffer in library that holds the version string.
const char* drizzle_bugreport ( void  )

Get bug report URL.

Returns:
Bug report URL string.
const char* drizzle_verbose_name ( drizzle_verbose_t  verbose)

Get string with the name of the given verbose level.

Parameters:
[in]verboseVerbose logging level.
Returns:
String form of verbose level.

Initialize a drizzle structure. Always check the return value even if passing in a pre-allocated structure. Some other initialization may have failed.

Parameters:
[in]drizzleCaller allocated structure, or NULL to allocate one.
Returns:
On success, a pointer to the (possibly allocated) structure. On failure this will be NULL.
drizzle_st* drizzle_clone ( drizzle_st drizzle,
const drizzle_st from 
)

Clone a drizzle structure.

Parameters:
[in]drizzleCaller allocated structure, or NULL to allocate one.
[in]fromDrizzle structure to use as a source to clone from.
Returns:
Same return as drizzle_create().
void drizzle_free ( drizzle_st drizzle)

Free a drizzle structure.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
const char* drizzle_error ( const drizzle_st drizzle)

Return an error string for last error encountered.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
Pointer to static buffer in library that holds an error string.
int drizzle_errno ( const drizzle_st drizzle)

Value of errno in the case of a DRIZZLE_RETURN_ERRNO return value.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
An errno value as defined in your system errno.h file.
uint16_t drizzle_error_code ( const drizzle_st drizzle)

Get server defined error code for the last result read.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
An error code given back in the server response.
const char* drizzle_sqlstate ( const drizzle_st drizzle)

Get SQL state code for the last result read.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
A SQLSTATE code given back in the server response.

Get options for a drizzle structure.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
Options set for the drizzle structure.
void drizzle_set_options ( drizzle_st drizzle,
drizzle_options_t  options 
)

Set options for a drizzle structure.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]optionsAvailable options for drizzle structure to set.
void drizzle_add_options ( drizzle_st drizzle,
drizzle_options_t  options 
)

Add options for a drizzle structure.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]optionsAvailable options for drizzle structure to add.
void drizzle_remove_options ( drizzle_st drizzle,
drizzle_options_t  options 
)

Remove options for a drizzle structure.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]optionsAvailable options for drizzle structure to remove.
void* drizzle_context ( const drizzle_st drizzle)

Get application context pointer.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
Application context that was previously set, or NULL.
void drizzle_set_context ( drizzle_st drizzle,
void *  context 
)

Set application context pointer.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]contextApplication context to set.
void drizzle_set_context_free_fn ( drizzle_st drizzle,
drizzle_context_free_fn function 
)

Set function to call when the drizzle structure is being cleaned up so the application can clean up the context pointer.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]functionFunction to call to clean up drizzle context.
int drizzle_timeout ( const drizzle_st drizzle)

Get current socket I/O activity timeout value.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
Timeout in milliseconds to wait for I/O activity. A negative value means an infinite timeout.
void drizzle_set_timeout ( drizzle_st drizzle,
int  timeout 
)

Set socket I/O activity timeout for connections in a Drizzle structure.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]timeoutMilliseconds to wait for I/O activity. A negative value means an infinite timeout.

Get current verbosity threshold for logging messages.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
Current verbosity threshold.
void drizzle_set_verbose ( drizzle_st drizzle,
drizzle_verbose_t  verbose 
)

Set verbosity threshold for logging messages. If this is set above DRIZZLE_VERBOSE_NEVER and the drizzle_set_log_fn() callback is set to NULL, messages are printed to STDOUT.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]verboseVerbosity threshold of what to log.
void drizzle_set_log_fn ( drizzle_st drizzle,
drizzle_log_fn function,
void *  context 
)

Set logging function for a drizzle structure. This function is only called for log messages that are above the verbosity threshold set with drizzle_set_verbose().

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]functionFunction to call when there is a logging message.
[in]contextArgument to pass into the callback function.
void drizzle_set_event_watch_fn ( drizzle_st drizzle,
drizzle_event_watch_fn function,
void *  context 
)

Set a custom I/O event watcher function for a drizzle structure. Used to integrate libdrizzle with a custom event loop. The callback will be invoked to register or deregister interest in events for a connection. When the events are triggered, drizzle_con_set_revents() should be called to indicate which events are ready. The event loop should stop waiting for these events, as libdrizzle will call the callback again if it is still interested. To resume processing, the libdrizzle function that returned DRIZZLE_RETURN_IO_WAIT should be called again. See drizzle_event_watch_fn().

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]functionFunction to call when there is an I/O event.
[in]contextArgument to pass into the callback function.

Initialize a connection structure. Always check the return value even if passing in a pre-allocated structure. Some other initialization may have failed.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]conCaller allocated structure, or NULL to allocate one.
Returns:
On success, a pointer to the (possibly allocated) structure. On failure this will be NULL.
drizzle_con_st* drizzle_con_clone ( drizzle_st drizzle,
drizzle_con_st con,
const drizzle_con_st from 
)

Clone a connection structure.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
[in]conCaller allocated structure, or NULL to allocate one.
[in]fromConnection structure to use as a source to clone from.
Returns:
Same return as drizzle_con_create().

Free a connection structure.

Parameters:
[in]conConnection structure previously initialized with drizzle_con_create(), drizzle_con_clone(), or related functions.
void drizzle_con_free_all ( drizzle_st drizzle)

Free all connections in a drizzle structure.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().

Wait for I/O on connections.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
Standard drizzle return value.

Get next connection that is ready for I/O.

Parameters:
[in]drizzleDrizzle structure previously initialized with drizzle_create() or drizzle_clone().
Returns:
Connection that is ready for I/O, or NULL if there are none.