diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/config.h.in | 21 | ||||
-rw-r--r-- | src/interfaces/ecpg/lib/data.c | 15 | ||||
-rw-r--r-- | src/interfaces/ecpg/lib/descriptor.c | 4 | ||||
-rw-r--r-- | src/interfaces/ecpg/lib/execute.c | 10 | ||||
-rw-r--r-- | src/interfaces/ecpg/lib/typename.c | 4 |
5 files changed, 46 insertions, 8 deletions
diff --git a/src/include/config.h.in b/src/include/config.h.in index b066daed7bd..4e36b9099a8 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -8,7 +8,7 @@ * or in config.h afterwards. Of course, if you edit config.h, then your * changes will be overwritten the next time you run configure. * - * $Id: config.h.in,v 1.147 2000/11/06 22:18:10 petere Exp $ + * $Id: config.h.in,v 1.148 2000/11/20 15:56:13 petere Exp $ */ #ifndef CONFIG_H @@ -601,12 +601,29 @@ extern void srandom(unsigned int seed); /* Define if C++ compiler accepts "#include <string>" */ #undef HAVE_CXX_STRING_HEADER -/* Define if a system lib (-ldl) has dlopen() (needed for AIX) */ +/* Define if you have the dlopen function */ #undef HAVE_DLOPEN /* Define if you have the optreset variable */ #undef HAVE_INT_OPTRESET +#undef HAVE_STRTOLL +#undef HAVE_STRTOQ + +#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ) +# define strtoll strtoq +# define HAVE_STRTOLL 1 +#endif + +#undef HAVE_STRTOULL +#undef HAVE_STRTOUQ + +#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ) +# define strtoull strtouq +# define HAVE_STRTOULL 1 +#endif + + /* *------------------------------------------------------------------------ * Part 4: pull in system-specific declarations. diff --git a/src/interfaces/ecpg/lib/data.c b/src/interfaces/ecpg/lib/data.c index 1c85de03505..fdaa583aa40 100644 --- a/src/interfaces/ecpg/lib/data.c +++ b/src/interfaces/ecpg/lib/data.c @@ -1,3 +1,5 @@ +#include "config.h" + #include <stdlib.h> #include <string.h> @@ -60,12 +62,14 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, case ECPGt_unsigned_long: ((long *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field); break; +#ifdef HAVE_LONG_LONG_INT_64 case ECPGt_long_long: ((long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field); break; case ECPGt_unsigned_long_long: ((unsigned long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field); - break; + break; +#endif /* HAVE_LONG_LONG_INT_64 */ case ECPGt_NO_INDICATOR: if (PQgetisnull(results, act_tuple, act_field)) { @@ -154,10 +158,12 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, } break; +#ifdef HAVE_LONG_LONG_INT_64 +# ifdef HAVE_STRTOLL case ECPGt_long_long: if (pval) { - ((long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10); + ((long long int *) var)[act_tuple] = strtoll(pval, &scan_length, 10); if ((isarray && *scan_length != ',' && *scan_length != '}') || (!isarray && *scan_length != '\0')) /* Garbage left */ { @@ -169,7 +175,8 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, ((long long int *) var)[act_tuple] = 0LL; break; - +# endif /* HAVE_STRTOLL */ +# ifdef HAVE_STRTOULL case ECPGt_unsigned_long_long: if (pval) { @@ -185,6 +192,8 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, ((unsigned long long int *) var)[act_tuple] = 0LL; break; +# endif /* HAVE_STRTOULL */ +#endif /* HAVE_LONG_LONG_INT_64 */ case ECPGt_float: case ECPGt_double: diff --git a/src/interfaces/ecpg/lib/descriptor.c b/src/interfaces/ecpg/lib/descriptor.c index 81d336deabe..5cdf8dc1f38 100644 --- a/src/interfaces/ecpg/lib/descriptor.c +++ b/src/interfaces/ecpg/lib/descriptor.c @@ -1,3 +1,5 @@ +#include "config.h" + #include "ecpgtype.h" #include "ecpglib.h" #include "ecpgerrno.h" @@ -81,12 +83,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 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 */ case ECPGt_float: *(float *) var = (float) value; break; diff --git a/src/interfaces/ecpg/lib/execute.c b/src/interfaces/ecpg/lib/execute.c index f1d11105f07..9daa97a087f 100644 --- a/src/interfaces/ecpg/lib/execute.c +++ b/src/interfaces/ecpg/lib/execute.c @@ -12,6 +12,8 @@ /* Taken over as part of PostgreSQL by Michael Meskes <meskes@postgresql.org> on Feb. 5th, 1998 */ +#include "config.h" + #include <stdio.h> #include <locale.h> @@ -414,11 +416,13 @@ ECPGexecute(struct statement * stmt) if (*(long *) var->ind_value < 0L) strcpy(buff, "null"); break; +#ifdef HAVE_LONG_LONG_INT_64 case ECPGt_long_long: case ECPGt_unsigned_long_long: if (*(long long int*) var->ind_value < 0LL) strcpy(buff, "null"); break; +#endif /* HAVE_LONG_LONG_INT_64 */ default: break; } @@ -542,7 +546,7 @@ ECPGexecute(struct statement * stmt) tobeinserted = mallocedval; break; - +#ifdef HAVE_LONG_LONG_INT_64 case ECPGt_long_long: if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno))) return false; @@ -580,7 +584,7 @@ ECPGexecute(struct statement * stmt) tobeinserted = mallocedval; break; - +#endif /* HAVE_LONG_LONG_INT_64 */ case ECPGt_float: if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno))) return false; @@ -1003,7 +1007,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...) * * Copyright (c) 2000, Christof Petig <christof.petig@wtal.de> * - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.13 2000/10/29 09:44:58 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.14 2000/11/20 15:56:14 petere Exp $ */ PGconn *ECPG_internal_get_connection(char *name); diff --git a/src/interfaces/ecpg/lib/typename.c b/src/interfaces/ecpg/lib/typename.c index a638c7d7666..710354ffe29 100644 --- a/src/interfaces/ecpg/lib/typename.c +++ b/src/interfaces/ecpg/lib/typename.c @@ -1,3 +1,5 @@ +#include "config.h" + #include <stdlib.h> #include "ecpgtype.h" #include "ecpglib.h" @@ -29,10 +31,12 @@ ECPGtype_name(enum ECPGttype typ) return "long"; case ECPGt_unsigned_long: return "unsigned long"; +#ifdef HAVE_LONG_LONG_INT_64 case ECPGt_long_long: return "long long"; case ECPGt_unsigned_long_long: return "unsigned long long"; +#endif /* HAVE_LONG_LONG_INT_64 */ case ECPGt_float: return "float"; case ECPGt_double: |