PostgreSQL Source Code
git master
|
#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 | true ((bool) 1) |
#define | false ((bool) 0) |
#define | SQLCODE sqlca.sqlcode |
#define | SQLSTATE sqlca.sqlstate |
Typedefs | |
typedef unsigned char | bool |
Functions | |
void | ECPGdebug (int, FILE *) |
bool | ECPGstatus (int, const char *) |
bool | ECPGsetcommit (int, const char *, const char *) |
bool | ECPGsetconn (int, const char *) |
bool | ECPGconnect (int, int, const char *, const char *, const char *, const char *, int) |
bool | ECPGdo (const int, const int, const int, const char *, const bool, const int, const char *,...) |
bool | ECPGtrans (int, const char *, const char *) |
bool | ECPGdisconnect (int, const char *) |
bool | ECPGprepare (int, const char *, const bool, const char *, const char *) |
bool | ECPGdeallocate (int, int, const char *, const char *) |
bool | ECPGdeallocate_all (int, int, const char *) |
char * | ECPGprepared_statement (const char *, const char *, int) |
PGconn * | ECPGget_PGconn (const char *) |
PGTransactionStatusType | ECPGtransactionStatus (const char *) |
void | sqlprint (void) |
bool | ECPGdo_descriptor (int, const char *, const char *, const char *) |
bool | ECPGdeallocate_desc (int, const char *) |
bool | ECPGallocate_desc (int, const char *) |
bool | ECPGget_desc_header (int, const char *, int *) |
bool | ECPGget_desc (int, const char *, int,...) |
bool | ECPGset_desc_header (int, const char *, int) |
bool | ECPGset_desc (int, const char *, int,...) |
void | ECPGset_noind_null (enum ECPGttype, void *) |
bool | ECPGis_noind_null (enum ECPGttype, const void *) |
bool | ECPGdescribe (int, int, bool, const char *, const char *,...) |
void | ECPGset_var (int, void *, int) |
void * | ECPGget_var (int number) |
void | ECPGfree_auto_mem (void) |
#define SQLCODE sqlca.sqlcode |
Definition at line 72 of file ecpglib.h.
Referenced by sql_check().
bool ECPGallocate_desc | ( | int | , |
const char * | |||
) |
Definition at line 797 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, PQmakeEmptyPGresult(), set_descriptors, and sqlca.
Referenced by fn(), and main().
bool ECPGconnect | ( | int | , |
int | , | ||
const char * | , | ||
const char * | , | ||
const char * | , | ||
const char * | , | ||
int | |||
) |
Definition at line 271 of file connect.c.
References all_connections, Assert, autocommit, connection::cache_head, compat, CONNECTION_BAD, 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_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(), next, port, PQconnectdbParams(), PQerrorMessage(), PQsetNoticeReceiver(), PQstatus(), connection::prep_stmts, pthread_mutex_lock(), pthread_mutex_unlock(), pthread_setspecific(), sqlca, generate_unaccent_rules::str, and user.
Referenced by main(), and test().
bool ECPGdeallocate | ( | int | , |
int | , | ||
const char * | , | ||
const char * | |||
) |
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, and INFORMIX_MODE.
Referenced by main().
bool ECPGdeallocate_all | ( | int | , |
int | , | ||
const char * | |||
) |
Definition at line 350 of file prepare.c.
References ecpg_deallocate_all_conn(), and ecpg_get_connection().
Referenced by main().
bool ECPGdeallocate_desc | ( | int | , |
const char * | |||
) |
Definition at line 750 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, sort-test::list, descriptor::next, next, set_descriptors, and sqlca.
Referenced by fn(), and main().
void ECPGdebug | ( | int | , |
FILE * | |||
) |
Definition at line 242 of file misc.c.
References debugstream, ecpg_internal_regression_mode, ecpg_log(), pthread_mutex_lock(), pthread_mutex_unlock(), and simple_debug.
Definition at line 852 of file descriptor.c.
References generate_unaccent_rules::args, connection::connection, sqlda_struct::desc_next, sqlda_compat::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, name, PQclear(), PQdescribePrepared(), descriptor::result, and generate_unaccent_rules::type.
Referenced by main().
bool ECPGdisconnect | ( | int | , |
const char * | |||
) |
Definition at line 684 of file connect.c.
References 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 main(), and test().
bool ECPGdo | ( | const int | , |
const int | , | ||
const int | , | ||
const char * | , | ||
const bool | , | ||
const int | , | ||
const char * | , | ||
... | |||
) |
Definition at line 2287 of file execute.c.
References generate_unaccent_rules::args, and ecpg_do().
Referenced by check_result_of_insert(), close_cur1(), ECPGdo_descriptor(), get_record1(), main(), open_cur1(), openit(), and test().
bool ECPGdo_descriptor | ( | int | , |
const char * | , | ||
const char * | , | ||
const char * | |||
) |
Definition at line 2302 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 138 of file memory.c.
References ecpg_free(), get_auto_allocs, auto_mem::next, auto_mem::pointer, and set_auto_allocs.
Referenced by ecpg_raise(), ecpg_raise_backend(), ECPGset_var(), and main().
bool ECPGget_desc | ( | int | , |
const char * | , | ||
int | , | ||
... | |||
) |
Definition at line 241 of file descriptor.c.
References generate_unaccent_rules::args, variable::arrsize, statement::connection, 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, statement::oldlocale, variable::pointer, PQfmod(), PQfname(), PQfsize(), PQftype(), PQgetisnull(), PQgetlength(), PQnfields(), PQntuples(), RETURN_IF_NO_DATA, setlocale, snprintf, sqlca, sqlca_t::sqlerrd, variable::type, generate_unaccent_rules::type, variable::value, variable::varcharsize, and VARHDRSZ.
Referenced by main().
bool ECPGget_desc_header | ( | int | , |
const char * | , | ||
int * | |||
) |
Definition at line 91 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(), sqlca, and sqlca_t::sqlerrd.
Referenced by main().
PGconn* ECPGget_PGconn | ( | const char * | ) |
Definition at line 734 of file connect.c.
References connection::connection, and ecpg_get_connection().
void* ECPGget_var | ( | int | number | ) |
Definition at line 581 of file misc.c.
References 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, |
const void * | |||
) |
Definition at line 388 of file misc.c.
References _check(), ECPGgeneric_bytea::arr, dgettext, ecpg_gettext, 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, fn(), ECPGgeneric_bytea::len, LONG_LONG_MIN, NUMERIC_NULL, PG_TEXTDOMAIN, pthread_mutex_lock(), pthread_mutex_unlock(), and sign.
Referenced by ecpg_store_input(), and risnull().
Definition at line 217 of file prepare.c.
References deallocate_one(), ECPG_COMPAT_PGSQL, ecpg_find_prepared_statement(), ecpg_get_connection(), ecpg_init(), and prepare_common().
Referenced by ecpg_auto_prepare(), main(), and test().
char* ECPGprepared_statement | ( | const char * | , |
const char * | , | ||
int | |||
) |
Definition at line 368 of file prepare.c.
References ecpg_get_connection(), and ecpg_prepared().
Referenced by main(), and test().
bool ECPGset_desc | ( | int | , |
const char * | , | ||
int | , | ||
... | |||
) |
Definition at line 607 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, variable::value, and variable::varcharsize.
Referenced by main().
bool ECPGset_desc_header | ( | int | , |
const char * | , | ||
int | |||
) |
Definition at line 575 of file descriptor.c.
References descriptor::count, and ecpg_find_desc().
Referenced by main().
void ECPGset_noind_null | ( | enum | ECPGttype, |
void * | |||
) |
Definition at line 319 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, and NUMERIC_NULL.
Referenced by ecpg_get_data(), ecpg_set_compat_sqlda(), ecpg_set_native_sqlda(), and rsetnull().
void ECPGset_var | ( | int | , |
void * | , | ||
int | |||
) |
Definition at line 526 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, sqlca_t::sqlcode, sqlca_t::sqlerrm, sqlca_t::sqlerrmc, sqlca_t::sqlerrml, and sqlca_t::sqlstate.
Referenced by ECPG_informix_set_var(), get_var1(), and main().
bool ECPGsetcommit | ( | int | , |
const char * | , | ||
const char * | |||
) |
Definition at line 165 of file connect.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, and PQtransactionStatus().
Referenced by main().
bool ECPGsetconn | ( | int | , |
const char * | |||
) |
Definition at line 202 of file connect.c.
References ecpg_get_connection(), ecpg_init(), and pthread_setspecific().
Referenced by main().
bool ECPGstatus | ( | int | , |
const char * | |||
) |
Definition at line 164 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 | , |
const char * | , | ||
const char * | |||
) |
Definition at line 198 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, and PQtransactionStatus().
Referenced by main(), and sql_check().
PGTransactionStatusType ECPGtransactionStatus | ( | const char * | ) |
Definition at line 182 of file misc.c.
References connection::connection, ecpg_get_connection(), PQTRANS_UNKNOWN, and PQtransactionStatus().
void sqlprint | ( | void | ) |
Definition at line 335 of file error.c.
References ecpg_gettext, ecpg_log(), ECPGget_sqlca(), fprintf, sqlca, sqlca_t::sqlerrm, sqlca_t::sqlerrmc, and sqlca_t::sqlerrml.
Referenced by check_result_of_insert(), fn(), main(), print(), print2(), and test().