]> granicus.if.org Git - postgresql/commitdiff
Ecpg now accepts "long long" datatypes even if "long" is 64bit wide. This used to...
authorMichael Meskes <meskes@postgresql.org>
Thu, 20 May 2010 22:10:46 +0000 (22:10 +0000)
committerMichael Meskes <meskes@postgresql.org>
Thu, 20 May 2010 22:10:46 +0000 (22:10 +0000)
src/interfaces/ecpg/ecpglib/data.c
src/interfaces/ecpg/ecpglib/descriptor.c
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/extern.h
src/interfaces/ecpg/ecpglib/misc.c
src/interfaces/ecpg/preproc/ecpg.header
src/interfaces/ecpg/preproc/ecpg.trailer

index 5035dbd705326f7ef4551384c39d23fc3a7c7f41..6088c66aa522f32ca59b8079ba13f76052815262 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.51 2010/02/27 21:53:21 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.52 2010/05/20 22:10:45 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -177,12 +177,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                case ECPGt_unsigned_long:
                        *((long *) (ind + ind_offset * act_tuple)) = value_for_indicator;
                        break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                case ECPGt_long_long:
                case ECPGt_unsigned_long_long:
                        *((long long int *) (ind + ind_offset * act_tuple)) = value_for_indicator;
                        break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                case ECPGt_NO_INDICATOR:
                        if (value_for_indicator == -1)
                        {
@@ -265,12 +265,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                case ECPGt_unsigned_long:
                                                        *((long *) (ind + ind_offset * act_tuple)) = size;
                                                        break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                                                case ECPGt_long_long:
                                                case ECPGt_unsigned_long_long:
                                                        *((long long int *) (ind + ind_offset * act_tuple)) = size;
                                                        break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                                                default:
                                                        break;
                                        }
@@ -350,7 +350,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                        }
                                        break;
 
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
 #ifdef HAVE_STRTOLL
                                case ECPGt_long_long:
                                        *((long long int *) (var + offset * act_tuple)) = strtoll(pval, &scan_length, 10);
@@ -376,7 +376,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
 
                                        break;
 #endif   /* HAVE_STRTOULL */
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
 
                                case ECPGt_float:
                                case ECPGt_double:
@@ -489,12 +489,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                                        case ECPGt_unsigned_long:
                                                                                *((long *) (ind + ind_offset * act_tuple)) = size;
                                                                                break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                                                                        case ECPGt_long_long:
                                                                        case ECPGt_unsigned_long_long:
                                                                                *((long long int *) (ind + ind_offset * act_tuple)) = size;
                                                                                break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                                                                        default:
                                                                                break;
                                                                }
@@ -534,12 +534,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                                        case ECPGt_unsigned_long:
                                                                                *((long *) (ind + offset * act_tuple)) = variable->len;
                                                                                break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                                                                        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 */
+#endif   /* HAVE_LONG_LONG */
                                                                        default:
                                                                                break;
                                                                }
index 21dbe0ce08e804d28fdc174e69314ccf57ffa9e3..b2edc2850b30238d89cdbfa92ed19062d558b797 100644 (file)
@@ -1,6 +1,6 @@
 /* dynamic SQL support routines
  *
- * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.36 2010/02/26 02:01:30 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.37 2010/05/20 22:10:45 meskes Exp $
  */
 
 #define POSTGRES_ECPG_INTERNAL
@@ -127,14 +127,14 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value)
                case ECPGt_unsigned_long:
                        *(unsigned long *) var = (unsigned long) value;
                        break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                case ECPGt_long_long:
                        *(long long int *) var = (long long int) value;
                        break;
                case ECPGt_unsigned_long_long:
                        *(unsigned long long int *) var = (unsigned long long int) value;
                        break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                case ECPGt_float:
                        *(float *) var = (float) value;
                        break;
@@ -172,14 +172,14 @@ set_int_item(int lineno, int *target, const void *var, enum ECPGttype vartype)
                case ECPGt_unsigned_long:
                        *target = *(unsigned long *) var;
                        break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                case ECPGt_long_long:
                        *target = *(long long int *) var;
                        break;
                case ECPGt_unsigned_long_long:
                        *target = *(unsigned long long int *) var;
                        break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                case ECPGt_float:
                        *target = *(float *) var;
                        break;
