PostgreSQL Source Code
git master
|
#include <stdbool.h>
#include <string.h>
#include "ecpg_config.h"
#include "ecpgtype.h"
#include "libpq-fe.h"
#include "sqlca.h"
Go to the source code of this file.
Macros | |
#define | SQLCODE sqlca.sqlcode |
#define | SQLSTATE sqlca.sqlstate |
Functions | |
void | ECPGdebug (int n, FILE *dbgs) |
bool | ECPGstatus (int lineno, const char *connection_name) |
bool | ECPGsetcommit (int lineno, const char *mode, const char *connection_name) |
bool | ECPGsetconn (int lineno, const char *connection_name) |
bool | ECPGconnect (int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit) |
bool | ECPGdo (const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query,...) |
bool | ECPGtrans (int lineno, const char *connection_name, const char *transaction) |
bool | ECPGdisconnect (int lineno, const char *connection_name) |
bool | ECPGprepare (int lineno, const char *connection_name, const bool questionmarks, const char *name, const char *variable) |
bool | ECPGdeallocate (int lineno, int c, const char *connection_name, const char *name) |
bool | ECPGdeallocate_all (int lineno, int compat, const char *connection_name) |
char * | ECPGprepared_statement (const char *connection_name, const char *name, int lineno) |
PGconn * | ECPGget_PGconn (const char *connection_name) |
PGTransactionStatusType | ECPGtransactionStatus (const char *connection_name) |
void | sqlprint (void) |
bool | ECPGdo_descriptor (int line, const char *connection, const char *descriptor, const char *query) |
bool | ECPGdeallocate_desc (int line, const char *name) |
bool | ECPGallocate_desc (int line, const char *name) |
bool | ECPGget_desc_header (int lineno, const char *desc_name, int *count) |
bool | ECPGget_desc (int lineno, const char *desc_name, int index,...) |
bool | ECPGset_desc_header (int lineno, const char *desc_name, int count) |
bool | ECPGset_desc (int lineno, const char *desc_name, int index,...) |
void | ECPGset_noind_null (enum ECPGttype type, void *ptr) |
bool | ECPGis_noind_null (enum ECPGttype type, const void *ptr) |
bool | ECPGdescribe (int line, int compat, bool input, const char *connection_name, const char *stmt_name,...) |
void | ECPGset_var (int number, void *pointer, int lineno) |
void * | ECPGget_var (int number) |
void | ECPGfree_auto_mem (void) |
void | ecpg_pthreads_init (void) |
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 ECPGallocate_desc | ( | int | line, |
const char * | name | ||
) |
Definition at line 792 of file descriptor.c.
References ecpg_alloc(), ecpg_free(), ecpg_init_sqlca(), ECPG_OUT_OF_MEMORY, ecpg_raise(), ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, ECPGget_sqlca(), get_descriptors(), name, PQmakeEmptyPGresult(), set_descriptors(), and sqlca.
Referenced by execute_test(), fn(), and main().
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 ECPGdeallocate | ( | int | lineno, |
int | c, | ||
const char * | connection_name, | ||
const char * | name | ||
) |
Definition at line 315 of file prepare.c.
References deallocate_one(), ecpg_find_prepared_statement(), ecpg_get_connection(), ecpg_init(), ECPG_INVALID_STMT, ecpg_raise(), ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, INFORMIX_MODE, and name.
Referenced by execute_test(), fn(), and main().
bool ECPGdeallocate_all | ( | int | lineno, |
int | compat, | ||
const char * | connection_name | ||
) |
Definition at line 350 of file prepare.c.
References compat, ecpg_deallocate_all_conn(), and ecpg_get_connection().
Referenced by main().
bool ECPGdeallocate_desc | ( | int | line, |
const char * | name | ||
) |
Definition at line 748 of file descriptor.c.
References descriptor_free(), ecpg_init_sqlca(), ECPG_OUT_OF_MEMORY, ecpg_raise(), ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME, ECPG_UNKNOWN_DESCRIPTOR, ECPGget_sqlca(), get_descriptors(), name, descriptor::name, descriptor::next, set_descriptors(), and sqlca.
Referenced by execute_test(), fn(), and main().
void ECPGdebug | ( | int | n, |
FILE * | dbgs | ||
) |
Definition at line 204 of file misc.c.
References debug_init_mutex, debug_mutex, debugstream, ecpg_internal_regression_mode, ecpg_log(), pthread_mutex_lock(), pthread_mutex_unlock(), and simple_debug.
bool ECPGdescribe | ( | int | line, |
int | compat, | ||
bool | input, | ||
const char * | connection_name, | ||
const char * | stmt_name, | ||
... | |||
) |
Definition at line 847 of file descriptor.c.
References generate_unaccent_rules::args, compat, connection::connection, sqlda_compat::desc_next, sqlda_struct::desc_next, ecpg_build_compat_sqlda(), ecpg_build_native_sqlda(), ecpg_check_PQresult(), ecpg_find_desc(), ecpg_find_prepared_statement(), ecpg_get_connection(), ecpg_gettext, ECPG_INVALID_STMT, ECPG_NO_CONN, ecpg_raise(), ECPG_SQLSTATE_CONNECTION_DOES_NOT_EXIST, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, ECPG_UNSUPPORTED, ECPGt_descriptor, ECPGt_EORT, ECPGt_sqlda, free, INFORMIX_MODE, input, name, PQclear(), PQdescribePrepared(), res, descriptor::result, type, va_end(), and va_start().
Referenced by execute_test(), and main().
bool ECPGdisconnect | ( | int | lineno, |
const char * | connection_name | ||
) |
Definition at line 676 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().
bool ECPGdo | ( | const int | lineno, |
const int | compat, | ||
const int | force_indicator, | ||
const char * | connection_name, | ||
const bool | questionmarks, | ||
const int | st, | ||
const char * | query, | ||
... | |||
) |
Definition at line 2275 of file execute.c.
References generate_unaccent_rules::args, compat, ecpg_do(), force_indicator, statement::lineno, questionmarks, va_end(), and va_start().
Referenced by check_result_of_insert(), close_cur1(), ECPGdo_descriptor(), execute_test(), fn(), get_record1(), main(), open_cur1(), openit(), test(), and test_thread().
bool ECPGdo_descriptor | ( | int | line, |
const char * | connection, | ||
const char * | descriptor, | ||
const char * | query | ||
) |
Definition at line 2290 of file execute.c.
References ECPG_COMPAT_PGSQL, ECPGdo(), ECPGt_descriptor, ECPGt_EOIT, ECPGt_EORT, and ECPGt_NO_INDICATOR.
void ECPGfree_auto_mem | ( | void | ) |
Definition at line 131 of file memory.c.
References ecpg_free(), get_auto_allocs(), auto_mem::next, auto_mem::pointer, and set_auto_allocs().
Referenced by auto_mem_destructor(), ecpg_raise(), ecpg_raise_backend(), ECPGset_var(), and main().
bool ECPGget_desc | ( | int | lineno, |
const char * | desc_name, | ||
int | index, | ||
... | |||
) |
Definition at line 234 of file descriptor.c.
References generate_unaccent_rules::args, variable::arrsize, Assert, ecpg_auto_alloc(), ecpg_dynamic_type(), ecpg_dynamic_type_DDT(), ecpg_free(), ecpg_get_connection(), ecpg_init_sqlca(), ECPG_INVALID_DESCRIPTOR_INDEX, ecpg_log(), ECPG_OUT_OF_MEMORY, ecpg_raise(), ecpg_result_by_descriptor(), ECPG_SQLSTATE_CARDINALITY_VIOLATION, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_INVALID_DESCRIPTOR_INDEX, ecpg_store_result(), ecpg_strdup(), ECPG_TOO_MANY_MATCHES, ECPG_UNKNOWN_DESCRIPTOR_ITEM, ECPGd_cardinality, ECPGd_data, ECPGd_di_code, ECPGd_EODT, ECPGd_indicator, ECPGd_key_member, ECPGd_length, ECPGd_name, ECPGd_nullable, ECPGd_octet, ECPGd_precision, ECPGd_ret_length, ECPGd_ret_octet, ECPGd_scale, ECPGd_type, ECPGget_sqlca(), ECPGt_EORT, ECPGt_NO_INDICATOR, get_char_item(), get_int_item(), variable::ind_arrsize, variable::ind_offset, variable::ind_pointer, variable::ind_type, variable::ind_value, variable::ind_varcharsize, statement::lineno, locale_t, variable::offset, variable::pointer, PQfmod(), PQfname(), PQfsize(), PQftype(), PQgetisnull(), PQgetlength(), PQnfields(), PQntuples(), RETURN_IF_NO_DATA, setlocale, snprintf, sqlca, stmt, type, variable::type, va_end(), va_start(), variable::value, variable::varcharsize, and VARHDRSZ.
Referenced by execute_test(), and main().
bool ECPGget_desc_header | ( | int | lineno, |
const char * | desc_name, | ||
int * | count | ||
) |
Definition at line 84 of file descriptor.c.
References ecpg_init_sqlca(), ecpg_log(), ECPG_OUT_OF_MEMORY, ecpg_raise(), ecpg_result_by_descriptor(), ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, ECPGget_sqlca(), PQnfields(), and sqlca.
Referenced by execute_test(), and main().
PGconn* ECPGget_PGconn | ( | const char * | connection_name | ) |
Definition at line 720 of file connect.c.
References connection::connection, and ecpg_get_connection().
void* ECPGget_var | ( | int | number | ) |
Definition at line 593 of file misc.c.
References ivlist, var_list::next, var_list::number, and var_list::pointer.
Referenced by ECPG_informix_get_var(), get_record1(), open_cur1(), and openit().
bool ECPGis_noind_null | ( | enum ECPGttype | type, |
const void * | ptr | ||
) |
Definition at line 361 of file misc.c.
References _check(), ECPGgeneric_bytea::arr, ECPGt_bytea, ECPGt_char, ECPGt_date, ECPGt_decimal, ECPGt_double, ECPGt_float, ECPGt_int, ECPGt_interval, ECPGt_long, ECPGt_long_long, ECPGt_numeric, ECPGt_short, ECPGt_string, ECPGt_timestamp, ECPGt_unsigned_char, ECPGt_unsigned_int, ECPGt_unsigned_long, ECPGt_unsigned_long_long, ECPGt_unsigned_short, ECPGt_varchar, len, LONG_LONG_MIN, NUMERIC_NULL, sign, and type.
Referenced by ecpg_store_input(), and risnull().
bool ECPGprepare | ( | int | lineno, |
const char * | connection_name, | ||
const bool | questionmarks, | ||
const char * | name, | ||
const char * | variable | ||
) |
Definition at line 217 of file prepare.c.
References deallocate_one(), ECPG_COMPAT_PGSQL, ecpg_find_prepared_statement(), ecpg_get_connection(), ecpg_init(), name, prepare_common(), and questionmarks.
Referenced by ecpg_auto_prepare(), execute_test(), fn(), main(), and test().
char* ECPGprepared_statement | ( | const char * | connection_name, |
const char * | name, | ||
int | lineno | ||
) |
Definition at line 368 of file prepare.c.
References ecpg_get_connection(), ecpg_prepared(), and name.
Referenced by execute_test(), main(), and test().
bool ECPGset_desc | ( | int | lineno, |
const char * | desc_name, | ||
int | index, | ||
... | |||
) |
Definition at line 605 of file descriptor.c.
References generate_unaccent_rules::args, variable::arrsize, descriptor::count, ecpg_alloc(), ecpg_find_desc(), ecpg_free(), ecpg_raise(), ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ecpg_store_input(), ECPG_UNKNOWN_DESCRIPTOR_ITEM, ECPGd_data, ECPGd_EODT, ECPGd_indicator, ECPGd_length, ECPGd_precision, ECPGd_scale, ECPGd_type, descriptor_item::indicator, descriptor::items, descriptor_item::length, descriptor_item::next, variable::next, descriptor_item::num, variable::offset, variable::pointer, descriptor_item::precision, descriptor_item::scale, set_desc_attr(), set_int_item(), snprintf, descriptor_item::type, variable::type, va_end(), va_start(), variable::value, and variable::varcharsize.
Referenced by main().
bool ECPGset_desc_header | ( | int | lineno, |
const char * | desc_name, | ||
int | count | ||
) |
Definition at line 573 of file descriptor.c.
References descriptor::count, and ecpg_find_desc().
Referenced by main().
void ECPGset_noind_null | ( | enum ECPGttype | type, |
void * | ptr | ||
) |
Definition at line 292 of file misc.c.
References ECPGt_bytea, ECPGt_char, ECPGt_date, ECPGt_decimal, ECPGt_double, ECPGt_float, ECPGt_int, ECPGt_interval, ECPGt_long, ECPGt_long_long, ECPGt_numeric, ECPGt_short, ECPGt_string, ECPGt_timestamp, ECPGt_unsigned_char, ECPGt_unsigned_int, ECPGt_unsigned_long, ECPGt_unsigned_long_long, ECPGt_unsigned_short, ECPGt_varchar, LONG_LONG_MIN, NUMERIC_NULL, and type.
Referenced by ecpg_get_data(), ecpg_set_compat_sqlda(), ecpg_set_native_sqlda(), and rsetnull().
void ECPGset_var | ( | int | number, |
void * | pointer, | ||
int | lineno | ||
) |
Definition at line 538 of file misc.c.
References calloc, ecpg_init_sqlca(), ECPG_OUT_OF_MEMORY, ecpg_raise(), ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, ECPGfree_auto_mem(), ECPGget_sqlca(), ivlist, var_list::next, var_list::number, var_list::pointer, snprintf, and sqlca.
Referenced by ECPG_informix_set_var(), get_var1(), and main().
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().
bool ECPGstatus | ( | int | lineno, |
const char * | connection_name | ||
) |
Definition at line 127 of file misc.c.
References connection::connection, ecpg_get_connection(), ecpg_init(), ECPG_NOT_CONN, ecpg_raise(), ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, and connection::name.
bool ECPGtrans | ( | int | lineno, |
const char * | connection_name, | ||
const char * | transaction | ||
) |
Definition at line 160 of file misc.c.
References connection::autocommit, connection::connection, ecpg_check_PQresult(), ECPG_COMPAT_PGSQL, ecpg_get_connection(), ecpg_init(), ecpg_log(), connection::name, PQclear(), PQexec(), PQTRANS_IDLE, PQtransactionStatus(), and res.
Referenced by commitTable(), main(), sql_check(), and test_thread().
PGTransactionStatusType ECPGtransactionStatus | ( | const char * | connection_name | ) |
Definition at line 145 of file misc.c.
References connection::connection, ecpg_get_connection(), PQTRANS_UNKNOWN, and PQtransactionStatus().
void sqlprint | ( | void | ) |
Definition at line 334 of file error.c.
References ecpg_gettext, ecpg_log(), ECPGget_sqlca(), fprintf, and sqlca.
Referenced by check_result_of_insert(), commitTable(), execute_test(), fn(), main(), print(), print2(), test(), and test_thread().