16 #define POSTGRES_ECPG_INTERNAL
21 #include "catalog/pg_type_d.h"
56 buffer_len = 2 * length + 1;
61 if (length == escaped_len)
63 res[0] =
res[escaped_len + 1] =
'\'';
64 res[escaped_len + 2] =
'\0';
72 memmove(
res + 2,
res + 1, escaped_len);
74 res[1] =
res[escaped_len + 2] =
'\'';
75 res[escaped_len + 3] =
'\0';
104 #ifndef HAVE_USELOCALE
116 for (;
text[p] !=
'\0'; p++)
118 if (
string && !std_strings &&
text[p] ==
'\\')
120 else if (
text[p] ==
'\'')
121 string =
string ?
false :
true;
124 if (
text[p] ==
'$' && isdigit((
unsigned char)
text[p + 1]))
129 for (
i = p + 1; isdigit((
unsigned char)
text[
i]);
i++)
131 if (!isalpha((
unsigned char)
text[
i]) &&
132 isascii((
unsigned char)
text[
i]) &&
text[
i] !=
'_')
153 if (new_entry == NULL)
158 new_entry->
next = *cache;
171 if ((
stmt->connection->cache_head) == NULL)
177 #define not_an_array_in_ecpg ECPG_ARRAY_NONE
260 for (cache_entry = (
stmt->connection->cache_head); cache_entry != NULL; cache_entry = cache_entry->
next)
266 array_query = (
char *)
ecpg_alloc(strlen(
"select typlen from pg_type where oid= and typelem<>0") + 11,
stmt->lineno);
267 if (array_query == NULL)
270 sprintf(array_query,
"select typlen from pg_type where oid=%d and typelem<>0",
type);
271 query =
PQexec(
stmt->connection->connection, array_query);
324 ecpg_log(
"ecpg_store_result on line %d: incorrect number of matches; %d don't fit into array of %ld\n",
359 for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
360 len += strlen(
PQgetvalue(results, act_tuple, act_field)) + 1;
362 len += (ntuples + 1) *
sizeof(
char *);
368 for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
370 int slen = strlen(
PQgetvalue(results, act_tuple, act_field)) + 1;
389 for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
393 ecpg_log(
"ecpg_store_result on line %d: allocating memory for %d tuples\n",
stmt->lineno, ntuples);
418 char **current_string = (
char **) var->
value;
421 char *current_data_location = (
char *) ¤t_string[ntuples + 1];
423 for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
425 int len = strlen(
PQgetvalue(results, act_tuple, act_field)) + 1;
433 *current_string = current_data_location;
434 current_data_location +=
len;
440 *current_string = NULL;
444 for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
459 sprintf(ptr,
"%s%s",
"NaN", delim);
460 else if (isinf(
value))
463 sprintf(ptr,
"%s%s",
"-Infinity", delim);
465 sprintf(ptr,
"%s%s",
"Infinity", delim);
475 sprintf(ptr,
"%s%s",
"NaN", delim);
476 else if (isinf(
value))
479 sprintf(ptr,
"%s%s",
"-Infinity", delim);
481 sprintf(ptr,
"%s%s",
"Infinity", delim);
498 strcpy(to_data,
"'\\x");
507 char **tobeinserted_p,
bool quote)
509 char *mallocedval = NULL;
510 char *newcopy = NULL;
523 *tobeinserted_p =
"";
531 *tobeinserted_p = NULL;
536 *tobeinserted_p = NULL;
541 *tobeinserted_p = NULL;
545 if (*(
long long int *) var->
ind_value < (
long long) 0)
546 *tobeinserted_p = NULL;
552 *tobeinserted_p = NULL;
558 if (*tobeinserted_p != NULL)
567 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
572 strcpy(mallocedval,
"{");
577 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
582 *tobeinserted_p = mallocedval;
586 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
591 strcpy(mallocedval,
"{");
596 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
601 *tobeinserted_p = mallocedval;
605 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
610 strcpy(mallocedval,
"{");
613 sprintf(mallocedval + strlen(mallocedval),
"%hu,", ((
unsigned short *) var->
value)[
element]);
615 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
618 sprintf(mallocedval,
"%hu", *((
unsigned short *) var->
value));
620 *tobeinserted_p = mallocedval;
624 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
629 strcpy(mallocedval,
"{");
634 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
637 sprintf(mallocedval,
"%u", *((
unsigned int *) var->
value));
639 *tobeinserted_p = mallocedval;
643 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
648 strcpy(mallocedval,
"{");
653 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
658 *tobeinserted_p = mallocedval;
662 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
667 strcpy(mallocedval,
"{");
670 sprintf(mallocedval + strlen(mallocedval),
"%lu,", ((
unsigned long *) var->
value)[
element]);
672 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
675 sprintf(mallocedval,
"%lu", *((
unsigned long *) var->
value));
677 *tobeinserted_p = mallocedval;
681 if (!(mallocedval =
ecpg_alloc(asize * 30, lineno)))
686 strcpy(mallocedval,
"{");
689 sprintf(mallocedval + strlen(mallocedval),
"%lld,", ((
long long int *) var->
value)[
element]);
691 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
694 sprintf(mallocedval,
"%lld", *((
long long int *) var->
value));
696 *tobeinserted_p = mallocedval;
700 if (!(mallocedval =
ecpg_alloc(asize * 30, lineno)))
705 strcpy(mallocedval,
"{");
708 sprintf(mallocedval + strlen(mallocedval),
"%llu,", ((
unsigned long long int *) var->
value)[
element]);
710 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
713 sprintf(mallocedval,
"%llu", *((
unsigned long long int *) var->
value));
715 *tobeinserted_p = mallocedval;
719 if (!(mallocedval =
ecpg_alloc(asize * 25, lineno)))
724 strcpy(mallocedval,
"{");
729 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
734 *tobeinserted_p = mallocedval;
738 if (!(mallocedval =
ecpg_alloc(asize * 25, lineno)))
743 strcpy(mallocedval,
"{");
748 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
753 *tobeinserted_p = mallocedval;
762 strcpy(mallocedval,
"{");
765 sprintf(mallocedval + strlen(mallocedval),
"%c,", (((
bool *) var->
value)[
element]) ?
't' :
'f');
767 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
771 if (var->
offset ==
sizeof(
char))
772 sprintf(mallocedval,
"%c", (*((
char *) var->
value)) ?
't' :
'f');
773 else if (var->
offset ==
sizeof(
int))
774 sprintf(mallocedval,
"%c", (*((
int *) var->
value)) ?
't' :
'f');
779 *tobeinserted_p = mallocedval;
789 if (!(newcopy =
ecpg_alloc(slen + 1, lineno)))
792 strncpy(newcopy, (
char *) var->
value, slen);
793 newcopy[slen] =
'\0';
802 *tobeinserted_p = mallocedval;
808 int slen = strlen((
char *) var->
value);
810 if (!(mallocedval =
ecpg_alloc(slen + 1, lineno)))
813 strncpy(mallocedval, (
char *) var->
value, slen);
814 mallocedval[slen] =
'\0';
816 *tobeinserted_p = mallocedval;
829 *tobeinserted_p = mallocedval;
851 *tobeinserted_p = mallocedval;
897 if (!(newcopy =
ecpg_realloc(mallocedval, strlen(mallocedval) + slen + 2, lineno)))
903 mallocedval = newcopy;
906 memcpy(mallocedval + strlen(mallocedval),
str, slen + 1);
908 strcpy(mallocedval + strlen(mallocedval),
",");
914 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
916 *tobeinserted_p = mallocedval;
944 if (!(newcopy =
ecpg_realloc(mallocedval, strlen(mallocedval) + slen + 2, lineno)))
950 mallocedval = newcopy;
953 memcpy(mallocedval + strlen(mallocedval),
str, slen + 1);
955 strcpy(mallocedval + strlen(mallocedval),
",");
961 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
963 *tobeinserted_p = mallocedval;
991 if (!(newcopy =
ecpg_realloc(mallocedval, strlen(mallocedval) + slen + 2, lineno)))
997 mallocedval = newcopy;
1000 memcpy(mallocedval + strlen(mallocedval),
str, slen + 1);
1002 strcpy(mallocedval + strlen(mallocedval),
",");
1008 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
1010 *tobeinserted_p = mallocedval;
1038 if (!(newcopy =
ecpg_realloc(mallocedval, strlen(mallocedval) + slen + 2, lineno)))
1044 mallocedval = newcopy;
1047 memcpy(mallocedval + strlen(mallocedval),
str, slen + 1);
1049 strcpy(mallocedval + strlen(mallocedval),
",");
1055 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
1057 *tobeinserted_p = mallocedval;
1079 bool malloced =
false;
1083 else if (!is_binary)
1088 if (value_s != NULL)
1095 value_s =
"no memory for logging of parameter";
1098 ecpg_log(
"ecpg_free_params on line %d: parameter %d = %s\n",
1099 lineno, nth, value_s);
1110 for (n = 0; n <
stmt->nparams; n++)
1114 stmt->paramformats[n],
stmt->lineno, n + 1);
1120 stmt->paramvalues = NULL;
1121 stmt->paramlengths = NULL;
1122 stmt->paramformats = NULL;
1132 + strlen(tobeinserted)
1133 + 1,
stmt->lineno)))
1139 strcpy(newcopy,
stmt->command);
1140 strcpy(newcopy + position - 1, tobeinserted);
1152 stmt->command = newcopy;
1160 char **tobeinserted)
1173 memcpy(*tobeinserted, desc_item->
data, desc_item->
data_len);
1216 int desc_counter = 0;
1219 bool std_strings =
false;
1240 tobeinserted = NULL;
1242 binary_format =
false;
1262 for (desc_item = desc->
items; desc_item; desc_item = desc_item->
next)
1264 if (desc_item->
num != desc_counter)
1272 binary_length = desc_item->
data_len;
1273 binary_format =
true;
1277 if (desc->
count == desc_counter)
1292 for (
i = 0;
i < sqlda->
sqld;
i++)
1294 if (
i + 1 == desc_counter)
1299 switch (desc_inlist.type)
1306 desc_inlist.varcharsize = 0;
1309 desc_inlist.arrsize = 1;
1310 desc_inlist.offset = 0;
1319 desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = 1;
1320 desc_inlist.ind_offset = 0;
1325 desc_inlist.ind_value = desc_inlist.ind_pointer = NULL;
1326 desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = desc_inlist.ind_offset = 0;
1334 if (sqlda->
sqld == desc_counter)
1347 for (
i = 0;
i < sqlda->
sqln;
i++)
1349 if (
i + 1 == desc_counter)
1354 switch (desc_inlist.type)
1361 desc_inlist.varcharsize = 0;
1364 desc_inlist.arrsize = 1;
1365 desc_inlist.offset = 0;
1374 desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = 1;
1375 desc_inlist.ind_offset = 0;
1380 desc_inlist.ind_value = desc_inlist.ind_pointer = NULL;
1381 desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = desc_inlist.ind_offset = 0;
1389 if (sqlda->
sqln == desc_counter)
1401 binary_format =
true;
1409 if ((position =
next_insert(
stmt->command, position,
stmt->questionmarks, std_strings) + 1) == 0)
1430 int ph_len = (
stmt->command[position] ==
'?') ? strlen(
"?") : strlen(
"$1");
1437 tobeinserted = NULL;
1445 else if (
stmt->command[position] ==
'0')
1470 tobeinserted = NULL;
1494 tobeinserted = NULL;
1498 bool realloc_failed =
false;
1499 char **newparamvalues;
1500 int *newparamlengths;
1501 int *newparamformats;
1504 if ((newparamvalues = (
char **)
ecpg_realloc(
stmt->paramvalues,
sizeof(
char *) * (
stmt->nparams + 1),
stmt->lineno)))
1505 stmt->paramvalues = newparamvalues;
1507 realloc_failed =
true;
1510 stmt->paramlengths = newparamlengths;
1512 realloc_failed =
true;
1515 stmt->paramformats = newparamformats;
1517 realloc_failed =
true;
1527 stmt->paramvalues[
stmt->nparams] = tobeinserted;
1528 stmt->paramlengths[
stmt->nparams] = binary_length;
1529 stmt->paramformats[
stmt->nparams] = (binary_format ? 1 : 0);
1533 if (
stmt->command[position] ==
'?')
1536 int buffersize =
sizeof(int) * CHAR_BIT * 10 / 3;
1539 if (!(tobeinserted = (
char *)
ecpg_alloc(buffersize,
stmt->lineno)))
1545 snprintf(tobeinserted, buffersize,
"$%d", counter++);
1552 tobeinserted = NULL;
1556 if (desc_counter == 0)
1585 stmt->results =
PQexec(
stmt->connection->connection,
"begin transaction");
1592 stmt->results = NULL;
1604 ecpg_log(
"ecpg_execute on line %d: query: %s; with %d parameter(s) on connection %s\n",
stmt->lineno,
stmt->command,
stmt->nparams,
stmt->connection->name);
1610 (
const char *
const *)
stmt->paramvalues,
1611 (
const int *)
stmt->paramlengths,
1612 (
const int *)
stmt->paramformats,
1614 ecpg_log(
"ecpg_execute on line %d: using PQexecPrepared for \"%s\"\n",
stmt->lineno,
stmt->command);
1618 if (
stmt->nparams == 0)
1621 ecpg_log(
"ecpg_execute on line %d: using PQexec\n",
stmt->lineno);
1626 stmt->command,
stmt->nparams, NULL,
1627 (
const char *
const *)
stmt->paramvalues,
1628 (
const int *)
stmt->paramlengths,
1629 (
const int *)
stmt->paramformats,
1632 ecpg_log(
"ecpg_execute on line %d: using PQexecParams\n",
stmt->lineno);
1674 bool status =
false;
1689 var =
stmt->outlist;
1696 ecpg_log(
"ecpg_process_output on line %d: correctly got %d tuples with %d fields\n",
stmt->lineno, ntuples, nfields);
1702 ecpg_log(
"ecpg_process_output on line %d: incorrect number of matches (%d)\n",
1703 stmt->lineno, ntuples);
1719 clear_result =
false;
1720 ecpg_log(
"ecpg_process_output on line %d: putting result (%d tuples) into descriptor %s\n",
1740 sqlda_new = sqlda->desc_next;
1744 *_sqlda = sqlda = sqlda_new = NULL;
1745 for (
i = ntuples - 1;
i >= 0;
i--)
1758 sqlda_new = sqlda->desc_next;
1764 ecpg_log(
"ecpg_process_output on line %d: out of memory allocating a new sqlda\n",
stmt->lineno);
1770 ecpg_log(
"ecpg_process_output on line %d: new sqlda was built\n",
stmt->lineno);
1772 *_sqlda = sqlda_new;
1775 ecpg_log(
"ecpg_process_output on line %d: putting result (1 tuple %d fields) into sqlda descriptor\n",
1778 sqlda_new->desc_next = sqlda;
1796 sqlda_new = sqlda->desc_next;
1800 *_sqlda = sqlda = sqlda_new = NULL;
1801 for (
i = ntuples - 1;
i >= 0;
i--)
1814 sqlda_new = sqlda->desc_next;
1820 ecpg_log(
"ecpg_process_output on line %d: out of memory allocating a new sqlda\n",
stmt->lineno);
1826 ecpg_log(
"ecpg_process_output on line %d: new sqlda was built\n",
stmt->lineno);
1828 *_sqlda = sqlda_new;
1831 ecpg_log(
"ecpg_process_output on line %d: putting result (1 tuple %d fields) into sqlda descriptor\n",
1834 sqlda_new->desc_next = sqlda;
1843 for (act_field = 0; act_field < nfields && status; act_field++)
1857 if (status && var != NULL)
1869 ecpg_log(
"ecpg_process_output on line %d: OK: %s\n",
stmt->lineno, cmdstat);
1871 !
sqlca->sqlerrd[2] &&
1872 (strncmp(cmdstat,
"UPDATE", 6) == 0
1873 || strncmp(cmdstat,
"INSERT", 6) == 0
1874 || strncmp(cmdstat,
"DELETE", 6) == 0))
1882 ecpg_log(
"ecpg_process_output on line %d: COPY OUT data transfer in progress\n",
stmt->lineno);
1895 ecpg_log(
"ecpg_process_output on line %d: got PGRES_COMMAND_OK after PGRES_COPY_OUT\n",
stmt->lineno);
1907 ecpg_log(
"ecpg_process_output on line %d: unknown execution status type\n",
1917 stmt->results = NULL;
1922 while ((notify =
PQnotifies(
stmt->connection->connection)) != NULL)
1924 ecpg_log(
"ecpg_process_output on line %d: asynchronous notification of \"%s\" from backend PID %d received\n",
1954 bool is_prepared_name_set;
1968 if (!
ecpg_init(con, connection_name, lineno))
1984 #ifdef HAVE_USELOCALE
1991 stmt->oldlocale = uselocale(ecpg_clocale);
1998 #ifdef HAVE__CONFIGTHREADLOCALE
1999 stmt->oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
2002 if (
stmt->oldlocale == NULL)
2026 stmt->command = prepname;
2053 stmt->connection = con;
2082 is_prepared_name_set =
false;
2176 is_prepared_name_set =
true;
2216 #ifdef HAVE_USELOCALE
2218 uselocale(
stmt->oldlocale);
2220 if (
stmt->oldlocale)
2222 #ifdef HAVE__CONFIGTHREADLOCALE
2229 if (
stmt->oldthreadlocale != -1)
2230 (void) _configthreadlocale(
stmt->oldthreadlocale);
void print(const void *obj)
#define Assert(condition)
#define ESCAPE_STRING_SYNTAX
void ecpg_pthreads_init(void)
struct connection * ecpg_get_connection(const char *connection_name)
unsigned ecpg_hex_enc_len(unsigned srclen)
bool ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, enum ECPGttype type, enum ECPGttype ind_type, char *var, char *ind, long varcharsize, long offset, long ind_offset, enum ARRAY_TYPE isarray, enum COMPAT_MODE compat, bool force_indicator)
unsigned ecpg_hex_encode(const char *src, unsigned len, char *dst)
static void PGresult * res
#define ECPG_CONVERT_BOOL
#define ECPG_TOO_MANY_ARGUMENTS
#define ECPG_TOO_FEW_ARGUMENTS
#define ECPG_INVALID_STMT
#define ECPG_INFORMIX_SUBSELECT_NOT_ONE
#define ECPG_TOO_MANY_MATCHES
#define ECPG_OUT_OF_MEMORY
struct descriptor * ecpg_find_desc(int line, const char *name)
bool ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMPAT_MODE compat)
#define ECPG_SQLSTATE_NO_DATA
struct sqlda_struct * ecpg_build_native_sqlda(int line, PGresult *res, int row, enum COMPAT_MODE compat)
char * ecpg_auto_alloc(long size, int lineno)
#define ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY
@ ECPG_COMPAT_INFORMIX_SE
#define ECPG_SQLSTATE_ECPG_INTERNAL_ERROR
const char * ecpg_type_name(enum ECPGttype typ)
bool ecpg_register_prepared_stmt(struct statement *stmt)
void ecpg_log(const char *format,...) pg_attribute_printf(1
void bool ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, char **name, const char *query)
void ecpg_clear_auto_mem(void)
bool ecpg_init(const struct connection *con, const char *connection_name, const int lineno)
#define ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS
char * ecpg_alloc(long size, int lineno)
#define ECPG_SQLSTATE_CARDINALITY_VIOLATION
void ecpg_set_compat_sqlda(int lineno, struct sqlda_compat **_sqlda, const PGresult *res, int row, enum COMPAT_MODE compat)
#define ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS
char * ecpg_strdup(const char *string, int lineno)
#define ECPG_SQLSTATE_DATATYPE_MISMATCH
char * ecpg_prepared(const char *name, struct connection *con)
void ecpg_set_native_sqlda(int lineno, struct sqlda_struct **_sqlda, const PGresult *res, int row, enum COMPAT_MODE compat)
int ecpg_dynamic_type(Oid type)
char * ecpg_realloc(void *ptr, long size, int lineno)
void ecpg_raise(int line, int code, const char *sqlstate, const char *str)
struct sqlda_compat * ecpg_build_compat_sqlda(int line, PGresult *res, int row, enum COMPAT_MODE compat)
void ecpg_free(void *ptr)
void ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat)
#define ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME
@ ECPGst_exec_with_exprlist
@ ECPGt_unsigned_long_long
static bool ecpg_type_infocache_push(struct ECPGtype_information_cache **cache, int oid, enum ARRAY_TYPE isarray, int lineno)
bool ecpg_build_params(struct statement *stmt)
bool ecpg_store_result(const PGresult *results, int act_field, const struct statement *stmt, struct variable *var)
static void sprintf_double_value(char *ptr, double value, const char *delim)
static void print_param_value(char *value, int len, int is_binary, int lineno, int nth)
static bool insert_tobeinserted(int position, int ph_len, struct statement *stmt, char *tobeinserted)
static char * quote_postgres(char *arg, bool quote, int lineno)
bool ecpg_execute(struct statement *stmt)
void ecpg_free_params(struct statement *stmt, bool print)
static enum ARRAY_TYPE ecpg_is_type_an_array(int type, const struct statement *stmt, const struct variable *var)
bool ecpg_store_input(const int lineno, const bool force_indicator, const struct variable *var, char **tobeinserted_p, bool quote)
static bool store_input_from_desc(struct statement *stmt, struct descriptor_item *desc_item, char **tobeinserted)
static void sprintf_float_value(char *ptr, float value, const char *delim)
void ecpg_do_epilogue(struct statement *stmt)
static char * convert_bytea_to_string(char *from_data, int from_len, int lineno)
bool ecpg_do(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query, va_list args)
static void free_variable(struct variable *var)
bool ecpg_do_prologue(int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, enum ECPG_statement_type statement_type, const char *query, va_list args, struct statement **stmt_out)
bool ecpg_process_output(struct statement *stmt, bool clear_result)
bool ecpg_autostart_transaction(struct statement *stmt)
bool ECPGdo_descriptor(int line, const char *connection, const char *descriptor, const char *query)
static void free_statement(struct statement *stmt)
#define not_an_array_in_ecpg
static int next_insert(char *text, int pos, bool questionmarks, bool std_strings)
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,...)
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
PGTransactionStatusType PQtransactionStatus(const PGconn *conn)
int PQgetlength(const PGresult *res, int tup_num, int field_num)
void PQfreemem(void *ptr)
PGnotify * PQnotifies(PGconn *conn)
Oid PQftype(const PGresult *res, int field_num)
PGresult * PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
ExecStatusType PQresultStatus(const PGresult *res)
char * PQcmdTuples(PGresult *res)
char * PQresultErrorMessage(const PGresult *res)
int PQfformat(const PGresult *res, int field_num)
int PQntuples(const PGresult *res)
PGresult * PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
PGresult * PQexec(PGconn *conn, const char *query)
size_t PQescapeString(char *to, const char *from, size_t length)
int PQconsumeInput(PGconn *conn)
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
char * PQcmdStatus(PGresult *res)
Oid PQoidValue(const PGresult *res)
int PQnfields(const PGresult *res)
PGresult * PQgetResult(PGconn *conn)
int PQgetCopyData(PGconn *conn, char **buffer, int async)
bool ECPGis_noind_null(enum ECPGttype type, const void *ptr)
struct sqlca_t * ECPGget_sqlca(void)
if(TABLE==NULL||TABLE_index==NULL)
char * PGTYPESdate_to_asc(date dDate)
char * PGTYPESinterval_to_asc(interval *span)
int PGTYPESnumeric_copy(numeric *src, numeric *dst)
int PGTYPESnumeric_from_decimal(decimal *src, numeric *dst)
char * PGTYPESnumeric_to_asc(numeric *num, int dscale)
numeric * PGTYPESnumeric_new(void)
void PGTYPESnumeric_free(numeric *var)
char * PGTYPEStimestamp_to_asc(timestamp tstamp)
static chr element(struct vars *v, const chr *startp, const chr *endp)
struct descriptor_item * next
struct descriptor_item * items
struct sqlvar_compat * sqlvar
struct sqlvar_struct sqlvar[1]
enum ECPG_statement_type statement_type