mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Fixed fetch into char * and added missing prototype for an Informix function.
This commit is contained in:
parent
4d9eede82f
commit
8902aaaa6c
src/interfaces/ecpg
@ -1496,6 +1496,11 @@ Sun Jun 15 11:18:58 CEST 2003
|
||||
Tue Jun 17 08:45:14 CEST 2003
|
||||
|
||||
- Fixed several parsing bugs.
|
||||
|
||||
Thu Jun 19 10:08:26 CEST 2003
|
||||
|
||||
- Added missing rdayofweek function for Informix compatibility.
|
||||
- Fixed fetch into char pointer.
|
||||
- Set ecpg version to 3.0.0
|
||||
- Set ecpg library to 4.0.0
|
||||
- Set pgtypes library to 1.0.0
|
||||
|
@ -343,6 +343,12 @@ rmdyjul (short mdy[3], Date *d)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rdayofweek(Date d)
|
||||
{
|
||||
return(PGTYPESdate_dayofweek(d));
|
||||
}
|
||||
|
||||
/* And the datetime stuff */
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.5 2003/06/15 04:07:58 momjian Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.6 2003/06/19 09:52:11 meskes Exp $ */
|
||||
|
||||
#define POSTGRES_ECPG_INTERNAL
|
||||
#include "postgres_fe.h"
|
||||
@ -100,11 +100,11 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
switch (type)
|
||||
{
|
||||
long res;
|
||||
unsigned long ures;
|
||||
unsigned long ures;
|
||||
double dres;
|
||||
char *scan_length;
|
||||
Numeric *nres;
|
||||
Date ddres;
|
||||
char *scan_length;
|
||||
Numeric *nres;
|
||||
Date ddres;
|
||||
Timestamp tres;
|
||||
Interval *ires;
|
||||
|
||||
@ -300,37 +300,45 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
case ECPGt_char:
|
||||
case ECPGt_unsigned_char:
|
||||
{
|
||||
strncpy((char *) ((long) var + offset * act_tuple), pval, varcharsize);
|
||||
if (varcharsize && varcharsize < strlen(pval))
|
||||
if (varcharsize == 0)
|
||||
{
|
||||
/* truncation */
|
||||
switch (ind_type)
|
||||
strncpy((char *) ((long) var + offset * act_tuple), pval, strlen(pval));
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy((char *) ((long) var + offset * act_tuple), pval, varcharsize);
|
||||
|
||||
if (varcharsize < strlen(pval))
|
||||
{
|
||||
case ECPGt_short:
|
||||
case ECPGt_unsigned_short:
|
||||
/* ((short *) ind)[act_tuple] = strlen(pval);*/
|
||||
*((short *) (ind + ind_offset * act_tuple)) = strlen(pval);
|
||||
break;
|
||||
case ECPGt_int:
|
||||
case ECPGt_unsigned_int:
|
||||
/* ((int *) ind)[act_tuple] = strlen(pval);*/
|
||||
*((int *) (ind + ind_offset * act_tuple)) = strlen(pval);
|
||||
break;
|
||||
case ECPGt_long:
|
||||
case ECPGt_unsigned_long:
|
||||
/* ((long *) ind)[act_tuple] = strlen(pval);*/
|
||||
*((long *) (ind + ind_offset * act_tuple)) = strlen(pval);
|
||||
break;
|
||||
/* truncation */
|
||||
switch (ind_type)
|
||||
{
|
||||
case ECPGt_short:
|
||||
case ECPGt_unsigned_short:
|
||||
/* ((short *) ind)[act_tuple] = strlen(pval);*/
|
||||
*((short *) (ind + ind_offset * act_tuple)) = strlen(pval);
|
||||
break;
|
||||
case ECPGt_int:
|
||||
case ECPGt_unsigned_int:
|
||||
/* ((int *) ind)[act_tuple] = strlen(pval);*/
|
||||
*((int *) (ind + ind_offset * act_tuple)) = strlen(pval);
|
||||
break;
|
||||
case ECPGt_long:
|
||||
case ECPGt_unsigned_long:
|
||||
/* ((long *) ind)[act_tuple] = strlen(pval);*/
|
||||
*((long *) (ind + ind_offset * act_tuple)) = strlen(pval);
|
||||
break;
|
||||
#ifdef HAVE_LONG_LONG_INT_64
|
||||
case ECPGt_long_long:
|
||||
case ECPGt_unsigned_long_long:
|
||||
*((long long int *) (ind + ind_offset * act_tuple)) = strlen(pval);
|
||||
break;
|
||||
case ECPGt_long_long:
|
||||
case ECPGt_unsigned_long_long:
|
||||
*((long long int *) (ind + ind_offset * act_tuple)) = strlen(pval);
|
||||
break;
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sqlca->sqlwarn[0] = sqlca->sqlwarn[1] = 'W';
|
||||
}
|
||||
sqlca->sqlwarn[0] = sqlca->sqlwarn[1] = 'W';
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -342,42 +350,46 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
|
||||
variable->len = strlen(pval);
|
||||
if (varcharsize == 0)
|
||||
{
|
||||
strncpy(variable->arr, pval, variable->len);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(variable->arr, pval, varcharsize);
|
||||
|
||||
if (varcharsize > 0 && variable->len > varcharsize)
|
||||
{
|
||||
/* truncation */
|
||||
switch (ind_type)
|
||||
if (variable->len > varcharsize)
|
||||
{
|
||||
case ECPGt_short:
|
||||
case ECPGt_unsigned_short:
|
||||
/* ((short *) ind)[act_tuple] = variable->len;*/
|
||||
*((short *) (ind + offset * act_tuple)) = variable->len;
|
||||
break;
|
||||
case ECPGt_int:
|
||||
case ECPGt_unsigned_int:
|
||||
/* ((int *) ind)[act_tuple] = variable->len;*/
|
||||
*((int *) (ind + offset * act_tuple)) = variable->len;
|
||||
break;
|
||||
case ECPGt_long:
|
||||
case ECPGt_unsigned_long:
|
||||
/* ((long *) ind)[act_tuple] = variable->len;*/
|
||||
*((long *) (ind + offset * act_tuple)) = variable->len;
|
||||
break;
|
||||
/* truncation */
|
||||
switch (ind_type)
|
||||
{
|
||||
case ECPGt_short:
|
||||
case ECPGt_unsigned_short:
|
||||
/* ((short *) ind)[act_tuple] = variable->len;*/
|
||||
*((short *) (ind + offset * act_tuple)) = variable->len;
|
||||
break;
|
||||
case ECPGt_int:
|
||||
case ECPGt_unsigned_int:
|
||||
/* ((int *) ind)[act_tuple] = variable->len;*/
|
||||
*((int *) (ind + offset * act_tuple)) = variable->len;
|
||||
break;
|
||||
case ECPGt_long:
|
||||
case ECPGt_unsigned_long:
|
||||
/* ((long *) ind)[act_tuple] = variable->len;*/
|
||||
*((long *) (ind + offset * act_tuple)) = variable->len;
|
||||
break;
|
||||
#ifdef HAVE_LONG_LONG_INT_64
|
||||
case ECPGt_long_long:
|
||||
case ECPGt_unsigned_long_long:
|
||||
*((long long int *) (ind + ind_offset * act_tuple)) = variable->len;
|
||||
break;
|
||||
case ECPGt_long_long:
|
||||
case ECPGt_unsigned_long_long:
|
||||
*((long long int *) (ind + ind_offset * act_tuple)) = variable->len;
|
||||
break;
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sqlca->sqlwarn[0] = sqlca->sqlwarn[1] = 'W';
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sqlca->sqlwarn[0] = sqlca->sqlwarn[1] = 'W';
|
||||
|
||||
variable->len = varcharsize;
|
||||
variable->len = varcharsize;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.7 2003/05/10 02:05:50 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.8 2003/06/19 09:52:11 meskes Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -16,7 +16,7 @@ NAME= pgtypes
|
||||
SO_MAJOR_VERSION= 1
|
||||
SO_MINOR_VERSION= 0.0
|
||||
|
||||
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
|
||||
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(top_srcdir)/src/include/utils $(CPPFLAGS) -g
|
||||
|
||||
OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \
|
||||
$(filter rint.o, $(LIBOBJS))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.233 2003/06/17 07:28:22 meskes Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.234 2003/06/19 09:52:11 meskes Exp $ */
|
||||
|
||||
/* Copyright comment */
|
||||
%{
|
||||
@ -5048,30 +5048,6 @@ variable: opt_pointer ECPGColLabelCommon opt_array_bounds opt_initializer
|
||||
$$ = cat_str(4, $1, mm_strdup($2), $3.str, $4);
|
||||
break;
|
||||
|
||||
/*case ECPGt_numeric:
|
||||
if (atoi(dimension) < 0)
|
||||
type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length);
|
||||
else
|
||||
type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length), dimension);
|
||||
|
||||
if (atoi(dimension) < 0)
|
||||
$$ = cat_str(4, mm_strdup(actual_storage[struct_level]), make_str("Numeric"), mm_strdup($2), $4);
|
||||
else
|
||||
$$ = cat_str(5, mm_strdup(actual_storage[struct_level]), make_str("Numeric"), mm_strdup($2), mm_strdup(dim), $4);
|
||||
break;
|
||||
|
||||
case ECPGt_interval:
|
||||
if (atoi(dimension) < 0)
|
||||
type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length);
|
||||
else
|
||||
type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length), dimension);
|
||||
|
||||
if (atoi(dimension) < 0)
|
||||
$$ = cat_str(4, mm_strdup(actual_storage[struct_level]), make_str("Interval"), mm_strdup($2), $4);
|
||||
else
|
||||
$$ = cat_str(5, mm_strdup(actual_storage[struct_level]), make_str("Interval"), mm_strdup($2), mm_strdup(dim), $4);
|
||||
break;*/
|
||||
|
||||
default:
|
||||
if (atoi(dimension) < 0)
|
||||
type = ECPGmake_simple_type(actual_type[struct_level].type_enum, make_str("1"));
|
||||
|
Loading…
Reference in New Issue
Block a user