Esempio n. 1
0
void
ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat)
{
	struct sqlca_t *sqlca = ECPGget_sqlca();
	char	   *sqlstate;
	char	   *message;

	if (result)
	{
		sqlstate = PQresultErrorField(result, PG_DIAG_SQLSTATE);
		if (sqlstate == NULL)
			sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
		message = PQresultErrorField(result, PG_DIAG_MESSAGE_PRIMARY);
	}
	else
	{
		sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
		message = PQerrorMessage(conn);
	}

	if (strcmp(sqlstate, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR) == 0)
	{
		/* we might get here if the connection breaks down, so let's
		 * check for this instead of giving just the generic internal error */
		if (PQstatus(conn) == CONNECTION_BAD)
		{
			sqlstate = "57P02";
			message = ecpg_gettext("the connection to the server was lost");
		}
	}

	/* copy error message */
	snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), "%s on line %d", message, line);
	sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);

	/* copy SQLSTATE */
	strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));

	/* assign SQLCODE for backward compatibility */
	if (strncmp(sqlca->sqlstate, "23505", sizeof(sqlca->sqlstate)) == 0)
		sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_DUPLICATE_KEY : ECPG_DUPLICATE_KEY;
	else if (strncmp(sqlca->sqlstate, "21000", sizeof(sqlca->sqlstate)) == 0)
		sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_SUBSELECT_NOT_ONE : ECPG_SUBSELECT_NOT_ONE;
	else
		sqlca->sqlcode = ECPG_PGSQL;

	/* %.*s is safe here as long as sqlstate is all-ASCII */
	ecpg_log("raising sqlstate %.*s (sqlcode %d): %s\n",
			 sizeof(sqlca->sqlstate), sqlca->sqlstate, sqlca->sqlcode, sqlca->sqlerrm.sqlerrmc);

	/* free all memory we have allocated for the user */
	ECPGfree_auto_mem();
}
Esempio n. 2
0
void
ECPGset_var(int number, void *pointer, int lineno)
{
	struct var_list *ptr;

	for (ptr = ivlist; ptr != NULL; ptr = ptr->next)
	{
		if (ptr->number == number)
		{
			/* already known => just change pointer value */
			ptr->pointer = pointer;
			return;
		}
	}

	/* a new one has to be added */
	ptr = (struct var_list *) calloc(1L, sizeof(struct var_list));
	if (!ptr)
	{
		struct sqlca_t *sqlca = ECPGget_sqlca();

		if (sqlca == NULL)
		{
			ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
					   ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
			return;
		}

		sqlca->sqlcode = ECPG_OUT_OF_MEMORY;
		strncpy(sqlca->sqlstate, "YE001", sizeof(sqlca->sqlstate));
		snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), "out of memory on line %d", lineno);
		sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
		/* free all memory we have allocated for the user */
		ECPGfree_auto_mem();
	}
	else
	{
		ptr->number = number;
		ptr->pointer = pointer;
		ptr->next = ivlist;
		ivlist = ptr;
	}
}
Esempio n. 3
0
void
ECPGraise_backend(int line, PGresult *result, PGconn *conn, int compat)
{
	struct sqlca_t *sqlca = ECPGget_sqlca();
	char	   *sqlstate;
	char	   *message;

	if (result)
	{
		sqlstate = PQresultErrorField(result, PG_DIAG_SQLSTATE);
		if (sqlstate == NULL)
			sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
		message = PQresultErrorField(result, PG_DIAG_MESSAGE_PRIMARY);
	}
	else
	{
		sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
		message = PQerrorMessage(conn);
	}

	/* copy error message */
	snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
			 "'%s' in line %d.", message, line);
	sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);

	/* copy SQLSTATE */
	strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));

	/* assign SQLCODE for backward compatibility */
	if (strncmp(sqlca->sqlstate, "23505", sizeof(sqlca->sqlstate)) == 0)
		sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_DUPLICATE_KEY : ECPG_DUPLICATE_KEY;
	else if (strncmp(sqlca->sqlstate, "21000", sizeof(sqlca->sqlstate)) == 0)
		sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_SUBSELECT_NOT_ONE : ECPG_SUBSELECT_NOT_ONE;
	else
		sqlca->sqlcode = ECPG_PGSQL;

	ECPGlog("raising sqlstate %.*s in line %d, '%s'.\n",
	sizeof(sqlca->sqlstate), sqlca->sqlstate, line, sqlca->sqlerrm.sqlerrmc);

	/* free all memory we have allocated for the user */
	ECPGfree_auto_mem();
}
Esempio n. 4
0
void
ecpg_raise(int line, int code, const char *sqlstate, const char *str)
{
	struct sqlca_t *sqlca = ECPGget_sqlca();

	sqlca->sqlcode = code;
	strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));

	switch (code)
	{
		case ECPG_NOT_FOUND:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("no data found on line %d"), line);
			break;

		case ECPG_OUT_OF_MEMORY:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("out of memory on line %d"), line);
			break;

		case ECPG_UNSUPPORTED:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
			  ecpg_gettext("unsupported type \"%s\" on line %d"), str, line);
			break;

		case ECPG_TOO_MANY_ARGUMENTS:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("too many arguments on line %d"), line);
			break;

		case ECPG_TOO_FEW_ARGUMENTS:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("too few arguments on line %d"), line);
			break;

		case ECPG_INT_FORMAT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("invalid input syntax for type int: \"%s\", on line %d"), str, line);
			break;

		case ECPG_UINT_FORMAT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("invalid input syntax for type unsigned int: \"%s\", on line %d"), str, line);
			break;

		case ECPG_FLOAT_FORMAT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("invalid input syntax for floating-point type: \"%s\", on line %d"), str, line);
			break;

		case ECPG_CONVERT_BOOL:
			if (str)
				snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

				/*
				 * translator: this string will be truncated at 149 characters
				 * expanded.
				 */
						 ecpg_gettext("invalid syntax for type boolean: \"%s\", on line %d"), str, line);
			else
				snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

				/*
				 * translator: this string will be truncated at 149 characters
				 * expanded.
				 */
						 ecpg_gettext("could not convert boolean value: size mismatch, on line %d"), line);
			break;

		case ECPG_EMPTY:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("empty query on line %d"), line);
			break;

		case ECPG_MISSING_INDICATOR:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
			  ecpg_gettext("null value without indicator on line %d"), line);
			break;

		case ECPG_NO_ARRAY:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("variable does not have an array type on line %d"), line);
			break;

		case ECPG_DATA_NOT_ARRAY:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("data read from server is not an array on line %d"), line);
			break;

		case ECPG_ARRAY_INSERT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("inserting an array of variables is not supported on line %d"), line);
			break;

		case ECPG_NO_CONN:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("connection \"%s\" does not exist on line %d"), str, line);
			break;

		case ECPG_NOT_CONN:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("not connected to connection \"%s\" on line %d"), str, line);
			break;

		case ECPG_INVALID_STMT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("invalid statement name \"%s\" on line %d"), str, line);
			break;

		case ECPG_UNKNOWN_DESCRIPTOR:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("descriptor \"%s\" not found on line %d"), str, line);
			break;

		case ECPG_INVALID_DESCRIPTOR_INDEX:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
			 ecpg_gettext("descriptor index out of range on line %d"), line);
			break;

		case ECPG_UNKNOWN_DESCRIPTOR_ITEM:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("unrecognized descriptor item \"%s\" on line %d"), str, line);
			break;

		case ECPG_VAR_NOT_NUMERIC:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("variable does not have a numeric type on line %d"), line);
			break;

		case ECPG_VAR_NOT_CHAR:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("variable does not have a character type on line %d"), line);
			break;

		case ECPG_TRANS:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
			ecpg_gettext("error in transaction processing on line %d"), line);
			break;

		case ECPG_CONNECT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("could not connect to database \"%s\" on line %d"), str, line);
			break;

		default:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),

			/*
			 * translator: this string will be truncated at 149 characters
			 * expanded.
			 */
					 ecpg_gettext("SQL error %d on line %d"), code, line);
			break;
	}

	sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
	ecpg_log("raising sqlcode %d on line %d: %s\n", code, line, sqlca->sqlerrm.sqlerrmc);

	/* free all memory we have allocated for the user */
	ECPGfree_auto_mem();
}
Esempio n. 5
0
void
ECPGraise(int line, int code, const char *sqlstate, const char *str)
{
	struct sqlca_t *sqlca = ECPGget_sqlca();

	sqlca->sqlcode = code;
	strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));

	switch (code)
	{
		case ECPG_NOT_FOUND:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "No data found in line %d.", line);
			break;

		case ECPG_OUT_OF_MEMORY:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Out of memory in line %d.", line);
			break;

		case ECPG_UNSUPPORTED:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Unsupported type %s in line %d.", str, line);
			break;

		case ECPG_TOO_MANY_ARGUMENTS:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Too many arguments in line %d.", line);
			break;

		case ECPG_TOO_FEW_ARGUMENTS:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Too few arguments in line %d.", line);
			break;

		case ECPG_INT_FORMAT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
				 "Not correctly formatted int type: %s line %d.", str, line);
			break;

		case ECPG_UINT_FORMAT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Not correctly formatted unsigned type: %s in line %d.", str, line);
			break;

		case ECPG_FLOAT_FORMAT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Not correctly formatted floating-point type: %s in line %d.", str, line);
			break;

		case ECPG_CONVERT_BOOL:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Unable to convert %s to bool on line %d.", str, line);
			break;

		case ECPG_EMPTY:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Empty query in line %d.", line);
			break;

		case ECPG_MISSING_INDICATOR:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "NULL value without indicator in line %d.", line);
			break;

		case ECPG_NO_ARRAY:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Variable is not an array in line %d.", line);
			break;

		case ECPG_DATA_NOT_ARRAY:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
				 "Data read from backend is not an array in line %d.", line);
			break;

		case ECPG_ARRAY_INSERT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
				 "Trying to insert an array of variables in line %d.", line);
			break;

		case ECPG_NO_CONN:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "No such connection %s in line %d.", str, line);
			break;

		case ECPG_NOT_CONN:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Not connected to '%s' in line %d.", str, line);
			break;

		case ECPG_INVALID_STMT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Invalid statement name %s in line %d.", str, line);
			break;

		case ECPG_UNKNOWN_DESCRIPTOR:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Descriptor %s not found in line %d.", str, line);
			break;

		case ECPG_INVALID_DESCRIPTOR_INDEX:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Descriptor index out of range in line %d.", line);
			break;

		case ECPG_UNKNOWN_DESCRIPTOR_ITEM:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Unknown descriptor item %s in line %d.", str, line);
			break;

		case ECPG_VAR_NOT_NUMERIC:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Variable is not a numeric type in line %d.", line);
			break;

		case ECPG_VAR_NOT_CHAR:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Variable is not a character type in line %d.", line);
			break;

		case ECPG_TRANS:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "Error in transaction processing in line %d.", line);
			break;

		case ECPG_CONNECT:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
				  "Could not connect to database %s in line %d.", str, line);
			break;

		default:
			snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
					 "SQL error #%d in line %d.", code, line);
			break;
	}

	sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
	ECPGlog("raising sqlcode %d in line %d, '%s'.\n", code, line, sqlca->sqlerrm.sqlerrmc);

	/* free all memory we have allocated for the user */
	ECPGfree_auto_mem();
}
Esempio n. 6
0
int main(void)
{
   /* exec sql begin declare section */
        
     
    
    
    
    
    
/*   char **d8=0; */
    
    
    
    
    
    
    
    
/*   int *i8=0; */
    
   
#line 9 "dynalloc.pgc"
 int * d1 = 0 ;
 
#line 10 "dynalloc.pgc"
 double * d2 = 0 ;
 
#line 11 "dynalloc.pgc"
 char ** d3 = 0 ;
 
#line 12 "dynalloc.pgc"
 char ** d4 = 0 ;
 
#line 13 "dynalloc.pgc"
 char ** d5 = 0 ;
 
#line 14 "dynalloc.pgc"
 char ** d6 = 0 ;
 
#line 15 "dynalloc.pgc"
 char ** d7 = 0 ;
 
#line 17 "dynalloc.pgc"
 char ** d9 = 0 ;
 
#line 18 "dynalloc.pgc"
 int * i1 = 0 ;
 
#line 19 "dynalloc.pgc"
 int * i2 = 0 ;
 
#line 20 "dynalloc.pgc"
 int * i3 = 0 ;
 
#line 21 "dynalloc.pgc"
 int * i4 = 0 ;
 
#line 22 "dynalloc.pgc"
 int * i5 = 0 ;
 
#line 23 "dynalloc.pgc"
 int * i6 = 0 ;
 
#line 24 "dynalloc.pgc"
 int * i7 = 0 ;
 
#line 26 "dynalloc.pgc"
 int * i9 = 0 ;
/* exec sql end declare section */
#line 27 "dynalloc.pgc"

   int i;

   ECPGdebug(1, stderr);

   /* exec sql whenever sqlerror  do sqlprint ( ) ; */
#line 32 "dynalloc.pgc"

   { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); 
#line 33 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 33 "dynalloc.pgc"


   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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, 0, ECPGst_normal, "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, 0, ECPGst_normal, "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, 0, ECPGst_normal, "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 ( );}
#line 39 "dynalloc.pgc"


   ECPGallocate_desc(__LINE__, "mydesc");
#line 41 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );
#line 41 "dynalloc.pgc"

   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select a , b , c , d , e , f , g , h , i from test order by a", ECPGt_EOIT, 
	ECPGt_descriptor, "mydesc", 1L, 1L, 1L, 
	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 42 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 42 "dynalloc.pgc"

   { ECPGget_desc(__LINE__, "mydesc", 1,ECPGd_indicator,
	ECPGt_int,&(i1),(long)1,(long)0,sizeof(int), ECPGd_data,
	ECPGt_int,&(d1),(long)1,(long)0,sizeof(int), ECPGd_EODT);

#line 43 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 43 "dynalloc.pgc"

   { ECPGget_desc(__LINE__, "mydesc", 2,ECPGd_indicator,
	ECPGt_int,&(i2),(long)1,(long)0,sizeof(int), ECPGd_data,
	ECPGt_double,&(d2),(long)1,(long)0,sizeof(double), ECPGd_EODT);

#line 44 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 44 "dynalloc.pgc"

   { ECPGget_desc(__LINE__, "mydesc", 3,ECPGd_indicator,
	ECPGt_int,&(i3),(long)1,(long)0,sizeof(int), ECPGd_data,
	ECPGt_char,&(d3),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);

#line 45 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 45 "dynalloc.pgc"

   { ECPGget_desc(__LINE__, "mydesc", 4,ECPGd_indicator,
	ECPGt_int,&(i4),(long)1,(long)0,sizeof(int), ECPGd_data,
	ECPGt_char,&(d4),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);

#line 46 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 46 "dynalloc.pgc"

   { ECPGget_desc(__LINE__, "mydesc", 5,ECPGd_indicator,
	ECPGt_int,&(i5),(long)1,(long)0,sizeof(int), ECPGd_data,
	ECPGt_char,&(d5),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);

#line 47 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 47 "dynalloc.pgc"

   { ECPGget_desc(__LINE__, "mydesc", 6,ECPGd_indicator,
	ECPGt_int,&(i6),(long)1,(long)0,sizeof(int), ECPGd_data,
	ECPGt_char,&(d6),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);

#line 48 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 48 "dynalloc.pgc"

   { ECPGget_desc(__LINE__, "mydesc", 7,ECPGd_indicator,
	ECPGt_int,&(i7),(long)1,(long)0,sizeof(int), ECPGd_data,
	ECPGt_char,&(d7),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);

#line 49 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 49 "dynalloc.pgc"

   /* skip box for now */
   /* exec sql get descriptor mydesc value 8 :d8=DATA, :i8=INDICATOR; */
   { ECPGget_desc(__LINE__, "mydesc", 9,ECPGd_indicator,
	ECPGt_int,&(i9),(long)1,(long)0,sizeof(int), ECPGd_data,
	ECPGt_char,&(d9),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);

#line 52 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 52 "dynalloc.pgc"


   printf("Result:\n");
   for (i=0;i<sqlca.sqlerrd[2];++i)
   {
      if (i1[i]) printf("NULL, ");
      else printf("%d, ",d1[i]);

      if (i2[i]) printf("NULL, ");
      else printf("%f, ",d2[i]);

      if (i3[i]) printf("NULL, ");
      else printf("'%s', ",d3[i]);

      if (i4[i]) printf("NULL, ");
      else printf("'%s', ",d4[i]);

      if (i5[i]) printf("NULL, ");
      else printf("'%s', ",d5[i]);

      if (i6[i]) printf("NULL, ");
      else printf("'%s', ",d6[i]);

      if (i7[i]) printf("NULL, ");
      else printf("'%s', ",d7[i]);

      if (i9[i]) printf("NULL, ");
      else printf("'%s', ",d9[i]);

      printf("\n");
   }
   ECPGfree_auto_mem();
   printf("\n");

   ECPGdeallocate_desc(__LINE__, "mydesc");
#line 86 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );
#line 86 "dynalloc.pgc"

   { ECPGdisconnect(__LINE__, "CURRENT");
#line 87 "dynalloc.pgc"

if (sqlca.sqlcode < 0) sqlprint ( );}
#line 87 "dynalloc.pgc"

   return 0;
}