driver-pgsql.c revision 5fe06fea9fee0f5e4e9cb49f6866877223f78b85
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Copyright (c) 2004-2008 Dovecot authors, see the included COPYING file */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#include "ioloop-internal.h" /* kind of dirty, but it should be fine.. */
struct pgsql_db {
char *connect_string;
char *error;
struct pgsql_binary_value {
unsigned char *value;
struct pgsql_result {
unsigned int fields_count;
const char **fields;
const char **values;
void *context;
struct pgsql_queue {
char *query;
struct pgsql_transaction_context {
void *context;
const char *error;
const char *msg;
int ret;
switch (ret) {
case PGRES_POLLING_READING:
case PGRES_POLLING_WRITING:
case PGRES_POLLING_OK:
case PGRES_POLLING_FAILED:
static enum sql_db_flags
unsigned int i, count;
for (i = 0; i < count; i++)
T_BEGIN {
} T_END;
if (free_result)
int ret;
if (ret > 0)
if (ret < 0) {
int ret;
if (ret < 0) {
if (ret > 0) {
return queue;
char *to;
#ifdef HAVE_PQESCAPE_STRING_CONN
return to;
static struct sql_result *
case PGRES_COMMAND_OK:
case PGRES_TUPLES_OK:
case PGRES_EMPTY_QUERY:
case PGRES_NONFATAL_ERROR:
const char *field_name)
unsigned int idx)
return NULL;
const char *value;
*size_r = 0;
return NULL;
const char *field_name)
int idx;
if (idx < 0)
return NULL;
const char *msg;
static struct sql_transaction_context *
const char **error_r)
MEMBER(v) {
MEMBER(v) {
void driver_pgsql_init(void);
void driver_pgsql_deinit(void);
void driver_pgsql_init(void)
void driver_pgsql_deinit(void)