mirror of
https://github.com/postgres/postgres.git
synced 2025-06-01 00:01:20 -04:00
Fixed some memory bugs that somehow reappeared.
Also fixed a new Coverity report.
This commit is contained in:
parent
7c9e2c75da
commit
e6e61afe16
@ -2080,5 +2080,7 @@ Tu Aug 8 13:26:25 CEST 2006
|
|||||||
We Aug 9 09:28:56 CEST 2006
|
We Aug 9 09:28:56 CEST 2006
|
||||||
|
|
||||||
- Fixed error handling in numeric conversion (Joachim).
|
- Fixed error handling in numeric conversion (Joachim).
|
||||||
|
- Fixed some memory bugs that somehow reappeared.
|
||||||
|
- Also fixed a new Coverity report.
|
||||||
- Set ecpg library version to 5.2.
|
- Set ecpg library version to 5.2.
|
||||||
- Set ecpg version to 4.2.1.
|
- Set ecpg version to 4.2.1.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.57 2006/08/08 15:30:39 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.58 2006/08/09 09:08:31 meskes Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The aim is to get a simpler inteface to the database routines.
|
* The aim is to get a simpler inteface to the database routines.
|
||||||
@ -1018,6 +1018,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
|
|||||||
strcpy(mallocedval + strlen(mallocedval), "date ");
|
strcpy(mallocedval + strlen(mallocedval), "date ");
|
||||||
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
||||||
strcpy(mallocedval + strlen(mallocedval), ",");
|
strcpy(mallocedval + strlen(mallocedval), ",");
|
||||||
|
ECPGfree(str);
|
||||||
}
|
}
|
||||||
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
|
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
|
||||||
}
|
}
|
||||||
@ -1037,11 +1038,11 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
|
|||||||
strcpy(mallocedval, "date ");
|
strcpy(mallocedval, "date ");
|
||||||
/* also copy trailing '\0' */
|
/* also copy trailing '\0' */
|
||||||
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
||||||
|
ECPGfree(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
*tobeinserted_p = mallocedval;
|
*tobeinserted_p = mallocedval;
|
||||||
*malloced_p = true;
|
*malloced_p = true;
|
||||||
ECPGfree(str);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1072,6 +1073,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
|
|||||||
strcpy(mallocedval + strlen(mallocedval), "timestamp ");
|
strcpy(mallocedval + strlen(mallocedval), "timestamp ");
|
||||||
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
||||||
strcpy(mallocedval + strlen(mallocedval), ",");
|
strcpy(mallocedval + strlen(mallocedval), ",");
|
||||||
|
ECPGfree(str);
|
||||||
}
|
}
|
||||||
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
|
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
|
||||||
}
|
}
|
||||||
@ -1091,11 +1093,11 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
|
|||||||
strcpy(mallocedval, "timestamp ");
|
strcpy(mallocedval, "timestamp ");
|
||||||
/* also copy trailing '\0' */
|
/* also copy trailing '\0' */
|
||||||
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
||||||
|
ECPGfree(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
*tobeinserted_p = mallocedval;
|
*tobeinserted_p = mallocedval;
|
||||||
*malloced_p = true;
|
*malloced_p = true;
|
||||||
ECPGfree(str);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/numeric.c,v 1.29 2006/08/09 07:30:56 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/numeric.c,v 1.30 2006/08/09 09:08:31 meskes Exp $ */
|
||||||
|
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -405,7 +405,10 @@ PGTYPESnumeric_to_asc(numeric *num, int dscale)
|
|||||||
dscale = num->dscale;
|
dscale = num->dscale;
|
||||||
|
|
||||||
if (PGTYPESnumeric_copy(num, numcopy) < 0)
|
if (PGTYPESnumeric_copy(num, numcopy) < 0)
|
||||||
|
{
|
||||||
|
PGTYPESnumeric_free(numcopy);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
/* get_str_from_var may change its argument */
|
/* get_str_from_var may change its argument */
|
||||||
s = get_str_from_var(numcopy, dscale);
|
s = get_str_from_var(numcopy, dscale);
|
||||||
PGTYPESnumeric_free(numcopy);
|
PGTYPESnumeric_free(numcopy);
|
||||||
@ -1465,15 +1468,18 @@ PGTYPESnumeric_from_double(double d, numeric *dst)
|
|||||||
{
|
{
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
numeric *tmp;
|
numeric *tmp;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (sprintf(buffer, "%f", d) == 0)
|
if (sprintf(buffer, "%f", d) == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((tmp = PGTYPESnumeric_from_asc(buffer, NULL)) == NULL)
|
if ((tmp = PGTYPESnumeric_from_asc(buffer, NULL)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
if (PGTYPESnumeric_copy(tmp, dst) != 0)
|
i = PGTYPESnumeric_copy(tmp, dst);
|
||||||
return -1;
|
|
||||||
PGTYPESnumeric_free(tmp);
|
PGTYPESnumeric_free(tmp);
|
||||||
|
if (i != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1485,14 +1491,19 @@ numericvar_to_double(numeric *var, double *dp)
|
|||||||
double val;
|
double val;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
numeric *varcopy = PGTYPESnumeric_new();
|
numeric *varcopy = PGTYPESnumeric_new();
|
||||||
int i;
|
|
||||||
|
|
||||||
if (PGTYPESnumeric_copy(var, varcopy) < 0)
|
if (PGTYPESnumeric_copy(var, varcopy) < 0)
|
||||||
|
{
|
||||||
|
PGTYPESnumeric_free(varcopy);
|
||||||
return -1;
|
return -1;
|
||||||
if ((tmp = get_str_from_var(varcopy, varcopy->dscale)) == NULL)
|
}
|
||||||
return -1;
|
|
||||||
|
tmp = get_str_from_var(varcopy, varcopy->dscale);
|
||||||
PGTYPESnumeric_free(varcopy);
|
PGTYPESnumeric_free(varcopy);
|
||||||
|
|
||||||
|
if (tmp == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* strtod seems to not reset errno to 0 in case of success.
|
* strtod seems to not reset errno to 0 in case of success.
|
||||||
* at least on aome architectures
|
* at least on aome architectures
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.69 2006/07/30 16:28:58 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.70 2006/08/09 09:08:32 meskes Exp $ */
|
||||||
|
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -286,14 +286,16 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
|
|||||||
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "Indicator for simple datatype has to be simple.\n");
|
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);
|
||||||
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);
|
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);
|
||||||
break;
|
break;
|
||||||
case ECPGt_descriptor:
|
case ECPGt_descriptor:
|
||||||
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
|
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");
|
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);
|
||||||
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix);
|
if (ind_type != NULL)
|
||||||
|
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
|
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
|
||||||
|
@ -55,9 +55,11 @@ main(void)
|
|||||||
num = PGTYPESnumeric_from_asc(nums[i], &endptr);
|
num = PGTYPESnumeric_from_asc(nums[i], &endptr);
|
||||||
check_errno();
|
check_errno();
|
||||||
if (endptr != NULL)
|
if (endptr != NULL)
|
||||||
|
{
|
||||||
printf("endptr of %d is not NULL\n", i);
|
printf("endptr of %d is not NULL\n", i);
|
||||||
if (*endptr != '\0')
|
if (*endptr != '\0')
|
||||||
printf("*endptr of %d is not \\0\n", i);
|
printf("*endptr of %d is not \\0\n", i);
|
||||||
|
}
|
||||||
text = PGTYPESnumeric_to_asc(num, -1);
|
text = PGTYPESnumeric_to_asc(num, -1);
|
||||||
check_errno();
|
check_errno();
|
||||||
printf("num[%d,1]: %s\n", i, text); free(text);
|
printf("num[%d,1]: %s\n", i, text); free(text);
|
||||||
|
@ -270,7 +270,7 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
printf("%d Columns\n",COUNT);
|
printf("%d Columns\n",COUNT);
|
||||||
for (INDEX=1;INDEX<=COUNT;++INDEX)
|
for (INDEX=1;INDEX<=COUNT;++INDEX)
|
||||||
{
|
{
|
||||||
/* :NULLABLE=nullable, */{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_ret_octet,
|
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_ret_octet,
|
||||||
ECPGt_int,&(RETURNED_OCTET_LENGTH),(long)1,(long)1,sizeof(int), ECPGd_name,
|
ECPGt_int,&(RETURNED_OCTET_LENGTH),(long)1,(long)1,sizeof(int), ECPGd_name,
|
||||||
ECPGt_char,(NAME),(long)120,(long)1,(120)*sizeof(char), ECPGd_scale,
|
ECPGt_char,(NAME),(long)120,(long)1,(120)*sizeof(char), ECPGd_scale,
|
||||||
ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_precision,
|
ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_precision,
|
||||||
@ -348,8 +348,6 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
else printf("<SQL3 %d> ",TYPE);
|
else printf("<SQL3 %d> ",TYPE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* nullable is not yet implemented in ecpg */
|
|
||||||
/* if (!NULLABLE) printf("not null "); */
|
|
||||||
if (OCTET_LENGTH>0) printf("[%d bytes]",OCTET_LENGTH);
|
if (OCTET_LENGTH>0) printf("[%d bytes]",OCTET_LENGTH);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
@ -365,10 +363,10 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_type,
|
ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_type,
|
||||||
ECPGt_int,&(TYPE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
ECPGt_int,&(TYPE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||||
|
|
||||||
#line 138 "dyntest.pgc"
|
#line 136 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 138 "dyntest.pgc"
|
#line 136 "dyntest.pgc"
|
||||||
|
|
||||||
if (INDICATOR==-1) printf("NULL");
|
if (INDICATOR==-1) printf("NULL");
|
||||||
else switch (TYPE)
|
else switch (TYPE)
|
||||||
@ -376,10 +374,10 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
||||||
ECPGt_bool,&(BOOLVAR),(long)1,(long)1,sizeof(bool), ECPGd_EODT);
|
ECPGt_bool,&(BOOLVAR),(long)1,(long)1,sizeof(bool), ECPGd_EODT);
|
||||||
|
|
||||||
#line 142 "dyntest.pgc"
|
#line 140 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 142 "dyntest.pgc"
|
#line 140 "dyntest.pgc"
|
||||||
|
|
||||||
printf(BOOLVAR?"true":"false");
|
printf(BOOLVAR?"true":"false");
|
||||||
break;
|
break;
|
||||||
@ -389,10 +387,10 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
{ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
{ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
||||||
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||||
|
|
||||||
#line 148 "dyntest.pgc"
|
#line 146 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 148 "dyntest.pgc"
|
#line 146 "dyntest.pgc"
|
||||||
|
|
||||||
printf("%*d",PRECISION,INTVAR);
|
printf("%*d",PRECISION,INTVAR);
|
||||||
}
|
}
|
||||||
@ -400,10 +398,10 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
{ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
{ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
||||||
ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
|
ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
|
||||||
|
|
||||||
#line 152 "dyntest.pgc"
|
#line 150 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 152 "dyntest.pgc"
|
#line 150 "dyntest.pgc"
|
||||||
|
|
||||||
printf("%*.*f",PRECISION+1,SCALE,FLOATVAR);
|
printf("%*.*f",PRECISION+1,SCALE,FLOATVAR);
|
||||||
}
|
}
|
||||||
@ -413,10 +411,10 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
||||||
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||||
|
|
||||||
#line 158 "dyntest.pgc"
|
#line 156 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 158 "dyntest.pgc"
|
#line 156 "dyntest.pgc"
|
||||||
|
|
||||||
printf("%d",INTVAR);
|
printf("%d",INTVAR);
|
||||||
break;
|
break;
|
||||||
@ -425,10 +423,10 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
||||||
ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
|
ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
|
||||||
|
|
||||||
#line 163 "dyntest.pgc"
|
#line 161 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 163 "dyntest.pgc"
|
#line 161 "dyntest.pgc"
|
||||||
|
|
||||||
printf("%f",FLOATVAR);
|
printf("%f",FLOATVAR);
|
||||||
break;
|
break;
|
||||||
@ -436,10 +434,10 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
||||||
ECPGt_double,&(DOUBLEVAR),(long)1,(long)1,sizeof(double), ECPGd_EODT);
|
ECPGt_double,&(DOUBLEVAR),(long)1,(long)1,sizeof(double), ECPGd_EODT);
|
||||||
|
|
||||||
#line 167 "dyntest.pgc"
|
#line 165 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 167 "dyntest.pgc"
|
#line 165 "dyntest.pgc"
|
||||||
|
|
||||||
printf("%f",DOUBLEVAR);
|
printf("%f",DOUBLEVAR);
|
||||||
break;
|
break;
|
||||||
@ -451,10 +449,10 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
|
||||||
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
|
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
|
||||||
|
|
||||||
#line 175 "dyntest.pgc"
|
#line 173 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 175 "dyntest.pgc"
|
#line 173 "dyntest.pgc"
|
||||||
|
|
||||||
printf("'%s'",STRINGVAR);
|
printf("'%s'",STRINGVAR);
|
||||||
break;
|
break;
|
||||||
@ -465,16 +463,16 @@ if (sqlca.sqlcode < 0) error ( );}
|
|||||||
}
|
}
|
||||||
|
|
||||||
{ ECPGdo(__LINE__, 0, 1, NULL, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
|
{ ECPGdo(__LINE__, 0, 1, NULL, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
|
||||||
#line 184 "dyntest.pgc"
|
#line 182 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );}
|
if (sqlca.sqlcode < 0) error ( );}
|
||||||
#line 184 "dyntest.pgc"
|
#line 182 "dyntest.pgc"
|
||||||
|
|
||||||
ECPGdeallocate_desc(__LINE__, "MYDESC");
|
ECPGdeallocate_desc(__LINE__, "MYDESC");
|
||||||
#line 185 "dyntest.pgc"
|
#line 183 "dyntest.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) error ( );
|
if (sqlca.sqlcode < 0) error ( );
|
||||||
#line 185 "dyntest.pgc"
|
#line 183 "dyntest.pgc"
|
||||||
|
|
||||||
|
|
||||||
/* no exec sql disconnect; */
|
/* no exec sql disconnect; */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -37,9 +37,11 @@ main(void)
|
|||||||
num = PGTYPESnumeric_from_asc(nums[i], &endptr);
|
num = PGTYPESnumeric_from_asc(nums[i], &endptr);
|
||||||
check_errno();
|
check_errno();
|
||||||
if (endptr != NULL)
|
if (endptr != NULL)
|
||||||
|
{
|
||||||
printf("endptr of %d is not NULL\n", i);
|
printf("endptr of %d is not NULL\n", i);
|
||||||
if (*endptr != '\0')
|
if (*endptr != '\0')
|
||||||
printf("*endptr of %d is not \\0\n", i);
|
printf("*endptr of %d is not \\0\n", i);
|
||||||
|
}
|
||||||
text = PGTYPESnumeric_to_asc(num, -1);
|
text = PGTYPESnumeric_to_asc(num, -1);
|
||||||
check_errno();
|
check_errno();
|
||||||
printf("num[%d,1]: %s\n", i, text); free(text);
|
printf("num[%d,1]: %s\n", i, text); free(text);
|
||||||
|
@ -62,7 +62,7 @@ int main(int argc,char **argv)
|
|||||||
:TYPE = type,
|
:TYPE = type,
|
||||||
:LENGTH = length, :OCTET_LENGTH=octet_length,
|
:LENGTH = length, :OCTET_LENGTH=octet_length,
|
||||||
:PRECISION = precision, :SCALE=scale,
|
:PRECISION = precision, :SCALE=scale,
|
||||||
/* :NULLABLE=nullable, */ :NAME=name,
|
:NAME=name,
|
||||||
:RETURNED_OCTET_LENGTH=returned_octet_length;
|
:RETURNED_OCTET_LENGTH=returned_octet_length;
|
||||||
printf("%s ",NAME);
|
printf("%s ",NAME);
|
||||||
switch (TYPE)
|
switch (TYPE)
|
||||||
@ -122,8 +122,6 @@ int main(int argc,char **argv)
|
|||||||
else printf("<SQL3 %d> ",TYPE);
|
else printf("<SQL3 %d> ",TYPE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* nullable is not yet implemented in ecpg */
|
|
||||||
/* if (!NULLABLE) printf("not null "); */
|
|
||||||
if (OCTET_LENGTH>0) printf("[%d bytes]",OCTET_LENGTH);
|
if (OCTET_LENGTH>0) printf("[%d bytes]",OCTET_LENGTH);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user