1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-22 12:22:45 +03:00

*** empty log message ***

This commit is contained in:
Michael Meskes
2000-09-19 11:47:16 +00:00
parent a5a290cab9
commit e9c3f0255f
16 changed files with 585 additions and 334 deletions

View File

@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.8 2000/09/17 13:02:46 petere Exp $
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.9 2000/09/19 11:47:13 meskes Exp $
#
#-------------------------------------------------------------------------
@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
NAME= ecpg
SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 1.1
SO_MINOR_VERSION= 2.0
CPPFLAGS += -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir)

View File

@@ -60,6 +60,12 @@ 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;
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;
case ECPGt_NO_INDICATOR:
if (PQgetisnull(results, act_tuple, act_field))
{
@@ -93,7 +99,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
{
ECPGraise(lineno, ECPG_INT_FORMAT, pval);
return (false);
res = 0L;
}
}
else
@@ -127,7 +132,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
{
ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
return (false);
ures = 0L;
}
}
else
@@ -150,7 +154,38 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
}
break;
case ECPGt_long_long:
if (pval)
{
((long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);
if ((isarray && *scan_length != ',' && *scan_length != '}')
|| (!isarray && *scan_length != '\0')) /* Garbage left */
{
ECPGraise(lineno, ECPG_INT_FORMAT, pval);
return (false);
}
}
else
((long long int *) var)[act_tuple] = 0LL;
break;
case ECPGt_unsigned_long_long:
if (pval)
{
((unsigned long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);
if ((isarray && *scan_length != ',' && *scan_length != '}')
|| (!isarray && *scan_length != '\0')) /* Garbage left */
{
ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
return (false);
}
}
else
((unsigned long long int *) var)[act_tuple] = 0LL;
break;
case ECPGt_float:
case ECPGt_double:
if (pval)

View File

@@ -63,29 +63,35 @@ get_int_item(int lineno, void *var, enum ECPGdtype vartype, int value)
{
switch (vartype)
{
case ECPGt_short:
*(short *) var = value;
case ECPGt_short:
*(short *) var = (short) value;
break;
case ECPGt_int:
*(int *) var = value;
*(int *) var = (int) value;
break;
case ECPGt_long:
*(long *) var = value;
*(long *) var = (long) value;
break;
case ECPGt_unsigned_short:
*(unsigned short *) var = value;
*(unsigned short *) var = (unsigned short) value;
break;
case ECPGt_unsigned_int:
*(unsigned int *) var = value;
*(unsigned int *) var = (unsigned int) value;
break;
case ECPGt_unsigned_long:
*(unsigned long *) var = value;
*(unsigned long *) var = (unsigned long) value;
break;
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;
case ECPGt_float:
*(float *) var = value;
*(float *) var = (float) value;
break;
case ECPGt_double:
*(double *) var = value;
*(double *) var = (double) value;
break;
default:
ECPGraise(lineno, ECPG_VAR_NOT_NUMERIC, NULL);

View File

@@ -305,6 +305,11 @@ ECPGexecute(struct statement * stmt)
if (*(long *) var->ind_value < 0L)
strcpy(buff, "null");
break;
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
if (*(long long int*) var->ind_value < 0LL)
strcpy(buff, "null");
break;
default:
break;
}
@@ -428,6 +433,44 @@ ECPGexecute(struct statement * stmt)
tobeinserted = mallocedval;
break;
case ECPGt_long_long:
if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
return false;
if (var->arrsize > 1)
{
strncpy(mallocedval, "'{", sizeof("'{"));
for (element = 0; element < var->arrsize; element++)
sprintf(mallocedval + strlen(mallocedval), "%lld,", ((long long *) var->value)[element]);
strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
}
else
sprintf(mallocedval, "%lld", *((long long *) var->value));
tobeinserted = mallocedval;
break;
case ECPGt_unsigned_long_long:
if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
return false;
if (var->arrsize > 1)
{
strncpy(mallocedval, "'{", sizeof("'{"));
for (element = 0; element < var->arrsize; element++)
sprintf(mallocedval + strlen(mallocedval), "%llu,", ((unsigned long long *) var->value)[element]);
strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
}
else
sprintf(mallocedval, "%llu", *((unsigned long long*) var->value));
tobeinserted = mallocedval;
break;
case ECPGt_float:
if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
@@ -868,7 +911,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.7 2000/05/29 21:25:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.8 2000/09/19 11:47:13 meskes Exp $
*/
PGconn *ECPG_internal_get_connection(char *name);

View File

@@ -28,6 +28,10 @@ ECPGtype_name(enum ECPGttype typ)
return "long";
case ECPGt_unsigned_long:
return "unsigned long";
case ECPGt_long_long:
return "long long";
case ECPGt_unsigned_long_long:
return "unsigned long long";
case ECPGt_float:
return "float";
case ECPGt_double: