PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include "ecpg-pthread-win32.h"
#include "ecpgerrno.h"
#include "ecpglib.h"
#include "ecpglib_extern.h"
#include "ecpgtype.h"
#include "sqlca.h"
Go to the source code of this file.
Macros | |
#define | POSTGRES_ECPG_INTERNAL |
Functions | |
static void | ecpg_actual_connection_init (void) |
void | ecpg_pthreads_init (void) |
static struct connection * | ecpg_get_connection_nr (const char *connection_name) |
struct connection * | ecpg_get_connection (const char *connection_name) |
static void | ecpg_finish (struct connection *act) |
bool | ECPGsetcommit (int lineno, const char *mode, const char *connection_name) |
bool | ECPGsetconn (int lineno, const char *connection_name) |
static void | ECPGnoticeReceiver (void *arg, const PGresult *result) |
bool | ECPGconnect (int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit) |
bool | ECPGdisconnect (int lineno, const char *connection_name) |
PGconn * | ECPGget_PGconn (const char *connection_name) |
Variables | |
static pthread_mutex_t | connections_mutex = PTHREAD_MUTEX_INITIALIZER |
static pthread_key_t | actual_connection_key |
static pthread_once_t | actual_connection_key_once = PTHREAD_ONCE_INIT |
static struct connection * | actual_connection = NULL |
static struct connection * | all_connections = NULL |
|
static |
Definition at line 24 of file connect.c.
References actual_connection_key.
Referenced by ecpg_pthreads_init().
|
static |
Definition at line 103 of file connect.c.
References actual_connection, actual_connection_key, all_connections, connection::cache_head, connection::connection, ECPG_COMPAT_PGSQL, ecpg_deallocate_all_conn(), ecpg_free(), ecpg_log(), ivlist, connection::name, ECPGtype_information_cache::next, connection::next, var_list::next, PQfinish(), pthread_getspecific(), and pthread_setspecific().
Referenced by ECPGconnect(), and ECPGdisconnect().
struct connection* ecpg_get_connection | ( | const char * | connection_name | ) |
Definition at line 71 of file connect.c.
References actual_connection, actual_connection_key, connections_mutex, ecpg_get_connection_nr(), ecpg_pthreads_init(), pthread_getspecific(), pthread_mutex_lock(), and pthread_mutex_unlock().
Referenced by ecpg_auto_prepare(), ecpg_do_prologue(), ecpg_freeStmtCacheEntry(), ECPGconnect(), ECPGdeallocate(), ECPGdeallocate_all(), ECPGdescribe(), ECPGget_desc(), ECPGget_PGconn(), ECPGprepare(), ECPGprepared_statement(), ECPGsetcommit(), ECPGsetconn(), ECPGstatus(), ECPGtrans(), and ECPGtransactionStatus().
|
static |
Definition at line 36 of file connect.c.
References actual_connection, actual_connection_key, all_connections, ecpg_pthreads_init(), connection::name, connection::next, and pthread_getspecific().
Referenced by ecpg_get_connection(), and ECPGdisconnect().
void ecpg_pthreads_init | ( | void | ) |
Definition at line 30 of file connect.c.
References actual_connection_key_once, and ecpg_actual_connection_init().
Referenced by ecpg_do_prologue(), ecpg_get_connection(), ecpg_get_connection_nr(), and ECPGconnect().
bool ECPGconnect | ( | int | lineno, |
int | c, | ||
const char * | name, | ||
const char * | user, | ||
const char * | passwd, | ||
const char * | connection_name, | ||
int | autocommit | ||
) |
Definition at line 255 of file connect.c.
References a, actual_connection, actual_connection_key, all_connections, Assert, autocommit, connection::cache_head, compat, CONNECTION_BAD, connections_mutex, dbname, ecpg_alloc(), ecpg_clear_auto_mem(), ECPG_CONNECT, ecpg_finish(), ecpg_free(), ecpg_get_connection(), ecpg_gettext, ecpg_init_sqlca(), ecpg_internal_regression_mode, ecpg_log(), ECPG_OUT_OF_MEMORY, ecpg_pthreads_init(), ecpg_raise(), ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, ecpg_strdup(), ECPGget_sqlca(), ECPGnoticeReceiver(), errmsg(), free, i, INFORMIX_MODE, last_dir_separator(), locale_t, name, next, port, PQconnectdbParams(), PQerrorMessage(), PQsetNoticeReceiver(), PQstatus(), connection::prep_stmts, pthread_mutex_lock(), pthread_mutex_unlock(), pthread_setspecific(), sqlca, str, and user.
Referenced by fn(), main(), test(), and test_thread().
bool ECPGdisconnect | ( | int | lineno, |
const char * | connection_name | ||
) |
Definition at line 673 of file connect.c.
References all_connections, connections_mutex, ecpg_finish(), ecpg_get_connection_nr(), ecpg_init(), ecpg_init_sqlca(), ECPG_OUT_OF_MEMORY, ecpg_raise(), ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, ECPGget_sqlca(), connection::next, pthread_mutex_lock(), pthread_mutex_unlock(), and sqlca.
Referenced by fn(), main(), test(), and test_thread().
PGconn* ECPGget_PGconn | ( | const char * | connection_name | ) |
Definition at line 717 of file connect.c.
References connection::connection, and ecpg_get_connection().
|
static |
Definition at line 203 of file connect.c.
References arg, ecpg_gettext, ecpg_log(), ECPG_SQLSTATE_ACTIVE_SQL_TRANSACTION, ECPG_SQLSTATE_DUPLICATE_CURSOR, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ECPG_SQLSTATE_INVALID_CURSOR_NAME, ECPG_SQLSTATE_NO_ACTIVE_SQL_TRANSACTION, ECPG_WARNING_IN_TRANSACTION, ECPG_WARNING_NO_TRANSACTION, ECPG_WARNING_PORTAL_EXISTS, ECPG_WARNING_UNKNOWN_PORTAL, ECPGget_sqlca(), PG_DIAG_MESSAGE_PRIMARY, PG_DIAG_SQLSTATE, PQresultErrorField(), sqlca, sqlca_t::sqlcode, and sqlca_t::sqlstate.
Referenced by ECPGconnect().
bool ECPGsetcommit | ( | int | lineno, |
const char * | mode, | ||
const char * | connection_name | ||
) |
Definition at line 153 of file connect.c.
References connection::autocommit, connection::connection, ecpg_check_PQresult(), ECPG_COMPAT_PGSQL, ecpg_get_connection(), ecpg_init(), ecpg_log(), mode, connection::name, PQclear(), PQexec(), PQTRANS_IDLE, and PQtransactionStatus().
bool ECPGsetconn | ( | int | lineno, |
const char * | connection_name | ||
) |
Definition at line 190 of file connect.c.
References actual_connection_key, ecpg_get_connection(), ecpg_init(), and pthread_setspecific().
Referenced by main().
|
static |
Definition at line 20 of file connect.c.
Referenced by ecpg_finish(), ecpg_get_connection(), ecpg_get_connection_nr(), and ECPGconnect().
|
static |
Definition at line 18 of file connect.c.
Referenced by ecpg_actual_connection_init(), ecpg_finish(), ecpg_get_connection(), ecpg_get_connection_nr(), ECPGconnect(), and ECPGsetconn().
|
static |
Definition at line 19 of file connect.c.
Referenced by ecpg_pthreads_init().
|
static |
Definition at line 21 of file connect.c.
Referenced by ecpg_finish(), ecpg_get_connection_nr(), ECPGconnect(), and ECPGdisconnect().
|
static |
Definition at line 17 of file connect.c.
Referenced by ecpg_get_connection(), ECPGconnect(), and ECPGdisconnect().