Wed, 25 Jul 2007 15:34:54 +0200
- Synced parser.
- - Set ecpg library version to 5.3.
- - Set ecpg version to 4.3.1.
+
+Tue, 14 Aug 2007 11:46:51 +0200
+
+ - Finished major rewrite to use new protocol version.
+ - Really prepare statements.
+ - Added more regression tests.
+ - Added auto-prepare mode.
+ - Use '$n' for positional variables, '?' is still possible via ecpg
+ option.
+ - Cleaned up the sources a little bit.
+ - Set ecpg library version to 6.0.
+ - Set ecpg version to 4.4.
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.48 2006/10/04 00:30:11 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.49 2007/08/14 10:01:52 meskes Exp $ */
#include <stdlib.h>
#include <string.h>
}
else
{
- if (PGTYPESnumeric_to_decimal(result, np) != 0)
- ret = ECPG_INFORMIX_NUM_OVERFLOW;
+ int i = PGTYPESnumeric_to_decimal(result, np);
free(result);
+ if (i != 0)
+ ret = ECPG_INFORMIX_NUM_OVERFLOW;
}
}
#
# Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.46 2007/01/20 17:16:17 petere Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.47 2007/08/14 10:01:52 meskes Exp $
#
#-------------------------------------------------------------------------
include $(top_builddir)/src/Makefile.global
NAME= ecpg
-SO_MAJOR_VERSION= 5
-SO_MINOR_VERSION= 3
+SO_MAJOR_VERSION= 6
+SO_MINOR_VERSION= 0
DLTYPE= library
override CPPFLAGS := -DFRONTEND \
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.41 2007/03/29 12:02:24 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.42 2007/08/14 10:01:52 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
{
if (con->committed)
{
- if ((results = PQexec(con->connection, "begin transaction")) == NULL)
- {
- ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
+ results = PQexec(con->connection, "begin transaction");
+ if (!ECPGcheck_PQresult(results, lineno, con->connection, ECPG_COMPAT_PGSQL))
return false;
- }
PQclear(results);
con->committed = false;
}
{
if (!con->committed)
{
- if ((results = PQexec(con->connection, "commit")) == NULL)
- {
- ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
+ results = PQexec(con->connection, "commit");
+ if (!ECPGcheck_PQresult(results, lineno, con->connection, ECPG_COMPAT_PGSQL))
return false;
- }
PQclear(results);
con->committed = true;
}
if (strncmp(sqlstate, "00", 2) == 0)
return;
- ECPGlog("%s", message);
+ ECPGlog("ECPGnoticeReceiver %s\n", message);
/* map to SQLCODE for backward compatibility */
if (strcmp(sqlstate, ECPG_SQLSTATE_INVALID_CURSOR_NAME) == 0)
/* dynamic SQL support routines
*
- * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.22 2007/06/11 11:52:08 meskes Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.23 2007/08/14 10:01:52 meskes Exp $
*/
#define POSTGRES_ECPG_INTERNAL
if (!desc_item)
return false;
desc_item->num = index;
+ if (desc->count < index)
+ desc->count = index;
desc_item->next = desc->items;
desc->items = desc_item;
}
{
enum ECPGdtype itemtype;
const char *tobeinserted = NULL;
- bool malloced;
itemtype = va_arg(args, enum ECPGdtype);
{
case ECPGd_data:
{
- if (!ECPGstore_input(lineno, true, var, &tobeinserted, &malloced, false))
+ if (!ECPGstore_input(lineno, true, var, &tobeinserted, false))
{
ECPGfree(var);
return false;
}
+
ECPGfree(desc_item->data); /* free() takes care of a potential NULL value */
desc_item->data = (char *) tobeinserted;
tobeinserted = NULL;
return false;
}
}
-
- /*
- * if (itemtype == ECPGd_data) { free(desc_item->data);
- * desc_item->data = NULL; }
- */
- }
- while (true);
+ } while (true);
ECPGfree(var);
return true;
bool
ECPGdeallocate_desc(int line, const char *name)
{
- struct descriptor *i;
+ struct descriptor *desc;
struct descriptor **lastptr = &all_descriptors;
struct sqlca_t *sqlca = ECPGget_sqlca();
ECPGinit_sqlca(sqlca);
- for (i = all_descriptors; i; lastptr = &i->next, i = i->next)
+ for (desc = all_descriptors; desc; lastptr = &desc->next, desc = desc->next)
{
- if (!strcmp(name, i->name))
+ if (!strcmp(name, desc->name))
{
struct descriptor_item *desc_item;
- for (desc_item = i->items; desc_item;)
+ for (desc_item = desc->items; desc_item;)
{
struct descriptor_item *di;
ECPGfree(di);
}
- *lastptr = i->next;
- ECPGfree(i->name);
- PQclear(i->result);
- ECPGfree(i);
+ *lastptr = desc->next;
+ ECPGfree(desc->name);
+ PQclear(desc->result);
+ ECPGfree(desc);
return true;
}
}
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.16 2007/05/31 15:13:05 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.17 2007/08/14 10:01:52 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
#include "extern.h"
#include "sqlca.h"
-
void
ECPGraise(int line, int code, const char *sqlstate, const char *str)
{
ECPGfree_auto_mem();
}
+/* filter out all error codes */
+bool
+ECPGcheck_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMPAT_MODE compat)
+{
+ if (results == NULL)
+ {
+ ECPGlog("ECPGcheck_PQresult line %d: error: %s", lineno, PQerrorMessage(connection));
+ ECPGraise_backend(lineno, NULL, connection, compat);
+ return (false);
+ }
+
+ switch (PQresultStatus(results))
+ {
+
+ case PGRES_TUPLES_OK:
+ return (true);
+ break;
+ case PGRES_EMPTY_QUERY:
+ /* do nothing */
+ ECPGraise(lineno, ECPG_EMPTY, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, NULL);
+ PQclear(results);
+ return (false);
+ break;
+ case PGRES_COMMAND_OK:
+ return (true);
+ break;
+ case PGRES_NONFATAL_ERROR:
+ case PGRES_FATAL_ERROR:
+ case PGRES_BAD_RESPONSE:
+ ECPGlog("ECPGcheck_PQresult line %d: Error: %s", lineno, PQresultErrorMessage(results));
+ ECPGraise_backend(lineno, results, connection, compat);
+ PQclear(results);
+ return (false);
+ break;
+ case PGRES_COPY_OUT:
+ return(true);
+ break;
+ case PGRES_COPY_IN:
+ ECPGlog("ECPGcheck_PQresult line %d: Got PGRES_COPY_IN ... tossing.\n", lineno);
+ PQendcopy(connection);
+ PQclear(results);
+ return(false);
+ break;
+ default:
+ ECPGlog("ECPGcheck_PQresult line %d: Got something else, postgres error.\n",
+ lineno);
+ ECPGraise_backend(lineno, results, connection, compat);
+ PQclear(results);
+ return(false);
+ break;
+ }
+}
+
/* print out an error message */
void
sqlprint(void)
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.67 2007/06/11 11:52:08 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.68 2007/08/14 10:01:52 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
res = (char *) ECPGalloc(buffer_len + 3, lineno);
if (!res)
return (res);
-
escaped_len = PQescapeString(res+1, arg, buffer_len);
if (length == escaped_len)
{
free_variable(stmt->inlist);
free_variable(stmt->outlist);
ECPGfree(stmt->command);
+ ECPGfree(stmt->name);
ECPGfree(stmt);
}
-static char *
-next_insert(char *text)
+static int
+next_insert(char *text, int pos, bool questionmarks)
{
- char *ptr = text;
bool string = false;
+ int p = pos;
- for (; *ptr != '\0' && (*ptr != '?' || string); ptr++)
+ for (; text[p] != '\0'; p++)
{
- if (*ptr == '\\') /* escape character */
- ptr++;
- else if (*ptr == '\'')
+ if (text[p] == '\\') /* escape character */
+ p++;
+ else if (text[p] == '\'')
string = string ? false : true;
+ else if (!string)
+ {
+ if (text[p] == '$' && isdigit(text[p+1]))
+ {
+ /* this can be either a dollar quote or a variable */
+ int i;
+
+ for (i = p + 1; isdigit(text[i]); i++);
+ if (!isalpha(text[i]) && isascii(text[i]) && text[i] != '_')
+ /* not dollar delimeted quote */
+ return p;
+ }
+ else if (questionmarks && text[p] == '?')
+ {
+ /* also allow old style placeholders */
+ return p;
+ }
+ }
}
- return (*ptr == '\0') ? NULL : ptr;
+ return -1;
}
static bool
sprintf(array_query, "select typlen from pg_type where oid=%d and typelem<>0", type);
query = PQexec(stmt->connection->connection, array_query);
ECPGfree(array_query);
- if (PQresultStatus(query) == PGRES_TUPLES_OK)
+ if (!ECPGcheck_PQresult(query, stmt->lineno, stmt->connection->connection, stmt->compat))
+ return (ECPG_ARRAY_ERROR);
+ else if (PQresultStatus(query) == PGRES_TUPLES_OK)
{
if (PQntuples(query) == 0)
isarray = ECPG_ARRAY_NONE;
isarray = ECPG_ARRAY_NONE;
}
}
+ PQclear(query);
}
- PQclear(query);
+ else
+ return (ECPG_ARRAY_ERROR);
+
ECPGtypeinfocache_push(&(stmt->connection->cache_head), type, isarray, stmt->lineno);
ECPGlog("ECPGis_type_an_array line %d: TYPE database: %d C: %d array: %s\n", stmt->lineno, type, var->type, isarray ? "Yes" : "No");
return isarray;
bool
ECPGstore_input(const int lineno, const bool force_indicator, const struct variable * var,
- const char **tobeinserted_p, bool *malloced_p, bool quote)
+ const char **tobeinserted_p, bool quote)
{
char *mallocedval = NULL;
char *newcopy = NULL;
* contents to arrive in a comma-separated list on insert (I think).
*/
- *malloced_p = false;
*tobeinserted_p = "";
/* check for null value and set input buffer accordingly */
case ECPGt_short:
case ECPGt_unsigned_short:
if (*(short *) var->ind_value < 0)
- *tobeinserted_p = "null";
+ *tobeinserted_p = NULL;
break;
case ECPGt_int:
case ECPGt_unsigned_int:
if (*(int *) var->ind_value < 0)
- *tobeinserted_p = "null";
+ *tobeinserted_p = NULL;
break;
case ECPGt_long:
case ECPGt_unsigned_long:
if (*(long *) var->ind_value < 0L)
- *tobeinserted_p = "null";
+ *tobeinserted_p = NULL;
break;
#ifdef HAVE_LONG_LONG_INT_64
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
if (*(long long int *) var->ind_value < (long long) 0)
- *tobeinserted_p = "null";
+ *tobeinserted_p = NULL;
break;
#endif /* HAVE_LONG_LONG_INT_64 */
case ECPGt_NO_INDICATOR:
if (force_indicator == false)
{
if (ECPGis_noind_null(var->type, var->value))
- *tobeinserted_p = "null";
+ *tobeinserted_p = NULL;
}
break;
default:
break;
}
- if (**tobeinserted_p == '\0')
+ if (*tobeinserted_p != NULL)
{
int asize = var->arrsize ? var->arrsize : 1;
sprintf(mallocedval, "%hd", *((short *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_int:
if (asize > 1)
{
- strcpy(mallocedval, "array [");
+ strcpy(mallocedval, "{");
for (element = 0; element < asize; element++)
sprintf(mallocedval + strlen(mallocedval), "%d,", ((int *) var->value)[element]);
- strcpy(mallocedval + strlen(mallocedval) - 1, "]");
+ strcpy(mallocedval + strlen(mallocedval) - 1, "}");
}
else
sprintf(mallocedval, "%d", *((int *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_unsigned_short:
sprintf(mallocedval, "%hu", *((unsigned short *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_unsigned_int:
sprintf(mallocedval, "%u", *((unsigned int *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_long:
sprintf(mallocedval, "%ld", *((long *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_unsigned_long:
sprintf(mallocedval, "%lu", *((unsigned long *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
#ifdef HAVE_LONG_LONG_INT_64
case ECPGt_long_long:
sprintf(mallocedval, "%lld", *((long long *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_unsigned_long_long:
sprintf(mallocedval, "%llu", *((unsigned long long *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
#endif /* HAVE_LONG_LONG_INT_64 */
case ECPGt_float:
sprintf(mallocedval, "%.14g", *((float *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_double:
sprintf(mallocedval, "%.14g", *((double *) var->value));
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_bool:
else
{
if (var->offset == sizeof(char))
- sprintf(mallocedval, "'%c'", (*((char *) var->value)) ? 't' : 'f');
+ sprintf(mallocedval, "%c", (*((char *) var->value)) ? 't' : 'f');
else if (var->offset == sizeof(int))
- sprintf(mallocedval, "'%c'", (*((int *) var->value)) ? 't' : 'f');
+ sprintf(mallocedval, "%c", (*((int *) var->value)) ? 't' : 'f');
else
ECPGraise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, "different size");
}
*tobeinserted_p = mallocedval;
- *malloced_p = true;
break;
case ECPGt_char:
return false;
*tobeinserted_p = mallocedval;
- *malloced_p = true;
}
break;
case ECPGt_const:
mallocedval[slen] = '\0';
*tobeinserted_p = mallocedval;
- *malloced_p = true;
}
break;
case ECPGt_varchar:
return false;
*tobeinserted_p = mallocedval;
- *malloced_p = true;
}
break;
}
*tobeinserted_p = mallocedval;
- *malloced_p = true;
}
break;
if (!element)
strcpy(mallocedval, "array [");
- strcpy(mallocedval + strlen(mallocedval), "interval ");
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
strcpy(mallocedval + strlen(mallocedval), ",");
ECPGfree(str);
return false;
}
- strcpy(mallocedval, "interval ");
/* also copy trailing '\0' */
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
ECPGfree(str);
}
*tobeinserted_p = mallocedval;
- *malloced_p = true;
}
break;
if (!element)
strcpy(mallocedval, "array [");
- strcpy(mallocedval + strlen(mallocedval), "date ");
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
strcpy(mallocedval + strlen(mallocedval), ",");
ECPGfree(str);
return false;
}
- strcpy(mallocedval, "date ");
/* also copy trailing '\0' */
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
ECPGfree(str);
}
*tobeinserted_p = mallocedval;
- *malloced_p = true;
}
break;
if (!element)
strcpy(mallocedval, "array [");
- strcpy(mallocedval + strlen(mallocedval), "timestamp ");
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
strcpy(mallocedval + strlen(mallocedval), ",");
ECPGfree(str);
return false;
}
- strcpy(mallocedval, "timestamp ");
/* also copy trailing '\0' */
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
ECPGfree(str);
}
*tobeinserted_p = mallocedval;
- *malloced_p = true;
}
break;
return true;
}
+static void
+free_params(const char **paramValues, int nParams, bool print, int lineno)
+{
+ int n;
+
+ for (n = 0; n < nParams; n++)
+ {
+ if (print)
+ ECPGlog("ECPGexecute line %d: parameter %d = %s\n", lineno, n + 1, paramValues[n] ? paramValues[n] : "null");
+ ECPGfree((void *)(paramValues[n]));
+ }
+ ECPGfree(paramValues);
+}
+
static bool
ECPGexecute(struct statement * stmt)
{
bool status = false;
- char *copiedquery;
char *cmdstat;
PGresult *results;
PGnotify *notify;
struct variable *var;
int desc_counter = 0;
-
- copiedquery = ECPGstrdup(stmt->command, stmt->lineno);
+ const char * *paramValues = NULL;
+ int nParams = 0;
+ int position = 0;
+ struct sqlca_t *sqlca = ECPGget_sqlca();
+ bool clear_result = true;
/*
- * Now, if the type is one of the fill in types then we take the argument
- * and enter that in the string at the first %s position. Then if there
- * are any more fill in types we fill in at the next and so on.
+ * If the type is one of the fill in types then we take the argument
+ * and enter it to our parameter array at the first position. Then if there
+ * are any more fill in types we add more parameters.
*/
var = stmt->inlist;
-
while (var)
{
- char *newcopy = NULL;
const char *tobeinserted;
- char *p;
- bool malloced = FALSE;
- int hostvarl = 0;
+ int counter = 1;
tobeinserted = NULL;
if (desc == NULL)
{
ECPGraise(stmt->lineno, ECPG_UNKNOWN_DESCRIPTOR, ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME, var->pointer);
- ECPGfree(copiedquery);
return false;
}
desc_counter++;
- if (desc->count < 0 || desc->count >= desc_counter)
+ for (desc_item = desc->items; desc_item; desc_item = desc_item->next)
{
- for (desc_item = desc->items; desc_item; desc_item = desc_item->next)
+ if (desc_item->num == desc_counter)
{
- if (desc_item->num == desc_counter)
+ desc_inlist.type = ECPGt_char;
+ desc_inlist.value = desc_item->data;
+ desc_inlist.pointer = &(desc_item->data);
+ desc_inlist.varcharsize = strlen(desc_item->data);
+ desc_inlist.arrsize = 1;
+ desc_inlist.offset = 0;
+ if (!desc_item->indicator)
{
- desc_inlist.type = ECPGt_char;
- desc_inlist.value = desc_item->data;
- desc_inlist.pointer = &(desc_item->data);
- desc_inlist.varcharsize = strlen(desc_item->data);
- desc_inlist.arrsize = 1;
- desc_inlist.offset = 0;
- if (!desc_item->indicator)
- {
- desc_inlist.ind_type = ECPGt_NO_INDICATOR;
- desc_inlist.ind_value = desc_inlist.ind_pointer = NULL;
- desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = desc_inlist.ind_offset = 0;
- }
- else
- {
- desc_inlist.ind_type = ECPGt_int;
- desc_inlist.ind_value = &(desc_item->indicator);
- desc_inlist.ind_pointer = &(desc_inlist.ind_value);
- desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = 1;
- desc_inlist.ind_offset = 0;
- }
- if (!ECPGstore_input(stmt->lineno, stmt->force_indicator, &desc_inlist, &tobeinserted, &malloced, true))
- {
- ECPGfree(copiedquery);
- return false;
- }
-
- break;
+ desc_inlist.ind_type = ECPGt_NO_INDICATOR;
+ desc_inlist.ind_value = desc_inlist.ind_pointer = NULL;
+ desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = desc_inlist.ind_offset = 0;
}
- }
+ else
+ {
+ desc_inlist.ind_type = ECPGt_int;
+ desc_inlist.ind_value = &(desc_item->indicator);
+ desc_inlist.ind_pointer = &(desc_inlist.ind_value);
+ desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = 1;
+ desc_inlist.ind_offset = 0;
+ }
+ if (!ECPGstore_input(stmt->lineno, stmt->force_indicator, &desc_inlist, &tobeinserted, false))
+ return false;
- if (!desc_item) /* no more entries found in descriptor */
- desc_counter = 0;
+ break;
+ }
}
- else
+ if (desc->count == desc_counter)
desc_counter = 0;
}
else
{
- if (!ECPGstore_input(stmt->lineno, stmt->force_indicator, var, &tobeinserted, &malloced, true))
+ if (!ECPGstore_input(stmt->lineno, stmt->force_indicator, var, &tobeinserted, false))
return false;
}
- if (tobeinserted)
+ /*
+ * now tobeinserted points to an area that contains the next parameter
+ * if var->type=ECPGt_char_variable we have a dynamic cursor
+ * we have to simulate a dynamic cursor because there is no backend functionality for it
+ */
+ if (var->type != ECPGt_char_variable)
{
- /*
- * Now tobeinserted points to an area that is to be inserted at
- * the first %s
- */
- if (!(newcopy = (char *) ECPGalloc(strlen(copiedquery)
+ nParams++;
+ if (!(paramValues = (const char **) ECPGrealloc(paramValues, sizeof(const char *) * nParams, stmt->lineno)))
+ {
+ ECPGfree(paramValues);
+ return false;
+ }
+
+ paramValues[nParams - 1] = tobeinserted;
+
+ if ((position = next_insert(stmt->command, position, stmt->questionmarks) + 1) == 0)
+ {
+ /*
+ * We have an argument but we dont have the matched up
+ * placeholder in the string
+ */
+ ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS,
+ ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS,
+ NULL);
+ free_params(paramValues, nParams, false, stmt->lineno);
+ return false;
+ }
+
+ /* let's see if this was an old style placeholder */
+ if (stmt->command[position-1] == '?')
+ {
+ /* yes, replace with new style */
+ int buffersize = sizeof(int) * CHAR_BIT * 10 / 3; /* a rough guess of the size we need */
+ char *buffer, *newcopy;
+
+ if (!(buffer = (char *) ECPGalloc(buffersize, stmt->lineno)))
+ {
+ free_params(paramValues, nParams, false, stmt->lineno);
+ return false;
+ }
+
+ snprintf(buffer, buffersize, "$%d", counter++);
+
+ if (!(newcopy = (char *) ECPGalloc(strlen(stmt->command) + strlen(buffer) + 1, stmt->lineno)))
+ {
+ free_params(paramValues, nParams, false, stmt->lineno);
+ ECPGfree(buffer);
+ return false;
+ }
+
+ strcpy(newcopy, stmt->command);
+
+ /* set positional parameter */
+ strcpy(newcopy + position - 1, buffer);
+
+ /*
+ * The strange thing in the second argument is the rest of the
+ * string from the old string
+ */
+ strcat(newcopy,
+ stmt->command
+ + position + 1);
+ ECPGfree(buffer);
+ ECPGfree(stmt->command);
+ stmt->command = newcopy;
+ }
+ }
+ else
+ {
+ char *newcopy;
+
+ if (!(newcopy = (char *) ECPGalloc(strlen(stmt->command)
+ strlen(tobeinserted)
+ 1, stmt->lineno)))
{
- ECPGfree(copiedquery);
+ free_params(paramValues, nParams, false, stmt->lineno);
return false;
}
- strcpy(newcopy, copiedquery);
- if ((p = next_insert(newcopy + hostvarl)) == NULL)
+ strcpy(newcopy, stmt->command);
+ if ((position = next_insert(stmt->command, position, stmt->questionmarks) + 1) == 0)
{
/*
* We have an argument but we dont have the matched up string
ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS,
ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS,
NULL);
- ECPGfree(copiedquery);
+ free_params(paramValues, nParams, false, stmt->lineno);
ECPGfree(newcopy);
return false;
}
else
{
- strcpy(p, tobeinserted);
- hostvarl = strlen(newcopy);
+ int ph_len = (stmt->command[position] == '?') ? strlen("?") : strlen("$1");
+
+ strcpy(newcopy + position - 1, tobeinserted);
/*
* The strange thing in the second argument is the rest of the
* string from the old string
*/
strcat(newcopy,
- copiedquery
- + (p - newcopy)
- + sizeof("?") - 1 /* don't count the '\0' */ );
- }
-
- /*
- * Now everything is safely copied to the newcopy. Lets free the
- * oldcopy and let the copiedquery get the var->value from the
- * newcopy.
- */
- if (malloced)
- {
- ECPGfree((char *) tobeinserted);
- tobeinserted = NULL;
+ stmt->command
+ + position
+ + ph_len - 1);
}
- ECPGfree(copiedquery);
- copiedquery = newcopy;
+ ECPGfree(stmt->command);
+ stmt->command = newcopy;
+
+ ECPGfree((char *)tobeinserted);
+ tobeinserted = NULL;
}
if (desc_counter == 0)
}
/* Check if there are unmatched things left. */
- if (next_insert(copiedquery) != NULL)
+ if (next_insert(stmt->command, position, stmt->questionmarks) >= 0)
{
ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS,
ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL);
- ECPGfree(copiedquery);
+ free_params(paramValues, nParams, false, stmt->lineno);
return false;
}
- /* Now the request is built. */
+ /* The request has been build. */
if (stmt->connection->committed && !stmt->connection->autocommit)
{
- if ((results = PQexec(stmt->connection->connection, "begin transaction")) == NULL)
+ results = PQexec(stmt->connection->connection, "begin transaction");
+ if (!ECPGcheck_PQresult(results, stmt->lineno, stmt->connection->connection, stmt->compat))
{
- ECPGraise(stmt->lineno, ECPG_TRANS,
- ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
- ECPGfree(copiedquery);
+ free_params(paramValues, nParams, false, stmt->lineno);
return false;
}
PQclear(results);
stmt->connection->committed = false;
}
- ECPGlog("ECPGexecute line %d: QUERY: %s on connection %s\n", stmt->lineno, copiedquery, stmt->connection->name);
- results = PQexec(stmt->connection->connection, copiedquery);
- ECPGfree(copiedquery);
-
- if (results == NULL)
+ ECPGlog("ECPGexecute line %d: QUERY: %s with %d parameter on connection %s \n", stmt->lineno, stmt->command, nParams, stmt->connection->name);
+ if (stmt->statement_type == ECPGst_execute)
{
- ECPGlog("ECPGexecute line %d: error: %s", stmt->lineno, PQerrorMessage(stmt->connection->connection));
- ECPGraise_backend(stmt->lineno, NULL, stmt->connection->connection, stmt->compat);
+ results = PQexecPrepared(stmt->connection->connection, stmt->name, nParams, paramValues, NULL, NULL, 0);
+ ECPGlog("ECPGexecute line %d: using PQexecPrepared for %s\n", stmt->lineno, stmt->command);
}
else
+ {
+ if (nParams == 0)
+ {
+ results = PQexec(stmt->connection->connection, stmt->command);
+ ECPGlog("ECPGexecute line %d: using PQexec\n", stmt->lineno);
+ }
+ else
+ {
+ results = PQexecParams(stmt->connection->connection, stmt->command, nParams, NULL, paramValues, NULL, NULL, 0);
+ ECPGlog("ECPGexecute line %d: using PQexecParams \n", stmt->lineno);
+ }
+ }
- /*
- * note: since some of the following code is duplicated in
- * descriptor.c it should go into a separate function
- */
+ free_params(paramValues, nParams, true, stmt->lineno);
+
+ if (!ECPGcheck_PQresult(results, stmt->lineno, stmt->connection->connection, stmt->compat))
+ return (false);
+
+ var = stmt->outlist;
+ switch (PQresultStatus(results))
{
- bool clear_result = TRUE;
- struct sqlca_t *sqlca = ECPGget_sqlca();
+ int nfields,
+ ntuples,
+ act_field;
- var = stmt->outlist;
- switch (PQresultStatus(results))
- {
- int nfields,
- ntuples,
- act_field;
+ case PGRES_TUPLES_OK:
+ nfields = PQnfields(results);
+ sqlca->sqlerrd[2] = ntuples = PQntuples(results);
+ ECPGlog("ECPGexecute line %d: Correctly got %d tuples with %d fields\n", stmt->lineno, ntuples, nfields);
+ status = true;
- case PGRES_TUPLES_OK:
- nfields = PQnfields(results);
- sqlca->sqlerrd[2] = ntuples = PQntuples(results);
- ECPGlog("ECPGexecute line %d: Correctly got %d tuples with %d fields\n", stmt->lineno, ntuples, nfields);
- status = true;
+ if (ntuples < 1)
+ {
+ if (ntuples)
+ ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d\n",
+ stmt->lineno, ntuples);
+ ECPGraise(stmt->lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
+ status = false;
+ break;
+ }
- if (ntuples < 1)
- {
- if (ntuples)
- ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d\n",
- stmt->lineno, ntuples);
- ECPGraise(stmt->lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
+ if (var != NULL && var->type == ECPGt_descriptor)
+ {
+ PGresult **resultpp = ECPGdescriptor_lvalue(stmt->lineno, (const char *) var->pointer);
+
+ if (resultpp == NULL)
status = false;
- break;
+ else
+ {
+ if (*resultpp)
+ PQclear(*resultpp);
+ *resultpp = results;
+ clear_result = FALSE;
+ ECPGlog("ECPGexecute putting result (%d tuples) into descriptor '%s'\n", PQntuples(results), (const char *) var->pointer);
}
-
- if (var != NULL && var->type == ECPGt_descriptor)
+ var = var->next;
+ }
+ else
+ for (act_field = 0; act_field < nfields && status; act_field++)
{
- PGresult **resultpp = ECPGdescriptor_lvalue(stmt->lineno, (const char *) var->pointer);
-
- if (resultpp == NULL)
- status = false;
- else
+ if (var != NULL)
{
- if (*resultpp)
- PQclear(*resultpp);
- *resultpp = results;
- clear_result = FALSE;
- ECPGlog("ECPGexecute putting result (%d tuples) into descriptor '%s'\n", PQntuples(results), (const char *) var->pointer);
+ status = ECPGstore_result(results, act_field, stmt, var);
+ var = var->next;
}
- var = var->next;
- }
- else
- for (act_field = 0; act_field < nfields && status; act_field++)
+ else if (!INFORMIX_MODE(stmt->compat))
{
- if (var != NULL)
- {
- status = ECPGstore_result(results, act_field, stmt, var);
- var = var->next;
- }
- else if (!INFORMIX_MODE(stmt->compat))
- {
- ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL);
- return (false);
- }
+ ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL);
+ return (false);
}
-
- if (status && var != NULL)
- {
- ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL);
- status = false;
}
- break;
- case PGRES_EMPTY_QUERY:
- /* do nothing */
- ECPGraise(stmt->lineno, ECPG_EMPTY, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, NULL);
- break;
- case PGRES_COMMAND_OK:
- status = true;
- cmdstat = PQcmdStatus(results);
- sqlca->sqlerrd[1] = PQoidValue(results);
- sqlca->sqlerrd[2] = atol(PQcmdTuples(results));
- ECPGlog("ECPGexecute line %d Ok: %s\n", stmt->lineno, cmdstat);
- if (stmt->compat != ECPG_COMPAT_INFORMIX_SE &&
- !sqlca->sqlerrd[2] &&
- (!strncmp(cmdstat, "UPDATE", 6)
- || !strncmp(cmdstat, "INSERT", 6)
- || !strncmp(cmdstat, "DELETE", 6)))
- ECPGraise(stmt->lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
- break;
- case PGRES_NONFATAL_ERROR:
- case PGRES_FATAL_ERROR:
- case PGRES_BAD_RESPONSE:
- ECPGlog("ECPGexecute line %d: Error: %s", stmt->lineno, PQresultErrorMessage(results));
- ECPGraise_backend(stmt->lineno, results, stmt->connection->connection, stmt->compat);
+ if (status && var != NULL)
+ {
+ ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL);
status = false;
- break;
- case PGRES_COPY_OUT:
- {
- char *buffer;
- int res;
+ }
- ECPGlog("ECPGexecute line %d: Got PGRES_COPY_OUT\n", stmt->lineno);
- while ((res = PQgetCopyData(stmt->connection->connection,
- &buffer, 0)) > 0)
- {
- printf("%s", buffer);
- PQfreemem(buffer);
- }
- if (res == -1)
- {
- /* COPY done */
- PQclear(results);
- results = PQgetResult(stmt->connection->connection);
- if (PQresultStatus(results) == PGRES_COMMAND_OK)
- ECPGlog("ECPGexecute line %d: Got PGRES_COMMAND_OK after PGRES_COPY_OUT\n", stmt->lineno);
- else
- ECPGlog("ECPGexecute line %d: Got error after PGRES_COPY_OUT: %s", PQresultErrorMessage(results));
- }
- break;
+ break;
+ case PGRES_COMMAND_OK:
+ status = true;
+ cmdstat = PQcmdStatus(results);
+ sqlca->sqlerrd[1] = PQoidValue(results);
+ sqlca->sqlerrd[2] = atol(PQcmdTuples(results));
+ ECPGlog("ECPGexecute line %d Ok: %s\n", stmt->lineno, cmdstat);
+ if (stmt->compat != ECPG_COMPAT_INFORMIX_SE &&
+ !sqlca->sqlerrd[2] &&
+ (!strncmp(cmdstat, "UPDATE", 6)
+ || !strncmp(cmdstat, "INSERT", 6)
+ || !strncmp(cmdstat, "DELETE", 6)))
+ ECPGraise(stmt->lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
+ break;
+ case PGRES_COPY_OUT:
+ {
+ char *buffer;
+ int res;
+
+ ECPGlog("ECPGexecute line %d: Got PGRES_COPY_OUT\n", stmt->lineno);
+ while ((res = PQgetCopyData(stmt->connection->connection,
+ &buffer, 0)) > 0)
+ {
+ printf("%s", buffer);
+ PQfreemem(buffer);
+ }
+ if (res == -1)
+ {
+ /* COPY done */
+ PQclear(results);
+ results = PQgetResult(stmt->connection->connection);
+ if (PQresultStatus(results) == PGRES_COMMAND_OK)
+ ECPGlog("ECPGexecute line %d: Got PGRES_COMMAND_OK after PGRES_COPY_OUT\n", stmt->lineno);
+ else
+ ECPGlog("ECPGexecute line %d: Got error after PGRES_COPY_OUT: %s", PQresultErrorMessage(results));
}
- case PGRES_COPY_IN:
- ECPGlog("ECPGexecute line %d: Got PGRES_COPY_IN ... tossing.\n", stmt->lineno);
- PQendcopy(stmt->connection->connection);
- break;
- default:
- ECPGlog("ECPGexecute line %d: Got something else, postgres error.\n",
- stmt->lineno);
- ECPGraise_backend(stmt->lineno, results, stmt->connection->connection, stmt->compat);
- status = false;
break;
- }
- if (clear_result)
- PQclear(results);
+ }
+ default:
+ /* execution should never reach this code because it is already handled in ECPGcheck_PQresult() */
+ ECPGlog("ECPGexecute line %d: Got something else, postgres error.\n",
+ stmt->lineno);
+ ECPGraise_backend(stmt->lineno, results, stmt->connection->connection, stmt->compat);
+ status = false;
+ break;
}
+ if (clear_result)
+ PQclear(results);
/* check for asynchronous returns */
notify = PQnotifies(stmt->connection->connection);
}
bool
-ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name, const char *query,...)
+ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const enum ECPG_statement_type st, const char *query,...)
{
va_list args;
struct statement *stmt;
char *oldlocale;
enum ECPGttype type;
struct variable **list;
+ enum ECPG_statement_type statement_type = st;
+ char *prepname;
+
+ if (!query)
+ {
+ ECPGraise(lineno, ECPG_EMPTY, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, NULL);
+ return(false);
+ }
/* Make sure we do NOT honor the locale for numeric input/output */
/* since the database wants the standard decimal point */
{
setlocale(LC_NUMERIC, oldlocale);
ECPGfree(oldlocale);
+ ECPGfree(prepname);
va_end(args);
return false;
}
- stmt->command = ECPGstrdup(query, lineno);
+ /* If statement type is ECPGst_prepnormal we are supposed to prepare
+ * the statement before executing them */
+ if (statement_type == ECPGst_prepnormal)
+ {
+ if (!ECPGauto_prepare(lineno, connection_name, questionmarks, &prepname, query))
+ return(false);
+
+ /* statement is now prepared, so instead of the query we have to execute the name */
+ stmt->command = prepname;
+ statement_type = ECPGst_execute;
+ }
+ else
+ stmt->command = ECPGstrdup(query, lineno);
+
+ stmt->name = NULL;
+
+ if (statement_type == ECPGst_execute)
+ {
+ /* if we have an EXECUTE command, only the name is send */
+ char *command = ECPGprepared(stmt->command, lineno);
+
+ if (command)
+ {
+ stmt->name = stmt->command;
+ stmt->command = ECPGstrdup(command, lineno);
+ }
+ else
+ ECPGraise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, stmt->command);
+ }
+
stmt->connection = con;
stmt->lineno = lineno;
stmt->compat = compat;
stmt->force_indicator = force_indicator;
+ stmt->questionmarks = questionmarks;
+ stmt->statement_type = statement_type;
list = &(stmt->inlist);
ECPGdo_descriptor(int line, const char *connection,
const char *descriptor, const char *query)
{
- return ECPGdo(line, ECPG_COMPAT_PGSQL, true, connection, (char *) query, ECPGt_EOIT,
+ return ECPGdo(line, ECPG_COMPAT_PGSQL, true, connection, '\0', 0, (char *) query, ECPGt_EOIT,
ECPGt_descriptor, descriptor, 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.24 2007/04/27 07:55:14 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.25 2007/08/14 10:01:52 meskes Exp $ */
#ifndef _ECPG_LIB_EXTERN_H
#define _ECPG_LIB_EXTERN_H
{
int lineno;
char *command;
+ char *name;
struct connection *connection;
enum COMPAT_MODE compat;
bool force_indicator;
+ enum ECPG_statement_type statement_type;
+ bool questionmarks;
struct variable *inlist;
struct variable *outlist;
};
bool ECPGstore_result(const PGresult *results, int act_field,
const struct statement * stmt, struct variable * var);
-bool ECPGstore_input(const int, const bool, const struct variable *, const char **, bool *, bool);
+bool ECPGstore_input(const int, const bool, const struct variable *, const char **, bool);
+
+bool ECPGcheck_PQresult(PGresult *, int, PGconn *, enum COMPAT_MODE);
+void ECPGraise(int line, int code, const char *sqlstate, const char *str);
+void ECPGraise_backend(int line, PGresult *result, PGconn *conn, int compat);
+char *ECPGprepared(const char *, int);
/* SQLSTATE values generated or processed by ecpglib (intentionally
* not exported -- users should refer to the codes directly) */
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.35 2007/03/29 12:02:24 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.36 2007/08/14 10:01:52 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
if (con->committed && !con->autocommit && strncmp(transaction, "begin", 5) != 0 && strncmp(transaction, "start", 5) != 0)
{
res = PQexec(con->connection, "begin transaction");
- if (res == NULL || PQresultStatus(res) != PGRES_COMMAND_OK)
- {
- ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
+ if (!ECPGcheck_PQresult(res, lineno, con->connection, ECPG_COMPAT_PGSQL))
return FALSE;
- }
PQclear(res);
}
res = PQexec(con->connection, transaction);
- if (res == NULL || PQresultStatus(res) != PGRES_COMMAND_OK)
- {
- ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
+ if (!ECPGcheck_PQresult(res, lineno, con->connection, ECPG_COMPAT_PGSQL))
return FALSE;
- }
PQclear(res);
}
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.18 2006/10/04 00:30:11 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.19 2007/08/14 10:01:52 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
static struct prepared_statement
{
- char *name;
+ char *name;
+ bool prepared;
struct statement *stmt;
struct prepared_statement *next;
} *prep_stmts = NULL;
+#define STMTID_SIZE 32
+
+typedef struct
+{
+ int lineno;
+ char stmtID[STMTID_SIZE];
+ char *ecpgQuery;
+ long execs; /* # of executions */
+ char *connection; /* connection for the statement */
+} stmtCacheEntry;
+
+static int nextStmtID = 1;
+static int stmtCacheNBuckets = 2039; /* # buckets - a prime # */
+static int stmtCacheEntPerBucket = 8; /* # entries/bucket */
+static stmtCacheEntry stmtCacheEntries[16384] = {{0,{0},0,0,0}};
+
static bool
isvarchar(unsigned char c)
{
return (false);
}
-static void
-replace_variables(char *text)
+static bool
+replace_variables(char **text, int lineno, bool questionmarks)
{
- char *ptr = text;
- bool string = false;
+ bool string = false;
+ int counter = 1, ptr = 0;
- for (; *ptr != '\0'; ptr++)
+ for (; (*text)[ptr] != '\0'; ptr++)
{
- if (*ptr == '\'')
+ if ((*text)[ptr] == '\'')
string = string ? false : true;
- if (!string && *ptr == ':')
+ if (string || (((*text)[ptr] != ':') && ((*text)[ptr] != '?')))
+ continue;
+
+ if (((*text)[ptr] == ':') && ((*text)[ptr+1] == ':'))
+ ptr += 2; /* skip '::' */
+ else
{
- if (ptr[1] == ':')
- ptr += 2; /* skip '::' */
- else
+ int len;
+ int buffersize = sizeof(int) * CHAR_BIT * 10 / 3; /* a rough guess of the size we need */
+ char *buffer, *newcopy;
+
+ if (!(buffer = (char *) ECPGalloc(buffersize, lineno)))
+ return false;
+
+ snprintf(buffer, buffersize, "$%d", counter++);
+
+ for (len=1; (*text)[ptr+len] && isvarchar((*text)[ptr+len]); len++);
+ if (!(newcopy = (char *) ECPGalloc(strlen(*text) - len + strlen(buffer) + 1, lineno)))
{
- *ptr = '?';
- for (++ptr; *ptr && isvarchar(*ptr); ptr++)
- *ptr = ' ';
- if (*ptr == '\0') /* we reached the end */
- ptr--; /* since we will ptr++ in the top level for
- * loop */
+ ECPGfree(buffer);
+ return false;
}
+
+ strncpy(newcopy, *text, ptr);
+ strcpy(newcopy + ptr, buffer);
+ strcat(newcopy, (*text) + ptr + len);
+
+ ECPGfree(*text);
+ ECPGfree(buffer);
+
+ *text = newcopy;
+
+ if ((*text)[ptr] == '\0') /* we reached the end */
+ ptr--; /* since we will (*text)[ptr]++ in the top level for
+ * loop */
}
}
+ return true;
}
/* handle the EXEC SQL PREPARE statement */
bool
-ECPGprepare(int lineno, const char *name, const char *variable)
+ECPGprepare(int lineno, const char *connection_name, const int questionmarks, const char *name, const char *variable)
{
struct statement *stmt;
struct prepared_statement *this;
struct sqlca_t *sqlca = ECPGget_sqlca();
+ PGresult *query;
ECPGinit_sqlca(sqlca);
+
/* check if we already have prepared this statement */
for (this = prep_stmts; this != NULL && strcmp(this->name, name) != 0; this = this->next);
if (this)
/* create statement */
stmt->lineno = lineno;
- stmt->connection = NULL;
+ stmt->connection = ECPGget_connection(connection_name);
stmt->command = ECPGstrdup(variable, lineno);
stmt->inlist = stmt->outlist = NULL;
/* if we have C variables in our statment replace them with '?' */
- replace_variables(stmt->command);
+ replace_variables(&(stmt->command), lineno, questionmarks);
/* add prepared statement to our list */
- this->name = ECPGstrdup(name, lineno);
+ this->name = (char *) name;
this->stmt = stmt;
- ECPGlog("ECPGprepare line %d: QUERY: %s\n", stmt->lineno, stmt->command);
+ /* and finally really prepare the statement */
+ query = PQprepare(stmt->connection->connection, name, stmt->command, 0, NULL);
+ if (!ECPGcheck_PQresult(query, stmt->lineno, stmt->connection->connection, stmt->compat))
+ {
+ ECPGfree(stmt->command);
+ ECPGfree(this);
+ ECPGfree(stmt);
+ return false;
+ }
+
+ ECPGlog("ECPGprepare line %d: NAME: %s QUERY: %s\n", stmt->lineno, name, stmt->command);
+ PQclear(query);
+ this->prepared = true;
if (prep_stmts == NULL)
this->next = NULL;
return true;
}
-/* handle the EXEC SQL DEALLOCATE PREPARE statement */
-bool
-ECPGdeallocate(int lineno, int c, const char *name)
-{
- bool ret = ECPGdeallocate_one(lineno, name);
- enum COMPAT_MODE compat = c;
-
- if (INFORMIX_MODE(compat))
- {
- /*
- * Just ignore all errors since we do not know the list of cursors we
- * are allowed to free. We have to trust the software.
- */
- return true;
- }
-
- if (!ret)
- ECPGraise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, name);
-
- return ret;
-}
-
-bool
-ECPGdeallocate_one(int lineno, const char *name)
+static bool
+deallocate_one(int lineno, const char *name)
{
struct prepared_statement *this,
*prev;
for (this = prep_stmts, prev = NULL; this != NULL && strcmp(this->name, name) != 0; prev = this, this = this->next);
if (this)
{
+ /* first deallocate the statement in the backend */
+ if (this->prepared)
+ {
+ char *text;
+ PGresult *query;
+
+ if (!(text = (char *) ECPGalloc(strlen("deallocate \"\" ") + strlen(this->name), this->stmt->lineno)))
+ return false;
+ else
+ {
+ sprintf(text, "deallocate \"%s\"", this->name);
+ query = PQexec(this->stmt->connection->connection, text);
+ ECPGfree(text);
+ if (!ECPGcheck_PQresult(query, lineno, this->stmt->connection->connection, this->stmt->compat))
+ return false;
+ PQclear(query);
+ }
+ }
+
/* okay, free all the resources */
- ECPGfree(this->name);
ECPGfree(this->stmt->command);
ECPGfree(this->stmt);
if (prev != NULL)
return false;
}
+/* handle the EXEC SQL DEALLOCATE PREPARE statement */
bool
-ECPGdeallocate_all(int lineno)
+ECPGdeallocate(int lineno, int c, const char *name)
+{
+ bool ret = deallocate_one(lineno, name);
+ enum COMPAT_MODE compat = c;
+
+ ECPGlog("ECPGdeallocate line %d: NAME: %s\n", lineno, name);
+ if (INFORMIX_MODE(compat))
+ {
+ /*
+ * Just ignore all errors since we do not know the list of cursors we
+ * are allowed to free. We have to trust the software.
+ */
+ return true;
+ }
+
+ if (!ret)
+ ECPGraise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, name);
+
+ return ret;
+}
+
+bool
+ECPGdeallocate_all(int lineno, int compat)
{
/* deallocate all prepared statements */
while (prep_stmts != NULL)
{
- bool b = ECPGdeallocate(lineno, ECPG_COMPAT_PGSQL, prep_stmts->name);
+ bool b = ECPGdeallocate(lineno, compat, prep_stmts->name);
if (!b)
return false;
return true;
}
+char *
+ECPGprepared(const char *name, int lineno)
+{
+ struct prepared_statement *this;
+
+ for (this = prep_stmts; this != NULL && ((strcmp(this->name, name) != 0) || this->prepared == false); this = this->next);
+ return (this) ? this->stmt->command : NULL;
+}
+
/* return the prepared statement */
char *
-ECPGprepared_statement(const char *name)
+ECPGprepared_statement(const char *name, int lineno)
{
struct prepared_statement *this;
for (this = prep_stmts; this != NULL && strcmp(this->name, name) != 0; this = this->next);
return (this) ? this->stmt->command : NULL;
}
+
+/*
+ * hash a SQL statement - returns entry # of first entry in the bucket
+ */
+static int
+HashStmt(const char *ecpgQuery)
+{
+ int stmtIx, bucketNo, hashLeng, stmtLeng;
+ long long hashVal, rotVal;
+
+ stmtLeng = strlen(ecpgQuery);
+ hashLeng = 50; /* use 1st 50 characters of statement */
+ if(hashLeng > stmtLeng) /* if the statement isn't that long */
+ hashLeng = stmtLeng; /* use its actual length */
+
+ hashVal = 0;
+ for(stmtIx = 0; stmtIx < hashLeng; ++stmtIx)
+ {
+ hashVal = hashVal + (int) ecpgQuery[stmtIx];
+ hashVal = hashVal << 13;
+ rotVal = (hashVal & 0x1fff00000000LL) >> 32;
+ hashVal = (hashVal & 0xffffffffLL) | rotVal;
+ }
+
+ bucketNo = hashVal % stmtCacheNBuckets;
+ bucketNo += 1; /* don't use bucket # 0 */
+
+ return (bucketNo * stmtCacheEntPerBucket);
+}
+
+/*
+ * search the statement cache - search for entry with matching ECPG-format query
+ * Returns entry # in cache if found
+ * OR zero if not present (zero'th entry isn't used)
+ */
+static int
+SearchStmtCache(const char *ecpgQuery)
+{
+ int entNo, entIx;
+
+/* hash the statement */
+ entNo = HashStmt(ecpgQuery);
+
+/* search the cache */
+ for(entIx = 0; entIx < stmtCacheEntPerBucket; ++entIx)
+ {
+ if(stmtCacheEntries[entNo].stmtID[0]) /* check if entry is in use */
+ {
+ if(!strcmp(ecpgQuery, stmtCacheEntries[entNo].ecpgQuery))
+ break; /* found it */
+ }
+ ++entNo; /* incr entry # */
+ }
+
+/* if entry wasn't found - set entry # to zero */
+ if(entIx >= stmtCacheEntPerBucket)
+ entNo = 0;
+
+ return(entNo);
+}
+
+/*
+ * free an entry in the statement cache
+ * Returns entry # in cache used
+ * OR negative error code
+ */
+static int
+ECPGfreeStmtCacheEntry(int entNo) /* entry # to free */
+{
+ stmtCacheEntry *entry;
+ PGresult *results;
+ char deallocText[100];
+ struct connection *con;
+
+ entry = &stmtCacheEntries[entNo];
+ if(!entry->stmtID[0]) /* return if the entry isn't in use */
+ return(0);
+
+ con = ECPGget_connection(entry->connection);
+/* free the server resources for the statement */
+ ECPGlog("ECPGfreeStmtCacheEntry line %d: deallocate %s, cache entry #%d\n", entry->lineno, entry->stmtID, entNo);
+ sprintf(deallocText, "DEALLOCATE PREPARE %s", entry->stmtID);
+ results = PQexec(con->connection, deallocText);
+
+ if (!ECPGcheck_PQresult(results, entry->lineno, con->connection, ECPG_COMPAT_PGSQL))
+ return(-1);
+ PQclear(results);
+
+ entry->stmtID[0] = '\0';
+
+/* free the memory used by the cache entry */
+ if(entry->ecpgQuery)
+ {
+ ECPGfree(entry->ecpgQuery);
+ entry->ecpgQuery = 0;
+ }
+
+ return(entNo);
+}
+
+/*
+ * add an entry to the statement cache
+ * returns entry # in cache used OR negative error code
+ */
+static int
+AddStmtToCache(int lineno, /* line # of statement */
+ char *stmtID, /* statement ID */
+ const char *connection, /* connection */
+ const char *ecpgQuery) /* query */
+{
+ int ix, initEntNo, luEntNo, entNo;
+ stmtCacheEntry *entry;
+
+/* hash the statement */
+ initEntNo = HashStmt(ecpgQuery);
+
+/* search for an unused entry */
+ entNo = initEntNo; /* start with the initial entry # for the bucket */
+ luEntNo = initEntNo; /* use it as the initial 'least used' entry */
+ for(ix = 0; ix < stmtCacheEntPerBucket; ++ix)
+ {
+ entry = &stmtCacheEntries[entNo];
+ if(!entry->stmtID[0]) /* unused entry - use it */
+ break;
+ if(entry->execs < stmtCacheEntries[luEntNo].execs)
+ luEntNo = entNo; /* save new 'least used' entry */
+ ++entNo; /* increment entry # */
+ }
+
+/* if no unused entries were found - use the 'least used' entry found in the bucket */
+ if(ix >= stmtCacheEntPerBucket) /* if no unused entries were found */
+ entNo = luEntNo; /* re-use the 'least used' entry */
+
+/* 'entNo' is the entry to use - make sure its free */
+ if (ECPGfreeStmtCacheEntry(entNo) < 0)
+ return (-1);
+
+/* add the query to the entry */
+ entry = &stmtCacheEntries[entNo];
+ entry->lineno = lineno;
+ entry->ecpgQuery = ECPGstrdup(ecpgQuery, lineno);
+ entry->connection = (char *)connection;
+ entry->execs = 0;
+ memcpy(entry->stmtID, stmtID, sizeof(entry->stmtID));
+
+ return(entNo);
+}
+
+/* handle cache and preparation of statments in auto-prepare mode */
+bool
+ECPGauto_prepare(int lineno, const char *connection_name, const int questionmarks, char **name, const char *query)
+{
+ int entNo;
+
+ /* search the statement cache for this statement */
+ entNo = SearchStmtCache(query);
+
+ /* if not found - add the statement to the cache */
+ if(entNo)
+ {
+ ECPGlog("ECPGauto_prepare line %d: stmt found in cache, entry %d\n", lineno, entNo);
+ *name = ECPGstrdup(stmtCacheEntries[entNo].stmtID, lineno);
+ }
+ else
+ {
+ ECPGlog("ECPGauto_prepare line %d: stmt not in cache; inserting\n", lineno);
+
+ /* generate a statement ID */
+ *name = (char *) ECPGalloc(STMTID_SIZE, lineno);
+ sprintf(*name, "ecpg%d", nextStmtID++);
+
+ if (!ECPGprepare(lineno, connection_name, questionmarks, ECPGstrdup(*name, lineno), query))
+ return(false);
+ if (AddStmtToCache(lineno, *name, connection_name, query) < 0)
+ return(false);
+ }
+
+ /* increase usage counter */
+ stmtCacheEntries[entNo].execs++;
+
+ return(true);
+}
+
/*
* this is a small part of c.h since we don't want to leak all postgres
* definitions into ecpg programs
- * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.70 2006/10/04 00:30:11 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.71 2007/08/14 10:01:52 meskes Exp $
*/
#ifndef _ECPGLIB_H
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(int, int, int, const char *, const char *,...);
+bool ECPGdo(const int, const int, const int, const char *, const char, const enum ECPG_statement_type, const char *,...);
bool ECPGtrans(int, const char *, const char *);
bool ECPGdisconnect(int, const char *);
-bool ECPGprepare(int, const char *, const char *);
+bool ECPGprepare(int, const char *, const int, const char *, const char *);
+bool ECPGauto_prepare(int, const char *, const int, char **, const char *);
bool ECPGdeallocate(int, int, const char *);
-bool ECPGdeallocate_one(int, const char *);
-bool ECPGdeallocate_all(int);
-char *ECPGprepared_statement(const char *);
+bool ECPGdeallocate_all(int, int);
+char *ECPGprepared_statement(const char *, int);
void ECPGlog(const char *format,...);
char *ECPGerrmsg(void);
const char *descriptor, const char *query);
bool ECPGdeallocate_desc(int line, const char *name);
bool ECPGallocate_desc(int line, const char *name);
-void ECPGraise(int line, int code, const char *sqlstate, const char *str);
-void ECPGraise_backend(int line, PGresult *result, PGconn *conn, int compat);
bool ECPGget_desc_header(int, const char *, int *);
bool ECPGget_desc(int, const char *, int,...);
bool ECPGset_desc_header(int, const char *, int);
* All types that can be handled for host variable declarations has to
* be handled eventually.
*
- * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpgtype.h,v 1.36 2006/03/11 04:38:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpgtype.h,v 1.37 2007/08/14 10:01:52 meskes Exp $
*/
/*
#define IS_SIMPLE_TYPE(type) ((type) >= ECPGt_char && (type) <= ECPGt_interval)
+/* we also have to handle different statement types */
+enum ECPG_statement_type
+{
+ ECPGst_normal,
+ ECPGst_execute,
+ ECPGst_exec_immediate,
+ ECPGst_prepnormal
+};
+
#ifdef __cplusplus
}
#endif
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.32 2006/10/04 00:30:11 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.33 2007/08/14 10:01:52 meskes Exp $ */
#include "postgres_fe.h"
fsec_t fsec;
struct tm tt,
*tm = &tt;
- int tzp;
int dtype;
int nf;
char *field[MAXDATEFIELDS];
}
if (ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf, ptr) != 0 ||
- DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp, EuroDates) != 0)
+ DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, EuroDates) != 0)
{
errno = PGTYPES_DATE_BAD_DATE;
return INT_MIN;
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.36 2007/02/19 17:41:39 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.37 2007/08/14 10:01:53 meskes Exp $ */
#ifndef DT_H
#define DT_H
int EncodeDateOnly(struct tm *, int, char *, bool);
void GetEpochTime(struct tm *);
int ParseDateTime(char *, char *, char **, int *, int, int *, char **);
-int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, int *, bool);
+int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool);
void j2date(int, int *, int *, int *);
void GetCurrentDateTime(struct tm *);
int date2j(int, int, int);
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.40 2007/05/21 07:07:48 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.41 2007/08/14 10:01:53 meskes Exp $ */
#include "postgres_fe.h"
*/
int
DecodeDateTime(char **field, int *ftype, int nf,
- int *dtype, struct tm * tm, fsec_t *fsec, int *tzp, bool EuroDates)
+ int *dtype, struct tm * tm, fsec_t *fsec, bool EuroDates)
{
int fmask = 0,
tmask,
int haveTextMonth = FALSE;
int is2digits = FALSE;
int bc = FALSE;
+ int t = 0;
+ int *tzp = &t;
/***
* We'll insist on at least all of the date fields, but initialize the
fsec_t fsec;
struct tm tt,
*tm = &tt;
- int tz;
int dtype;
int nf;
char *field[MAXDATEFIELDS];
}
if (ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf, ptr) != 0 ||
- DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz, 0) != 0)
+ DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, 0) != 0)
{
errno = PGTYPES_TS_BAD_TIMESTAMP;
return (noresult);
#
# Copyright (c) 1998-2007, PostgreSQL Global Development Group
#
-# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.126 2007/04/01 08:56:58 petere Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.127 2007/08/14 10:01:53 meskes Exp $
#
#-------------------------------------------------------------------------
include $(top_builddir)/src/Makefile.global
MAJOR_VERSION= 4
-MINOR_VERSION= 3
-PATCHLEVEL=1
+MINOR_VERSION= 4
+PATCHLEVEL=0
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(srcdir) -DMAJOR_VERSION=$(MAJOR_VERSION) \
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.99 2007/06/11 11:52:08 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.100 2007/08/14 10:01:53 meskes Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
auto_create_c = false,
system_includes = false,
force_indicator = true,
+ questionmarks = false,
header_mode = false,
- regression_mode = false;
+ regression_mode = false,
+ auto_prepare = false;
-char *output_filename;
+char *output_filename;
enum COMPAT_MODE compat = ECPG_COMPAT_PGSQL;
printf(" -I DIRECTORY search DIRECTORY for include files\n");
printf(" -o OUTFILE write result to OUTFILE\n");
printf(" -r OPTION specify runtime behaviour;\n"
- " OPTION can only be \"no_indicator\"\n");
+ " OPTION can be:\n"
+ " \"no_indicator\"\n"
+ " \"prepare\"\n"
+ " \"questionmarks\"\n");
printf(" -t turn on autocommit of transactions\n");
printf(" --help show this help, then exit\n");
printf(" --regression run in regression testing mode\n");
case 'r':
if (strcmp(optarg, "no_indicator") == 0)
force_indicator = false;
+ else if (strcmp(optarg, "prepare") == 0)
+ auto_prepare = true;
+ else if (strcmp(optarg, "questionmarks") == 0)
+ questionmarks = true;
else
{
fprintf(stderr, "Try '%s --help' for more information.\n", argv[0]);
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/extern.h,v 1.66 2007/06/11 11:52:08 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/extern.h,v 1.67 2007/08/14 10:01:53 meskes Exp $ */
#ifndef _ECPG_PREPROC_EXTERN_H
#define _ECPG_PREPROC_EXTERN_H
auto_create_c,
system_includes,
force_indicator,
+ questionmarks,
ret_value,
struct_level,
ecpg_informix_var,
- regression_mode;
+ regression_mode,
+ auto_prepare;
extern char *descriptor_index;
extern char *descriptor_name;
extern char *connection;
extern void lex_init(void);
extern char *make_str(const char *);
extern void output_line_number(void);
-extern void output_statement(char *, int, char *);
+extern void output_statement(char *, int, enum ECPG_statement_type);
+extern void output_prepare_statement(char *, char *);
+extern void output_deallocate_prepare_statement(char *);
extern void output_simple_statement(char *);
extern char *hashline_number(void);
extern int base_yyparse(void);
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.19 2006/10/04 00:30:12 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.20 2007/08/14 10:01:53 meskes Exp $ */
#include "postgres_fe.h"
#include "extern.h"
-static void output_escaped_str(char *cmd);
+static void output_escaped_str(char *cmd, bool quoted);
void
output_line_number(void)
{
char *line = hashline_number();
- /* output_escaped_str(line); */
fprintf(yyout, "%s", line);
free(line);
}
void
output_simple_statement(char *stmt)
{
- output_escaped_str(stmt);
+ output_escaped_str(stmt, false);
output_line_number();
free(stmt);
}
+
/*
* store the whenever action here
*/
#endif
)
{
- char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + 21 + strlen(input_filename));
+ char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename));
sprintf(line, "\n#line %d \"%s\"\n", yylineno, input_filename);
}
void
-output_statement(char *stmt, int mode, char *con)
+output_statement(char *stmt, int whenever_mode, enum ECPG_statement_type st)
{
- fprintf(yyout, "{ ECPGdo(__LINE__, %d, %d, %s, \"", compat, force_indicator, con ? con : "NULL");
- output_escaped_str(stmt);
- fputs("\", ", yyout);
+
+ fprintf(yyout, "{ ECPGdo(__LINE__, %d, %d, %s, %d, ", compat, force_indicator, connection ? connection : "NULL", questionmarks);
+ if (st == ECPGst_normal)
+ {
+ if (auto_prepare)
+ fprintf(yyout, "%d, \"", ECPGst_prepnormal);
+ else
+ fprintf(yyout, "%d, \"", ECPGst_normal);
+
+ output_escaped_str(stmt, false);
+ fputs("\", ", yyout);
+ }
+ else
+ fprintf(yyout, "%d, %s, ", st, stmt);
/* dump variables to C file */
dump_variables(argsinsert, 1);
fputs("ECPGt_EORT);", yyout);
reset_variables();
- mode |= 2;
- whenever_action(mode);
+ whenever_action(whenever_mode|2);
free(stmt);
if (connection != NULL)
free(connection);
}
+void
+output_prepare_statement(char *name, char *stmt)
+{
+ fprintf(yyout, "{ ECPGprepare(__LINE__, %s, %d, ", connection ? connection : "NULL", questionmarks);
+ output_escaped_str(name, true);
+ fputs(", ", yyout);
+ output_escaped_str(stmt, true);
+ fputs(");", yyout);
+ whenever_action(2);
+ free(name);
+ if (connection != NULL)
+ free(connection);
+}
+
+void
+output_deallocate_prepare_statement(char *name)
+{
+ if (strcmp(name, "all"))
+ {
+ fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, ", compat);
+ output_escaped_str(name, true);
+ fputs(");", yyout);
+ }
+ else
+ fprintf(yyout, "{ ECPGdeallocate_all(__LINE__, %d);", compat);
+
+ whenever_action(2);
+ free(name);
+ if (connection != NULL)
+ free(connection);
+}
static void
-output_escaped_str(char *str)
+output_escaped_str(char *str, bool quoted)
{
- int i,
- len = strlen(str);
+ int i = 0;
+ int len = strlen(str);
+
+ if (quoted && str[0] == '\"' && str[len-1] == '\"') /* do not escape quotes at beginning and end if quoted string */
+ {
+ i = 1;
+ len--;
+ fputs("\"", yyout);
+ }
/* output this char by char as we have to filter " and \n */
- for (i = 0; i < len; i++)
+ for (; i < len; i++)
{
if (str[i] == '"')
fputs("\\\"", yyout);
else if (str[i] == '\n')
fputs("\\\n", yyout);
+ else if (str[i] == '\\')
+ fputs("\\\\", yyout);
else if (str[i] == '\r' && str[i + 1] == '\n')
{
fputs("\\\r\n", yyout);
else
fputc(str[i], yyout);
}
+
+ if (quoted && str[0] == '\"' && str[len] == '\"')
+ fputs("\"", yyout);
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.152 2007/03/17 19:25:23 meskes Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.153 2007/08/14 10:01:53 meskes Exp $
*
*-------------------------------------------------------------------------
*/
static int xcdepth = 0; /* depth of nesting in slash-star comments */
static char *dolqstart; /* current $foo$ quote start string */
static bool escape_string_warning;
-static bool standard_conforming_strings;
static bool warn_on_first_escape;
static YY_BUFFER_STATE scanbufhandle;
static char *scanbuf;
* <xh> hexadecimal numeric string - thomas 1997-11-16
* <xq> standard quoted strings - thomas 1997-07-30
* <xe> extended quoted strings (support backslash escape sequences)
+ * <xn> national character quoted strings
* <xdolq> $foo$ quoted strings
*/
%x xdc
%x xh
%x xe
+%x xn
%x xq
%x xdolq
%x xcond
warn_on_first_escape = true;
token_start = yytext;
state_before = YYSTATE;
- if (standard_conforming_strings)
- BEGIN(xq);
- else
- BEGIN(xe);
+ BEGIN(xn);
startlit();
}
<C>{xqstart} {
warn_on_first_escape = false;
token_start = yytext;
state_before = YYSTATE;
- BEGIN(xe);
+ BEGIN(xq);
startlit();
}
<SQL>{xqstart} {
warn_on_first_escape = true;
token_start = yytext;
state_before = YYSTATE;
- if (standard_conforming_strings)
- BEGIN(xq);
- else
- BEGIN(xe);
+ BEGIN(xq);
startlit();
}
<SQL>{xestart} {
BEGIN(xe);
startlit();
}
-<xq,xe>{quotestop} |
-<xq,xe>{quotefail} {
+<xq>{quotestop} |
+<xq>{quotefail} {
yyless(1);
BEGIN(state_before);
yylval.str = mm_strdup(literalbuf);
return SCONST;
}
-<xq,xe>{xqdouble} { addlitchar('\''); }
-<xq>{xqinside} { addlit(yytext, yyleng); }
+<xe>{quotestop} |
+<xe>{quotefail} {
+ yyless(1);
+ BEGIN(state_before);
+ yylval.str = mm_strdup(literalbuf);
+ return ECONST;
+ }
+<xn>{quotestop} |
+<xn>{quotefail} {
+ yyless(1);
+ BEGIN(state_before);
+ yylval.str = mm_strdup(literalbuf);
+ return NCONST;
+ }
+<xq,xe,xn>{xqdouble} { addlitchar('\''); }
+<xq,xn>{xqinside} { addlit(yytext, yyleng); }
<xe>{xeinside} { addlit(yytext, yyleng); }
<xe>{xeescape} {
check_escape_warning();
check_escape_warning();
addlit(yytext, yyleng);
}
-<xq,xe>{quotecontinue} { /* ignore */ }
+<xq,xe,xn>{quotecontinue} { /* ignore */ }
<xe>. {
/* This is only needed for \ just before EOF */
addlitchar(yytext[0]);
}
-<xq,xe><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "Unterminated quoted string"); }
+<xq,xe,xn><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "Unterminated quoted string"); }
<SQL>{dolqfailed} {
/* throw back all but the initial "$" */
yyless(1);
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.348 2007/07/25 16:10:41 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.349 2007/08/14 10:01:53 meskes Exp $ */
/* Copyright comment */
%{
static int QueryIsRule = 0, FoundInto = 0;
static int initializer = 0;
+static int pacounter = 1;
+static char pacounter_buffer[sizeof(int) * CHAR_BIT * 10 / 3]; /* a rough guess at the size we need */
static struct this_type actual_type[STRUCT_DEPTH];
static char *actual_startline[STRUCT_DEPTH];
struct ECPGtype ecpg_query = {ECPGt_char_variable, 0L, NULL, {NULL}};
-/* INFORMIX workaround, no longer needed
-static struct inf_compat_col
-{
- char *name;
- char *indirection;
- struct inf_compat_col *next;
-} *informix_col;
-
-static struct inf_compat_val
-{
- char *val;
- struct inf_compat_val *next;
-} *informix_val;
-*/
-
/*
* Handle parsing errors and warnings
*/
fclose(yyin);
fclose(yyout);
if (unlink(output_filename) != 0 && *output_filename != '-')
- fprintf(stderr, "Could not remove output file %s!\n", output_filename);
+ fprintf(stderr, "Could not remove output file %s!\n", output_filename);
exit(error_code);
}
}
count = 1;
for (; count > 0; count --)
- result = cat2_str(result, make_str("? , "));
+ {
+ sprintf(pacounter_buffer, "$%d", pacounter++);
+ result = cat_str(3, result, strdup(pacounter_buffer), make_str(" , "));
+ }
/* removed the trailing " ," */
if ((ptr->variable->type->type != ECPGt_varchar && ptr->variable->type->type != ECPGt_char && ptr->variable->type->type != ECPGt_unsigned_char) && atoi(ptr->variable->type->size) > 1)
{
- ptr->variable = new_variable(cat_str(4, make_str("("), mm_strdup(ECPGtype_name(ptr->variable->type->u.element->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, make_str("1")), ptr->variable->type->size), 0);
+ ptr->variable = new_variable(cat_str(4, make_str("("), mm_strdup(ECPGtype_name(ptr->variable->type->u.element->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, make_str("1"), ptr->variable->type->u.element->lineno), ptr->variable->type->size), 0);
sprintf(temp, "%d, (", ecpg_informix_var++);
}
else if ((ptr->variable->type->type == ECPGt_varchar || ptr->variable->type->type == ECPGt_char || ptr->variable->type->type == ECPGt_unsigned_char) && atoi(ptr->variable->type->size) > 1)
{
- ptr->variable = new_variable(cat_str(4, make_str("("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size), 0);
+ ptr->variable = new_variable(cat_str(4, make_str("("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, (", ecpg_informix_var++);
}
else
{
- ptr->variable = new_variable(cat_str(4, make_str("*("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size), 0);
+ ptr->variable = new_variable(cat_str(4, make_str("*("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, &(", ecpg_informix_var++);
}
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
if (atoi(ptr->indicator->type->size) > 1)
{
- ptr->indicator = new_variable(cat_str(4, make_str("("), mm_strdup(ECPGtype_name(ptr->indicator->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size), 0);
+ ptr->indicator = new_variable(cat_str(4, make_str("("), mm_strdup(ECPGtype_name(ptr->indicator->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, (", ecpg_informix_var++);
}
else
{
- ptr->indicator = new_variable(cat_str(4, make_str("*("), mm_strdup(ECPGtype_name(ptr->indicator->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size), 0);
+ ptr->indicator = new_variable(cat_str(4, make_str("*("), mm_strdup(ECPGtype_name(ptr->indicator->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, &(", ecpg_informix_var++);
}
result = cat_str(5, result, make_str("ECPG_informix_set_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
enum ECPGdtype dtype_enum;
struct fetch_desc descriptor;
struct su_symbol struct_union;
+ struct prep prep;
}
/* special embedded SQL token */
%token NULLS_FIRST NULLS_LAST WITH_CASCADED WITH_LOCAL WITH_CHECK
/* Special token types, not actually keywords - see the "lex" file */
-%token <str> IDENT SCONST Op CSTRING CVARIABLE CPP_LINE IP BCONST XCONST DOLCONST
+%token <str> IDENT SCONST Op CSTRING CVARIABLE CPP_LINE IP BCONST
+%token <str> XCONST DOLCONST ECONST NCONST
%token <ival> ICONST PARAM
%token <dval> FCONST
%type <str> RemoveOperStmt RenameStmt all_Op opt_trusted opt_lancompiler
%type <str> VariableSetStmt var_value zone_value VariableShowStmt
%type <str> VariableResetStmt AlterTableStmt from_list overlay_list
-%type <str> relation_name OptTableSpace LockStmt opt_lock
+%type <str> relation_name OptTableSpace LockStmt opt_lock
%type <str> CreateUserStmt AlterUserStmt CreateSeqStmt OptSeqList
%type <str> OptSeqElem TriggerForSpec TriggerForOpt TriggerForType
%type <str> DropTrigStmt TriggerOneEvent TriggerEvents RuleActionStmt
%type <str> select_limit CheckPointStmt ECPGColId old_aggr_list
%type <str> OptSchemaName OptSchemaEltList schema_stmt opt_drop_behavior
%type <str> handler_name any_name_list any_name opt_as insert_column_list
-%type <str> columnref values_clause AllConstVar where_or_current_clause
-%type <str> insert_column_item DropRuleStmt ctext_expr
+%type <str> columnref values_clause AllConstVar prep_type_clause ExecuteStmt
+%type <str> insert_column_item DropRuleStmt ctext_expr execute_param_clause
%type <str> createfunc_opt_item set_rest var_list_or_default alter_rel_cmd
%type <str> CreateFunctionStmt createfunc_opt_list func_table
%type <str> DropUserStmt copy_from copy_opt_list copy_opt_item
%type <str> ConstBit GenericType TableFuncElementList opt_analyze
%type <str> opt_sort_clause subquery_Op transaction_mode_item
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen
-%type <str> indicator ECPGExecute ECPGPrepare ecpg_using ecpg_into
+%type <str> indicator ecpg_using ecpg_into DeallocateStmt
%type <str> storage_declaration storage_clause opt_initializer c_anything
%type <str> variable_list variable c_thing c_term ECPGKeywords_vanames
%type <str> opt_pointer ECPGDisconnect dis_name storage_modifier
%type <str> var_type_declarations quoted_ident_stringvar ECPGKeywords_rest
%type <str> db_prefix server opt_options opt_connection_name c_list
%type <str> ECPGSetConnection ECPGTypedef c_args ECPGKeywords ECPGCKeywords
-%type <str> enum_type civar civarind ECPGCursorStmt ECPGDeallocate
-%type <str> ECPGFree ECPGDeclare ECPGVar opt_at enum_definition
+%type <str> enum_type civar civarind ECPGCursorStmt PreparableStmt
+%type <str> ECPGFree ECPGDeclare ECPGVar at enum_definition
%type <str> struct_union_type s_struct_union vt_declarations execute_rest
%type <str> var_declaration type_declaration single_vt_declaration
%type <str> ECPGSetAutocommit on_off variable_declarations ECPGDescribe
%type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_output
%type <str> ECPGGetDescriptorHeader ECPGColLabel single_var_declaration
%type <str> reserved_keyword unreserved_keyword ecpg_interval opt_ecpg_using
-%type <str> col_name_keyword precision opt_scale
+%type <str> col_name_keyword precision opt_scale ECPGExecuteImmediateStmt
%type <str> ECPGTypeName using_list ECPGColLabelCommon UsingConst
%type <str> using_descriptor into_descriptor opt_nulls_order opt_asc_desc
%type <str> prepared_name struct_union_type_with_symbol OptConsTableSpace
%type <str> CreateOpFamilyStmt AlterOpFamilyStmt create_as_target
%type <str> xml_attributes xml_attribute_list document_or_content xml_whitespace_option
%type <str> opt_xml_root_standalone xml_root_version xml_attribute_el
+%type <str> where_or_current_clause
%type <struct_union> s_struct_union_symbol
%type <type> var_type
+%type <prep> PrepareStmt
+
%type <action> action
%type <index> opt_array_bounds
| statements statement
;
-statement: ecpgstart opt_at stmt ';' { connection = NULL; }
+statement: ecpgstart at stmt ';' { connection = NULL; }
| ecpgstart stmt ';'
| ecpgstart ECPGVarDeclaration
{
| '}' { remove_typedefs(braces_open); remove_variables(braces_open--); fputs("}", yyout); }
;
-opt_at: AT connection_object
+at: AT connection_object
{
connection = $2;
/*
*/
if (argsinsert != NULL)
argsinsert = NULL;
- };
-
-stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
- | AlterDatabaseSetStmt { output_statement($1, 0, connection); }
- | AlterDomainStmt { output_statement($1, 0, connection); }
- | AlterFunctionStmt { output_statement($1, 0, connection); }
- | AlterGroupStmt { output_statement($1, 0, connection); }
- | AlterObjectSchemaStmt { output_statement($1, 0, connection); }
- | AlterOwnerStmt { output_statement($1, 0, connection); }
- | AlterSeqStmt { output_statement($1, 0, connection); }
- | AlterTableStmt { output_statement($1, 0, connection); }
- | AlterRoleSetStmt { output_statement($1, 0, connection); }
- | AlterRoleStmt { output_statement($1, 0, connection); }
- | AlterUserStmt { output_statement($1, 0, connection); }
- | AnalyzeStmt { output_statement($1, 0, connection); }
- | CheckPointStmt { output_statement($1, 0, connection); }
+ }
+ ;
+
+stmt: AlterDatabaseStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterDatabaseSetStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterDomainStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterFunctionStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterGroupStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterObjectSchemaStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterOwnerStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterSeqStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterTableStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterRoleSetStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterRoleStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterUserStmt { output_statement($1, 0, ECPGst_normal); }
+ | AnalyzeStmt { output_statement($1, 0, ECPGst_normal); }
+ | CheckPointStmt { output_statement($1, 0, ECPGst_normal); }
| ClosePortalStmt
{
if (INFORMIX_MODE)
free($1);
}
else
- output_statement($1, 0, connection);
+ output_statement($1, 0, ECPGst_normal);
}
else
- output_statement($1, 0, connection);
- }
- | ClusterStmt { output_statement($1, 0, connection); }
- | CommentStmt { output_statement($1, 0, connection); }
- | ConstraintsSetStmt { output_statement($1, 0, connection); }
- | CopyStmt { output_statement($1, 0, connection); }
- | CreateAsStmt { output_statement($1, 0, connection); }
- | CreateAssertStmt { output_statement($1, 0, connection); }
- | CreateCastStmt { output_statement($1, 0, connection); }
- | CreateConversionStmt { output_statement($1, 0, connection); }
- | CreateDomainStmt { output_statement($1, 0, connection); }
- | CreateFunctionStmt { output_statement($1, 0, connection); }
- | CreateGroupStmt { output_statement($1, 0, connection); }
- | CreatePLangStmt { output_statement($1, 0, connection); }
- | CreateOpClassStmt { output_statement($1, 0, connection); }
- | CreateOpFamilyStmt { output_statement($1, 0, connection); }
- | AlterOpFamilyStmt { output_statement($1, 0, connection); }
- | CreateRoleStmt { output_statement($1, 0, connection); }
- | CreateSchemaStmt { output_statement($1, 0, connection); }
- | CreateSeqStmt { output_statement($1, 0, connection); }
- | CreateStmt { output_statement($1, 0, connection); }
- | CreateTableSpaceStmt { output_statement($1, 0, connection); }
- | CreateTrigStmt { output_statement($1, 0, connection); }
- | CreateUserStmt { output_statement($1, 0, connection); }
- | CreatedbStmt { output_statement($1, 0, connection); }
- /*| DeallocateStmt { output_statement($1, 0, connection); }*/
+ output_statement($1, 0, ECPGst_normal);
+ }
+ | ClusterStmt { output_statement($1, 0, ECPGst_normal); }
+ | CommentStmt { output_statement($1, 0, ECPGst_normal); }
+ | ConstraintsSetStmt { output_statement($1, 0, ECPGst_normal); }
+ | CopyStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateAsStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateAssertStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateCastStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateConversionStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateDomainStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateFunctionStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateGroupStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreatePLangStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateOpClassStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateOpFamilyStmt { output_statement($1, 0, ECPGst_normal); }
+ | AlterOpFamilyStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateRoleStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateSchemaStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateSeqStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateTableSpaceStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateTrigStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreateUserStmt { output_statement($1, 0, ECPGst_normal); }
+ | CreatedbStmt { output_statement($1, 0, ECPGst_normal); }
+ | DeallocateStmt
+ {
+ if (connection)
+ mmerror(PARSE_ERROR, ET_ERROR, "no at option for deallocate statement.\n");
+
+ output_deallocate_prepare_statement($1);
+ }
| DeclareCursorStmt { output_simple_statement($1); }
- | DefineStmt { output_statement($1, 0, connection); }
- | DeleteStmt { output_statement($1, 1, connection); }
- | DiscardStmt { output_statement($1, 1, connection); }
- | DropAssertStmt { output_statement($1, 0, connection); }
- | DropCastStmt { output_statement($1, 0, connection); }
- | DropGroupStmt { output_statement($1, 0, connection); }
- | DropOpClassStmt { output_statement($1, 0, connection); }
- | DropOpFamilyStmt { output_statement($1, 0, connection); }
- | DropOwnedStmt { output_statement($1, 0, connection); }
- | DropPLangStmt { output_statement($1, 0, connection); }
- | DropRoleStmt { output_statement($1, 0, connection); }
- | DropRuleStmt { output_statement($1, 0, connection); }
- | DropStmt { output_statement($1, 0, connection); }
- | DropTableSpaceStmt { output_statement($1, 0, connection); }
- | DropTrigStmt { output_statement($1, 0, connection); }
- | DropUserStmt { output_statement($1, 0, connection); }
- | DropdbStmt { output_statement($1, 0, connection); }
- | ExplainStmt { output_statement($1, 0, connection); }
-/* | ExecuteStmt { output_statement($1, 0, connection); }*/
- | FetchStmt { output_statement($1, 1, connection); }
- | GrantStmt { output_statement($1, 0, connection); }
- | GrantRoleStmt { output_statement($1, 0, connection); }
- | IndexStmt { output_statement($1, 0, connection); }
- | InsertStmt { output_statement($1, 1, connection); }
- | ListenStmt { output_statement($1, 0, connection); }
- | LoadStmt { output_statement($1, 0, connection); }
- | LockStmt { output_statement($1, 0, connection); }
- | NotifyStmt { output_statement($1, 0, connection); }
-/* | PrepareStmt { output_statement($1, 0, connection); }*/
- | ReassignOwnedStmt { output_statement($1, 0, connection); }
- | ReindexStmt { output_statement($1, 0, connection); }
- | RemoveAggrStmt { output_statement($1, 0, connection); }
- | RemoveOperStmt { output_statement($1, 0, connection); }
- | RemoveFuncStmt { output_statement($1, 0, connection); }
- | RenameStmt { output_statement($1, 0, connection); }
- | RevokeStmt { output_statement($1, 0, connection); }
- | RevokeRoleStmt { output_statement($1, 0, connection); }
- | RuleStmt { output_statement($1, 0, connection); }
- | SelectStmt { output_statement($1, 1, connection); }
+ | DefineStmt { output_statement($1, 0, ECPGst_normal); }
+ | DeleteStmt { output_statement($1, 1, ECPGst_normal); }
+ | DiscardStmt { output_statement($1, 1, ECPGst_normal); }
+ | DropAssertStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropCastStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropGroupStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropOpClassStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropOpFamilyStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropOwnedStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropPLangStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropRoleStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropRuleStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropTableSpaceStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropTrigStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropUserStmt { output_statement($1, 0, ECPGst_normal); }
+ | DropdbStmt { output_statement($1, 0, ECPGst_normal); }
+ | ExplainStmt { output_statement($1, 0, ECPGst_normal); }
+ | ExecuteStmt { output_statement($1, 0, ECPGst_execute); }
+ | FetchStmt { output_statement($1, 1, ECPGst_normal); }
+ | GrantStmt { output_statement($1, 0, ECPGst_normal); }
+ | GrantRoleStmt { output_statement($1, 0, ECPGst_normal); }
+ | IndexStmt { output_statement($1, 0, ECPGst_normal); }
+ | InsertStmt { output_statement($1, 1, ECPGst_normal); }
+ | ListenStmt { output_statement($1, 0, ECPGst_normal); }
+ | LoadStmt { output_statement($1, 0, ECPGst_normal); }
+ | LockStmt { output_statement($1, 0, ECPGst_normal); }
+ | NotifyStmt { output_statement($1, 0, ECPGst_normal); }
+ | PrepareStmt {
+ if ($1.type == NULL || strlen($1.type) == 0) /* use PQprepare without type parameters */
+ output_prepare_statement($1.name, $1.stmt);
+ else /* use PQexec and let backend do its stuff */
+ {
+ char *txt = cat_str(5, make_str("prepare"), $1.name, $1.type, make_str("as"), $1.stmt);
+ output_statement(txt, 0, ECPGst_normal);
+ }
+ }
+ | ReassignOwnedStmt { output_statement($1, 0, ECPGst_normal); }
+ | ReindexStmt { output_statement($1, 0, ECPGst_normal); }
+ | RemoveAggrStmt { output_statement($1, 0, ECPGst_normal); }
+ | RemoveOperStmt { output_statement($1, 0, ECPGst_normal); }
+ | RemoveFuncStmt { output_statement($1, 0, ECPGst_normal); }
+ | RenameStmt { output_statement($1, 0, ECPGst_normal); }
+ | RevokeStmt { output_statement($1, 0, ECPGst_normal); }
+ | RevokeRoleStmt { output_statement($1, 0, ECPGst_normal); }
+ | RuleStmt { output_statement($1, 0, ECPGst_normal); }
+ | SelectStmt { output_statement($1, 1, ECPGst_normal); }
| TransactionStmt
{
fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
whenever_action(2);
free($1);
}
- | TruncateStmt { output_statement($1, 0, connection); }
- | UnlistenStmt { output_statement($1, 0, connection); }
- | UpdateStmt { output_statement($1, 1, connection); }
- | VacuumStmt { output_statement($1, 0, connection); }
- | VariableSetStmt { output_statement($1, 0, connection); }
- | VariableShowStmt { output_statement($1, 0, connection); }
- | VariableResetStmt { output_statement($1, 0, connection); }
- | ViewStmt { output_statement($1, 0, connection); }
+ | TruncateStmt { output_statement($1, 0, ECPGst_normal); }
+ | UnlistenStmt { output_statement($1, 0, ECPGst_normal); }
+ | UpdateStmt { output_statement($1, 1, ECPGst_normal); }
+ | VacuumStmt { output_statement($1, 0, ECPGst_normal); }
+ | VariableSetStmt { output_statement($1, 0, ECPGst_normal); }
+ | VariableShowStmt { output_statement($1, 0, ECPGst_normal); }
+ | VariableResetStmt { output_statement($1, 0, ECPGst_normal); }
+ | ViewStmt { output_statement($1, 0, ECPGst_normal); }
| ECPGAllocateDescr
{
fprintf(yyout,"ECPGallocate_desc(__LINE__, %s);",$1);
{
output_simple_statement($1);
}
- | ECPGDeallocate
- {
- if (connection)
- mmerror(PARSE_ERROR, ET_ERROR, "no at option for deallocate statement.\n");
- fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s);", compat, $1);
- whenever_action(2);
- free($1);
- }
| ECPGDeallocateDescr
{
if (connection)
whenever_action(2);
free($1);
}
- | ECPGExecute
- {
- output_statement($1, 0, connection);
- }
+ | ECPGExecuteImmediateStmt { output_statement($1, 0, ECPGst_exec_immediate); }
| ECPGFree
{
- fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, \"%s\");", compat, $1);
+ if (strcmp($1, "all"))
+ fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, \"%s\");", compat, $1);
+ else
+ fprintf(yyout, "{ ECPGdeallocate_all(__LINE__, %d);", compat);
whenever_action(2);
free($1);
if ((ptr = add_additional_variables($1, true)) != NULL)
{
- output_statement(mm_strdup(ptr->command), 0,
- ptr->connection ? mm_strdup(ptr->connection) : NULL);
+ connection = ptr->connection ? mm_strdup(ptr->connection) : NULL;
+ output_statement(mm_strdup(ptr->command), 0, 0);
ptr->opened = true;
}
}
- | ECPGPrepare
- {
- if (connection)
- mmerror(PARSE_ERROR, ET_ERROR, "no at option for prepare statement.\n");
-
- fprintf(yyout, "{ ECPGprepare(__LINE__, %s);", $1);
- whenever_action(2);
- free($1);
- }
- /* | ECPGRelease { / * output already done * / } */
| ECPGSetAutocommit
{
fprintf(yyout, "{ ECPGsetcommit(__LINE__, \"%s\", %s);", $1, connection ? connection : "NULL");
;
fetch_direction: NEXT { $$ = make_str("next"); }
- | PRIOR { $$ = make_str("prior"); }
- | FIRST_P { $$ = make_str("first"); }
- | LAST_P { $$ = make_str("last"); }
- | ABSOLUTE_P IntConst { $$ = cat2_str(make_str("absolute"), $2); }
- | RELATIVE_P IntConst { $$ = cat2_str(make_str("relative"), $2); }
- | IntConst { $$ = $1; }
- | ALL { $$ = make_str("all"); }
- | FORWARD { $$ = make_str("forward"); }
- | FORWARD IntConst { $$ = cat2_str(make_str("forward"), $2); }
- | FORWARD ALL { $$ = make_str("forward all"); }
- | BACKWARD { $$ = make_str("backward"); }
- | BACKWARD IntConst { $$ = cat2_str(make_str("backward"), $2); }
- | BACKWARD ALL { $$ = make_str("backward all"); }
+ | PRIOR { $$ = make_str("prior"); }
+ | FIRST_P { $$ = make_str("first"); }
+ | LAST_P { $$ = make_str("last"); }
+ | ABSOLUTE_P IntConst {
+ if ($2[1] == '$')
+ mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
+ else
+ $$ = cat2_str(make_str("absolute"), $2);
+ }
+ | RELATIVE_P IntConst {
+ if ($2[1] == '$')
+ mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
+ else
+ $$ = cat2_str(make_str("relative"), $2);
+ }
+ | IntConst {
+ if ($1[1] == '$')
+ mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
+ else
+ $$ = $1;
+ }
+ | ALL { $$ = make_str("all"); }
+ | FORWARD { $$ = make_str("forward"); }
+ | FORWARD IntConst {
+ if ($2[1] == '$')
+ mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
+ else
+ $$ = cat2_str(make_str("forward"), $2);
+ }
+ | FORWARD ALL { $$ = make_str("forward all"); }
+ | BACKWARD { $$ = make_str("backward"); }
+ | BACKWARD IntConst {
+ if ($2[1] == '$')
+ mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
+ else
+ $$ = cat2_str(make_str("backward"), $2);
+ }
+ | BACKWARD ALL { $$ = make_str("backward all"); }
;
from_in: IN_P { $$ = make_str("in"); }
| UpdateStmt
| DeleteStmt
| DeclareCursorStmt
- /* | ExecuteStmt */
+ | ExecuteStmt
;
opt_analyze:
analyze_keyword { $$ = $1; }
| /* EMPTY */ { $$ = EMPTY; }
;
-/*
-
-conflicts with ecpg
-
-PrepareStmt: PREPARE name prep_type_clause AS PreparableStmt
- { $$ = cat_str(5, make_str("prepare"), $2, $3, make_str("as"), $5); }
+PrepareStmt: PREPARE prepared_name prep_type_clause AS PreparableStmt
+ {
+ $$.name = $2;
+ $$.type = $3;
+ $$.stmt = cat_str(3, make_str("\""), $5, make_str("\""));
+ }
+ | PREPARE prepared_name FROM execstring /* ECPG addon */
+ {
+ $$.name = $2;
+ $$.type = NULL;
+ $$.stmt = $4;
+ }
;
PreparableStmt:
;
prep_type_clause: '(' type_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
- | /* EMPTY * / { $$ = EMPTY; }
+ | /* EMPTY */ { $$ = EMPTY; }
;
-ExecuteStmt: EXECUTE name execute_param_clause
- { $$ = cat_str(3, make_str("execute"), $2, $3); }
+ExecuteStmt: EXECUTE prepared_name execute_param_clause execute_rest /* execute_rest is an ecpg addon */
+ {
+ /* $$ = cat_str(3, make_str("ECPGprepared_statement("), $2, make_str(", __LINE__)"));*/
+ $$ = $2;
+ }
| CREATE OptTemp TABLE create_as_target AS
- EXECUTE name execute_param_clause
- { $$ = cat_str(11, make_str("create"), $2, make_str("table"), $4, $5, $6, $7, $8, make_str("as execute"), $11, $12); }
+ EXECUTE prepared_name execute_param_clause
+ { $$ = cat_str(7, make_str("create"), $2, make_str("table"), $4, make_str("as execute"), $7, $8); }
;
execute_param_clause: '(' expr_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
- | /* EMPTY * / { $$ = EMPTY; }
+ | /* EMPTY */ { $$ = EMPTY; }
;
-DeallocateStmt: DEALLOCATE name { $$ = cat2_str(make_str("deallocate"), $2); }
- | DEALLOCATE PREPARE name { $$ = cat2_str(make_str("deallocate prepare"), $3); }
- | DEALLOCATE ALL { $$ = make_str("deallocate all"); }
- | DEALLOCATE PREPARE ALL { $$ = make_str("deallocate prepare all"); }
+DeallocateStmt: DEALLOCATE prepared_name { $$ = $2; }
+ | DEALLOCATE PREPARE prepared_name { $$ = $3; }
+ | DEALLOCATE ALL { $$ = make_str("all"); }
+ | DEALLOCATE PREPARE ALL { $$ = make_str("all"); }
;
-*/
/*****************************************************************************
*
| /*EMPTY*/ { $$ = EMPTY; /* no qualifiers */ }
;
-where_or_current_clause: WHERE a_expr { $$ = cat2_str(make_str("where"), $2); }
- | WHERE CURRENT_P OF name { $$ = cat2_str(make_str("where current of"), $4); }
- | WHERE CURRENT_P OF PARAM { $$ = make_str("where current of param"); }
- | /*EMPTY*/ { $$ = EMPTY; /* no qualifiers */ }
- ;
+where_or_current_clause: WHERE a_expr { $$ = cat2_str(make_str("where"), $2); }
+ | WHERE CURRENT_P OF name { $$ = cat2_str(make_str("where current of"), $4); }
+ | WHERE CURRENT_P OF PARAM { $$ = make_str("where current of param"); }
+ | /*EMPTY*/ { $$ = EMPTY; /* no qualifiers */ }
+ ;
TableFuncElementList: TableFuncElement
{ $$ = $1; }
$$[strlen($1)+2]='\0';
free($1);
}
+ | ECONST
+ {
+ /* escaped quote starting with E */
+ $$ = (char *)mm_alloc(strlen($1) + 4);
+ $$[0]='E';
+ $$[1]='\'';
+ strcpy($$+2, $1);
+ $$[strlen($1)+2]='\'';
+ $$[strlen($1)+3]='\0';
+ free($1);
+ }
+ | NCONST
+ {
+ /* escaped quote starting with rNE */
+ $$ = (char *)mm_alloc(strlen($1) + 4);
+ $$[0]='N';
+ $$[1]='\'';
+ strcpy($$+2, $1);
+ $$[strlen($1)+2]='\'';
+ $$[strlen($1)+3]='\0';
+ free($1);
+ }
| DOLCONST
{
$$ = $1;
IntConstVar: Iconst
{
- char *length = mm_alloc(32);
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
sprintf(length, "%d", (int) strlen($1));
- new_variable($1, ECPGmake_simple_type(ECPGt_const, length), 0);
+ new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = $1;
}
| cvariable { $$ = $1; }
AllConstVar: Fconst
{
- char *length = mm_alloc(32);
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
sprintf(length, "%d", (int) strlen($1));
- new_variable($1, ECPGmake_simple_type(ECPGt_const, length), 0);
+ new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = $1;
}
| IntConstVar { $$ = $1; }
| '-' Fconst
{
- char *length = mm_alloc(32);
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = cat2_str(make_str("-"), $2);
sprintf(length, "%d", (int) strlen(var));
- new_variable(var, ECPGmake_simple_type(ECPGt_const, length), 0);
+ new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
}
| '-' Iconst
{
- char *length = mm_alloc(32);
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = cat2_str(make_str("-"), $2);
sprintf(length, "%d", (int) strlen(var));
- new_variable(var, ECPGmake_simple_type(ECPGt_const, length), 0);
+ new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
}
| Sconst
{
- char *length = mm_alloc(32);
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = $1 + 1;
var[strlen(var) - 1] = '\0';
sprintf(length, "%d", (int) strlen(var));
- new_variable(var, ECPGmake_simple_type(ECPGt_const, length), 0);
+ new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
}
;
this->next = cur;
this->name = $2;
this->connection = connection;
- this->command = cat_str(6, make_str("declare"), mm_strdup($2), $3, make_str("cursor"), $5, make_str("for ?"));
+ this->command = cat_str(6, make_str("declare"), mm_strdup($2), $3, make_str("cursor"), $5, make_str("for $1"));
this->argsresult = NULL;
thisquery->type = &ecpg_query;
thisquery->brace_level = 0;
thisquery->next = NULL;
- thisquery->name = (char *) mm_alloc(sizeof("ECPGprepared_statement()") + strlen($7));
- sprintf(thisquery->name, "ECPGprepared_statement(%s)", $7);
+ thisquery->name = (char *) mm_alloc(sizeof("ECPGprepared_statement(, __LINE__)") + strlen($7));
+ sprintf(thisquery->name, "ECPGprepared_statement(%s, __LINE__)", $7);
this->argsinsert = NULL;
add_variable_to_head(&(this->argsinsert), thisquery, &no_indicator);
}
;
-/*
- * the exec sql deallocate prepare command to deallocate a previously
- * prepared statement
- */
-ECPGDeallocate: DEALLOCATE PREPARE prepared_name
- { $$ = $3; }
- | DEALLOCATE prepared_name
- { $$ = $2; }
- ;
-
+ECPGExecuteImmediateStmt: EXECUTE IMMEDIATE execstring
+ {
+ /* execute immediate means prepare the statement and
+ * immediately execute it */
+ $$ = $3;
+ };
/*
* variable decalartion outside exec sql declare block
*/
$$.type_enum = this->type->type_enum;
$$.type_dimension = this->type->type_dimension;
$$.type_index = this->type->type_index;
- $$.type_sizeof = this->type->type_sizeof;
+ if (this->type->type_sizeof && strlen(this->type->type_sizeof) != 0)
+ $$.type_sizeof = this->type->type_sizeof;
+ else
+ $$.type_sizeof = cat_str(3, make_str("sizeof("), mm_strdup(this->name), make_str(")"));
+
struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
}
}
char *dimension = $3.index1; /* dimension of array */
char *length = $3.index2; /* length of string */
char dim[14L];
+ char *vcn;
adjust_array(actual_type[struct_level].type_enum, &dimension, &length, actual_type[struct_level].type_dimension, actual_type[struct_level].type_index, strlen($1), false);
case ECPGt_varchar:
if (atoi(dimension) < 0)
- type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length);
+ type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, yylineno);
else
- type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length), dimension);
-
+ type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, yylineno), dimension);
+
if (strcmp(dimension, "0") == 0 || abs(atoi(dimension)) == 1)
*dim = '\0';
else
if (atoi(length) < 0 || strcmp(length, "0") == 0)
mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");
+ /* make sure varchar struct name is unique by adding linenumer of its definition */
+ vcn = (char *) mm_alloc(strlen($2) + sizeof(int) * CHAR_BIT * 10 / 3);
+ sprintf(vcn, "%s_%d", $2, yylineno);
if (strcmp(dimension, "0") == 0)
- $$ = cat_str(7, make2_str(make_str(" struct varchar_"), mm_strdup($2)), make_str(" { int len; char arr["), mm_strdup(length), make_str("]; } *"), mm_strdup($2), $4, $5);
+ $$ = cat_str(7, make2_str(make_str(" struct varchar_"), vcn), make_str(" { int len; char arr["), mm_strdup(length), make_str("]; } *"), mm_strdup($2), $4, $5);
else
- $$ = cat_str(8, make2_str(make_str(" struct varchar_"), mm_strdup($2)), make_str(" { int len; char arr["), mm_strdup(length), make_str("]; } "), mm_strdup($2), mm_strdup(dim), $4, $5);
+ $$ = cat_str(8, make2_str(make_str(" struct varchar_"), vcn), make_str(" { int len; char arr["), mm_strdup(length), make_str("]; } "), mm_strdup($2), mm_strdup(dim), $4, $5);
break;
case ECPGt_char:
length = mm_alloc(i+sizeof("sizeof()"));
sprintf(length, "sizeof(%s)", $5+2);
}
- type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length);
+ type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, 0);
}
else
- type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length), dimension);
+ type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, 0), dimension);
$$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
break;
default:
if (atoi(dimension) < 0)
- type = ECPGmake_simple_type(actual_type[struct_level].type_enum, make_str("1"));
+ type = ECPGmake_simple_type(actual_type[struct_level].type_enum, make_str("1"), 0);
else
- type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, make_str("1")), dimension);
+ type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, make_str("1"), 0), dimension);
$$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
break;
| char_variable { $$ = $1; }
;
-/*
- * execute a given string as sql command
- */
-ECPGExecute : EXECUTE IMMEDIATE execstring
- {
- struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
-
- thisquery->type = &ecpg_query;
- thisquery->brace_level = 0;
- thisquery->next = NULL;
- thisquery->name = $3;
-
- add_variable_to_head(&argsinsert, thisquery, &no_indicator);
-
- $$ = make_str("?");
- }
- | EXECUTE prepared_name
- {
- struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
-
- thisquery->type = &ecpg_query;
- thisquery->brace_level = 0;
- thisquery->next = NULL;
- thisquery->name = (char *) mm_alloc(sizeof("ECPGprepared_statement()") + strlen($2));
- sprintf(thisquery->name, "ECPGprepared_statement(%s)", $2);
-
- add_variable_to_head(&argsinsert, thisquery, &no_indicator);
- }
- execute_rest
- {
- $$ = make_str("?");
- }
- ;
-
execute_rest: ecpg_using ecpg_into { $$ = EMPTY; }
| ecpg_into ecpg_using { $$ = EMPTY; }
| ecpg_using { $$ = EMPTY; }
{ $$ = make3_str(make_str("\""), $1, make_str("\"")); }
;
-prepared_name: name { $$ = make3_str(make_str("\""), $1, make_str("\"")); }
+prepared_name: name {
+ if ($1[0] == '\"' && $1[strlen($1)-1] == '\"') /* already quoted? */
+ $$ = $1;
+ else /* not quoted => convert to lowercase */
+ {
+ int i;
+
+ for (i = 0; i< strlen($1); i++)
+ $1[i] = tolower($1[i]);
+
+ $$ = make3_str(make_str("\""), $1, make_str("\""));
+ }
+ }
| char_variable { $$ = $1; }
;
* the exec sql free command to deallocate a previously
* prepared statement
*/
-ECPGFree: SQL_FREE name { $$ = $2; };
+ECPGFree: SQL_FREE name { $$ = $2; }
+ | SQL_FREE ALL { $$ = make_str("all"); }
+ ;
/*
* open is an open cursor, at the moment this has to be removed
UsingConst: AllConst
{
- if ($1[1] != '?') /* found a constant */
+ if ($1[1] != '$') /* found a constant */
{
char *length = mm_alloc(32);
sprintf(length, "%d", (int) strlen($1));
- add_variable_to_head(&argsinsert, new_variable($1, ECPGmake_simple_type(ECPGt_const, length), 0), &no_indicator);
+ add_variable_to_head(&argsinsert, new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
}
}
| civarind { $$ = EMPTY; }
;
-/*
- * As long as the prepare statement is not supported by the backend, we will
- * try to simulate it here so we get dynamic SQL
- *
- * It is supported now but not usable yet by ecpg.
- */
-ECPGPrepare: PREPARE prepared_name FROM execstring
- { $$ = cat_str(3, $2, make_str(","), $4); }
- ;
/*
* We accept descibe but do nothing with it so far.
ECPGDescribe: SQL_DESCRIBE INPUT_P name using_descriptor
{
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement.\n");
- $$ = (char *) mm_alloc(sizeof("1, ECPGprepared_statement(\"\")") + strlen($3));
- sprintf($$, "1, ECPGprepared_statement(\"%s\")", $3);
+ $$ = (char *) mm_alloc(sizeof("1, ECPGprepared_statement(\"\", __LINE__)") + strlen($3));
+ sprintf($$, "1, ECPGprepared_statement(\"%s\", __LINE__)", $3);
}
| SQL_DESCRIBE opt_output name using_descriptor
{
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement.\n");
- $$ = (char *) mm_alloc(sizeof("0, ECPGprepared_statement(\"\")") + strlen($3));
- sprintf($$, "0, ECPGprepared_statement(\"%s\")", $3);
+ $$ = (char *) mm_alloc(sizeof("0, ECPGprepared_statement(\"\", __LINE__)") + strlen($3));
+ sprintf($$, "0, ECPGprepared_statement(\"%s\", __LINE__)", $3);
}
| SQL_DESCRIBE opt_output name into_descriptor
{
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement.\n");
- $$ = (char *) mm_alloc(sizeof("0, ECPGprepared_statement(\"\")") + strlen($3));
- sprintf($$, "0, ECPGprepared_statement(\"%s\")", $3);
+ $$ = (char *) mm_alloc(sizeof("0, ECPGprepared_statement(\"\", __LINE__)") + strlen($3));
+ sprintf($$, "0, ECPGprepared_statement(\"%s\", __LINE__)", $3);
}
;
| TYPE_P { $$ = ECPGd_type; }
;
-
-/*
- * for compatibility with ORACLE we will also allow the keyword RELEASE
- * after a transaction statement to disconnect from the database.
- */
-
-/* We cannot do that anymore since it causes shift/reduce conflicts. 2004-09-27 Michael Meskes
-ECPGRelease: TransactionStmt RELEASE
- {
- if (strcmp($1, "begin") == 0)
- mmerror(PARSE_ERROR, ET_ERROR, "RELEASE does not make sense when beginning a transaction");
-
- fprintf(yyout, "ECPGtrans(__LINE__, %s, \"%s\");",
- connection ? connection : "NULL", $1);
- whenever_action(0);
- fprintf(yyout, "ECPGdisconnect(__LINE__, %s);",
- connection ? connection : "\"CURRENT\"");
- whenever_action(0);
- free($1);
- }
- ;
-*/
-
/*
* set/reset the automatic transaction mode, this needs a differnet handling
* as the other set commands
case ECPGt_varchar:
if (atoi(dimension) == -1)
- type = ECPGmake_simple_type($5.type_enum, length);
+ type = ECPGmake_simple_type($5.type_enum, length, 0);
else
- type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length), dimension);
+ type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length, 0), dimension);
break;
case ECPGt_char:
case ECPGt_unsigned_char:
if (atoi(dimension) == -1)
- type = ECPGmake_simple_type($5.type_enum, length);
+ type = ECPGmake_simple_type($5.type_enum, length, 0);
else
- type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length), dimension);
+ type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length, 0), dimension);
break;
default:
mmerror(PARSE_ERROR, ET_ERROR, "No multidimensional array support for simple data types");
if (atoi(dimension) < 0)
- type = ECPGmake_simple_type($5.type_enum, make_str("1"));
+ type = ECPGmake_simple_type($5.type_enum, make_str("1"), 0);
else
- type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, make_str("1")), dimension);
+ type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, make_str("1"), 0), dimension);
break;
}
into_list : coutputvariable | into_list ',' coutputvariable
;
-ecpgstart: SQL_START { reset_variables(); }
+ecpgstart: SQL_START {
+ reset_variables();
+ pacounter = 1;
+ }
;
c_args: /*EMPTY*/ { $$ = EMPTY; }
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.72 2007/03/17 19:25:23 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.73 2007/08/14 10:01:53 meskes Exp $ */
#include "postgres_fe.h"
if (rm->type->u.element->type == ECPGt_struct)
type = ECPGmake_struct_type(rm->type->u.element->u.members, rm->type->u.element->type, rm->type->u.element->struct_sizeof);
else
- type = ECPGmake_array_type(ECPGmake_simple_type(rm->type->u.element->type, rm->type->u.element->size), rm->type->size);
+ type = ECPGmake_array_type(ECPGmake_simple_type(rm->type->u.element->type, rm->type->u.element->size, rm->type->u.element->lineno), rm->type->size);
break;
default:
- type = ECPGmake_simple_type(rm->type->type, rm->type->size);
+ type = ECPGmake_simple_type(rm->type->type, rm->type->size, rm->type->lineno);
break;
}
}
struct ECPGtype *
-ECPGmake_simple_type(enum ECPGttype type, char *size)
+ECPGmake_simple_type(enum ECPGttype type, char *size, int lineno)
{
struct ECPGtype *ne = (struct ECPGtype *) mm_alloc(sizeof(struct ECPGtype));
ne->size = size;
ne->u.element = NULL;
ne->struct_sizeof = NULL;
+ ne->lineno = lineno; /* only needed for varchar */
return ne;
}
struct ECPGtype *
ECPGmake_array_type(struct ECPGtype * type, char *size)
{
- struct ECPGtype *ne = ECPGmake_simple_type(ECPGt_array, size);
+ struct ECPGtype *ne = ECPGmake_simple_type(ECPGt_array, size, 0);
ne->u.element = type;
struct ECPGtype *
ECPGmake_struct_type(struct ECPGstruct_member * rm, enum ECPGttype type, char *struct_sizeof)
{
- struct ECPGtype *ne = ECPGmake_simple_type(type, make_str("1"));
+ struct ECPGtype *ne = ECPGmake_simple_type(type, make_str("1"), 0);
ne->u.members = ECPGstruct_member_dup(rm);
ne->struct_sizeof = struct_sizeof;
*/
static void ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
char *varcharsize,
- char *arrsiz, const char *siz, const char *prefix);
+ char *arrsiz, const char *siz, const char *prefix, int);
static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz,
struct ECPGtype * type, struct ECPGtype * ind_type, const char *offset, const char *prefix, const char *ind_prefix);
ECPGdump_a_simple(o, name,
type->u.element->type,
- type->u.element->size, type->size, NULL, prefix);
+ type->u.element->size, type->size, NULL, prefix, type->lineno);
if (ind_type != NULL)
{
if (ind_type->type == ECPGt_NO_INDICATOR)
- ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix);
+ ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix, 0);
else
{
ECPGdump_a_simple(o, ind_name, ind_type->u.element->type,
- ind_type->u.element->size, ind_type->size, NULL, ind_prefix);
+ ind_type->u.element->size, ind_type->size, NULL, ind_prefix, 0);
}
}
}
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "Indicator for simple datatype has to be simple.\n");
- ECPGdump_a_simple(o, name, type->type, make_str("1"), (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("1"), struct_sizeof, prefix);
+ ECPGdump_a_simple(o, name, type->type, make_str("1"), (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("1"), struct_sizeof, prefix, 0);
if (ind_type != NULL)
- ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), ind_struct_sizeof, ind_prefix);
+ ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), ind_struct_sizeof, ind_prefix, 0);
break;
case ECPGt_descriptor:
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "Indicator for simple datatype has to be simple.\n");
- ECPGdump_a_simple(o, name, type->type, NULL, make_str("-1"), NULL, prefix);
+ ECPGdump_a_simple(o, name, type->type, NULL, make_str("-1"), NULL, prefix, 0);
if (ind_type != NULL)
- ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix);
+ ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix, 0);
break;
default:
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "Indicator for simple datatype has to be simple.\n");
- ECPGdump_a_simple(o, name, type->type, type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), struct_sizeof, prefix);
+ ECPGdump_a_simple(o, name, type->type, type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), struct_sizeof, prefix, type->lineno);
if (ind_type != NULL)
- ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), ind_struct_sizeof, ind_prefix);
+ ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), ind_struct_sizeof, ind_prefix, 0);
break;
}
}
char *varcharsize,
char *arrsize,
const char *siz,
- const char *prefix
-)
+ const char *prefix,
+ int lineno)
{
if (type == ECPGt_NO_INDICATOR)
fprintf(o, "\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ");
else
{
char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4);
- char *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1 + strlen(varcharsize));
+ char *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1 + strlen(varcharsize)+ sizeof(int) * CHAR_BIT * 10 / 3);
switch (type)
{
else
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
- sprintf(offset, "sizeof(struct varchar_%s)", name);
+ if (lineno)
+ sprintf(offset, "sizeof(struct varchar_%s_%d)", name, lineno);
+ else
+ sprintf(offset, "sizeof(struct varchar_%s)", name);
break;
case ECPGt_char:
case ECPGt_unsigned_char:
if (atoi(arrsize) < 0)
strcpy(arrsize, "1");
- if (siz == NULL || strcmp(arrsize, "0") == 0 || strcmp(arrsize, "1") == 0)
+ if (siz == NULL || strlen(siz) == 0 || strcmp(arrsize, "0") == 0 || strcmp(arrsize, "1") == 0)
fprintf(o, "\n\t%s,%s,(long)%s,(long)%s,%s, ", get_type(type), variable, varcharsize, arrsize, offset);
else
fprintf(o, "\n\t%s,%s,(long)%s,(long)%s,%s, ", get_type(type), variable, varcharsize, arrsize, siz);
struct ECPGstruct_member *members; /* A pointer to a list of
* members. */
} u;
+ int lineno;
};
/* Everything is malloced. */
void ECPGmake_struct_member(char *, struct ECPGtype *, struct ECPGstruct_member **);
-struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *);
+struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *, int);
struct ECPGtype *ECPGmake_varchar_type(enum ECPGttype, long);
struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, char *);
struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *);
char *symbol;
};
+struct prep
+{
+ char *name;
+ char *stmt;
+ char *type;
+};
+
struct this_type
{
enum ECPGttype type_enum;
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.41 2006/07/30 16:28:58 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.42 2007/08/14 10:01:53 meskes Exp $ */
#include "postgres_fe.h"
switch (members->type->type)
{
case ECPGt_array:
- return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size), members->type->size), brace_level));
+ return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->lineno), members->type->size), brace_level));
case ECPGt_struct:
case ECPGt_union:
return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->struct_sizeof), brace_level));
default:
- return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size), brace_level));
+ return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->lineno), brace_level));
}
}
else
switch (members->type->u.element->type)
{
case ECPGt_array:
- return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size), members->type->u.element->size), brace_level));
+ return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->lineno), members->type->u.element->size), brace_level));
case ECPGt_struct:
case ECPGt_union:
return (new_variable(name, ECPGmake_struct_type(members->type->u.element->u.members, members->type->u.element->type, members->type->u.element->struct_sizeof), brace_level));
default:
- return (new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size), brace_level));
+ return (new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->lineno), brace_level));
}
break;
case '-':
switch (p->type->u.element->type)
{
case ECPGt_array:
- return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size), p->type->u.element->size), p->brace_level));
+ return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->lineno), p->type->u.element->size), p->brace_level));
case ECPGt_struct:
case ECPGt_union:
return (new_variable(name, ECPGmake_struct_type(p->type->u.element->u.members, p->type->u.element->type, p->type->u.element->struct_sizeof), p->brace_level));
default:
- return (new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size), p->brace_level));
+ return (new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->u.element->lineno), p->brace_level));
}
}
}
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.71 2007/06/15 08:23:52 meskes Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.72 2007/08/14 10:01:53 meskes Exp $
subdir = src/interfaces/ecpg/test
top_builddir = ../../../..
# port number for temp-installation test postmaster
# this is also defined in test/connect/Makefile
-TEMP_PORT = 5$(DEF_PGPORT)
+TEMP_PORT = 4$(DEF_PGPORT)
# where to find psql for testing an existing installation
PSQLDIR = $(bindir)
printf("(libc: (%s)) ", strerror(errno));
break;
}
-
}
int main(void)
{
- $char c[] = "abc ";
+ $char c[] = "abc";
$short s = 17;
$int i = -74874;
$bool b = 1;
deccvint(7, &j);
deccvint(14, &m);
decadd(&j, &m, &n);
- $delete from test where i=:n;
+ $delete from test where i= :n::decimal;
printf("DELETE: %ld\n", sqlca.sqlcode);
$select 1 from test where i=14;
intvl = PGTYPESinterval_from_asc("1 day 2 hours 24 minutes 65 seconds", NULL);
PGTYPEStimestamp_add_interval(&d, intvl, &e);
-
+ free(intvl);
c++;
EXEC SQL insert into history
# port number for temp-installation test postmaster
# this is also defined in ../Makefile
-TEMP_PORT = 5$(DEF_PGPORT)
+TEMP_PORT = 4$(DEF_PGPORT)
test1.pgc: test1.pgc.in
sed -e 's,@TEMP_PORT@,$(TEMP_PORT),g' \
test: pgtypeslib/dt_test2
test: pgtypeslib/num_test
test: pgtypeslib/num_test2
+test: preproc/array_of_struct
+test: preproc/autoprep
test: preproc/comment
test: preproc/define
test: preproc/init
test: sql/fetch
test: sql/func
test: sql/indicators
+test: sql/oldexec
test: sql/quote
test: sql/show
test: sql/insupd
test: pgtypeslib/dt_test2
test: pgtypeslib/num_test
test: pgtypeslib/num_test2
+test: preproc/array_of_struct
+test: preproc/autoprep
test: preproc/comment
test: preproc/define
test: preproc/init
test: sql/fetch
test: sql/func
test: sql/indicators
+test: sql/oldexec
test: sql/quote
test: sql/show
test: sql/insupd
printf("(libc: (%s)) ", strerror(errno));
break;
}
-
}
{
#line 15 "rnull.pgc"
- char c [] = "abc " ;
+ char c [] = "abc" ;
#line 15 "rnull.pgc"
#line 29 "rnull.pgc"
- { ECPGdo(__LINE__, 1, 0, NULL, "create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, 0, "create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ) ", ECPGt_EOIT, ECPGt_EORT);
#line 33 "rnull.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 34 "rnull.pgc"
- { ECPGdo(__LINE__, 1, 0, NULL, "insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , ? , ? , ? , ? , ? , ? , ? ) ",
- ECPGt_char,(c),(long)sizeof("abc "),(long)1,(sizeof("abc "))*sizeof(char),
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, 0, "insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , $1 , $2 , $3 , $4 , $5 , $6 , $7 ) ",
+ ECPGt_char,(c),(long)sizeof("abc"),(long)1,(sizeof("abc"))*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
rsetnull(CDATETYPE, (char *) &dat);
rsetnull(CDTIMETYPE, (char *) &tmp);
- { ECPGdo(__LINE__, 1, 0, NULL, "insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values ( 2 , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ",
- ECPGt_char,(c),(long)sizeof("abc "),(long)1,(sizeof("abc "))*sizeof(char),
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, 0, "insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values ( 2 , $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 ) ",
+ ECPGt_char,(c),(long)sizeof("abc"),(long)1,(sizeof("abc"))*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
printf("first select\n");
- { ECPGdo(__LINE__, 1, 0, NULL, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1 ", ECPGt_EOIT,
- ECPGt_char,(c),(long)sizeof("abc "),(long)1,(sizeof("abc "))*sizeof(char),
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, 0, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1 ", ECPGt_EOIT,
+ ECPGt_char,(c),(long)sizeof("abc"),(long)1,(sizeof("abc"))*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
printf("second select\n");
- { ECPGdo(__LINE__, 1, 0, NULL, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2 ", ECPGt_EOIT,
- ECPGt_char,(c),(long)sizeof("abc "),(long)1,(sizeof("abc "))*sizeof(char),
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, 0, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2 ", ECPGt_EOIT,
+ ECPGt_char,(c),(long)sizeof("abc"),(long)1,(sizeof("abc"))*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
test_null(CDATETYPE, (char *) &dat);
test_null(CDTIMETYPE, (char *) &tmp);
- { ECPGdo(__LINE__, 1, 0, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, 0, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 91 "rnull.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 31: QUERY: create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ) on connection regress1
+[NO_PID]: ECPGexecute line 31: QUERY: create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 31: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 34 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36: QUERY: insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , 'abc ' , 17 , -74874 , 't' , 3.710000038147 , 487444 , 404.404 ) on connection regress1
+[NO_PID]: ECPGexecute line 36: QUERY: insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , $1 , $2 , $3 , $4 , $5 , $6 , $7 ) with 7 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: parameter 1 = abc
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: parameter 2 = 17
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: parameter 3 = -74874
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: parameter 4 = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: parameter 5 = 3.710000038147
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: parameter 6 = 487444
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: parameter 7 = 404.404
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 39 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 52: QUERY: insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values ( 2 , null , null , null , 't' , null , null , null , null , null , null ) on connection regress1
+[NO_PID]: ECPGexecute line 52: QUERY: insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values ( 2 , $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 ) with 10 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 1 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 2 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 3 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 4 = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 5 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 6 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 7 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 8 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 9 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: parameter 10 = null
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 55 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 59: QUERY: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1 on connection regress1
+[NO_PID]: ECPGexecute line 59: QUERY: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 59: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 59: Correctly got 1 tuples with 10 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 59: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 76: QUERY: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2 on connection regress1
+[NO_PID]: ECPGexecute line 76: QUERY: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 76: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 76: Correctly got 1 tuples with 10 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 91: QUERY: drop table test on connection regress1
+[NO_PID]: ECPGexecute line 91: QUERY: drop table test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 91: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 91 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
if (sqlca.sqlcode != 0) exit(1);
- { ECPGdo(__LINE__, 1, 1, NULL, "create table test ( i int primary key , j int ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "create table test ( i int primary key , j int ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
/* this INSERT works */
rsetnull(CDECIMALTYPE, (char *)&j);
- { ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values ( 7 , ? ) ",
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "insert into test ( i , j ) values ( 7 , $1 ) ",
ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 27 "test_informix.pgc"
/* this INSERT should fail because i is a unique column */
- { ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values ( 7 , 12 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "insert into test ( i , j ) values ( 7 , 12 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 31 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 33 "test_informix.pgc"
- { ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values ( ? , 1 ) ",
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "insert into test ( i , j ) values ( $1 , 1 ) ",
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 35 "test_informix.pgc"
/* this will fail (more than one row in subquery) */
- { ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "select i from test where j = ( select j from test ) ", ECPGt_EOIT, ECPGt_EORT);
#line 39 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
/* this however should be ok */
- { ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test order by i limit 1 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "select i from test where j = ( select j from test order by i limit 1 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 43 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
ECPG_informix_set_var( 0, &( i ), __LINE__);\
- /* declare c cursor for select * from test where i <= ? */
+ /* declare c cursor for select * from test where i <= $1 */
#line 47 "test_informix.pgc"
openit();
while (1)
{
- { ECPGdo(__LINE__, 1, 1, NULL, "fetch forward from c", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "fetch forward from c", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
deccvint(7, &j);
deccvint(14, &m);
decadd(&j, &m, &n);
- { ECPGdo(__LINE__, 1, 1, NULL, "delete from test where i = ? ",
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "delete from test where i = $1 :: decimal ",
ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 72 "test_informix.pgc"
printf("DELETE: %ld\n", sqlca.sqlcode);
- { ECPGdo(__LINE__, 1, 1, NULL, "select 1 from test where i = 14 ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "select 1 from test where i = 14 ", ECPGt_EOIT, ECPGt_EORT);
#line 75 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
printf("Exists: %ld\n", sqlca.sqlcode);
- { ECPGdo(__LINE__, 1, 1, NULL, "select 1 from test where i = 147 ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "select 1 from test where i = 147 ", ECPGt_EOIT, ECPGt_EORT);
#line 78 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 81 "test_informix.pgc"
- { ECPGdo(__LINE__, 1, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 82 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
static void openit(void)
{
- { ECPGdo(__LINE__, 1, 1, NULL, "declare c cursor for select * from test where i <= ? ",
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "declare c cursor for select * from test where i <= $1 ",
ECPGt_int,&(*( int *)(ECPG_informix_get_var( 0))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 92 "test_informix.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 23: QUERY: create table test ( i int primary key , j int ) on connection regress1
+[NO_PID]: ECPGexecute line 23: QUERY: create table test ( i int primary key , j int ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 27: QUERY: insert into test ( i , j ) values ( 7 , 0 ) on connection regress1
+[NO_PID]: ECPGexecute line 27: QUERY: insert into test ( i , j ) values ( 7 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 27: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 27: parameter 1 = 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 28 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 31: QUERY: insert into test ( i , j ) values ( 7 , 12 ) on connection regress1
+[NO_PID]: ECPGexecute line 31: QUERY: insert into test ( i , j ) values ( 7 , 12 ) with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 31: Error: ERROR: duplicate key value violates unique constraint "test_pkey"
+[NO_PID]: ECPGexecute line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGcheck_PQresult line 31: Error: ERROR: duplicate key value violates unique constraint "test_pkey"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 23505 (sqlcode: -239) in line 31, ''duplicate key value violates unique constraint "test_pkey"' in line 31.'.
[NO_PID]: sqlca: code: -239, state: 23505
[NO_PID]: ECPGtrans line 33 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: insert into test ( i , j ) values ( 14 , 1 ) on connection regress1
+[NO_PID]: ECPGexecute line 35: QUERY: insert into test ( i , j ) values ( $1 , 1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: parameter 1 = 14
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 36 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: QUERY: select i from test where j = ( select j from test ) on connection regress1
+[NO_PID]: ECPGexecute line 39: QUERY: select i from test where j = ( select j from test ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: Error: ERROR: more than one row returned by a subquery used as an expression
+[NO_PID]: ECPGcheck_PQresult line 39: Error: ERROR: more than one row returned by a subquery used as an expression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 21000 (sqlcode: -284) in line 39, ''more than one row returned by a subquery used as an expression' in line 39.'.
[NO_PID]: sqlca: code: -284, state: 21000
[NO_PID]: ECPGtrans line 40 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 43: QUERY: select i from test where j = ( select j from test order by i limit 1 ) on connection regress1
+[NO_PID]: ECPGexecute line 43: QUERY: select i from test where j = ( select j from test order by i limit 1 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 43: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 92: QUERY: declare c cursor for select * from test where i <= 14 on connection regress1
+[NO_PID]: ECPGexecute line 92: QUERY: declare c cursor for select * from test where i <= $1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 92: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 92: parameter 1 = 14
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 92 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c on connection regress1
+[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 54: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 54: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 54: RESULT: 0 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c on connection regress1
+[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 54: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 54: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 54: RESULT: 1 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c on connection regress1
+[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 54: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 54: Correctly got 0 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 54, 'No data found in line 54.'.
[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 72: QUERY: delete from test where i = 21.0 on connection regress1
+[NO_PID]: ECPGexecute line 72: QUERY: delete from test where i = $1 :: decimal with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 72: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 72: parameter 1 = 21.0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 72 Ok: DELETE 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 72, 'No data found in line 72.'.
[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 75: QUERY: select 1 from test where i = 14 on connection regress1
+[NO_PID]: ECPGexecute line 75: QUERY: select 1 from test where i = 14 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 75: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 75: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 78: QUERY: select 1 from test where i = 147 on connection regress1
+[NO_PID]: ECPGexecute line 78: QUERY: select 1 from test where i = 147 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 78: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 78: Correctly got 0 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGtrans line 81 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 82: QUERY: drop table test on connection regress1
+[NO_PID]: ECPGexecute line 82: QUERY: drop table test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 82: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 82 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
sql_check("main", "connect", 0);
- { ECPGdo(__LINE__, 1, 1, NULL, "set DateStyle to 'DMY'", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "set DateStyle to 'DMY'", ECPGt_EOIT, ECPGt_EORT);
#line 66 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 66 "test_informix2.pgc"
- { ECPGdo(__LINE__, 1, 1, NULL, "create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 68 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
sql_check("main", "create", 0);
- { ECPGdo(__LINE__, 1, 1, NULL, "insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 73 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
sql_check("main", "insert", 0);
- { ECPGdo(__LINE__, 1, 1, NULL, "select max ( timestamp ) from history ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "select max ( timestamp ) from history ", ECPGt_EOIT,
ECPGt_timestamp,&(maxd),(long)1,(long)1,sizeof(timestamp),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 78 "test_informix2.pgc"
sql_check("main", "select max", 100);
- { ECPGdo(__LINE__, 1, 1, NULL, "select customerid , timestamp from history where timestamp = ? limit 1 ",
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "select customerid , timestamp from history where timestamp = $1 limit 1 ",
ECPGt_timestamp,&(maxd),(long)1,(long)1,sizeof(timestamp),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_int,&(c),(long)1,(long)1,sizeof(int),
intvl = PGTYPESinterval_from_asc("1 day 2 hours 24 minutes 65 seconds", NULL);
PGTYPEStimestamp_add_interval(&d, intvl, &e);
-
+ free(intvl);
c++;
- { ECPGdo(__LINE__, 1, 1, NULL, "insert into history ( customerid , timestamp , action_taken , narrative ) values ( ? , ? , 'test' , 'test' ) ",
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "insert into history ( customerid , timestamp , action_taken , narrative ) values ( $1 , $2 , 'test' , 'test' ) ",
ECPGt_int,&(c),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_timestamp,&(e),(long)1,(long)1,sizeof(timestamp),
#line 100 "test_informix2.pgc"
- { ECPGdo(__LINE__, 1, 1, NULL, "drop table history ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, 0, "drop table history ", ECPGt_EOIT, ECPGt_EORT);
#line 102 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 66: QUERY: set DateStyle to 'DMY' on connection regress1
+[NO_PID]: ECPGexecute line 66: QUERY: set DateStyle to 'DMY' with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 66: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 66 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: QUERY: create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ) on connection regress1
+[NO_PID]: ECPGexecute line 68: QUERY: create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 68: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 68 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 71: QUERY: insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) on connection regress1
+[NO_PID]: ECPGexecute line 71: QUERY: insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 76: QUERY: select max ( timestamp ) from history on connection regress1
+[NO_PID]: ECPGexecute line 76: QUERY: select max ( timestamp ) from history with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 76: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 76: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 76: RESULT: Wed 07 May 13:28:34 2003 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 81: QUERY: select customerid , timestamp from history where timestamp = timestamp '2003-05-07 13:28:34' limit 1 on connection regress1
+[NO_PID]: ECPGexecute line 81: QUERY: select customerid , timestamp from history where timestamp = $1 limit 1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 81: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 81: parameter 1 = 2003-05-07 13:28:34
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 81: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 81: RESULT: Wed 07 May 13:28:34 2003 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 95: QUERY: insert into history ( customerid , timestamp , action_taken , narrative ) values ( 2 , timestamp '2003-05-08 15:53:39' , 'test' , 'test' ) on connection regress1
+[NO_PID]: ECPGexecute line 95: QUERY: insert into history ( customerid , timestamp , action_taken , narrative ) values ( $1 , $2 , 'test' , 'test' ) with 2 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 95: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 95: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 95: parameter 2 = 2003-05-08 15:53:39
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 95 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 100 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 102: QUERY: drop table history on connection regress1
+[NO_PID]: ECPGexecute line 102: QUERY: drop table history with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 102: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 102 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 23: QUERY: alter user connectuser encrypted password 'connectpw' on connection main
+[NO_PID]: ECPGexecute line 23: QUERY: alter user connectuser encrypted password 'connectpw' with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: ALTER ROLE
[NO_PID]: sqlca: code: 0, state: 00000
/* this selects from "second" which was opened last */
- { ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 28 "test2.pgc"
- { ECPGdo(__LINE__, 0, 1, "first", "select current_database () ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, "first", 0, 0, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 29 "test2.pgc"
- { ECPGdo(__LINE__, 0, 1, "second", "select current_database () ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, "second", 0, 0, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "test2.pgc"
{ ECPGsetconn(__LINE__, "first");}
#line 32 "test2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 33 "test2.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 36 "test2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 37 "test2.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 28: QUERY: select current_database () on connection second
+[NO_PID]: ECPGexecute line 28: QUERY: select current_database () with 0 parameter on connection second
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 28: RESULT: regress1 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 29: QUERY: select current_database () on connection first
+[NO_PID]: ECPGexecute line 29: QUERY: select current_database () with 0 parameter on connection first
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 29: RESULT: connectdb offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 30: QUERY: select current_database () on connection second
+[NO_PID]: ECPGexecute line 30: QUERY: select current_database () with 0 parameter on connection second
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 30: RESULT: regress1 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 33: QUERY: select current_database () on connection first
+[NO_PID]: ECPGexecute line 33: QUERY: select current_database () with 0 parameter on connection first
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 33: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection first closed.
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 37: QUERY: select current_database () on connection second
+[NO_PID]: ECPGexecute line 37: QUERY: select current_database () with 0 parameter on connection second
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
/* this selects from "second" which was opened last */
- { ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 27 "test3.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 30 "test3.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 31 "test3.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 27: QUERY: select current_database () on connection second
+[NO_PID]: ECPGexecute line 27: QUERY: select current_database () with 0 parameter on connection second
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 27: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection second closed.
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 31: QUERY: select current_database () on connection first
+[NO_PID]: ECPGexecute line 31: QUERY: select current_database () with 0 parameter on connection first
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 31: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "main", 0); }
#line 22 "test5.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
#line 23 "test5.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 23: QUERY: alter user connectuser encrypted password 'connectpw' on connection main
+[NO_PID]: ECPGexecute line 23: QUERY: alter user connectuser encrypted password 'connectpw' with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: ALTER ROLE
[NO_PID]: sqlca: code: 0, state: 00000
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 28 "dt_test.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table date_test ( d date , ts timestamp ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table date_test ( d date , ts timestamp ) ", ECPGt_EOIT, ECPGt_EORT);
#line 29 "dt_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 29 "dt_test.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
#line 30 "dt_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
date1 = PGTYPESdate_from_asc(d1, NULL);
ts1 = PGTYPEStimestamp_from_asc(t1, NULL);
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into date_test ( d , ts ) values ( ? , ? ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into date_test ( d , ts ) values ( $1 , $2 ) ",
ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_timestamp,&(ts1),(long)1,(long)1,sizeof(timestamp),
#line 35 "dt_test.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from date_test where d = ? ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from date_test where d = $1 ",
ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 29: QUERY: create table date_test ( d date , ts timestamp ) on connection regress1
+[NO_PID]: ECPGexecute line 29: QUERY: create table date_test ( d date , ts timestamp ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 30: QUERY: set datestyle to iso on connection regress1
+[NO_PID]: ECPGexecute line 30: QUERY: set datestyle to iso with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: insert into date_test ( d , ts ) values ( date '1966-01-17' , timestamp '2000-07-12 17:34:29' ) on connection regress1
+[NO_PID]: ECPGexecute line 35: QUERY: insert into date_test ( d , ts ) values ( $1 , $2 ) with 2 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: parameter 1 = 1966-01-17
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: parameter 2 = 2000-07-12 17:34:29
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 37: QUERY: select * from date_test where d = date '1966-01-17' on connection regress1
+[NO_PID]: ECPGexecute line 37: QUERY: select * from date_test where d = $1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: parameter 1 = 1966-01-17
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 34 "num_test.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 35 "num_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
des = PGTYPESnumeric_new();
PGTYPESnumeric_copy(res, des);
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( text , num ) values ( 'test' , ? ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( text , num ) values ( 'test' , $1 ) ",
ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 60 "num_test.pgc"
PGTYPESnumeric_mul(value1, value2, res);
PGTYPESnumeric_free(value2);
- { ECPGdo(__LINE__, 0, 1, NULL, "select num from test where text = 'test' ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select num from test where text = 'test' ", ECPGt_EOIT,
ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 66 "num_test.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGsetcommit line 34 action = off connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) on connection regress1
+[NO_PID]: ECPGexecute line 35: QUERY: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 60: QUERY: insert into test ( text , num ) values ( 'test' , 2369.7 ) on connection regress1
+[NO_PID]: ECPGexecute line 60: QUERY: insert into test ( text , num ) values ( 'test' , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 60: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 60: parameter 1 = 2369.7
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 60 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 66: QUERY: select num from test where text = 'test' on connection regress1
+[NO_PID]: ECPGexecute line 66: QUERY: select num from test where text = 'test' with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 66: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 66: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
--- /dev/null
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "array_of_struct.pgc"
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 3 "array_of_struct.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 5 "array_of_struct.pgc"
+
+/* exec sql whenever sql_warning sqlprint ; */
+#line 6 "array_of_struct.pgc"
+
+/* exec sql whenever not found sqlprint ; */
+#line 7 "array_of_struct.pgc"
+
+
+typedef struct {
+#line 12 "array_of_struct.pgc"
+ struct varchar_name_12 { int len; char arr[ 50 ]; } name ;
+
+#line 13 "array_of_struct.pgc"
+ int phone ;
+ } customer ;
+#line 14 "array_of_struct.pgc"
+
+
+typedef struct ind {
+#line 19 "array_of_struct.pgc"
+ short name_ind ;
+
+#line 20 "array_of_struct.pgc"
+ short phone_ind ;
+ } cust_ind ;
+#line 21 "array_of_struct.pgc"
+
+
+int main( int argc, char * argv[] )
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+ typedef struct {
+#line 30 "array_of_struct.pgc"
+ struct varchar_name_30 { int len; char arr[ 50 ]; } name ;
+
+#line 31 "array_of_struct.pgc"
+ int phone ;
+ } customer2 ;
+
+#line 32 "array_of_struct.pgc"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#line 26 "array_of_struct.pgc"
+ customer custs1 [ 10 ] ;
+
+#line 27 "array_of_struct.pgc"
+ cust_ind inds [ 10 ] ;
+
+#line 33 "array_of_struct.pgc"
+ customer2 custs2 [ 10 ] ;
+
+#line 38 "array_of_struct.pgc"
+ struct customer3 {
+#line 36 "array_of_struct.pgc"
+ struct varchar_name_36 { int len; char arr[ 50 ]; } name ;
+
+#line 37 "array_of_struct.pgc"
+ int phone ;
+ } custs3 [ 10 ] ;
+
+#line 43 "array_of_struct.pgc"
+ struct customer4 {
+#line 41 "array_of_struct.pgc"
+ struct varchar_name_41 { int len; char arr[ 50 ]; } name ;
+
+#line 42 "array_of_struct.pgc"
+ int phone ;
+ } custs4 ;
+
+#line 44 "array_of_struct.pgc"
+ int r ;
+/* exec sql end declare section */
+#line 45 "array_of_struct.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0);
+#line 49 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 49 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 49 "array_of_struct.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table customers ( c varchar ( 50 ) , p int ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 51 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 51 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 51 "array_of_struct.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into customers values ( 'John Doe' , '12345' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 52 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 52 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 52 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 52 "array_of_struct.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into customers values ( 'Jane Doe' , '67890' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 53 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 53 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 53 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "array_of_struct.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from customers limit 2 ", ECPGt_EOIT,
+ ECPGt_varchar,&(custs1->name),(long)50,(long)10,sizeof( customer ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
+ ECPGt_int,&(custs1->phone),(long)1,(long)10,sizeof( customer ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
+#line 55 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 55 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 55 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 55 "array_of_struct.pgc"
+
+ printf("custs1:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs1[r].name.arr );
+ printf( "phone - %d\n", custs1[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from customers limit 2 ", ECPGt_EOIT,
+ ECPGt_varchar,&(custs2->name),(long)50,(long)10,sizeof( customer2 ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
+ ECPGt_int,&(custs2->phone),(long)1,(long)10,sizeof( customer2 ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
+#line 63 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 63 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 63 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 63 "array_of_struct.pgc"
+
+ printf("\ncusts2:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs2[r].name.arr );
+ printf( "phone - %d\n", custs2[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from customers limit 2 ", ECPGt_EOIT,
+ ECPGt_varchar,&(custs3->name),(long)50,(long)10,sizeof( struct customer3 ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
+ ECPGt_int,&(custs3->phone),(long)1,(long)10,sizeof( struct customer3 ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
+#line 71 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 71 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 71 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 71 "array_of_struct.pgc"
+
+ printf("\ncusts3:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs3[r].name.arr );
+ printf( "phone - %d\n", custs3[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from customers limit 1 ", ECPGt_EOIT,
+ ECPGt_varchar,&(custs4.name),(long)50,(long)1,sizeof(struct varchar_name_41),
+ ECPGt_short,&(inds[0].name_ind),(long)1,(long)1,sizeof(short),
+ ECPGt_int,&(custs4.phone),(long)1,(long)1,sizeof(int),
+ ECPGt_short,&(inds[0].phone_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);
+#line 79 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 79 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 79 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 79 "array_of_struct.pgc"
+
+ printf("\ncusts4:\n");
+ printf( "name - %s\n", custs4.name.arr );
+ printf( "phone - %d\n", custs4.phone );
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 84 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 84 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 84 "array_of_struct.pgc"
+
+
+ return( 0 );
+}
--- /dev/null
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: QUERY: create table customers ( c varchar ( 50 ) , p int ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: QUERY: insert into customers values ( 'John Doe' , '12345' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: QUERY: insert into customers values ( 'Jane Doe' , '67890' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 55: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 55: Correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 55: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 55: RESULT: Jane Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 55: RESULT: 12345 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 55: RESULT: 67890 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 63: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 63: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 63: Correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 63: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 63: RESULT: Jane Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 63: RESULT: 12345 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 63: RESULT: 67890 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: QUERY: select * from customers limit 2 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: Correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 71: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 71: RESULT: Jane Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 71: RESULT: 12345 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 71: RESULT: 67890 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 79: QUERY: select * from customers limit 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 79: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 79: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 79: RESULT: John Doe offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 79: RESULT: 12345 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection regress1 closed.
+[NO_PID]: sqlca: code: 0, state: 00000
--- /dev/null
+custs1:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs2:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs3:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs4:
+name - John Doe
+phone - 12345
--- /dev/null
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "autoprep.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* test automatic prepare for all statements */
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "autoprep.pgc"
+
+
+int main(int argc, char* argv[]) {
+ /* exec sql begin declare section */
+
+
+#line 10 "autoprep.pgc"
+ int item [ 4 ] , ind [ 4 ] , i = 1 ;
+/* exec sql end declare section */
+#line 11 "autoprep.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
+#line 14 "autoprep.pgc"
+
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 16 "autoprep.pgc"
+
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 17 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "create table T ( Item1 int , Item2 int ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 19 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 19 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 19 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "insert into T values ( 1 , null ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 21 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 21 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 21 "autoprep.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "insert into T values ( 1 , $1 ) ",
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 22 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 22 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 22 "autoprep.pgc"
+
+ i++;
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "insert into T values ( 1 , $1 ) ",
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 24 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 24 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "autoprep.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "i", " insert into T values ( 1 , 2 ) ");
+#line 25 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 25 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 25 "autoprep.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "i", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 26 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT,
+ ECPGt_int,(item),(long)1,(long)4,sizeof(int),
+ ECPGt_int,(ind),(long)1,(long)4,sizeof(int), ECPGt_EORT);
+#line 28 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 28 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 28 "autoprep.pgc"
+
+
+ for (i=0; i<4; i++)
+ printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
+
+ /* declare C cursor for select Item1 from T */
+#line 33 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "declare C cursor for select Item1 from T ", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 35 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "fetch 1 in C", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 37 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 37 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 37 "autoprep.pgc"
+
+ printf("i = %d\n", i);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "close C", ECPGt_EOIT, ECPGt_EORT);
+#line 40 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 40 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 40 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 3, "drop table T ", ECPGt_EOIT, ECPGt_EORT);
+#line 42 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 42 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 42 "autoprep.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 44 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 44 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 44 "autoprep.pgc"
+
+
+ return 0;
+}
--- /dev/null
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 19: stmt not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 19: NAME: ecpg1 QUERY: create table T ( Item1 int , Item2 int )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19: QUERY: create table T ( Item1 int , Item2 int ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19: using PQexecPrepared for create table T ( Item1 int , Item2 int )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 21: stmt not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 21: NAME: ecpg2 QUERY: insert into T values ( 1 , null )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 21: QUERY: insert into T values ( 1 , null ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 21: using PQexecPrepared for insert into T values ( 1 , null )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 21 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 22: stmt not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 22: NAME: ecpg3 QUERY: insert into T values ( 1 , $1 )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: QUERY: insert into T values ( 1 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: using PQexecPrepared for insert into T values ( 1 , $1 )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 24: stmt found in cache, entry 6248
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24: QUERY: insert into T values ( 1 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24: using PQexecPrepared for insert into T values ( 1 , $1 )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 25: NAME: i QUERY: insert into T values ( 1 , 2 )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: QUERY: insert into T values ( 1 , 2 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecPrepared for insert into T values ( 1 , 2 )
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 28: stmt not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 28: NAME: ecpg4 QUERY: select Item2 from T order by Item2 nulls last
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: QUERY: select Item2 from T order by Item2 nulls last with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: using PQexecPrepared for select Item2 from T order by Item2 nulls last
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: Correctly got 4 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 28: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 28: RESULT: 2 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 28: RESULT: 2 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 28: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 35: stmt not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 35: NAME: ecpg5 QUERY: declare C cursor for select Item1 from T
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: QUERY: declare C cursor for select Item1 from T with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexecPrepared for declare C cursor for select Item1 from T
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 37: stmt not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 37: NAME: ecpg6 QUERY: fetch 1 in C
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: QUERY: fetch 1 in C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: using PQexecPrepared for fetch 1 in C
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 37: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 40: stmt not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 40: NAME: ecpg7 QUERY: close C
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: QUERY: close C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: using PQexecPrepared for close C
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40 Ok: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGauto_prepare line 42: stmt not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 42: NAME: ecpg8 QUERY: drop table T
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: QUERY: drop table T with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: using PQexecPrepared for drop table T
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42 Ok: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection regress1 closed.
+[NO_PID]: sqlca: code: 0, state: 00000
--- /dev/null
+item[0] = 1
+item[1] = 2
+item[2] = 2
+item[3] = -1
+i = 1
#line 34 "define.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 36 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "define.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 39 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 39 "define.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 40 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 41 "define.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from test ", ECPGt_EOIT,
ECPGt_char,(name),(long)8,(long)6,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(amount),(long)1,(long)6,sizeof(int),
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 56 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36: QUERY: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) on connection regress1
+[NO_PID]: ECPGexecute line 36: QUERY: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 37 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: QUERY: insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ) on connection regress1
+[NO_PID]: ECPGexecute line 39: QUERY: insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 39 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 40: QUERY: insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ) on connection regress1
+[NO_PID]: ECPGexecute line 40: QUERY: insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 40 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 41 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 43: QUERY: select * from test on connection regress1
+[NO_PID]: ECPGexecute line 43: QUERY: select * from test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 43: Correctly got 2 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 43: RESULT: t offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 56: QUERY: drop table test on connection regress1
+[NO_PID]: ECPGexecute line 56: QUERY: drop table test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 56: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 56 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
/* exec sql whenever sqlerror do fa ( ) ; */
#line 87 "init.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 88 "init.pgc"
if (sqlca.sqlcode < 0) fa ( );}
/* exec sql whenever sqlerror do fb ( 20 ) ; */
#line 89 "init.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 90 "init.pgc"
if (sqlca.sqlcode < 0) fb ( 20 );}
/* exec sql whenever sqlerror do fc ( \"50\" ) ; */
#line 91 "init.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 92 "init.pgc"
if (sqlca.sqlcode < 0) fc ( "50" );}
/* exec sql whenever sqlerror do fd ( \"50\" , 1 ) ; */
#line 93 "init.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 94 "init.pgc"
if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
/* exec sql whenever sqlerror do fe ( ENUM0 ) ; */
#line 95 "init.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 96 "init.pgc"
if (sqlca.sqlcode < 0) fe ( ENUM0 );}
/* exec sql whenever sqlerror do sqlnotice ( NULL , 0 ) ; */
#line 97 "init.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 98 "init.pgc"
if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
exit (sqlca.sqlcode);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 51 "type.pgc"
if (sqlca.sqlcode)
exit (sqlca.sqlcode);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 58 "type.pgc"
if (sqlca.sqlcode)
exit (sqlca.sqlcode);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "select idnum , name , accs , string1 , string2 , string3 from empl where idnum = ? ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select idnum , name , accs , string1 , string2 , string3 from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 50: QUERY: create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) ) on connection regress1
+[NO_PID]: ECPGexecute line 50: QUERY: create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 50: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 50 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 58: QUERY: insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' ) on connection regress1
+[NO_PID]: ECPGexecute line 58: QUERY: insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 58: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 58 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 65: QUERY: select idnum , name , accs , string1 , string2 , string3 from empl where idnum = 1 on connection regress1
+[NO_PID]: ECPGexecute line 65: QUERY: select idnum , name , accs , string1 , string2 , string3 from empl where idnum = $1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 65: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 65: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 65: Correctly got 1 tuples with 6 fields
[NO_PID]: sqlca: code: 0, state: 00000
#line 27 "variable.pgc"
struct personal_struct {
#line 25 "variable.pgc"
- struct varchar_name { int len; char arr[ BUFFERSIZ ]; } name ;
+ struct varchar_name_25 { int len; char arr[ BUFFERSIZ ]; } name ;
#line 26 "variable.pgc"
struct birthinfo birth ;
strcpy(msg, "set");
- { ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
#line 46 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
strcpy(msg, "create");
- { ECPGdo(__LINE__, 0, 1, NULL, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
#line 49 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
strcpy(msg, "insert");
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 52 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 52 "variable.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 53 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 53 "variable.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 1' , 16 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into family ( name , age ) values ( 'Child 1' , 16 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 54 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 54 "variable.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 2' , 14 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into family ( name , age ) values ( 'Child 2' , 14 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 55 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 55 "variable.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 3' , 9 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into family ( name , age ) values ( 'Child 3' , 9 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 56 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
strcpy(msg, "open");
- { ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from family ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare cur cursor for select name , born , age , married , children from family ", ECPGt_EOIT, ECPGt_EORT);
#line 62 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
memset(i, 0, sizeof(ind_personal));
while (1) {
strcpy(msg, "fetch");
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch cur", ECPGt_EOIT,
- ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name),
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch cur", ECPGt_EOIT,
+ ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name_25),
ECPGt_int,&(i->ind_name),(long)1,(long)1,sizeof(int),
ECPGt_long,&(p->birth.born),(long)1,(long)1,sizeof(long),
ECPGt_long,&(i->ind_birth.born),(long)1,(long)1,sizeof(long),
}
strcpy(msg, "close");
- { ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "close cur", ECPGt_EOIT, ECPGt_EORT);
#line 88 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
strcpy(msg, "drop");
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table family ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table family ", ECPGt_EOIT, ECPGt_EORT);
#line 91 "variable.pgc"
if (sqlca.sqlcode < 0) exit (1);}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 46: QUERY: set datestyle to iso on connection regress1
+[NO_PID]: ECPGexecute line 46: QUERY: set datestyle to iso with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 46 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49: QUERY: create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) on connection regress1
+[NO_PID]: ECPGexecute line 49: QUERY: create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 49: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 49 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 52: QUERY: insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) on connection regress1
+[NO_PID]: ECPGexecute line 52: QUERY: insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) on connection regress1
+[NO_PID]: ECPGexecute line 53: QUERY: insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 53 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 54: QUERY: insert into family ( name , age ) values ( 'Child 1' , 16 ) on connection regress1
+[NO_PID]: ECPGexecute line 54: QUERY: insert into family ( name , age ) values ( 'Child 1' , 16 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 54: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 54 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 55: QUERY: insert into family ( name , age ) values ( 'Child 2' , 14 ) on connection regress1
+[NO_PID]: ECPGexecute line 55: QUERY: insert into family ( name , age ) values ( 'Child 2' , 14 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 55: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 55 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 56: QUERY: insert into family ( name , age ) values ( 'Child 3' , 9 ) on connection regress1
+[NO_PID]: ECPGexecute line 56: QUERY: insert into family ( name , age ) values ( 'Child 3' , 9 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 56: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 56 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 59 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 62: QUERY: declare cur cursor for select name , born , age , married , children from family on connection regress1
+[NO_PID]: ECPGexecute line 62: QUERY: declare cur cursor for select name , born , age , married , children from family with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 62: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 62 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1
+[NO_PID]: ECPGexecute line 71: QUERY: fetch cur with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 71: RESULT: 3 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1
+[NO_PID]: ECPGexecute line 71: QUERY: fetch cur with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 71: RESULT: 3 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1
+[NO_PID]: ECPGexecute line 71: QUERY: fetch cur with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1
+[NO_PID]: ECPGexecute line 71: QUERY: fetch cur with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1
+[NO_PID]: ECPGexecute line 71: QUERY: fetch cur with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1
+[NO_PID]: ECPGexecute line 71: QUERY: fetch cur with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 71: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: Correctly got 0 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 71, 'No data found in line 71.'.
[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 88: QUERY: close cur on connection regress1
+[NO_PID]: ECPGexecute line 88: QUERY: close cur with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 88: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 88 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 91: QUERY: drop table family on connection regress1
+[NO_PID]: ECPGexecute line 91: QUERY: drop table family with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 91: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 91 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
if (sqlca.sqlcode < 0) sqlprint();}
#line 31 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( i int , c char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( i int , c char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 32 "whenever.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 1 , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( 1 , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 33 "whenever.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
/* exec sql whenever sql_warning do warn ( ) ; */
#line 35 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from test ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(c),(long)6,(long)1,(6)*sizeof(char),
#line 37 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 39 "whenever.pgc"
/* exec sql whenever sqlerror do print ( \"select\" ) ; */
#line 42 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 43 "whenever.pgc"
/* exec sql whenever sqlerror call print2 ( ) ; */
#line 46 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 47 "whenever.pgc"
/* exec sql whenever sqlerror continue ; */
#line 50 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 51 "whenever.pgc"
/* exec sql whenever sqlerror goto error ; */
#line 54 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 55 "whenever.pgc"
/* exec sql whenever sqlerror stop ; */
#line 61 "whenever.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 62 "whenever.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: create table test ( i int , c char ( 10 ) ) on connection regress1
+[NO_PID]: ECPGexecute line 32: QUERY: create table test ( i int , c char ( 10 ) ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 33: QUERY: insert into test values ( 1 , 'abcdefghij' ) on connection regress1
+[NO_PID]: ECPGexecute line 33: QUERY: insert into test values ( 1 , 'abcdefghij' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 33 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36: QUERY: select * from test on connection regress1
+[NO_PID]: ECPGexecute line 36: QUERY: select * from test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
Warning: At least one column was truncated
[NO_PID]: ECPGtrans line 37 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: ECPGexecute line 39: QUERY: select * from nonexistant with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: ECPGexecute line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGcheck_PQresult line 39: Error: ERROR: relation "nonexistant" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 39, ''relation "nonexistant" does not exist' in line 39.'.
[NO_PID]: sqlca: code: -400, state: 42P01
sql error 'relation "nonexistant" does not exist' in line 39.
[NO_PID]: ECPGtrans line 40 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 43: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: ECPGexecute line 43: QUERY: select * from nonexistant with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 43: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: ECPGcheck_PQresult line 43: Error: ERROR: relation "nonexistant" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 43, ''relation "nonexistant" does not exist' in line 43.'.
[NO_PID]: sqlca: code: -400, state: 42P01
sql error 'relation "nonexistant" does not exist' in line 43.
[NO_PID]: ECPGtrans line 44 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 47: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: ECPGexecute line 47: QUERY: select * from nonexistant with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 47: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: ECPGexecute line 47: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGcheck_PQresult line 47: Error: ERROR: relation "nonexistant" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 47, ''relation "nonexistant" does not exist' in line 47.'.
[NO_PID]: sqlca: code: -400, state: 42P01
sql error 'relation "nonexistant" does not exist' in line 47.
[NO_PID]: ECPGtrans line 48 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 51: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: ECPGexecute line 51: QUERY: select * from nonexistant with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 51: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: ECPGcheck_PQresult line 51: Error: ERROR: relation "nonexistant" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 51, ''relation "nonexistant" does not exist' in line 51.'.
[NO_PID]: sqlca: code: -400, state: 42P01
[NO_PID]: ECPGtrans line 52 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 55: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: ECPGexecute line 55: QUERY: select * from nonexistant with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 55: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: ECPGexecute line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGcheck_PQresult line 55: Error: ERROR: relation "nonexistant" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 55, ''relation "nonexistant" does not exist' in line 55.'.
[NO_PID]: sqlca: code: -400, state: 42P01
[NO_PID]: ECPGtrans line 59 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 62: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: ECPGexecute line 62: QUERY: select * from nonexistant with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 62: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 62: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: ECPGcheck_PQresult line 62: Error: ERROR: relation "nonexistant" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 62, ''relation "nonexistant" does not exist' in line 62.'.
[NO_PID]: sqlca: code: -400, state: 42P01
#line 31 "array.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 33 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 33 "array.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( f , i , a , text ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 35 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 35 "array.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 140787.0 , 2 , ? , ? ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( f , i , a , text ) values ( 140787.0 , 2 , $1 , $2 ) ",
ECPGt_int,(a),(long)1,(long)10,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "array.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 14.07 , ? , ? , ? ) ",
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( f , i , a , text ) values ( 14.07 , $1 , $2 , $3 ) ",
ECPGt_int,&(did),(long)1,(long)0,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(a),(long)1,(long)10,sizeof(int),
#line 43 "array.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select f , text from test where i = 1 ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select f , text from test where i = 1 ", ECPGt_EOIT,
ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
printf("Found f=%f text=%10.10s\n", f, text);
f=140787;
- { ECPGdo(__LINE__, 0, 1, NULL, "select a , text from test where f = ? ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select a , text from test where f = $1 ",
ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_int,(a),(long)1,(long)10,sizeof(int),
printf("Found text=%10.10s\n", t);
- { ECPGdo(__LINE__, 0, 1, NULL, "select a from test where f = ? ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select a from test where f = $1 ",
ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
printf("Found text=%s\n", text);
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 70 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 31 action = begin transaction connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 33: QUERY: create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) ) on connection regress1
+[NO_PID]: ECPGexecute line 33: QUERY: create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 33 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: insert into test ( f , i , a , text ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' ) on connection regress1
+[NO_PID]: ECPGexecute line 35: QUERY: insert into test ( f , i , a , text ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 37: QUERY: insert into test ( f , i , a , text ) values ( 140787.0 , 2 , array [9,8,7,6,5,4,3,2,1,0] , 'klmnopqrst' ) on connection regress1
+[NO_PID]: ECPGexecute line 37: QUERY: insert into test ( f , i , a , text ) values ( 140787.0 , 2 , $1 , $2 ) with 2 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: parameter 1 = {9,8,7,6,5,4,3,2,1,0}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: parameter 2 = klmnopqrst
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: QUERY: insert into test ( f , i , a , text ) values ( 14.07 , 1 , array [9,8,7,6,5,4,3,2,1,0] , '0123456789' ) on connection regress1
+[NO_PID]: ECPGexecute line 39: QUERY: insert into test ( f , i , a , text ) values ( 14.07 , $1 , $2 , $3 ) with 3 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: parameter 2 = {9,8,7,6,5,4,3,2,1,0}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: parameter 3 = 0123456789
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 39 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 43 action = begin transaction connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 45: QUERY: select f , text from test where i = 1 on connection regress1
+[NO_PID]: ECPGexecute line 45: QUERY: select f , text from test where i = 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 45: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 45: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 45: RESULT: 0123456789 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: select a , text from test where f = 140787 on connection regress1
+[NO_PID]: ECPGexecute line 53: QUERY: select a , text from test where f = $1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: parameter 1 = 140787
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 53: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 53: RESULT: klmnopqrst offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 63: QUERY: select a from test where f = 140787 on connection regress1
+[NO_PID]: ECPGexecute line 63: QUERY: select a from test where f = $1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 63: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 63: parameter 1 = 140787
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 63: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 63: RESULT: {9,8,7,6,5,4,3,2,1,0} offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 70: QUERY: drop table test on connection regress1
+[NO_PID]: ECPGexecute line 70: QUERY: drop table test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 70: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
exit (sqlca.sqlcode);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 36 "binary.pgc"
if (sqlca.sqlcode)
exit (sqlca.sqlcode);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into empl values ( 1 , 'first user' , 320 , ? ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into empl values ( 1 , 'first user' , 320 , $1 ) ",
ECPGt_char,&(data),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 43 "binary.pgc"
exit (sqlca.sqlcode);
}
- /* declare C cursor for select name , accs , byte from empl where idnum = ? */
+ /* declare C cursor for select name , accs , byte from empl where idnum = $1 */
#line 50 "binary.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "declare C cursor for select name , accs , byte from empl where idnum = ? ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare C cursor for select name , accs , byte from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 51 "binary.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch C", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch C", ECPGt_EOIT,
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short),
memset(empl.name, 0, 21L);
memset(empl.byte, '#', 20L);
- /* declare B binary cursor for select name , accs , byte from empl where idnum = ? */
+ /* declare B binary cursor for select name , accs , byte from empl where idnum = $1 */
#line 63 "binary.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "declare B binary cursor for select name , accs , byte from empl where idnum = ? ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare B binary cursor for select name , accs , byte from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 64 "binary.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch B", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch B", ECPGt_EOIT,
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short),
exit (sqlca.sqlcode);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "close B", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "close B", ECPGt_EOIT, ECPGt_EORT);}
#line 72 "binary.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ) on connection regress1
+[NO_PID]: ECPGexecute line 35: QUERY: create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 43: QUERY: insert into empl values ( 1 , 'first user' , 320 , E'\\001\\155\\000\\212' ) on connection regress1
+[NO_PID]: ECPGexecute line 43: QUERY: insert into empl values ( 1 , 'first user' , 320 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: parameter 1 = \001\155\000\212
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 43 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 51: QUERY: declare C cursor for select name , accs , byte from empl where idnum = 1 on connection regress1
+[NO_PID]: ECPGexecute line 51: QUERY: declare C cursor for select name , accs , byte from empl where idnum = $1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 51 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 52: QUERY: fetch C on connection regress1
+[NO_PID]: ECPGexecute line 52: QUERY: fetch C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: \001m\000\212 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: QUERY: declare B binary cursor for select name , accs , byte from empl where idnum = 1 on connection regress1
+[NO_PID]: ECPGexecute line 64: QUERY: declare B binary cursor for select name , accs , byte from empl where idnum = $1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 65: QUERY: fetch B on connection regress1
+[NO_PID]: ECPGexecute line 65: QUERY: fetch B with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 65: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 65: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 65: RESULT: BINARY offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 72: QUERY: close B on connection regress1
+[NO_PID]: ECPGexecute line 72: QUERY: close B with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 72: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 72 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( \"index\" numeric ( 3 ) primary key , \"payload\" int4 not null ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( \"index\" numeric ( 3 ) primary key , \"payload\" int4 not null ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 20 "code100.pgc"
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
for (index=0;index<10;++index)
- { { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( payload , index ) values ( 0 , ? ) ",
+ { { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( payload , index ) values ( 0 , $1 ) ",
ECPGt_int,&(index),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 28 "code100.pgc"
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
- { ECPGdo(__LINE__, 0, 1, NULL, "update test set payload = payload + 1 where index = - 1 ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "update test set payload = payload + 1 where index = - 1 ", ECPGt_EOIT, ECPGt_EORT);}
#line 35 "code100.pgc"
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
- { ECPGdo(__LINE__, 0, 1, NULL, "delete from test where index = - 1 ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "delete from test where index = - 1 ", ECPGt_EOIT, ECPGt_EORT);}
#line 38 "code100.pgc"
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( select * from test where index = - 1 ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( select * from test where index = - 1 ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 41 "code100.pgc"
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table test ", ECPGt_EOIT, ECPGt_EORT);}
#line 44 "code100.pgc"
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 18: QUERY: create table test ( "index" numeric ( 3 ) primary key , "payload" int4 not null ) on connection regress1
+[NO_PID]: ECPGexecute line 18: QUERY: create table test ( "index" numeric ( 3 ) primary key , "payload" int4 not null ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 18: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 22 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 0 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 1 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 2 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 3 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 3
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 4 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 4
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 5 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 5
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 6 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 6
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 7 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 7
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 8 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 8
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , 9 ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values ( 0 , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: parameter 1 = 9
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 31 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 34: QUERY: update test set payload = payload + 1 where index = - 1 on connection regress1
+[NO_PID]: ECPGexecute line 34: QUERY: update test set payload = payload + 1 where index = - 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 34: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34 Ok: UPDATE 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 34, 'No data found in line 34.'.
[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 38: QUERY: delete from test where index = - 1 on connection regress1
+[NO_PID]: ECPGexecute line 38: QUERY: delete from test where index = - 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 38: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38 Ok: DELETE 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 38, 'No data found in line 38.'.
[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 41: QUERY: insert into test ( select * from test where index = - 1 ) on connection regress1
+[NO_PID]: ECPGexecute line 41: QUERY: insert into test ( select * from test where index = - 1 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 41 Ok: INSERT 0 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 41, 'No data found in line 41.'.
[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 44: QUERY: drop table test on connection regress1
+[NO_PID]: ECPGexecute line 44: QUERY: drop table test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 44: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 44 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
if (sqlca.sqlcode < 0) sqlprint();}
#line 19 "copystdout.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table foo ( a int , b varchar ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table foo ( a int , b varchar ) ", ECPGt_EOIT, ECPGt_EORT);
#line 20 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 20 "copystdout.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values ( 5 , 'abc' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into foo values ( 5 , 'abc' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 21 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "copystdout.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values ( 6 , 'def' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into foo values ( 6 , 'def' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "copystdout.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values ( 7 , 'ghi' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into foo values ( 7 , 'ghi' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
/* EXEC SQL COPY foo TO:fname WITH DELIMITER ','; */
/* printf ("copy to /tmp/foo : sqlca.sqlcode = %ld", sqlca.sqlcode); */
- { ECPGdo(__LINE__, 0, 1, NULL, "copy foo to stdout with delimiter ','", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "copy foo to stdout with delimiter ','", ECPGt_EOIT, ECPGt_EORT);
#line 29 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 20: QUERY: create table foo ( a int , b varchar ) on connection regress1
+[NO_PID]: ECPGexecute line 20: QUERY: create table foo ( a int , b varchar ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 20: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 20 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 21: QUERY: insert into foo values ( 5 , 'abc' ) on connection regress1
+[NO_PID]: ECPGexecute line 21: QUERY: insert into foo values ( 5 , 'abc' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 21: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 22: QUERY: insert into foo values ( 6 , 'def' ) on connection regress1
+[NO_PID]: ECPGexecute line 22: QUERY: insert into foo values ( 6 , 'def' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 23: QUERY: insert into foo values ( 7 , 'ghi' ) on connection regress1
+[NO_PID]: ECPGexecute line 23: QUERY: insert into foo values ( 7 , 'ghi' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 29: QUERY: copy foo to stdout with delimiter ',' on connection regress1
+[NO_PID]: ECPGexecute line 29: QUERY: copy foo to stdout with delimiter ',' with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29: Got PGRES_COPY_OUT
[NO_PID]: sqlca: code: 0, state: 00000
#line 17 "define.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 19 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 19 "define.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 29 , 'abcdef' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( 29 , 'abcdef' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 20 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( null , 'defined' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( null , 'defined' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( null , 'someothervar not defined' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( null , 'someothervar not defined' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 31 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
- { ECPGdo(__LINE__, 0, 1, NULL, "select 1 , 29 :: text || '-' || 'abcdef' ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select 1 , 29 :: text || '-' || 'abcdef' ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(s),(long)200,(long)1,(200)*sizeof(char),
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 29 , 'no string' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( 29 , 'no string' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 42 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
- { ECPGdo(__LINE__, 0, 1, NULL, "set TIMEZONE to 'UTC'", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set TIMEZONE to 'UTC'", ECPGt_EOIT, ECPGt_EORT);
#line 53 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 19: QUERY: create table test ( a int , b text ) on connection regress1
+[NO_PID]: ECPGexecute line 19: QUERY: create table test ( a int , b text ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 20: QUERY: insert into test values ( 29 , 'abcdef' ) on connection regress1
+[NO_PID]: ECPGexecute line 20: QUERY: insert into test values ( 29 , 'abcdef' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 20: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 20 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 23: QUERY: insert into test values ( null , 'defined' ) on connection regress1
+[NO_PID]: ECPGexecute line 23: QUERY: insert into test values ( null , 'defined' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 31: QUERY: insert into test values ( null , 'someothervar not defined' ) on connection regress1
+[NO_PID]: ECPGexecute line 31: QUERY: insert into test values ( null , 'someothervar not defined' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 31: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36: QUERY: select 1 , 29 :: text || '-' || 'abcdef' on connection regress1
+[NO_PID]: ECPGexecute line 36: QUERY: select 1 , 29 :: text || '-' || 'abcdef' with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 36: RESULT: 29-abcdef offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 42: QUERY: insert into test values ( 29 , 'no string' ) on connection regress1
+[NO_PID]: ECPGexecute line 42: QUERY: insert into test values ( 29 , 'no string' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: set TIMEZONE to 'UTC' on connection regress1
+[NO_PID]: ECPGexecute line 53: QUERY: set TIMEZONE to 'UTC' with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 53 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
#line 8 "desc.pgc"
- char * stmt1 = "INSERT INTO test1 VALUES (?, ?)" ;
+ char * stmt1 = "INSERT INTO test1 VALUES ($1, $2)" ;
#line 9 "desc.pgc"
- char * stmt2 = "SELECT * from test1 where a = ? and b = ?" ;
+ char * stmt2 = "SELECT * from test1 where a = $1 and b = $2" ;
#line 10 "desc.pgc"
- char * stmt3 = "SELECT * from test1 where a = ?" ;
+ char * stmt3 = "SELECT * from test1 where :var = a" ;
#line 12 "desc.pgc"
int val1 = 1 ;
#line 27 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test1 ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test1 ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 29 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "desc.pgc"
- { ECPGprepare(__LINE__, "foo1" , stmt1);
+ { ECPGprepare(__LINE__, NULL, 0, "foo1", stmt1);
#line 30 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 30 "desc.pgc"
- { ECPGprepare(__LINE__, "foo2" , stmt2);
+ { ECPGprepare(__LINE__, NULL, 0, "Foo-1", stmt1);
#line 31 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 31 "desc.pgc"
- { ECPGprepare(__LINE__, "foo3" , stmt3);
+ { ECPGprepare(__LINE__, NULL, 0, "foo2", stmt2);
#line 32 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "desc.pgc"
+ { ECPGprepare(__LINE__, NULL, 0, "foo3", stmt3);
+#line 33 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(ECPGprepared_statement("foo1")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 33 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo1",
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 34 "desc.pgc"
+#line 35 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 34 "desc.pgc"
+#line 35 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
-#line 36 "desc.pgc"
+#line 37 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 36 "desc.pgc"
+#line 37 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
ECPGt_int,&(val2null),(long)1,(long)1,sizeof(int), ECPGd_EODT);
-#line 37 "desc.pgc"
+#line 38 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 37 "desc.pgc"
+#line 38 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(ECPGprepared_statement("foo1")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo1",
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 39 "desc.pgc"
+#line 40 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 39 "desc.pgc"
+#line 40 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_const,"3",(long)1,(long)1,strlen("3"), ECPGd_EODT);
-#line 41 "desc.pgc"
+#line 42 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 41 "desc.pgc"
+#line 42 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
ECPGt_const,"this is a long test",(long)19,(long)1,strlen("this is a long test"), ECPGd_indicator,
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
-#line 42 "desc.pgc"
+#line 43 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 42 "desc.pgc"
+#line 43 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(ECPGprepared_statement("foo1")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "Foo-1",
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 44 "desc.pgc"
+#line 45 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 44 "desc.pgc"
+#line 45 "desc.pgc"
+
+
+ { ECPGdeallocate(__LINE__, 0, "Foo-1");
+#line 47 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 47 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
-#line 46 "desc.pgc"
+#line 49 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 46 "desc.pgc"
+#line 49 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
-#line 47 "desc.pgc"
+#line 50 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 47 "desc.pgc"
+#line 50 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(ECPGprepared_statement("foo2")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "foo2",
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_descriptor, "outdesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 49 "desc.pgc"
+#line 52 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 49 "desc.pgc"
+#line 52 "desc.pgc"
{ ECPGget_desc(__LINE__, "outdesc", 1,ECPGd_data,
ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char), ECPGd_EODT);
-#line 51 "desc.pgc"
+#line 54 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 51 "desc.pgc"
+#line 54 "desc.pgc"
printf("output = %s\n", val2output);
- /* declare c1 cursor for ? */
-#line 54 "desc.pgc"
+ /* declare c1 cursor for $1 */
+#line 57 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "declare c1 cursor for ?",
- ECPGt_char_variable,(ECPGprepared_statement("foo2")),(long)1,(long)1,(1)*sizeof(char),
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare c1 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("foo2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 55 "desc.pgc"
+#line 58 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 55 "desc.pgc"
+#line 58 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c1", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch next from c1", ECPGt_EOIT,
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
ECPGt_int,&(ind1),(long)1,(long)1,sizeof(int),
ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
ECPGt_int,&(ind2),(long)1,(long)1,sizeof(int), ECPGt_EORT);
-#line 57 "desc.pgc"
+#line 60 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 57 "desc.pgc"
+#line 60 "desc.pgc"
printf("val1=%d (ind1: %d) val2=%s (ind2: %d)\n",
val1output, ind1, val2output, ind2);
- { ECPGdo(__LINE__, 0, 1, NULL, "close c1", ECPGt_EOIT, ECPGt_EORT);
-#line 61 "desc.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "close c1", ECPGt_EOIT, ECPGt_EORT);
+#line 64 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 61 "desc.pgc"
+#line 64 "desc.pgc"
{ ECPGset_desc_header(__LINE__, "indesc", (int)(1));
-#line 63 "desc.pgc"
+#line 66 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 63 "desc.pgc"
+#line 66 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
-#line 64 "desc.pgc"
+#line 67 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 64 "desc.pgc"
+#line 67 "desc.pgc"
- /* declare c2 cursor for ? */
-#line 66 "desc.pgc"
+ /* declare c2 cursor for $1 */
+#line 69 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "declare c2 cursor for ?",
- ECPGt_char_variable,(ECPGprepared_statement("foo3")),(long)1,(long)1,(1)*sizeof(char),
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare c2 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("foo3", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 67 "desc.pgc"
+#line 70 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 67 "desc.pgc"
+#line 70 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c2", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch next from c2", ECPGt_EOIT,
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
-#line 69 "desc.pgc"
+#line 72 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 69 "desc.pgc"
+#line 72 "desc.pgc"
printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
- { ECPGdo(__LINE__, 0, 1, NULL, "close c2", ECPGt_EOIT, ECPGt_EORT);
-#line 72 "desc.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "close c2", ECPGt_EOIT, ECPGt_EORT);
+#line 75 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 72 "desc.pgc"
+#line 75 "desc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from test1 where a = 3 ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from test1 where a = 3 ", ECPGt_EOIT,
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
-#line 74 "desc.pgc"
+#line 77 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 74 "desc.pgc"
+#line 77 "desc.pgc"
printf("val1=%d val2=%c%c%c%c warn=%c truncate=%d\n", val1output, val2output[0], val2output[1], val2output[2], val2output[3], sqlca.sqlwarn[0], val2i);
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table test1 ", ECPGt_EOIT, ECPGt_EORT);
-#line 77 "desc.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table test1 ", ECPGt_EOIT, ECPGt_EORT);
+#line 80 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 77 "desc.pgc"
+#line 80 "desc.pgc"
+
+ { ECPGdeallocate_all(__LINE__, 0);
+#line 81 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 81 "desc.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
-#line 78 "desc.pgc"
+#line 82 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 78 "desc.pgc"
+#line 82 "desc.pgc"
ECPGdeallocate_desc(__LINE__, "indesc");
-#line 80 "desc.pgc"
+#line 84 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();
-#line 80 "desc.pgc"
+#line 84 "desc.pgc"
ECPGdeallocate_desc(__LINE__, "outdesc");
-#line 81 "desc.pgc"
+#line 85 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();
-#line 81 "desc.pgc"
+#line 85 "desc.pgc"
return 0;
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 29: QUERY: create table test1 ( a int , b text ) on connection regress1
+[NO_PID]: ECPGexecute line 29: QUERY: create table test1 ( a int , b text ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 30: QUERY: INSERT INTO test1 VALUES (?, ?)
+[NO_PID]: ECPGprepare line 30: NAME: foo1 QUERY: INSERT INTO test1 VALUES ($1, $2)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 31: NAME: Foo-1 QUERY: INSERT INTO test1 VALUES ($1, $2)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 32: NAME: foo2 QUERY: SELECT * from test1 where a = $1 and b = $2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 33: NAME: foo3 QUERY: SELECT * from test1 where $1 = a
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: QUERY: INSERT INTO test1 VALUES ($1, $2) with 2 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexecPrepared for INSERT INTO test1 VALUES ($1, $2)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: parameter 2 = one
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: QUERY: INSERT INTO test1 VALUES ($1, $2) with 2 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: using PQexecPrepared for INSERT INTO test1 VALUES ($1, $2)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: parameter 2 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 45: QUERY: INSERT INTO test1 VALUES ($1, $2) with 2 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 31: QUERY: SELECT * from test1 where a = ? and b = ?
+[NO_PID]: ECPGexecute line 45: using PQexecPrepared for INSERT INTO test1 VALUES ($1, $2)
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 32: QUERY: SELECT * from test1 where a = ?
+[NO_PID]: ECPGexecute line 45: parameter 1 = 3
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 34: QUERY: INSERT INTO test1 VALUES ('1', 'one') on connection regress1
+[NO_PID]: ECPGexecute line 45: parameter 2 = this is a long test
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 45 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: QUERY: INSERT INTO test1 VALUES ('2', null) on connection regress1
+[NO_PID]: ECPGdeallocate line 47: NAME: Foo-1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 52: QUERY: SELECT * from test1 where a = $1 and b = $2 with 2 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 44: QUERY: INSERT INTO test1 VALUES ('3', 'this is a long test') on connection regress1
+[NO_PID]: ECPGexecute line 52: using PQexecPrepared for SELECT * from test1 where a = $1 and b = $2
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 44 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 52: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49: QUERY: SELECT * from test1 where a = '1' and b = 'one' on connection regress1
+[NO_PID]: ECPGexecute line 52: parameter 2 = one
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49: Correctly got 1 tuples with 2 fields
+[NO_PID]: ECPGexecute line 52: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute putting result (1 tuples) into descriptor 'outdesc'
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_desc: reading items for tuple 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 51: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: ECPGget_data line 54: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 58: QUERY: declare c1 cursor for SELECT * from test1 where a = $1 and b = $2 with 2 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 58: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 58: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 58: parameter 2 = one
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 58 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 60: QUERY: fetch next from c1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 60: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 60: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 60: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 60: RESULT: one offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64: QUERY: close c1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64 Ok: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 70: QUERY: declare c2 cursor for SELECT * from test1 where $1 = a with 1 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 55: QUERY: declare c1 cursor for SELECT * from test1 where a = '1' and b = 'one' on connection regress1
+[NO_PID]: ECPGexecute line 70: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 55 Ok: DECLARE CURSOR
+[NO_PID]: ECPGexecute line 70: parameter 1 = 2
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 57: QUERY: fetch next from c1 on connection regress1
+[NO_PID]: ECPGexecute line 70 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 57: Correctly got 1 tuples with 2 fields
+[NO_PID]: ECPGexecute line 72: QUERY: fetch next from c2 with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 57: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: ECPGexecute line 72: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 57: RESULT: one offset: -1 array: Yes
+[NO_PID]: ECPGexecute line 72: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 61: QUERY: close c1 on connection regress1
+[NO_PID]: ECPGget_data line 72: RESULT: 2 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 61 Ok: CLOSE CURSOR
+[NO_PID]: ECPGget_data line 72: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 67: QUERY: declare c2 cursor for SELECT * from test1 where a = '2' on connection regress1
+[NO_PID]: ECPGexecute line 75: QUERY: close c2 with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 67 Ok: DECLARE CURSOR
+[NO_PID]: ECPGexecute line 75: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 69: QUERY: fetch next from c2 on connection regress1
+[NO_PID]: ECPGexecute line 75 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 69: Correctly got 1 tuples with 2 fields
+[NO_PID]: ECPGexecute line 77: QUERY: select * from test1 where a = 3 with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 69: RESULT: 2 offset: -1 array: Yes
+[NO_PID]: ECPGexecute line 77: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 69: RESULT: offset: -1 array: Yes
+[NO_PID]: ECPGexecute line 77: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 72: QUERY: close c2 on connection regress1
+[NO_PID]: ECPGget_data line 77: RESULT: 3 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 72 Ok: CLOSE CURSOR
+[NO_PID]: ECPGget_data line 77: RESULT: this is a long test offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 74: QUERY: select * from test1 where a = 3 on connection regress1
+[NO_PID]: ECPGexecute line 80: QUERY: drop table test1 with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 74: Correctly got 1 tuples with 2 fields
+[NO_PID]: ECPGexecute line 80: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 74: RESULT: 3 offset: -1 array: Yes
+[NO_PID]: ECPGexecute line 80 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 74: RESULT: this is a long test offset: -1 array: Yes
+[NO_PID]: ECPGdeallocate line 81: NAME: foo3
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 77: QUERY: drop table test1 on connection regress1
+[NO_PID]: ECPGdeallocate line 81: NAME: foo2
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 77 Ok: DROP TABLE
+[NO_PID]: ECPGdeallocate line 81: NAME: foo1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
#line 33 "dynalloc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to mdy", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set datestyle to mdy", ECPGt_EOIT, ECPGt_EORT);
#line 35 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 35 "dynalloc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet ) ", ECPGt_EOIT, ECPGt_EORT);
#line 37 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 37 "dynalloc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( b , c , d , e , f , g , h , i ) values ( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( b , c , d , e , f , g , h , i ) values ( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 38 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 38 "dynalloc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( b , c , d , e , f , g , h , i ) values ( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test ( b , c , d , e , f , g , h , i ) values ( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null ) ", ECPGt_EOIT, ECPGt_EORT);
#line 39 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
if (sqlca.sqlcode < 0) sqlprint ( );
#line 41 "dynalloc.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select a , b , c , d , e , f , g , h , i from test order by a ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select a , b , c , d , e , f , g , h , i from test order by a ", ECPGt_EOIT,
ECPGt_descriptor, "mydesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 42 "dynalloc.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: set datestyle to mdy on connection regress1
+[NO_PID]: ECPGexecute line 35: QUERY: set datestyle to mdy with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 37: QUERY: create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet ) on connection regress1
+[NO_PID]: ECPGexecute line 37: QUERY: create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 38: QUERY: insert into test ( b , c , d , e , f , g , h , i ) values ( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' ) on connection regress1
+[NO_PID]: ECPGexecute line 38: QUERY: insert into test ( b , c , d , e , f , g , h , i ) values ( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 38: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: QUERY: insert into test ( b , c , d , e , f , g , h , i ) values ( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null ) on connection regress1
+[NO_PID]: ECPGexecute line 39: QUERY: insert into test ( b , c , d , e , f , g , h , i ) values ( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 39 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 42: QUERY: select a , b , c , d , e , f , g , h , i from test order by a on connection regress1
+[NO_PID]: ECPGexecute line 42: QUERY: select a , b , c , d , e , f , g , h , i from test order by a with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42: Correctly got 2 tuples with 9 fields
[NO_PID]: sqlca: code: 0, state: 00000
#line 20 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to postgres", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set datestyle to postgres", ECPGt_EOIT, ECPGt_EORT);
#line 22 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 22 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 24 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 24 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 1 , 'one' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( 1 , 'one' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 25 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 25 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 2 , 'two' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( 2 , 'two' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 26 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 26 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( null , 'three' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( null , 'three' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 27 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 27 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 4 , 'four' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( 4 , 'four' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 28 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 28 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 5 , null ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( 5 , null ) ", ECPGt_EOIT, ECPGt_EORT);
#line 29 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 29 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( null , null ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test values ( null , null ) ", ECPGt_EOIT, ECPGt_EORT);
#line 30 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
if (sqlca.sqlcode < 0) sqlprint ( );
#line 32 "dynalloc2.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select * from test ", ECPGt_EOIT,
ECPGt_descriptor, "mydesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 33 "dynalloc2.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 22: QUERY: set datestyle to postgres on connection regress1
+[NO_PID]: ECPGexecute line 22: QUERY: set datestyle to postgres with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 24: QUERY: create table test ( a int , b text ) on connection regress1
+[NO_PID]: ECPGexecute line 24: QUERY: create table test ( a int , b text ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 25: QUERY: insert into test values ( 1 , 'one' ) on connection regress1
+[NO_PID]: ECPGexecute line 25: QUERY: insert into test values ( 1 , 'one' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: insert into test values ( 2 , 'two' ) on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: insert into test values ( 2 , 'two' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 27: QUERY: insert into test values ( null , 'three' ) on connection regress1
+[NO_PID]: ECPGexecute line 27: QUERY: insert into test values ( null , 'three' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 27: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 28: QUERY: insert into test values ( 4 , 'four' ) on connection regress1
+[NO_PID]: ECPGexecute line 28: QUERY: insert into test values ( 4 , 'four' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 29: QUERY: insert into test values ( 5 , null ) on connection regress1
+[NO_PID]: ECPGexecute line 29: QUERY: insert into test values ( 5 , null ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 30: QUERY: insert into test values ( null , null ) on connection regress1
+[NO_PID]: ECPGexecute line 30: QUERY: insert into test values ( null , null ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 33: QUERY: select * from test on connection regress1
+[NO_PID]: ECPGexecute line 33: QUERY: select * from test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 33: Correctly got 6 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
#line 47 "dyntest.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to german", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set datestyle to german", ECPGt_EOIT, ECPGt_EORT);
#line 49 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 49 "dyntest.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8 , b boolean , comment text , day date ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8 , b boolean , comment text , day date ) ", ECPGt_EOIT, ECPGt_EORT);
#line 53 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 53 "dyntest.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 54 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 54 "dyntest.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 55 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 55 "dyntest.pgc"
- { ECPGprepare(__LINE__, "MYQUERY" , QUERY);
+ { ECPGprepare(__LINE__, NULL, 0, "myquery", QUERY);
#line 57 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 57 "dyntest.pgc"
- /* declare MYCURS cursor for ? */
+ /* declare MYCURS cursor for $1 */
#line 58 "dyntest.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "declare MYCURS cursor for ?",
- ECPGt_char_variable,(ECPGprepared_statement("MYQUERY")),(long)1,(long)1,(1)*sizeof(char),
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare MYCURS cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("myquery", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 60 "dyntest.pgc"
while (1)
{
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch in MYCURS", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch in MYCURS", ECPGt_EOIT,
ECPGt_descriptor, "MYDESC", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 64 "dyntest.pgc"
}
}
- { ECPGdo(__LINE__, 0, 1, NULL, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
#line 197 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49: QUERY: set datestyle to german on connection regress1
+[NO_PID]: ECPGexecute line 49: QUERY: set datestyle to german with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 49: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 49 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 51: QUERY: create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8 , b boolean , comment text , day date ) on connection regress1
+[NO_PID]: ECPGexecute line 51: QUERY: create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8 , b boolean , comment text , day date ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 51 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 54: QUERY: insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' ) on connection regress1
+[NO_PID]: ECPGexecute line 54: QUERY: insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 54: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 54 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 55: QUERY: insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' ) on connection regress1
+[NO_PID]: ECPGexecute line 55: QUERY: insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 55: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 55 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 57: QUERY: select * from dyntest
+[NO_PID]: ECPGprepare line 57: NAME: myquery QUERY: select * from dyntest
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 60: QUERY: declare MYCURS cursor for select * from dyntest with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 60: QUERY: declare MYCURS cursor for select * from dyntest on connection regress1
+[NO_PID]: ECPGexecute line 60: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 60 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: QUERY: fetch in MYCURS on connection regress1
+[NO_PID]: ECPGexecute line 64: QUERY: fetch in MYCURS with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 7 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 179: RESULT: 14.07.1987 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: QUERY: fetch in MYCURS on connection regress1
+[NO_PID]: ECPGexecute line 64: QUERY: fetch in MYCURS with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 7 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 179: RESULT: 05.11.1999 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: QUERY: fetch in MYCURS on connection regress1
+[NO_PID]: ECPGexecute line 64: QUERY: fetch in MYCURS with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: Correctly got 0 tuples with 7 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 64, 'No data found in line 64.'.
[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 197: QUERY: close MYCURS on connection regress1
+[NO_PID]: ECPGexecute line 197: QUERY: close MYCURS with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 197: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 197 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
if (sqlca.sqlcode < 0) sqlprint();}
#line 24 "execute.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 25 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 2, command, ECPGt_EOIT, ECPGt_EORT);
#line 29 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 2, command, ECPGt_EOIT, ECPGt_EORT);
#line 32 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 2, command, ECPGt_EOIT, ECPGt_EORT);
#line 35 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
- sprintf(command, "insert into test (name, amount, letter) select name, amount+?, letter from test");
- { ECPGprepare(__LINE__, "I" , command);
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+$1, letter from test");
+ { ECPGprepare(__LINE__, NULL, 0, "i", command);
#line 40 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 40 "execute.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(ECPGprepared_statement("I")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "i",
ECPGt_int,&(increment),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 41 "execute.pgc"
sprintf (command, "select * from test");
- { ECPGprepare(__LINE__, "F" , command);
+ { ECPGprepare(__LINE__, NULL, 0, "f", command);
#line 49 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 49 "execute.pgc"
- /* declare CUR cursor for ? */
+ /* declare CUR cursor for $1 */
#line 50 "execute.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "declare CUR cursor for ?",
- ECPGt_char_variable,(ECPGprepared_statement("F")),(long)1,(long)1,(1)*sizeof(char),
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare CUR cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("f", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 52 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 52 "execute.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch 8 in CUR", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch 8 in CUR", ECPGt_EOIT,
ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "close CUR", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "close CUR", ECPGt_EOIT, ECPGt_EORT);
#line 66 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 66 "execute.pgc"
+ { ECPGdeallocate(__LINE__, 0, "f");
+#line 67 "execute.pgc"
- sprintf (command, "select * from test where amount = ?");
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 67 "execute.pgc"
- { ECPGprepare(__LINE__, "F" , command);
-#line 70 "execute.pgc"
-if (sqlca.sqlcode < 0) sqlprint();}
-#line 70 "execute.pgc"
+ sprintf (command, "select * from test where amount = $1");
+
+ { ECPGprepare(__LINE__, NULL, 0, "f", command);
+#line 71 "execute.pgc"
- /* declare CUR2 cursor for ? */
+if (sqlca.sqlcode < 0) sqlprint();}
#line 71 "execute.pgc"
+ /* declare CUR2 cursor for $1 */
+#line 72 "execute.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "declare CUR2 cursor for ?",
- ECPGt_char_variable,(ECPGprepared_statement("F")),(long)1,(long)1,(1)*sizeof(char),
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare CUR2 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("f", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_const,"1",(long)1,(long)1,strlen("1"),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 73 "execute.pgc"
+#line 74 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 73 "execute.pgc"
+#line 74 "execute.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch in CUR2", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch in CUR2", ECPGt_EOIT,
ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 74 "execute.pgc"
+#line 75 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 74 "execute.pgc"
+#line 75 "execute.pgc"
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
-#line 79 "execute.pgc"
+#line 80 "execute.pgc"
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
-#line 80 "execute.pgc"
+#line 81 "execute.pgc"
int a = amount [ i ] ;
/* exec sql end declare section */
-#line 81 "execute.pgc"
+#line 82 "execute.pgc"
strncpy(n, name[i], 8);
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "close CUR2", ECPGt_EOIT, ECPGt_EORT);
-#line 87 "execute.pgc"
-
-if (sqlca.sqlcode < 0) sqlprint();}
-#line 87 "execute.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "close CUR2", ECPGt_EOIT, ECPGt_EORT);
#line 88 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 88 "execute.pgc"
- { ECPGtrans(__LINE__, NULL, "commit");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 89 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 89 "execute.pgc"
- { ECPGdisconnect(__LINE__, "CURRENT");
+ { ECPGtrans(__LINE__, NULL, "commit");
#line 90 "execute.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 90 "execute.pgc"
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 91 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 91 "execute.pgc"
+
return (0);
}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 25: QUERY: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) on connection main
+[NO_PID]: ECPGexecute line 25: QUERY: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 26 action = commit connection = main
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 29: QUERY: insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f') on connection main
+[NO_PID]: ECPGexecute line 29: QUERY: insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f') with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: insert into test (name, amount, letter) values ('db: ''r1''', 2, 't') on connection main
+[NO_PID]: ECPGexecute line 32: QUERY: insert into test (name, amount, letter) values ('db: ''r1''', 2, 't') with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: insert into test (name, amount, letter) select name, amount+10, letter from test on connection main
+[NO_PID]: ECPGexecute line 35: QUERY: insert into test (name, amount, letter) select name, amount+10, letter from test with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 2
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 40: QUERY: insert into test (name, amount, letter) select name, amount+?, letter from test
+[NO_PID]: ECPGprepare line 40: NAME: i QUERY: insert into test (name, amount, letter) select name, amount+$1, letter from test
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 41: QUERY: insert into test (name, amount, letter) select name, amount+100, letter from test on connection main
+[NO_PID]: ECPGexecute line 41: QUERY: insert into test (name, amount, letter) select name, amount+$1, letter from test with 1 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: using PQexecPrepared for insert into test (name, amount, letter) select name, amount+$1, letter from test
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: parameter 1 = 100
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 41 Ok: INSERT 0 4
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 45 action = commit connection = main
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 49: QUERY: select * from test
+[NO_PID]: ECPGprepare line 49: NAME: f QUERY: select * from test
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 52: QUERY: declare CUR cursor for select * from test on connection main
+[NO_PID]: ECPGexecute line 52: QUERY: declare CUR cursor for select * from test with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: fetch 8 in CUR on connection main
+[NO_PID]: ECPGexecute line 53: QUERY: fetch 8 in CUR with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 53: Correctly got 8 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 66: QUERY: close CUR on connection main
+[NO_PID]: ECPGexecute line 66: QUERY: close CUR with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 66: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 66 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 70: QUERY: select * from test where amount = ?
+[NO_PID]: ECPGdeallocate line 67: NAME: f
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 71: NAME: f QUERY: select * from test where amount = $1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74: QUERY: declare CUR2 cursor for select * from test where amount = $1 with 1 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 75: QUERY: fetch in CUR2 with 0 parameter on connection main
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 73: QUERY: declare CUR2 cursor for select * from test where amount = 1 on connection main
+[NO_PID]: ECPGexecute line 75: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 73 Ok: DECLARE CURSOR
+[NO_PID]: ECPGexecute line 75: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 74: QUERY: fetch in CUR2 on connection main
+[NO_PID]: ECPGget_data line 75: RESULT: db: 'r1' offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 74: Correctly got 1 tuples with 3 fields
+[NO_PID]: ECPGget_data line 75: RESULT: 1 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 74: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: ECPGget_data line 75: RESULT: f offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 74: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: ECPGexecute line 88: QUERY: close CUR2 with 0 parameter on connection main
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 74: RESULT: f offset: -1 array: Yes
+[NO_PID]: ECPGexecute line 88: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 87: QUERY: close CUR2 on connection main
+[NO_PID]: ECPGexecute line 88 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 87 Ok: CLOSE CURSOR
+[NO_PID]: ECPGexecute line 89: QUERY: drop table test with 0 parameter on connection main
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 88: QUERY: drop table test on connection main
+[NO_PID]: ECPGexecute line 89: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 88 Ok: DROP TABLE
+[NO_PID]: ECPGexecute line 89 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 89 action = commit connection = main
+[NO_PID]: ECPGtrans line 90 action = commit connection = main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
int main(int argc, char* argv[]) {
/* exec sql begin declare section */
-
+
#line 9 "fetch.pgc"
char str [ 25 ] ;
#line 10 "fetch.pgc"
- int i , how_many = 1 ;
+ int i ;
/* exec sql end declare section */
#line 11 "fetch.pgc"
#line 17 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 19 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 19 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 1 , 'text1' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into My_Table values ( 1 , 'text1' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 21 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 2 , 'text2' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into My_Table values ( 2 , 'text2' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 3 , 'text3' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into My_Table values ( 3 , 'text3' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 23 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 4 , 'text4' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into My_Table values ( 4 , 'text4' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 24 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 26 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "declare C cursor for select * from My_Table ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare C cursor for select * from My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 28 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 30 "fetch.pgc"
while (1) {
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch 1 in C", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch 1 in C", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char),
/* exec sql whenever not found continue ; */
#line 36 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "move backward 2 in C", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "move backward 2 in C", ECPGt_EOIT, ECPGt_EORT);
#line 37 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 37 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch ? in C",
- ECPGt_int,&(how_many),(long)1,(long)1,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch 1 in C", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char),
printf("%d: %s\n", i, str);
- { ECPGdo(__LINE__, 0, 1, NULL, "close C", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "close C", ECPGt_EOIT, ECPGt_EORT);
#line 42 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 42 "fetch.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 44 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 19: QUERY: create table My_Table ( Item1 int , Item2 text ) on connection regress1
+[NO_PID]: ECPGexecute line 19: QUERY: create table My_Table ( Item1 int , Item2 text ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 21: QUERY: insert into My_Table values ( 1 , 'text1' ) on connection regress1
+[NO_PID]: ECPGexecute line 21: QUERY: insert into My_Table values ( 1 , 'text1' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 21: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 22: QUERY: insert into My_Table values ( 2 , 'text2' ) on connection regress1
+[NO_PID]: ECPGexecute line 22: QUERY: insert into My_Table values ( 2 , 'text2' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 23: QUERY: insert into My_Table values ( 3 , 'text3' ) on connection regress1
+[NO_PID]: ECPGexecute line 23: QUERY: insert into My_Table values ( 3 , 'text3' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 24: QUERY: insert into My_Table values ( 4 , 'text4' ) on connection regress1
+[NO_PID]: ECPGexecute line 24: QUERY: insert into My_Table values ( 4 , 'text4' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 28: QUERY: declare C cursor for select * from My_Table on connection regress1
+[NO_PID]: ECPGexecute line 28: QUERY: declare C cursor for select * from My_Table with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 32: RESULT: text1 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 32: RESULT: text2 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 32: RESULT: text3 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 32: RESULT: text4 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32: Correctly got 0 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 32, 'No data found in line 32.'.
[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 37: QUERY: move backward 2 in C on connection regress1
+[NO_PID]: ECPGexecute line 37: QUERY: move backward 2 in C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37 Ok: MOVE 2
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 39: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: ECPGexecute line 39: QUERY: fetch 1 in C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 39: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 39: RESULT: text4 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 42: QUERY: close C on connection regress1
+[NO_PID]: ECPGexecute line 42: QUERY: close C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 44: QUERY: drop table My_Table on connection regress1
+[NO_PID]: ECPGexecute line 44: QUERY: drop table My_Table with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 44: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 44 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
int main(int argc, char* argv[]) {
+
+#line 8 "func.pgc"
+ char text [ 25 ] ;
+
+#line 8 "func.pgc"
+
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
-#line 10 "func.pgc"
+#line 11 "func.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);}
-#line 12 "func.pgc"
+#line 13 "func.pgc"
/* exec sql whenever sql_warning sqlprint ; */
-#line 13 "func.pgc"
+#line 14 "func.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 14 "func.pgc"
+#line 15 "func.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 16 "func.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 17 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 16 "func.pgc"
+#line 17 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 16 "func.pgc"
-
+#line 17 "func.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create function My_Table_Check () returns trigger as $test$\
- BEGIN\
- RAISE WARNING 'Notice: TG_NAME=%, TG WHEN=%', TG_NAME, TG_WHEN;\
- RETURN NEW;\
- END; $test$ language plpgsql", ECPGt_EOIT, ECPGt_EORT);
-#line 24 "func.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table Log ( name text , w text ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 18 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 24 "func.pgc"
+#line 18 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 24 "func.pgc"
+#line 18 "func.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( )", ECPGt_EOIT, ECPGt_EORT);
-#line 30 "func.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create function My_Table_Check () returns trigger as $test$\
+ BEGIN\
+ INSERT INTO Log VALUES(TG_NAME, TG_WHEN);\
+ RETURN NEW;\
+ END; $test$ language plpgsql", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 30 "func.pgc"
+#line 26 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 30 "func.pgc"
+#line 26 "func.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 1234 , 'Some random text' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( )", ECPGt_EOIT, ECPGt_EORT);
#line 32 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "func.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 5678 , 'The Quick Brown' ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 33 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into My_Table values ( 1234 , 'Some random text' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 34 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 33 "func.pgc"
+#line 34 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 33 "func.pgc"
-
+#line 34 "func.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "drop trigger My_Table_Check_Trigger on My_Table ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into My_Table values ( 5678 , 'The Quick Brown' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 35 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 35 "func.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "drop function My_Table_Check () ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select name from Log limit 1 ", ECPGt_EOIT,
+ ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 36 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "func.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
-#line 37 "func.pgc"
+ printf("Trigger %s fired.\n", text);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop trigger My_Table_Check_Trigger on My_Table ", ECPGt_EOIT, ECPGt_EORT);
+#line 39 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 37 "func.pgc"
+#line 39 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 37 "func.pgc"
+#line 39 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop function My_Table_Check () ", ECPGt_EOIT, ECPGt_EORT);
+#line 40 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 40 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 40 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table Log ", ECPGt_EOIT, ECPGt_EORT);
+#line 41 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 41 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 41 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
+#line 42 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 42 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 42 "func.pgc"
{ ECPGdisconnect(__LINE__, "ALL");
-#line 39 "func.pgc"
+#line 44 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 39 "func.pgc"
+#line 44 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 39 "func.pgc"
+#line 44 "func.pgc"
return 0;
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGsetcommit line 12 action = on connection = regress1
+[NO_PID]: ECPGsetcommit line 13 action = on connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 16: QUERY: create table My_Table ( Item1 int , Item2 text ) on connection regress1
+[NO_PID]: ECPGexecute line 17: QUERY: create table My_Table ( Item1 int , Item2 text ) with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 16 Ok: CREATE TABLE
+[NO_PID]: ECPGexecute line 17: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 18: QUERY: create function My_Table_Check () returns trigger as $test$ BEGIN RAISE WARNING 'Notice: TG_NAME=%, TG WHEN=%', TG_NAME, TG_WHEN; RETURN NEW; END; $test$ language plpgsql on connection regress1
+[NO_PID]: ECPGexecute line 17 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 18 Ok: CREATE FUNCTION
+[NO_PID]: ECPGexecute line 18: QUERY: create table Log ( name text , w text ) with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( ) on connection regress1
+[NO_PID]: ECPGexecute line 18: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26 Ok: CREATE TRIGGER
+[NO_PID]: ECPGexecute line 18 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: insert into My_Table values ( 1234 , 'Some random text' ) on connection regress1
+[NO_PID]: ECPGexecute line 20: QUERY: create function My_Table_Check () returns trigger as $test$ BEGIN INSERT INTO Log VALUES(TG_NAME, TG_WHEN); RETURN NEW; END; $test$ language plpgsql with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: Notice: TG_NAME=my_table_check_trigger, TG WHEN=BEFORE[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 0
-[NO_PID]: sqlca: code: 0, state: 01000
-[NO_PID]: ECPGexecute line 32 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 01000
-sql error Notice: TG_NAME=my_table_check_trigger, TG WHEN=BEFORE
-[NO_PID]: ECPGexecute line 33: QUERY: insert into My_Table values ( 5678 , 'The Quick Brown' ) on connection regress1
+[NO_PID]: ECPGexecute line 20: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: Notice: TG_NAME=my_table_check_trigger, TG WHEN=BEFORE[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 0
-[NO_PID]: sqlca: code: 0, state: 01000
-[NO_PID]: ECPGexecute line 33 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 01000
-sql error Notice: TG_NAME=my_table_check_trigger, TG WHEN=BEFORE
-[NO_PID]: ECPGexecute line 35: QUERY: drop trigger My_Table_Check_Trigger on My_Table on connection regress1
+[NO_PID]: ECPGexecute line 20 Ok: CREATE FUNCTION
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35 Ok: DROP TRIGGER
+[NO_PID]: ECPGexecute line 28: QUERY: create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( ) with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36: QUERY: drop function My_Table_Check () on connection regress1
+[NO_PID]: ECPGexecute line 28: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36 Ok: DROP FUNCTION
+[NO_PID]: ECPGexecute line 28 Ok: CREATE TRIGGER
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 37: QUERY: drop table My_Table on connection regress1
+[NO_PID]: ECPGexecute line 34: QUERY: insert into My_Table values ( 1234 , 'Some random text' ) with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 37 Ok: DROP TABLE
+[NO_PID]: ECPGexecute line 34: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: QUERY: insert into My_Table values ( 5678 , 'The Quick Brown' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: QUERY: select name from Log limit 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: Correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 36: RESULT: my_table_check_trigger offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: QUERY: drop trigger My_Table_Check_Trigger on My_Table with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39 Ok: DROP TRIGGER
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: QUERY: drop function My_Table_Check () with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40 Ok: DROP FUNCTION
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: QUERY: drop table Log with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41 Ok: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: QUERY: drop table My_Table with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
+Trigger my_table_check_trigger fired.
#line 17 "indicators.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( \"id\" int primary key , \"str\" text not null , val int null ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table indicator_test ( \"id\" int primary key , \"str\" text not null , val int null ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 22 "indicators.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 23 "indicators.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values ( 1 , 'Hello' , 0 ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into indicator_test ( id , str , val ) values ( 1 , 'Hello' , 0 ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 25 "indicators.pgc"
/* use indicator in insert */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values ( 2 , 'Hi there' , ? ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into indicator_test ( id , str , val ) values ( 2 , 'Hi there' , $1 ) ",
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
#line 28 "indicators.pgc"
nullind = 0;
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values ( 3 , 'Good evening' , ? ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into indicator_test ( id , str , val ) values ( 3 , 'Good evening' , $1 ) ",
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
#line 30 "indicators.pgc"
/* use indicators to get information about selects */
- { ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 1 ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select val from indicator_test where id = 1 ", ECPGt_EOIT,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 34 "indicators.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 2 ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select val from indicator_test where id = 2 ", ECPGt_EOIT,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
#line 35 "indicators.pgc"
printf("intvar: %d, nullind: %d\n", intvar, nullind);
- { ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 3 ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select val from indicator_test where id = 3 ", ECPGt_EOIT,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
#line 37 "indicators.pgc"
/* use indicators for update */
intvar = 5; nullind = -1;
- { ECPGdo(__LINE__, 0, 1, NULL, "update test set val = ? where id = 1 ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "update indicator_test set val = $1 where id = 1 ",
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
#line 42 "indicators.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 1 ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select val from indicator_test where id = 1 ", ECPGt_EOIT,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
#line 43 "indicators.pgc"
printf("intvar: %d, nullind: %d\n", intvar, nullind);
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table indicator_test ", ECPGt_EOIT, ECPGt_EORT);}
#line 46 "indicators.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGsetcommit line 17 action = off connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 19: QUERY: create table test ( "id" int primary key , "str" text not null , val int null ) on connection regress1
+[NO_PID]: ECPGexecute line 19: QUERY: create table indicator_test ( "id" int primary key , "str" text not null , val int null ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 23 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 25: QUERY: insert into test ( id , str , val ) values ( 1 , 'Hello' , 0 ) on connection regress1
+[NO_PID]: ECPGexecute line 25: QUERY: insert into indicator_test ( id , str , val ) values ( 1 , 'Hello' , 0 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 28: QUERY: insert into test ( id , str , val ) values ( 2 , 'Hi there' , null ) on connection regress1
+[NO_PID]: ECPGexecute line 28: QUERY: insert into indicator_test ( id , str , val ) values ( 2 , 'Hi there' , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: parameter 1 = null
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 30: QUERY: insert into test ( id , str , val ) values ( 3 , 'Good evening' , 5 ) on connection regress1
+[NO_PID]: ECPGexecute line 30: QUERY: insert into indicator_test ( id , str , val ) values ( 3 , 'Good evening' , $1 ) with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30: parameter 1 = 5
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 31 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 34: QUERY: select val from test where id = 1 on connection regress1
+[NO_PID]: ECPGexecute line 34: QUERY: select val from indicator_test where id = 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 34: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 34: RESULT: 0 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: select val from test where id = 2 on connection regress1
+[NO_PID]: ECPGexecute line 35: QUERY: select val from indicator_test where id = 2 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 35: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 37: QUERY: select val from test where id = 3 on connection regress1
+[NO_PID]: ECPGexecute line 37: QUERY: select val from indicator_test where id = 3 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 37: RESULT: 5 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 42: QUERY: update test set val = null where id = 1 on connection regress1
+[NO_PID]: ECPGexecute line 42: QUERY: update indicator_test set val = $1 where id = 1 with 1 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: parameter 1 = null
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42 Ok: UPDATE 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 43: QUERY: select val from test where id = 1 on connection regress1
+[NO_PID]: ECPGexecute line 43: QUERY: select val from indicator_test where id = 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 43: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 43: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 46: QUERY: drop table test on connection regress1
+[NO_PID]: ECPGexecute line 46: QUERY: drop table indicator_test with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 46 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
#line 16 "insupd.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b int ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table insupd_test ( a int , b int ) ", ECPGt_EOIT, ECPGt_EORT);
#line 18 "insupd.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 18 "insupd.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values ( 1 , 1 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into insupd_test ( a , b ) values ( 1 , 1 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 20 "insupd.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 20 "insupd.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values ( 2 , 2 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into insupd_test ( a , b ) values ( 2 , 2 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 21 "insupd.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "insupd.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values ( 3 , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into insupd_test ( a , b ) values ( 3 , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "insupd.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 22 "insupd.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "update test set a = a + 1 ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "update insupd_test set a = a + 1 ", ECPGt_EOIT, ECPGt_EORT);
#line 24 "insupd.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 24 "insupd.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "update test set ( a , b )= ( 5 , 5 ) where a = 4 ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "update insupd_test set ( a , b )= ( 5 , 5 ) where a = 4 ", ECPGt_EOIT, ECPGt_EORT);
#line 25 "insupd.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 25 "insupd.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "update test set a = 4 where a = 3 ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "update insupd_test set a = 4 where a = 3 ", ECPGt_EOIT, ECPGt_EORT);
#line 26 "insupd.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 26 "insupd.pgc"
;
- { ECPGdo(__LINE__, 0, 1, NULL, "select a , b from test order by a ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select a , b from insupd_test order by a ", ECPGt_EOIT,
ECPGt_int,(i1),(long)1,(long)3,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(i2),(long)1,(long)3,sizeof(int),
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 18: QUERY: create table test ( a int , b int ) on connection regress1
+[NO_PID]: ECPGexecute line 18: QUERY: create table insupd_test ( a int , b int ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 18: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 20: QUERY: insert into test ( a , b ) values ( 1 , 1 ) on connection regress1
+[NO_PID]: ECPGexecute line 20: QUERY: insert into insupd_test ( a , b ) values ( 1 , 1 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 20: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 20 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 21: QUERY: insert into test ( a , b ) values ( 2 , 2 ) on connection regress1
+[NO_PID]: ECPGexecute line 21: QUERY: insert into insupd_test ( a , b ) values ( 2 , 2 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 21: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 22: QUERY: insert into test ( a , b ) values ( 3 , 3 ) on connection regress1
+[NO_PID]: ECPGexecute line 22: QUERY: insert into insupd_test ( a , b ) values ( 3 , 3 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 24: QUERY: update test set a = a + 1 on connection regress1
+[NO_PID]: ECPGexecute line 24: QUERY: update insupd_test set a = a + 1 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24 Ok: UPDATE 3
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 25: QUERY: update test set ( a , b )= ( 5 , 5 ) where a = 4 on connection regress1
+[NO_PID]: ECPGexecute line 25: QUERY: update insupd_test set ( a , b )= ( 5 , 5 ) where a = 4 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25 Ok: UPDATE 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: update test set a = 4 where a = 3 on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: update insupd_test set a = 4 where a = 3 with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: UPDATE 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 28: QUERY: select a , b from test order by a on connection regress1
+[NO_PID]: ECPGexecute line 28: QUERY: select a , b from insupd_test order by a with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28: Correctly got 3 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
--- /dev/null
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "oldexec.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "oldexec.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 8 "oldexec.pgc"
+
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+#line 14 "oldexec.pgc"
+ int amount [ 8 ] ;
+
+#line 15 "oldexec.pgc"
+ int increment = 100 ;
+
+#line 16 "oldexec.pgc"
+ char name [ 8 ] [ 8 ] ;
+
+#line 17 "oldexec.pgc"
+ char letter [ 8 ] [ 1 ] ;
+
+#line 18 "oldexec.pgc"
+ char command [ 128 ] ;
+/* exec sql end declare section */
+#line 19 "oldexec.pgc"
+
+ int i,j;
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , "main", 0);
+#line 24 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 0, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 25 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 25 "oldexec.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 26 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "oldexec.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 2, command, ECPGt_EOIT, ECPGt_EORT);
+#line 29 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 29 "oldexec.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 2, command, ECPGt_EOIT, ECPGt_EORT);
+#line 32 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "oldexec.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 2, command, ECPGt_EOIT, ECPGt_EORT);
+#line 35 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "oldexec.pgc"
+
+
+ printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+$1, letter from test");
+ { ECPGprepare(__LINE__, NULL, 1, "i", command);
+#line 40 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 40 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 1, "i",
+ ECPGt_int,&(increment),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 41 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 41 "oldexec.pgc"
+
+
+ printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 45 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 45 "oldexec.pgc"
+
+
+ sprintf (command, "select * from test");
+
+ { ECPGprepare(__LINE__, NULL, 1, "f", command);
+#line 49 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 49 "oldexec.pgc"
+
+ /* declare CUR cursor for $1 */
+#line 50 "oldexec.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 0, "declare CUR cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("f", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 52 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 52 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 0, "fetch 8 in CUR", ECPGt_EOIT,
+ ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 53 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "oldexec.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ /* exec sql begin declare section */
+
+
+
+#line 58 "oldexec.pgc"
+ char n [ 8 ] , l = letter [ i ] [ 0 ] ;
+
+#line 59 "oldexec.pgc"
+ int a = amount [ i ] ;
+/* exec sql end declare section */
+#line 60 "oldexec.pgc"
+
+
+ strncpy(n, name[i], 8);
+ printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 0, "close CUR", ECPGt_EOIT, ECPGt_EORT);
+#line 66 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 66 "oldexec.pgc"
+
+
+ sprintf (command, "select * from test where ? = amount");
+
+ { ECPGprepare(__LINE__, NULL, 1, "f", command);
+#line 70 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 70 "oldexec.pgc"
+
+ /* declare CUR3 cursor for $1 */
+#line 71 "oldexec.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 0, "declare CUR3 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("f", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_const,"1",(long)1,(long)1,strlen("1"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 73 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 73 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 0, "fetch in CUR3", ECPGt_EOIT,
+ ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 74 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 74 "oldexec.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ /* exec sql begin declare section */
+
+
+
+#line 79 "oldexec.pgc"
+ char n [ 8 ] , l = letter [ i ] [ 0 ] ;
+
+#line 80 "oldexec.pgc"
+ int a = amount [ i ] ;
+/* exec sql end declare section */
+#line 81 "oldexec.pgc"
+
+
+ strncpy(n, name[i], 8);
+ printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 0, "close CUR3", ECPGt_EOIT, ECPGt_EORT);
+#line 87 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 87 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, 0, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
+#line 88 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 88 "oldexec.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 89 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 89 "oldexec.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 90 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 90 "oldexec.pgc"
+
+
+ return (0);
+}
--- /dev/null
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25: QUERY: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 26 action = commit connection = main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: QUERY: insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f') with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: QUERY: insert into test (name, amount, letter) values ('db: ''r1''', 2, 't') with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: QUERY: insert into test (name, amount, letter) select name, amount+10, letter from test with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 40: NAME: i QUERY: insert into test (name, amount, letter) select name, amount+$1, letter from test
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: QUERY: insert into test (name, amount, letter) select name, amount+$1, letter from test with 1 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: using PQexecPrepared for insert into test (name, amount, letter) select name, amount+$1, letter from test
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: parameter 1 = 100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41 Ok: INSERT 0 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 45 action = commit connection = main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 49: NAME: f QUERY: select * from test
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: QUERY: declare CUR cursor for select * from test with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: QUERY: fetch 8 in CUR with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: Correctly got 8 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 2 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 11 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 12 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 101 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 102 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 111 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 112 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 66: QUERY: close CUR with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 66: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 66 Ok: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGdeallocate line 70: NAME: f
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 70: NAME: f QUERY: select * from test where $1 = amount
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 73: QUERY: declare CUR3 cursor for select * from test where $1 = amount with 1 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 73: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 73: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 73 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74: QUERY: fetch in CUR3 with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74: Correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 74: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 74: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 74: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 87: QUERY: close CUR3 with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 87: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 87 Ok: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 88: QUERY: drop table test with 0 parameter on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 88: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 88 Ok: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 89 action = commit connection = main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
--- /dev/null
+Inserted 2 tuples via execute immediate
+Inserted 4 tuples via prepared execute
+name[0]=db: 'r1' amount[0]=1 letter[0]=f
+name[1]=db: 'r1' amount[1]=2 letter[1]=t
+name[2]=db: 'r1' amount[2]=11 letter[2]=f
+name[3]=db: 'r1' amount[3]=12 letter[3]=t
+name[4]=db: 'r1' amount[4]=101 letter[4]=f
+name[5]=db: 'r1' amount[5]=102 letter[5]=t
+name[6]=db: 'r1' amount[6]=111 letter[6]=f
+name[7]=db: 'r1' amount[7]=112 letter[7]=t
+name[0]=db: 'r1' amount[0]=1 letter[0]=f
#line 18 "parser.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table T ( Item1 int , Item2 int ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table T ( Item1 int , Item2 int ) ", ECPGt_EOIT, ECPGt_EORT);
#line 20 "parser.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 20 "parser.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into T values ( 1 , null ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into T values ( 1 , null ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "parser.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "parser.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into T values ( 1 , 1 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into T values ( 1 , 1 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "parser.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 23 "parser.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into T values ( 1 , 2 ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into T values ( 1 , 2 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 24 "parser.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 24 "parser.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT,
ECPGt_int,(item),(long)1,(long)3,sizeof(int),
ECPGt_int,(ind),(long)1,(long)3,sizeof(int), ECPGt_EORT);
#line 26 "parser.pgc"
for (i=0; i<3; i++)
printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table T ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table T ", ECPGt_EOIT, ECPGt_EORT);
#line 31 "parser.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGsetcommit line 16 action = on connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 20: QUERY: create table T ( Item1 int , Item2 int ) on connection regress1
+[NO_PID]: ECPGexecute line 20: QUERY: create table T ( Item1 int , Item2 int ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 20: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 20 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 22: QUERY: insert into T values ( 1 , null ) on connection regress1
+[NO_PID]: ECPGexecute line 22: QUERY: insert into T values ( 1 , null ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 23: QUERY: insert into T values ( 1 , 1 ) on connection regress1
+[NO_PID]: ECPGexecute line 23: QUERY: insert into T values ( 1 , 1 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 24: QUERY: insert into T values ( 1 , 2 ) on connection regress1
+[NO_PID]: ECPGexecute line 24: QUERY: insert into T values ( 1 , 2 ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: select Item2 from T order by Item2 nulls last on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: select Item2 from T order by Item2 nulls last with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: Correctly got 3 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 26: RESULT: offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 31: QUERY: drop table T on connection regress1
+[NO_PID]: ECPGexecute line 31: QUERY: drop table T with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 31: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
int main(int argc, char* argv[]) {
/* exec sql begin declare section */
+
#line 9 "quote.pgc"
char var [ 25 ] ;
-/* exec sql end declare section */
+
#line 10 "quote.pgc"
+ int i ;
+/* exec sql end declare section */
+#line 11 "quote.pgc"
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
-#line 13 "quote.pgc"
+#line 14 "quote.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);}
-#line 15 "quote.pgc"
+#line 16 "quote.pgc"
/* exec sql whenever sql_warning sqlprint ; */
-#line 16 "quote.pgc"
+#line 17 "quote.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 17 "quote.pgc"
+#line 18 "quote.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table \"My_Table\" ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 19 "quote.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table \"My_Table\" ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 20 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 19 "quote.pgc"
+#line 20 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 19 "quote.pgc"
+#line 20 "quote.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "show standard_conforming_strings", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "show standard_conforming_strings", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 21 "quote.pgc"
+#line 22 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 21 "quote.pgc"
+#line 22 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 21 "quote.pgc"
+#line 22 "quote.pgc"
printf("Standard conforming strings: %s\n", var);
/* this is a\\b actually */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 25 "quote.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into \"My_Table\" values ( 1 , 'a\\\\\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 25 "quote.pgc"
+#line 26 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 25 "quote.pgc"
+#line 26 "quote.pgc"
- /* this is a\b */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 27 "quote.pgc"
+ /* this is a\\b */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into \"My_Table\" values ( 1 , E'a\\\\\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 28 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 27 "quote.pgc"
+#line 28 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 27 "quote.pgc"
+#line 28 "quote.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);
-#line 29 "quote.pgc"
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 29 "quote.pgc"
+#line 30 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 29 "quote.pgc"
+#line 30 "quote.pgc"
- /* this is a\\b actually */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 32 "quote.pgc"
+ /* this is a\\\\b actually */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into \"My_Table\" values ( 2 , 'a\\\\\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 32 "quote.pgc"
+#line 33 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 32 "quote.pgc"
+#line 33 "quote.pgc"
- /* this is a\b */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 34 "quote.pgc"
+ /* this is a\\b */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into \"My_Table\" values ( 2 , E'a\\\\\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 34 "quote.pgc"
+#line 35 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 34 "quote.pgc"
+#line 35 "quote.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
-#line 36 "quote.pgc"
+ { ECPGtrans(__LINE__, NULL, "begin transaction ");
+#line 37 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 36 "quote.pgc"
+#line 37 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 36 "quote.pgc"
-
+#line 37 "quote.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
+ /* declare C cursor for select * from \"My_Table\" */
#line 38 "quote.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "declare C cursor for select * from \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
+#line 40 "quote.pgc"
+
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 38 "quote.pgc"
+#line 40 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 38 "quote.pgc"
+#line 40 "quote.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 42 "quote.pgc"
+
+
+ while (true)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "fetch C", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 46 "quote.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 46 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 46 "quote.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 46 "quote.pgc"
+
+ printf("value: %d %s\n", i, var);
+ }
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 50 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 50 "quote.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 50 "quote.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
+#line 51 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 51 "quote.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 51 "quote.pgc"
{ ECPGdisconnect(__LINE__, "ALL");
-#line 40 "quote.pgc"
+#line 53 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
-#line 40 "quote.pgc"
+#line 53 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 40 "quote.pgc"
+#line 53 "quote.pgc"
return 0;
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGsetcommit line 15 action = on connection = regress1
+[NO_PID]: ECPGsetcommit line 16 action = on connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 19: QUERY: create table "My_Table" ( Item1 int , Item2 text ) on connection regress1
+[NO_PID]: ECPGexecute line 20: QUERY: create table "My_Table" ( Item1 int , Item2 text ) with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
+[NO_PID]: ECPGexecute line 20: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 21: QUERY: show standard_conforming_strings on connection regress1
+[NO_PID]: ECPGexecute line 20 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 21: Correctly got 1 tuples with 1 fields
+[NO_PID]: ECPGexecute line 22: QUERY: show standard_conforming_strings with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 21: RESULT: off offset: -1 array: Yes
+[NO_PID]: ECPGexecute line 22: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 25: QUERY: insert into "My_Table" values ( 1 , 'a\\b' ) on connection regress1
+[NO_PID]: ECPGexecute line 22: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: nonstandard use of \\ in a string literal[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 0
-[NO_PID]: sqlca: code: 0, state: 22P06
-[NO_PID]: ECPGexecute line 25 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 22P06
-sql error nonstandard use of \\ in a string literal
-[NO_PID]: ECPGexecute line 27: QUERY: insert into "My_Table" values ( 1 , 'a\\b' ) on connection regress1
+[NO_PID]: ECPGget_data line 22: RESULT: off offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: QUERY: insert into "My_Table" values ( 1 , 'a\\\\b' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGnoticeReceiver nonstandard use of \\ in a string literal
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: nonstandard use of \\ in a string literal[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 0
[NO_PID]: sqlca: code: 0, state: 22P06
-[NO_PID]: ECPGexecute line 27 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 26: using PQexec
+[NO_PID]: sqlca: code: 0, state: 22P06
+[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 22P06
sql error nonstandard use of \\ in a string literal
-[NO_PID]: ECPGexecute line 29: QUERY: set standard_conforming_strings to on on connection regress1
+[NO_PID]: ECPGexecute line 28: QUERY: insert into "My_Table" values ( 1 , E'a\\\\b' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30: QUERY: set standard_conforming_strings to on with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30 Ok: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33: QUERY: insert into "My_Table" values ( 2 , 'a\\\\b' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: QUERY: insert into "My_Table" values ( 2 , E'a\\\\b' ) with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 37 action = begin transaction connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: QUERY: declare C cursor for select * from "My_Table" with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 40 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: QUERY: fetch C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 46: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 46: RESULT: a\\b offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: QUERY: fetch C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 46: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 46: RESULT: a\\b offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: QUERY: fetch C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 46: RESULT: 2 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 46: RESULT: a\\\\b offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: QUERY: fetch C with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 46: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 29 Ok: SET
+[NO_PID]: ECPGget_data line 46: RESULT: 2 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: insert into "My_Table" values ( 1 , 'a\\b' ) on connection regress1
+[NO_PID]: ECPGget_data line 46: RESULT: a\\b offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 46: QUERY: fetch C with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 34: QUERY: insert into "My_Table" values ( 1 , 'a\\b' ) on connection regress1
+[NO_PID]: ECPGexecute line 46: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 46: Correctly got 0 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36: QUERY: select * from "My_Table" on connection regress1
+[NO_PID]: raising sqlcode 100 in line 46, 'No data found in line 46.'.
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ECPGtrans line 50 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36: Correctly got 4 tuples with 2 fields
+[NO_PID]: ECPGexecute line 51: QUERY: drop table "My_Table" with 0 parameter on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -202 in line 36, 'Too few arguments in line 36.'.
-[NO_PID]: sqlca: code: -202, state: 07002
-sql error Too few arguments in line 36.
-[NO_PID]: ECPGexecute line 38: QUERY: drop table "My_Table" on connection regress1
+[NO_PID]: ECPGexecute line 51: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 38 Ok: DROP TABLE
+[NO_PID]: ECPGexecute line 51 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
Standard conforming strings: off
+value: 1 a\\b
+value: 1 a\\b
+value: 2 a\\\\b
+value: 2 a\\b
#line 16 "show.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "set search_path to 'public'", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set search_path to 'public'", ECPGt_EOIT, ECPGt_EORT);
#line 18 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 18 "show.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "show search_path", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "show search_path", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 19 "show.pgc"
printf("Var: Search path: %s\n", var);
- { ECPGdo(__LINE__, 0, 1, NULL, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);
#line 22 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "show.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "show standard_conforming_strings", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "show standard_conforming_strings", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 23 "show.pgc"
printf("Var: Standard conforming strings: %s\n", var);
- { ECPGdo(__LINE__, 0, 1, NULL, "set time zone PST8PDT", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set time zone PST8PDT", ECPGt_EOIT, ECPGt_EORT);
#line 26 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 26 "show.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "show time zone", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "show time zone", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 27 "show.pgc"
printf("Time Zone: %s\n", var);
- { ECPGdo(__LINE__, 0, 1, NULL, "set transaction isolation level read committed", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "set transaction isolation level read committed", ECPGt_EOIT, ECPGt_EORT);
#line 30 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
if (sqlca.sqlcode < 0) sqlprint();}
#line 30 "show.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "show transaction isolation level", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "show transaction isolation level", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 31 "show.pgc"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 18: QUERY: set search_path to 'public' on connection regress1
+[NO_PID]: ECPGexecute line 18: QUERY: set search_path to 'public' with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 18: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 19: QUERY: show search_path on connection regress1
+[NO_PID]: ECPGexecute line 19: QUERY: show search_path with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 19: RESULT: public offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 22: QUERY: set standard_conforming_strings to off on connection regress1
+[NO_PID]: ECPGexecute line 22: QUERY: set standard_conforming_strings to off with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 23: QUERY: show standard_conforming_strings on connection regress1
+[NO_PID]: ECPGexecute line 23: QUERY: show standard_conforming_strings with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 23: RESULT: off offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 26: QUERY: set time zone PST8PDT on connection regress1
+[NO_PID]: ECPGexecute line 26: QUERY: set time zone PST8PDT with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 26: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 27: QUERY: show time zone on connection regress1
+[NO_PID]: ECPGexecute line 27: QUERY: show time zone with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 27: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 27: RESULT: PST8PDT offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 30: QUERY: set transaction isolation level read committed on connection regress1
+[NO_PID]: ECPGexecute line 30: QUERY: set transaction isolation level read committed with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 30: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 31: QUERY: show transaction isolation level on connection regress1
+[NO_PID]: ECPGexecute line 31: QUERY: show transaction isolation level with 0 parameter on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 31: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
#line 46 "thread.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);}
#line 47 "thread.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 48 "thread.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 53 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
#line 85 "thread.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select count (*) from test_thread ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select count (*) from test_thread ", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 86 "thread.pgc"
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
- { ECPGdo(__LINE__, 0, 1, l_connection, "insert into test_thread ( thread , iteration ) values ( ? , ? ) ",
+ { ECPGdo(__LINE__, 0, 1, l_connection, 0, 0, "insert into test_thread ( thread , iteration ) values ( $1 , $2 ) ",
ECPGt_char,(l_connection),(long)128,(long)1,(128)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
-No threading enabled.
+Success.
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
#line 47 "thread_implicit.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);}
#line 48 "thread_implicit.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 49 "thread_implicit.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);}
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 54 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
#line 86 "thread_implicit.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select count (*) from test_thread ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "select count (*) from test_thread ", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 87 "thread_implicit.pgc"
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test_thread ( thread , iteration ) values ( ? , ? ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, 0, "insert into test_thread ( thread , iteration ) values ( $1 , $2 ) ",
ECPGt_char,(l_connection),(long)128,(long)1,(128)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
-No threading enabled.
+Success.
include $(top_srcdir)/$(subdir)/../Makefile.regress
-TESTS = comment comment.c \
+TESTS = array_of_struct array_of_struct.c \
+ autoprep autoprep.c \
+ comment comment.c \
define define.c \
init init.c \
type type.c \
all: $(TESTS)
+array_of_struct.c: array_of_struct.pgc ../regression.h
+ $(ECPG) -c -o $@ -I$(srcdir) $<
+
+autoprep.c: autoprep.pgc ../regression.h
+ $(ECPG) -r prepare -o $@ -I$(srcdir) $<
+
--- /dev/null
+#include <stdio.h>
+
+exec sql include ../regression;
+
+EXEC SQL WHENEVER sqlerror sqlprint;
+EXEC SQL WHENEVER sqlwarning sqlprint;
+EXEC SQL WHENEVER not found sqlprint;
+
+EXEC SQL TYPE customer IS
+ struct
+ {
+ varchar name[50];
+ int phone;
+ };
+
+EXEC SQL TYPE cust_ind IS
+ struct ind
+ {
+ short name_ind;
+ short phone_ind;
+ };
+
+int main( int argc, char * argv[] )
+{
+ EXEC SQL begin declare section;
+ customer custs1[10];
+ cust_ind inds[10];
+ typedef struct
+ {
+ varchar name[50];
+ int phone;
+ } customer2;
+ customer2 custs2[10];
+ struct customer3
+ {
+ varchar name[50];
+ int phone;
+ } custs3[10];
+ struct customer4
+ {
+ varchar name[50];
+ int phone;
+ } custs4;
+ int r;
+ EXEC SQL end declare section;
+
+ ECPGdebug(1, stderr);
+
+ EXEC SQL connect to REGRESSDB1;
+
+ EXEC SQL create table customers (c varchar(50), p int);
+ EXEC SQL insert into customers values ('John Doe', '12345');
+ EXEC SQL insert into customers values ('Jane Doe', '67890');
+
+ EXEC SQL select * INTO :custs1:inds from customers limit 2;
+ printf("custs1:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs1[r].name.arr );
+ printf( "phone - %d\n", custs1[r].phone );
+ }
+
+ EXEC SQL select * INTO :custs2:inds from customers limit 2;
+ printf("\ncusts2:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs2[r].name.arr );
+ printf( "phone - %d\n", custs2[r].phone );
+ }
+
+ EXEC SQL select * INTO :custs3:inds from customers limit 2;
+ printf("\ncusts3:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs3[r].name.arr );
+ printf( "phone - %d\n", custs3[r].phone );
+ }
+
+ EXEC SQL select * INTO :custs4:inds[0] from customers limit 1;
+ printf("\ncusts4:\n");
+ printf( "name - %s\n", custs4.name.arr );
+ printf( "phone - %d\n", custs4.phone );
+
+ EXEC SQL disconnect all;
+
+ return( 0 );
+}
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* test automatic prepare for all statements */
+EXEC SQL INCLUDE ../regression;
+
+int main(int argc, char* argv[]) {
+ EXEC SQL BEGIN DECLARE SECTION;
+ int item[4], ind[4], i = 1;
+ EXEC SQL END DECLARE SECTION;
+
+ ECPGdebug(1, stderr);
+ EXEC SQL CONNECT TO REGRESSDB1;
+
+ EXEC SQL WHENEVER SQLWARNING SQLPRINT;
+ EXEC SQL WHENEVER SQLERROR SQLPRINT;
+
+ EXEC SQL CREATE TABLE T ( Item1 int, Item2 int );
+
+ EXEC SQL INSERT INTO T VALUES ( 1, null );
+ EXEC SQL INSERT INTO T VALUES ( 1, :i );
+ i++;
+ EXEC SQL INSERT INTO T VALUES ( 1, :i );
+ EXEC SQL PREPARE I AS INSERT INTO T VALUES ( 1, 2 );
+ EXEC SQL EXECUTE I;
+
+ EXEC SQL SELECT Item2 INTO :item:ind FROM T ORDER BY Item2 NULLS LAST;
+
+ for (i=0; i<4; i++)
+ printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
+
+ EXEC SQL DECLARE C CURSOR FOR SELECT Item1 FROM T;
+
+ EXEC SQL OPEN C;
+
+ EXEC SQL FETCH 1 IN C INTO :i;
+ printf("i = %d\n", i);
+
+ EXEC SQL CLOSE C;
+
+ EXEC SQL DROP TABLE T;
+
+ EXEC SQL DISCONNECT ALL;
+
+ return 0;
+}
fetch fetch.c \
func func.c \
indicators indicators.c \
+ oldexec oldexec.c \
parser parser.c \
quote quote.c \
show show.c \
all: $(TESTS)
-# bits needs the -c option for the "EXEC SQL TYPE" construct
-bits.c: bits.pgc ../regression.h
- $(ECPG) -c -o $@ -I$(srcdir) $<
+oldexec.c: oldexec.pgc ../regression.h
+ $(ECPG) -r questionmarks -o $@ -I$(srcdir) $<
EXEC SQL INSERT INTO test(f,i,a,text) VALUES(404.90,3,'{0,1,2,3,4,5,6,7,8,9}','abcdefghij');
EXEC SQL INSERT INTO test(f,i,a,text) VALUES(140787.0,2,:a,:text);
-
+
EXEC SQL INSERT INTO test(f,i,a,text) VALUES(14.07,:did,:a,:t);
EXEC SQL COMMIT;
main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
- char *stmt1 = "INSERT INTO test1 VALUES (?, ?)";
- char *stmt2 = "SELECT * from test1 where a = ? and b = ?";
- char *stmt3 = "SELECT * from test1 where a = ?";
+ char *stmt1 = "INSERT INTO test1 VALUES ($1, $2)";
+ char *stmt2 = "SELECT * from test1 where a = $1 and b = $2";
+ char *stmt3 = "SELECT * from test1 where :var = a";
int val1 = 1;
char val2[4] = "one", val2output[] = "AAA";
EXEC SQL CREATE TABLE test1 (a int, b text);
EXEC SQL PREPARE foo1 FROM :stmt1;
+ EXEC SQL PREPARE "Foo-1" FROM :stmt1;
EXEC SQL PREPARE foo2 FROM :stmt2;
EXEC SQL PREPARE foo3 FROM :stmt3;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 3;
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val1, DATA = 'this is a long test';
- EXEC SQL EXECUTE foo1 USING DESCRIPTOR indesc;
+ EXEC SQL EXECUTE "Foo-1" USING DESCRIPTOR indesc;
+
+ EXEC SQL DEALLOCATE "Foo-1";
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2i, DATA = :val2;
printf("val1=%d val2=%c%c%c%c warn=%c truncate=%d\n", val1output, val2output[0], val2output[1], val2output[2], val2output[3], sqlca.sqlwarn[0], val2i);
EXEC SQL DROP TABLE test1;
+ EXEC SQL DEALLOCATE ALL;
EXEC SQL DISCONNECT;
EXEC SQL DEALLOCATE DESCRIPTOR indesc;
exec sql insert into dyntest values ('first entry', 14.7, 14, 123045607890, true, 'The world''''s most advanced open source database.', '1987-07-14');
exec sql insert into dyntest values ('second entry', 1407.87, 1407, 987065403210, false, 'The elephant never forgets.', '1999-11-5');
- exec sql prepare MYQUERY from:QUERY;
+ exec sql prepare MYQUERY from :QUERY;
exec sql declare MYCURS cursor for MYQUERY;
exec sql open MYCURS;
printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
- sprintf(command, "insert into test (name, amount, letter) select name, amount+?, letter from test");
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+$1, letter from test");
exec sql prepare I from :command;
exec sql execute I using :increment;
sprintf (command, "select * from test");
- exec sql prepare F from :command;
- exec sql declare CUR cursor for F;
+ exec sql prepare f from :command;
+ exec sql declare CUR cursor for f;
exec sql open CUR;
exec sql fetch 8 in CUR into :name, :amount, :letter;
}
exec sql close CUR;
+ exec sql deallocate f;
- sprintf (command, "select * from test where amount = ?");
+ sprintf (command, "select * from test where amount = $1");
- exec sql prepare F from :command;
- exec sql declare CUR2 cursor for F;
+ exec sql prepare f from :command;
+ exec sql declare CUR2 cursor for f;
exec sql open CUR2 using 1;
exec sql fetch in CUR2 into :name, :amount, :letter;
int main(int argc, char* argv[]) {
EXEC SQL BEGIN DECLARE SECTION;
char str[25];
- int i, how_many = 1;
+ int i;
EXEC SQL END DECLARE SECTION;
ECPGdebug(1, stderr);
EXEC SQL WHENEVER NOT FOUND CONTINUE;
EXEC SQL MOVE BACKWARD 2 IN C;
- EXEC SQL FETCH :how_many IN C INTO :i, :str;
+ EXEC SQL FETCH 1 IN C INTO :i, :str;
printf("%d: %s\n", i, str);
EXEC SQL CLOSE C;
EXEC SQL INCLUDE ../regression;
int main(int argc, char* argv[]) {
+ EXEC SQL char text[25];
ECPGdebug(1, stderr);
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
EXEC SQL CREATE TABLE My_Table ( Item1 int, Item2 text );
+ EXEC SQL CREATE TABLE Log (name text, w text);
EXEC SQL CREATE FUNCTION My_Table_Check() RETURNS trigger
AS $test$
BEGIN
- RAISE WARNING 'Notice: TG_NAME=%, TG WHEN=%', TG_NAME, TG_WHEN;
+ INSERT INTO Log VALUES(TG_NAME, TG_WHEN);
RETURN NEW;
END; $test$
LANGUAGE plpgsql;
EXEC SQL INSERT INTO My_Table VALUES (1234, 'Some random text');
EXEC SQL INSERT INTO My_Table VALUES (5678, 'The Quick Brown');
+ EXEC SQL SELECT name INTO :text FROM Log LIMIT 1;
+ printf("Trigger %s fired.\n", text);
EXEC SQL DROP TRIGGER My_Table_Check_Trigger ON My_Table;
EXEC SQL DROP FUNCTION My_Table_Check();
+ EXEC SQL DROP TABLE Log;
EXEC SQL DROP TABLE My_Table;
EXEC SQL DISCONNECT ALL;
exec sql connect to REGRESSDB1;
exec sql set autocommit to off;
- exec sql create table test (
+ exec sql create table indicator_test (
"id" int primary key,
"str" text NOT NULL,
val int null);
exec sql commit work;
- exec sql insert into test (id, str, val) values ( 1, 'Hello', 0);
+ exec sql insert into indicator_test (id, str, val) values ( 1, 'Hello', 0);
/* use indicator in insert */
- exec sql insert into test (id, str, val) values ( 2, 'Hi there', :intvar :nullind);
+ exec sql insert into indicator_test (id, str, val) values ( 2, 'Hi there', :intvar :nullind);
nullind = 0;
- exec sql insert into test (id, str, val) values ( 3, 'Good evening', :intvar :nullind);
+ exec sql insert into indicator_test (id, str, val) values ( 3, 'Good evening', :intvar :nullind);
exec sql commit work;
/* use indicators to get information about selects */
- exec sql select val into :intvar from test where id = 1;
- exec sql select val into :intvar :nullind from test where id = 2;
+ exec sql select val into :intvar from indicator_test where id = 1;
+ exec sql select val into :intvar :nullind from indicator_test where id = 2;
printf("intvar: %d, nullind: %d\n", intvar, nullind);
- exec sql select val into :intvar :nullind from test where id = 3;
+ exec sql select val into :intvar :nullind from indicator_test where id = 3;
printf("intvar: %d, nullind: %d\n", intvar, nullind);
/* use indicators for update */
intvar = 5; nullind = -1;
- exec sql update test set val = :intvar :nullind where id = 1;
- exec sql select val into :intvar :nullind from test where id = 1;
+ exec sql update indicator_test set val = :intvar :nullind where id = 1;
+ exec sql select val into :intvar :nullind from indicator_test where id = 1;
printf("intvar: %d, nullind: %d\n", intvar, nullind);
- exec sql drop table test;
+ exec sql drop table indicator_test;
exec sql commit work;
exec sql disconnect;
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
- EXEC SQL CREATE TABLE test(a int, b int);
+ EXEC SQL CREATE TABLE insupd_test(a int, b int);
- EXEC SQL INSERT INTO test (a,b) values (1, 1);
- EXEC SQL INSERT INTO test (a,b) values (2, 2);
- EXEC SQL INSERT INTO test (a,b) values (3, 3);
+ EXEC SQL INSERT INTO insupd_test (a,b) values (1, 1);
+ EXEC SQL INSERT INTO insupd_test (a,b) values (2, 2);
+ EXEC SQL INSERT INTO insupd_test (a,b) values (3, 3);
- EXEC SQL UPDATE test set a=a+1;
- EXEC SQL UPDATE test set (a,b)=(5,5) where a = 4;
- EXEC SQL UPDATE test set a=4 where a=3;;
+ EXEC SQL UPDATE insupd_test set a=a+1;
+ EXEC SQL UPDATE insupd_test set (a,b)=(5,5) where a = 4;
+ EXEC SQL UPDATE insupd_test set a=4 where a=3;;
- EXEC SQL SELECT a,b into :i1,:i2 from test order by a;
+ EXEC SQL SELECT a,b into :i1,:i2 from insupd_test order by a;
printf("test\na b\n%d %d\n%d %d\n%d %d\n", i1[0], i2[0], i1[1], i2[1], i1[2], i2[2]);
--- /dev/null
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+exec sql include ../regression;
+
+exec sql whenever sqlerror sqlprint;
+
+int
+main(void)
+{
+exec sql begin declare section;
+ int amount[8];
+ int increment=100;
+ char name[8][8];
+ char letter[8][1];
+ char command[128];
+exec sql end declare section;
+ int i,j;
+
+ ECPGdebug(1, stderr);
+
+ exec sql connect to REGRESSDB1 as main;
+ exec sql create table test (name char(8), amount int, letter char(1));
+ exec sql commit;
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
+ exec sql execute immediate :command;
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
+ exec sql execute immediate :command;
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
+ exec sql execute immediate :command;
+
+ printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+$1, letter from test");
+ exec sql prepare I from :command;
+ exec sql execute I using :increment;
+
+ printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
+
+ exec sql commit;
+
+ sprintf (command, "select * from test");
+
+ exec sql prepare F from :command;
+ exec sql declare CUR cursor for F;
+
+ exec sql open CUR;
+ exec sql fetch 8 in CUR into :name, :amount, :letter;
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ exec sql begin declare section;
+ char n[8], l = letter[i][0];
+ int a = amount[i];
+ exec sql end declare section;
+
+ strncpy(n, name[i], 8);
+ printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
+ }
+
+ exec sql close CUR;
+
+ sprintf (command, "select * from test where ? = amount");
+
+ exec sql prepare F from :command;
+ exec sql declare CUR3 cursor for F;
+
+ exec sql open CUR3 using 1;
+ exec sql fetch in CUR3 into :name, :amount, :letter;
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ exec sql begin declare section;
+ char n[8], l = letter[i][0];
+ int a = amount[i];
+ exec sql end declare section;
+
+ strncpy(n, name[i], 8);
+ printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
+ }
+
+ exec sql close CUR3;
+ exec sql drop table test;
+ exec sql commit;
+ exec sql disconnect;
+
+ return (0);
+}
int main(int argc, char* argv[]) {
EXEC SQL BEGIN DECLARE SECTION;
char var[25];
+ int i;
EXEC SQL END DECLARE SECTION;
ECPGdebug(1, stderr);
/* this is a\\b actually */
EXEC SQL INSERT INTO "My_Table" VALUES ( 1, 'a\\\\b' );
- /* this is a\b */
+ /* this is a\\b */
EXEC SQL INSERT INTO "My_Table" VALUES ( 1, E'a\\\\b' );
EXEC SQL SET standard_conforming_strings TO on;
- /* this is a\\b actually */
- EXEC SQL INSERT INTO "My_Table" VALUES ( 1, 'a\\\\b' );
- /* this is a\b */
- EXEC SQL INSERT INTO "My_Table" VALUES ( 1, E'a\\\\b' );
+ /* this is a\\\\b actually */
+ EXEC SQL INSERT INTO "My_Table" VALUES ( 2, 'a\\\\b' );
+ /* this is a\\b */
+ EXEC SQL INSERT INTO "My_Table" VALUES ( 2, E'a\\\\b' );
+
+ EXEC SQL BEGIN;
+ EXEC SQL DECLARE C CURSOR FOR SELECT * FROM "My_Table";
+
+ EXEC SQL OPEN C;
+
+ EXEC SQL WHENEVER NOT FOUND DO BREAK;
- EXEC SQL SELECT * FROM "My_Table";
+ while (true)
+ {
+ EXEC SQL FETCH C INTO :i, :var;
+ printf("value: %d %s\n", i, var);
+ }
+ EXEC SQL ROLLBACK;
EXEC SQL DROP TABLE "My_Table";
EXEC SQL DISCONNECT ALL;