]> granicus.if.org Git - postgresql/commitdiff
Fixed fetch into char * and added missing prototype for an Informix function.
authorMichael Meskes <meskes@postgresql.org>
Thu, 19 Jun 2003 09:52:11 +0000 (09:52 +0000)
committerMichael Meskes <meskes@postgresql.org>
Thu, 19 Jun 2003 09:52:11 +0000 (09:52 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/compatlib/informix.c
src/interfaces/ecpg/ecpglib/data.c
src/interfaces/ecpg/pgtypeslib/Makefile
src/interfaces/ecpg/preproc/preproc.y

index f6ae819dd4b5083fab08a70d9e33cc669fc9e5f0..a50d7affd432283370e0c607478085bfd8fb6ad1 100644 (file)
@@ -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
index 3729fe3dd1c85341c1b10c25ee7ed91b781711a9..5e3e94b416f1844d19f6691cad5f13a5e60e04b1 100644 (file)
@@ -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
index 8105f3a6cf379931468a695fdd68090789f3f0fb..97c0172f91467d69bbb1cd6371948672d3b7fe75 100644 (file)
@@ -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)
+                                       {
+                                               strncpy((char *) ((long) var + offset * act_tuple), pval, strlen(pval));
+                                       }
+                                       else
                                        {
-                                               /* truncation */
-                                               switch (ind_type)
+                                               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;
index 33deef223b8093bdf00b07402c92afc04aecdd57..168b13d6b1b8c6b4785969eab85efc3e1c9a783c 100644 (file)
@@ -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))
index d96b6500cfd18eb2f20cf24ef6c8b754920a7431..d096dd220ba39e9ff4f6992f1e7f16fa11f10420 100644 (file)
@@ -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"));