16 #define POSTGRES_ECPG_INTERNAL 21 #include "catalog/pg_type_d.h" 56 buffer_len = 2 * length + 1;
57 res = (
char *)
ecpg_alloc(buffer_len + 3, lineno);
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 #ifdef HAVE_USELOCALE 106 freelocale(stmt->clocale);
119 for (; text[p] !=
'\0'; p++)
121 if (
string && !std_strings && text[p] ==
'\\')
123 else if (text[p] ==
'\'')
124 string =
string ?
false :
true;
127 if (text[p] ==
'$' && isdigit((
unsigned char) text[p + 1]))
132 for (i = p + 1; isdigit((
unsigned char) text[i]); i++)
134 if (!isalpha((
unsigned char) text[i]) &&
135 isascii((
unsigned char) text[i]) && text[
i] !=
'_')
139 else if (questionmarks && text[p] ==
'?')
156 if (new_entry == NULL)
161 new_entry->
next = *cache;
180 #define not_an_array_in_ecpg ECPG_ARRAY_NONE 265 if (cache_entry->
oid == type)
269 array_query = (
char *)
ecpg_alloc(strlen(
"select typlen from pg_type where oid= and typelem<>0") + 11, stmt->
lineno);
270 if (array_query == NULL)
273 sprintf(array_query,
"select typlen from pg_type where oid=%d and typelem<>0", type);
327 ecpg_log(
"ecpg_store_result on line %d: incorrect number of matches; %d don't fit into array of %ld\n",
362 for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
363 len += strlen(
PQgetvalue(results, act_tuple, act_field)) + 1;
365 len += (ntuples + 1) *
sizeof(
char *);
371 for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
373 int len = strlen(
PQgetvalue(results, act_tuple, act_field)) + 1;
379 len = var->
offset * ntuples;
386 len = var->
offset * ntuples;
392 for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
396 ecpg_log(
"ecpg_store_result on line %d: allocating memory for %d tuples\n", stmt->
lineno, ntuples);
421 char **current_string = (
char **) var->
value;
424 char *current_data_location = (
char *) ¤t_string[ntuples + 1];
426 for (act_tuple = 0; act_tuple < ntuples &&
status; act_tuple++)
428 int len = strlen(
PQgetvalue(results, act_tuple, act_field)) + 1;
436 *current_string = current_data_location;
437 current_data_location += len;
443 *current_string = NULL;
447 for (act_tuple = 0; act_tuple < ntuples &&
status; act_tuple++)
462 sprintf(ptr,
"%s%s",
"NaN", delim);
463 else if (isinf(value))
466 sprintf(ptr,
"%s%s",
"-Infinity", delim);
468 sprintf(ptr,
"%s%s",
"Infinity", delim);
471 sprintf(ptr,
"%.15g%s", value, delim);
478 sprintf(ptr,
"%s%s",
"NaN", delim);
479 else if (isinf(value))
482 sprintf(ptr,
"%s%s",
"-Infinity", delim);
484 sprintf(ptr,
"%s%s",
"Infinity", delim);
487 sprintf(ptr,
"%.15g%s", value, delim);
501 strcpy(to_data,
"'\\x");
510 char **tobeinserted_p,
bool quote)
512 char *mallocedval = NULL;
513 char *newcopy = NULL;
526 *tobeinserted_p =
"";
534 *tobeinserted_p = NULL;
539 *tobeinserted_p = NULL;
544 *tobeinserted_p = NULL;
548 if (*(
long long int *) var->
ind_value < (
long long) 0)
549 *tobeinserted_p = NULL;
552 if (force_indicator ==
false)
555 *tobeinserted_p = NULL;
561 if (*tobeinserted_p != NULL)
570 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
575 strcpy(mallocedval,
"{");
577 for (element = 0; element < asize; element++)
578 sprintf(mallocedval + strlen(mallocedval),
"%hd,", ((
short *) var->
value)[element]);
580 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
585 *tobeinserted_p = mallocedval;
589 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
594 strcpy(mallocedval,
"{");
596 for (element = 0; element < asize; element++)
597 sprintf(mallocedval + strlen(mallocedval),
"%d,", ((
int *) var->
value)[element]);
599 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
604 *tobeinserted_p = mallocedval;
608 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
613 strcpy(mallocedval,
"{");
615 for (element = 0; element < asize; element++)
616 sprintf(mallocedval + strlen(mallocedval),
"%hu,", ((
unsigned short *) var->
value)[element]);
618 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
621 sprintf(mallocedval,
"%hu", *((
unsigned short *) var->
value));
623 *tobeinserted_p = mallocedval;
627 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
632 strcpy(mallocedval,
"{");
634 for (element = 0; element < asize; element++)
635 sprintf(mallocedval + strlen(mallocedval),
"%u,", ((
unsigned int *) var->
value)[element]);
637 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
640 sprintf(mallocedval,
"%u", *((
unsigned int *) var->
value));
642 *tobeinserted_p = mallocedval;
646 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
651 strcpy(mallocedval,
"{");
653 for (element = 0; element < asize; element++)
654 sprintf(mallocedval + strlen(mallocedval),
"%ld,", ((
long *) var->
value)[element]);
656 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
661 *tobeinserted_p = mallocedval;
665 if (!(mallocedval =
ecpg_alloc(asize * 20, lineno)))
670 strcpy(mallocedval,
"{");
672 for (element = 0; element < asize; element++)
673 sprintf(mallocedval + strlen(mallocedval),
"%lu,", ((
unsigned long *) var->
value)[element]);
675 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
678 sprintf(mallocedval,
"%lu", *((
unsigned long *) var->
value));
680 *tobeinserted_p = mallocedval;
684 if (!(mallocedval =
ecpg_alloc(asize * 30, lineno)))
689 strcpy(mallocedval,
"{");
691 for (element = 0; element < asize; element++)
692 sprintf(mallocedval + strlen(mallocedval),
"%lld,", ((
long long int *) var->
value)[element]);
694 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
697 sprintf(mallocedval,
"%lld", *((
long long int *) var->
value));
699 *tobeinserted_p = mallocedval;
703 if (!(mallocedval =
ecpg_alloc(asize * 30, lineno)))
708 strcpy(mallocedval,
"{");
710 for (element = 0; element < asize; element++)
711 sprintf(mallocedval + strlen(mallocedval),
"%llu,", ((
unsigned long long int *) var->
value)[element]);
713 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
716 sprintf(mallocedval,
"%llu", *((
unsigned long long int *) var->
value));
718 *tobeinserted_p = mallocedval;
722 if (!(mallocedval =
ecpg_alloc(asize * 25, lineno)))
727 strcpy(mallocedval,
"{");
729 for (element = 0; element < asize; element++)
732 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
737 *tobeinserted_p = mallocedval;
741 if (!(mallocedval =
ecpg_alloc(asize * 25, lineno)))
746 strcpy(mallocedval,
"{");
748 for (element = 0; element < asize; element++)
751 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
756 *tobeinserted_p = mallocedval;
765 strcpy(mallocedval,
"{");
767 for (element = 0; element < asize; element++)
768 sprintf(mallocedval + strlen(mallocedval),
"%c,", (((
bool *) var->
value)[element]) ?
't' :
'f');
770 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
774 if (var->
offset ==
sizeof(
char))
775 sprintf(mallocedval,
"%c", (*((
char *) var->
value)) ?
't' :
'f');
776 else if (var->
offset ==
sizeof(
int))
777 sprintf(mallocedval,
"%c", (*((
int *) var->
value)) ?
't' :
'f');
782 *tobeinserted_p = mallocedval;
792 if (!(newcopy =
ecpg_alloc(slen + 1, lineno)))
795 strncpy(newcopy, (
char *) var->
value, slen);
796 newcopy[slen] =
'\0';
805 *tobeinserted_p = mallocedval;
811 int slen = strlen((
char *) var->
value);
813 if (!(mallocedval =
ecpg_alloc(slen + 1, lineno)))
816 strncpy(mallocedval, (
char *) var->
value, slen);
817 mallocedval[slen] =
'\0';
819 *tobeinserted_p = mallocedval;
828 if (!(mallocedval = (
char *)
ecpg_alloc(variable->
len, lineno)))
831 memcpy(mallocedval, variable->
arr, variable->
len);
832 *tobeinserted_p = mallocedval;
841 if (!(newcopy = (
char *)
ecpg_alloc(variable->
len + 1, lineno)))
844 strncpy(newcopy, variable->
arr, variable->
len);
845 newcopy[variable->
len] =
'\0';
854 *tobeinserted_p = mallocedval;
873 for (element = 0; element < asize; element++)
900 if (!(newcopy =
ecpg_realloc(mallocedval, strlen(mallocedval) + slen + 2, lineno)))
906 mallocedval = newcopy;
909 memcpy(mallocedval + strlen(mallocedval), str, slen + 1);
911 strcpy(mallocedval + strlen(mallocedval),
",");
917 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
919 *tobeinserted_p = mallocedval;
936 for (element = 0; element < asize; element++)
947 if (!(newcopy =
ecpg_realloc(mallocedval, strlen(mallocedval) + slen + 2, lineno)))
953 mallocedval = newcopy;
956 memcpy(mallocedval + strlen(mallocedval), str, slen + 1);
958 strcpy(mallocedval + strlen(mallocedval),
",");
964 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
966 *tobeinserted_p = mallocedval;
983 for (element = 0; element < asize; element++)
994 if (!(newcopy =
ecpg_realloc(mallocedval, strlen(mallocedval) + slen + 2, lineno)))
1000 mallocedval = newcopy;
1003 memcpy(mallocedval + strlen(mallocedval), str, slen + 1);
1005 strcpy(mallocedval + strlen(mallocedval),
",");
1011 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
1013 *tobeinserted_p = mallocedval;
1030 for (element = 0; element < asize; element++)
1041 if (!(newcopy =
ecpg_realloc(mallocedval, strlen(mallocedval) + slen + 2, lineno)))
1047 mallocedval = newcopy;
1050 memcpy(mallocedval + strlen(mallocedval), str, slen + 1);
1052 strcpy(mallocedval + strlen(mallocedval),
",");
1058 strcpy(mallocedval + strlen(mallocedval) - 1,
"}");
1060 *tobeinserted_p = mallocedval;
1082 bool malloced =
false;
1086 else if (!is_binary)
1091 if (value_s != NULL)
1098 value_s =
"no memory for logging of parameter";
1101 ecpg_log(
"ecpg_free_params on line %d: parameter %d = %s\n",
1102 lineno, nth, value_s);
1113 for (n = 0; n < stmt->
nparams; n++)
1135 + strlen(tobeinserted)
1142 strcpy(newcopy, stmt->
command);
1143 strcpy(newcopy + position - 1, tobeinserted);
1163 char **tobeinserted)
1176 memcpy(*tobeinserted, desc_item->
data, desc_item->
data_len);
1219 int desc_counter = 0;
1222 bool std_strings =
false;
1226 if (value && strcmp(value,
"on") == 0)
1243 tobeinserted = NULL;
1245 binary_format =
false;
1265 for (desc_item = desc->
items; desc_item; desc_item = desc_item->
next)
1267 if (desc_item->
num != desc_counter)
1275 binary_length = desc_item->
data_len;
1276 binary_format =
true;
1280 if (desc->
count == desc_counter)
1295 for (
i = 0;
i < sqlda->
sqld;
i++)
1297 if (
i + 1 == desc_counter)
1302 switch (desc_inlist.type)
1309 desc_inlist.varcharsize = 0;
1312 desc_inlist.arrsize = 1;
1313 desc_inlist.offset = 0;
1322 desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = 1;
1323 desc_inlist.ind_offset = 0;
1328 desc_inlist.ind_value = desc_inlist.ind_pointer = NULL;
1329 desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = desc_inlist.ind_offset = 0;
1337 if (sqlda->
sqld == desc_counter)
1350 for (
i = 0;
i < sqlda->
sqln;
i++)
1352 if (
i + 1 == desc_counter)
1357 switch (desc_inlist.type)
1364 desc_inlist.varcharsize = 0;
1367 desc_inlist.arrsize = 1;
1368 desc_inlist.offset = 0;
1377 desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = 1;
1378 desc_inlist.ind_offset = 0;
1383 desc_inlist.ind_value = desc_inlist.ind_pointer = NULL;
1384 desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = desc_inlist.ind_offset = 0;
1392 if (sqlda->
sqln == desc_counter)
1405 binary_format =
true;
1434 int ph_len = (stmt->
command[position] ==
'?') ? strlen(
"?") : strlen(
"$1");
1441 tobeinserted = NULL;
1449 else if (stmt->
command[position] ==
'0')
1464 sprintf(str,
"\"%s\"", tobeinserted);
1474 tobeinserted = NULL;
1498 tobeinserted = NULL;
1502 bool realloc_failed =
false;
1503 char **newparamvalues;
1504 int *newparamlengths;
1505 int *newparamformats;
1511 realloc_failed =
true;
1516 realloc_failed =
true;
1521 realloc_failed =
true;
1537 if (stmt->
command[position] ==
'?')
1540 int buffersize =
sizeof(int) * CHAR_BIT * 10 / 3;
1549 snprintf(tobeinserted, buffersize,
"$%d", counter++);
1556 tobeinserted = NULL;
1560 if (desc_counter == 0)
1618 ecpg_log(
"ecpg_execute on line %d: using PQexecPrepared for \"%s\"\n", stmt->
lineno, stmt->
command);
1625 ecpg_log(
"ecpg_execute on line %d: using PQexec\n", stmt->
lineno);
1636 ecpg_log(
"ecpg_execute on line %d: using PQexecParams\n", stmt->
lineno);
1700 ecpg_log(
"ecpg_process_output on line %d: correctly got %d tuples with %d fields\n", stmt->
lineno, ntuples, nfields);
1706 ecpg_log(
"ecpg_process_output on line %d: incorrect number of matches (%d)\n",
1724 clear_result =
false;
1725 ecpg_log(
"ecpg_process_output on line %d: putting result (%d tuples) into descriptor %s\n",
1745 sqlda_new = sqlda->desc_next;
1749 *_sqlda = sqlda = sqlda_new = NULL;
1750 for (
i = ntuples - 1;
i >= 0;
i--)
1763 sqlda_new = sqlda->desc_next;
1769 ecpg_log(
"ecpg_process_output on line %d: out of memory allocating a new sqlda\n", stmt->
lineno);
1775 ecpg_log(
"ecpg_process_output on line %d: new sqlda was built\n", stmt->
lineno);
1777 *_sqlda = sqlda_new;
1780 ecpg_log(
"ecpg_process_output on line %d: putting result (1 tuple %d fields) into sqlda descriptor\n",
1783 sqlda_new->desc_next = sqlda;
1801 sqlda_new = sqlda->desc_next;
1805 *_sqlda = sqlda = sqlda_new = NULL;
1806 for (
i = ntuples - 1;
i >= 0;
i--)
1819 sqlda_new = sqlda->desc_next;
1825 ecpg_log(
"ecpg_process_output on line %d: out of memory allocating a new sqlda\n", stmt->
lineno);
1831 ecpg_log(
"ecpg_process_output on line %d: new sqlda was built\n", stmt->
lineno);
1833 *_sqlda = sqlda_new;
1836 ecpg_log(
"ecpg_process_output on line %d: putting result (1 tuple %d fields) into sqlda descriptor\n",
1839 sqlda_new->desc_next = sqlda;
1848 for (act_field = 0; act_field < nfields &&
status; act_field++)
1862 if (status && var != NULL)
1874 ecpg_log(
"ecpg_process_output on line %d: OK: %s\n", stmt->
lineno, cmdstat);
1877 (strncmp(cmdstat,
"UPDATE", 6) == 0
1878 || strncmp(cmdstat,
"INSERT", 6) == 0
1879 || strncmp(cmdstat,
"DELETE", 6) == 0))
1887 ecpg_log(
"ecpg_process_output on line %d: COPY OUT data transfer in progress\n", stmt->
lineno);
1900 ecpg_log(
"ecpg_process_output on line %d: got PGRES_COMMAND_OK after PGRES_COPY_OUT\n", stmt->
lineno);
1912 ecpg_log(
"ecpg_process_output on line %d: unknown execution status type\n",
1929 ecpg_log(
"ecpg_process_output on line %d: asynchronous notification of \"%s\" from backend PID %d received\n",
1959 bool is_prepared_name_set;
1982 #ifdef HAVE_USELOCALE 1983 stmt->clocale = newlocale(LC_NUMERIC_MASK,
"C", (
locale_t) 0);
1989 stmt->
oldlocale = uselocale(stmt->clocale);
1996 #ifdef HAVE__CONFIGTHREADLOCALE 1997 stmt->oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
2008 #ifdef ENABLE_THREAD_SAFETY 2009 ecpg_pthreads_init();
2014 if (!
ecpg_init(con, connection_name, lineno))
2092 is_prepared_name_set =
false;
2114 var->
pointer = va_arg(args,
char *);
2117 var->
arrsize = va_arg(args,
long);
2118 var->
offset = va_arg(args,
long);
2175 for (ptr = *list; ptr && ptr->
next; ptr = ptr->
next)
2186 is_prepared_name_set =
true;
2226 #ifdef HAVE_USELOCALE 2232 #ifdef HAVE__CONFIGTHREADLOCALE 2239 if (stmt->oldthreadlocale != -1)
2240 (void) _configthreadlocale(stmt->oldthreadlocale);
2259 query, args, &stmt))
2292 va_start(args, query);
2293 ret =
ecpg_do(lineno, compat, force_indicator, connection_name,
2294 questionmarks, st, query, args);
bool ecpg_register_prepared_stmt(struct statement *)
int PQgetlength(const PGresult *res, int tup_num, int field_num)
static bool insert_tobeinserted(int position, int ph_len, struct statement *stmt, char *tobeinserted)
PGresult * PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
int PQnfields(const PGresult *res)
bool ecpg_store_result(const PGresult *results, int act_field, const struct statement *stmt, struct variable *var)
static void sprintf_float_value(char *ptr, float value, const char *delim)
int PGTYPESnumeric_copy(numeric *, numeric *)
char arr[FLEXIBLE_ARRAY_MEMBER]
void ecpg_free_params(struct statement *stmt, bool print)
bool ecpg_process_output(struct statement *stmt, bool clear_result)
static bool ecpg_type_infocache_push(struct ECPGtype_information_cache **cache, int oid, enum ARRAY_TYPE isarray, int lineno)
void print(const void *obj)
size_t PQescapeString(char *to, const char *from, size_t length)
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
PGnotify * PQnotifies(PGconn *conn)
#define ECPG_SQLSTATE_ECPG_INTERNAL_ERROR
void ecpg_raise(int line, int code, const char *sqlstate, const char *str)
int ecpg_dynamic_type(Oid)
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,...)
char * PQcmdTuples(PGresult *res)
char * ecpg_realloc(void *, long, int)
#define ECPG_INVALID_STMT
unsigned ecpg_hex_enc_len(unsigned srclen)
#define ECPG_SQLSTATE_NO_DATA
Oid PQoidValue(const PGresult *res)
enum ECPG_statement_type statement_type
char * ecpg_strdup(const char *, int)
int PGTYPESnumeric_from_decimal(decimal *, numeric *)
#define ECPG_CONVERT_BOOL
#define ECPG_SQLSTATE_CARDINALITY_VIOLATION
struct sqlvar_struct sqlvar[1]
#define ECPG_TOO_MANY_ARGUMENTS
static void free_statement(struct statement *stmt)
#define ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS
bool ecpg_autostart_transaction(struct statement *stmt)
void ecpg_set_compat_sqlda(int, struct sqlda_compat **, const PGresult *, int, enum COMPAT_MODE)
char * PGTYPESdate_to_asc(date)
static void free_variable(struct variable *var)
#define ESCAPE_STRING_SYNTAX
int PQntuples(const PGresult *res)
static enum ARRAY_TYPE ecpg_is_type_an_array(int type, const struct statement *stmt, const struct variable *var)
bool ECPGdo_descriptor(int line, const char *connection, const char *descriptor, const char *query)
ExecStatusType PQresultStatus(const PGresult *res)
int PQgetCopyData(PGconn *conn, char **buffer, int async)
static char * quote_postgres(char *arg, bool quote, int lineno)
#define ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY
void PGTYPESnumeric_free(numeric *)
bool ecpg_build_params(struct statement *stmt)
bool ecpg_execute(struct statement *stmt)
#define ECPG_TOO_MANY_MATCHES
numeric * PGTYPESnumeric_new(void)
static void print_param_value(char *value, int len, int is_binary, int lineno, int nth)
char * ecpg_auto_alloc(long, int)
#define ECPG_OUT_OF_MEMORY
struct sqlca_t * ECPGget_sqlca(void)
struct connection * connection
struct ECPGtype_information_cache * cache_head
static int next_insert(char *text, int pos, bool questionmarks, bool std_strings)
Oid PQftype(const PGresult *res, int field_num)
struct descriptor * ecpg_find_desc(int line, const char *name)
char * ecpg_prepared(const char *, struct connection *)
struct sqlda_struct * ecpg_build_native_sqlda(int, PGresult *, int, enum COMPAT_MODE)
void ecpg_log(const char *format,...) pg_attribute_printf(1
struct sqlda_compat * ecpg_build_compat_sqlda(int, PGresult *, int, enum COMPAT_MODE)
#define not_an_array_in_ecpg
char * ecpg_alloc(long, int)
void bool ecpg_auto_prepare(int, const char *, const int, char **, const char *)
PGTransactionStatusType PQtransactionStatus(const PGconn *conn)
static chr element(struct vars *v, const chr *startp, const chr *endp)
void ecpg_clear_auto_mem(void)
const char * ecpg_type_name(enum ECPGttype)
char * PGTYPESnumeric_to_asc(numeric *, int)
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)
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)
#define ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS
char * PQcmdStatus(PGresult *res)
#define ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME
static char * convert_bytea_to_string(char *from_data, int from_len, int lineno)
static bool store_input_from_desc(struct statement *stmt, struct descriptor_item *desc_item, char **tobeinserted)
int PQconsumeInput(PGconn *conn)
void PQclear(PGresult *res)
bool ecpg_check_PQresult(PGresult *, int, PGconn *, enum COMPAT_MODE)
unsigned ecpg_hex_encode(const char *src, unsigned len, char *dst)
#define ECPG_TOO_FEW_ARGUMENTS
char * PGTYPEStimestamp_to_asc(timestamp)
void ecpg_set_native_sqlda(int, struct sqlda_struct **, const PGresult *, int, enum COMPAT_MODE)
struct descriptor_item * items
char * PGTYPESinterval_to_asc(interval *)
bool ECPGis_noind_null(enum ECPGttype type, const void *ptr)
#define ECPG_INFORMIX_SUBSELECT_NOT_ONE
void ecpg_do_epilogue(struct statement *stmt)
char arr[FLEXIBLE_ARRAY_MEMBER]
struct descriptor_item * next
char * PQresultErrorMessage(const PGresult *res)
PGresult * PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
static void sprintf_double_value(char *ptr, double value, const char *delim)
struct connection * ecpg_get_connection(const char *connection_name)
#define ECPG_SQLSTATE_DATATYPE_MISMATCH
bool ecpg_store_input(const int lineno, const bool force_indicator, const struct variable *var, char **tobeinserted_p, bool quote)
PGresult * PQexec(PGconn *conn, const char *query)
static void static void status(const char *fmt,...) pg_attribute_printf(1
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)
int PQfformat(const PGresult *res, int field_num)
void PQfreemem(void *ptr)
bool ecpg_init(const struct connection *, const char *, const int)
PGresult * PQgetResult(PGconn *conn)
void ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat)
struct sqlvar_compat * sqlvar
struct variable * outlist