-/* $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"
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)
{
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;
}
}
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);
break;
#endif /* HAVE_STRTOULL */
-#endif /* HAVE_LONG_LONG_INT_64 */
+#endif /* HAVE_LONG_LONG */
case ECPGt_float:
case ECPGt_double:
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;
}
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;
}
/* 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
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;
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;
-/* $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.
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)
{
*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;
*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;
-/* $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
-/* $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"
#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
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;
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;
-/* $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 */
%{
#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 { \
-/* $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
| 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;
}
| 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;
| 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;
}
| SQL_LONG SQL_LONG INT_P
{
-#ifdef HAVE_LONG_LONG_INT_64
+#ifdef HAVE_LONG_LONG
$$ = ECPGt_long_long;
#else
$$ = ECPGt_long;