index 8ae102b44936c16c97d353bd69d2982c066e530c..60b7c75f0ec37b7123b93cb8dea53e71760e488e 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.95 2010/02/26 02:01:30 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.96 2010/05/20 22:10:45 meskes Exp $ */
 
 /*
  * The aim is to get a simpler inteface to the database routines.
@@ -541,13 +541,13 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
                        if (*(long *) var->ind_value < 0L)
                                *tobeinserted_p = NULL;
                        break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                case ECPGt_long_long:
                case ECPGt_unsigned_long_long:
                        if (*(long long int *) var->ind_value < (long long) 0)
                                *tobeinserted_p = NULL;
                        break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                case ECPGt_NO_INDICATOR:
                        if (force_indicator == false)
                        {
@@ -679,7 +679,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
 
                                *tobeinserted_p = mallocedval;
                                break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                        case ECPGt_long_long:
                                if (!(mallocedval = ecpg_alloc(asize * 30, lineno)))
                                        return false;
@@ -717,7 +717,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
 
                                *tobeinserted_p = mallocedval;
                                break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                        case ECPGt_float:
                                if (!(mallocedval = ecpg_alloc(asize * 25, lineno)))
                                        return false;
index 7a5259f793b70e979b2eef2a07d54410ab9e08b8..d42e9295951d3b0d86a60c6792a6bcad07490c2c 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.39 2010/02/26 02:01:30 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.40 2010/05/20 22:10:45 meskes Exp $ */
 
 #ifndef _ECPG_LIB_EXTERN_H
 #define _ECPG_LIB_EXTERN_H
 #include <limits.h>
 #endif
 
+/* Do we know the C99 data type "long long"? */
+#if defined(LLONG_MIN) || defined(LONGLONG_MIN) || defined(HAVE_LONG_LONG_INT_64)
+#define HAVE_LONG_LONG 1
+#endif
+
 enum COMPAT_MODE
 {
        ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE
index 9fade9ea3c2034c6400a8bf605a23660c897199a..92cbad9a188396ea61f7a8696cd6de3d0a722ea3 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.56 2010/02/26 02:01:30 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.57 2010/05/20 22:10:46 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -17,7 +17,7 @@
 #include "pgtypes_interval.h"
 #include "pg_config_paths.h"
 
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
 #ifndef LONG_LONG_MIN
 #ifdef LLONG_MIN
 #define LONG_LONG_MIN LLONG_MIN
@@ -327,12 +327,12 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr)
                case ECPGt_date:
                        *((long *) ptr) = LONG_MIN;
                        break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                case ECPGt_long_long:
                case ECPGt_unsigned_long_long:
                        *((long long *) ptr) = LONG_LONG_MIN;
                        break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                case ECPGt_float:
                        memset((char *) ptr, 0xff, sizeof(float));
                        break;
@@ -399,13 +399,13 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr)
                        if (*((long *) ptr) == LONG_MIN)
                                return true;
                        break;
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                case ECPGt_long_long:
                case ECPGt_unsigned_long_long:
                        if (*((long long *) ptr) == LONG_LONG_MIN)
                                return true;
                        break;
-#endif   /* HAVE_LONG_LONG_INT_64 */
+#endif   /* HAVE_LONG_LONG */
                case ECPGt_float:
                        return (_check(ptr, sizeof(float)));
                        break;
index 6b05776ee583141e51c576fcdf683c8a639fb943..848a3a23dc9ea1d447ac57756dc7e8f651fb2d71 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.14 2010/03/09 11:09:45 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.15 2010/05/20 22:10:46 meskes Exp $ */
 
 /* Copyright comment */
 %{
@@ -7,6 +7,11 @@
 #include "extern.h"
 #include <unistd.h>
 
+/* Do we know the C99 datatype "long long"? */
+#if defined(LLONG_MIN) || defined(LONGLONG_MIN) || defined(HAVE_LONG_LONG_INT_64)
+#define HAVE_LONG_LONG 1
+#endif
+
 /* Location tracking support --- simpler than bison's default */
 #define YYLLOC_DEFAULT(Current, Rhs, N) \
        do { \
index d5e16afab60a28d83df01173f5e224cf763071bd..1d854d4bbc06b713f0c96b9d5673c6c71d80dc7e 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.24 2010/03/31 08:45:18 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.25 2010/05/20 22:10:46 meskes Exp $ */
 
 statements: /*EMPTY*/
                 | statements statement
@@ -781,7 +781,7 @@ unsigned_type: SQL_UNSIGNED SQL_SHORT               { $$ = ECPGt_unsigned_short; }
                | SQL_UNSIGNED SQL_LONG INT_P           { $$ = ECPGt_unsigned_long; }
                | SQL_UNSIGNED SQL_LONG SQL_LONG
                {
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                        $$ = ECPGt_unsigned_long_long;
 #else
                        $$ = ECPGt_unsigned_long;
@@ -789,7 +789,7 @@ unsigned_type: SQL_UNSIGNED SQL_SHORT               { $$ = ECPGt_unsigned_short; }
                }
                | SQL_UNSIGNED SQL_LONG SQL_LONG INT_P
                {
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                        $$ = ECPGt_unsigned_long_long;
 #else
                        $$ = ECPGt_unsigned_long;
@@ -805,7 +805,7 @@ signed_type: SQL_SHORT                              { $$ = ECPGt_short; }
                | SQL_LONG INT_P                        { $$ = ECPGt_long; }
                | SQL_LONG SQL_LONG
                {
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                        $$ = ECPGt_long_long;
 #else
                        $$ = ECPGt_long;
@@ -813,7 +813,7 @@ signed_type: SQL_SHORT                              { $$ = ECPGt_short; }
                }
                | SQL_LONG SQL_LONG INT_P
                {
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
                        $$ = ECPGt_long_long;
 #else
                        $$ = ECPGt_long;