Data Structures | Defines | Typedefs | Enumerations | Functions

internals.h File Reference

Database functions and data structures used by the db module, but not exported as official API. More...

#include <dballe/db/querybuf.h>
#include <dballe/db/odbcworkarounds.h>
#include <sqltypes.h>

Go to the source code of this file.

Data Structures

struct  _dba_db
 DB-ALLe session structure. More...
struct  _dba_db_cursor
 Structure used to build and execute a query, and to iterate through the results. More...
struct  _dba_db_seq

Defines

#define DBA_DB_DEFINED
#define TRACE(...)   do { } while (0)
 Trace macros internally used for debugging.
#define IFTRACE   if (0)
 Prefix a block of code to compile only if trace is enabled.

Typedefs

typedef struct _dba_dbdba_db
typedef struct _dba_db_seqdba_db_seq

Enumerations

enum  dba_db_server_type { MYSQL, SQLITE, ORACLE, POSTGRES }
 

Supported SQL servers.


Functions

dba_err dba_db_error_odbc (SQLSMALLINT handleType, SQLHANDLE handle, const char *fmt,...)
 Report an ODBC error, using informations from the ODBC diagnostic record.
dba_err dba_db_error_odbc_except (const char *error_to_ignore, SQLSMALLINT handleType, SQLHANDLE handle, const char *fmt,...)
 Report an ODBC error, using informations from the ODBC diagnostic record, and ignoring one kind of SQL error.
dba_err dba_db_statement_create (dba_db db, SQLHSTMT *stm)
 Create a new ODBC statement handle.
dba_err dba_db_last_insert_id (dba_db db, int *id)
 Report the last ID auto-generated by an insert.
dba_err dba_db_seq_create (dba_db db, const char *name, dba_db_seq *seq)
 Create a new dba_seq structure to interact with a database sequence.
dba_err dba_db_seq_read (dba_db_seq seq)
 Read the current value of a sequence.
void dba_db_seq_delete (dba_db_seq seq)
 Deletes a dba_seq structure.
dba_err dba_db_drop_table_if_exists (dba_db db, const char *name)
 Delete a table in the database if it exists, otherwise do nothing.
dba_err dba_db_run_sql (dba_db db, const char *query)
 Run a one-off SQL query.
dba_err dba_db_begin (dba_db db)
 Begin a transaction.
dba_err dba_db_commit (dba_db db)
 Commit a transaction.
void dba_db_rollback (dba_db db)
 Rollback a transaction.
dba_err dba_db_need_repinfo (dba_db db)
 Ensure that db->repinfo is initialized.
dba_err dba_db_need_pseudoana (dba_db db)
 Ensure that db->pseudoana is initialized.
dba_err dba_db_need_context (dba_db db)
 Ensure that db->context is initialized.
dba_err dba_db_need_data (dba_db db)
 Ensure that db->data is initialized.
dba_err dba_db_need_attr (dba_db db)
 Ensure that db->attr is initialized.

Detailed Description

Database functions and data structures used by the db module, but not exported as official API.


Define Documentation

#define TRACE (   ... )    do { } while (0)

Typedef Documentation

typedef struct _dba_db* dba_db

DB-ALLe session structure.


Function Documentation

dba_err dba_db_error_odbc_except ( const char *  error_to_ignore,
SQLSMALLINT  handleType,
SQLHANDLE  handle,
const char *  fmt,
  ... 
)

Report an ODBC error, using informations from the ODBC diagnostic record, and ignoring one kind of SQL error.

For an (incomplete) list of SQL error codes, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp

References DBA_ERR_ODBC.