#ifndef SQL_API_PRIVATE_H
#define SQL_API_PRIVATE_H
#include "sql-api.h"
#include "module-context.h"
enum sql_db_state {
/* not connected to database */
/* waiting for connection attempt to succeed or fail */
/* connected, allowing more queries */
/* connected, no more queries allowed */
};
/* Minimum delay between reconnecting to same server */
/* Maximum time to avoiding reconnecting to same server */
/* If no servers are connected but a query is requested, try reconnecting to
next server which has been disconnected longer than this (with a single
server setup this is really the "max delay" and the SQL_CONNECT_MAX_DELAY
is never used). */
/* Abort connect() if it can't connect within this time. */
/* Abort queries after this many seconds */
/* Default max. number of connections to create per host */
struct sql_db_module_register {
unsigned int id;
};
union sql_db_module_context {
};
extern struct sql_db_module_register sql_db_module_register;
struct sql_transaction_query {
const char *query;
unsigned int *affected_rows;
};
struct sql_db_vfuncs {
void *context);
const char **error_r);
unsigned int *affected_rows);
struct sql_prepared_statement *
const char *query_template);
struct sql_statement *
struct sql_statement *
unsigned int column_idx, const char *value);
unsigned int column_idx, const void *value,
struct sql_statement *stmt,
unsigned int *affected_rows);
};
struct sql_db {
const char *name;
struct sql_db_vfuncs v;
enum sql_db_state prev_state,
void *context);
void *state_change_context;
/* last time we started connecting to this server
(which may or may not have succeeded) */
unsigned int connect_delay;
unsigned int connect_failure_count;
};
struct sql_result_vfuncs {
unsigned int idx);
unsigned int idx);
const unsigned char *
unsigned int idx,
const char *field_name);
};
struct sql_prepared_statement {
};
struct sql_statement {
const char *query_template;
};
struct sql_field_map {
};
struct sql_result {
struct sql_result_vfuncs v;
int refcount;
unsigned int map_size;
void *fetch_dest;
};
struct sql_transaction_context {
/* commit() must use this query list if head is non-NULL. */
};
extern struct sql_result sql_not_connected_result;
struct sql_db *
const char *query, unsigned int *affected_rows);
#endif