Fixed array pointers, no longer using void * in arithmetics.

This commit is contained in:
Michael Meskes 2002-01-08 14:25:06 +00:00
parent 055d4f9208
commit 1e15f9e119
5 changed files with 17 additions and 13 deletions

View File

@ -1188,5 +1188,9 @@ Sun Dec 23 13:08:36 CET 2001
Mon Jan 7 12:18:01 CET 2002 Mon Jan 7 12:18:01 CET 2002
- Fixed parser to accept initializing expressions starting with "(". - Fixed parser to accept initializing expressions starting with "(".
Tue Jan 8 15:16:37 CET 2002
- Fixed array pointers, no longer using void *.
- Set ecpg version to 2.9.0. - Set ecpg version to 2.9.0.
- Set library version to 3.3.0. - Set library version to 3.3.0.

View File

@ -1,4 +1,4 @@
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.21 2001/12/23 12:17:41 meskes Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.22 2002/01/08 14:25:04 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
@ -14,7 +14,7 @@
bool bool
ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
enum ECPGttype type, enum ECPGttype ind_type, enum ECPGttype type, enum ECPGttype ind_type,
void *var, void *ind, long varcharsize, long offset, char *var, char *ind, long varcharsize, long offset,
long ind_offset, bool isarray) long ind_offset, bool isarray)
{ {
char *pval = (char *) PQgetvalue(results, act_tuple, act_field); char *pval = (char *) PQgetvalue(results, act_tuple, act_field);

View File

@ -1,4 +1,4 @@
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.34 2001/12/23 12:17:41 meskes Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.35 2002/01/08 14:25:04 meskes Exp $ */
/* /*
* The aim is to get a simpler inteface to the database routines. * The aim is to get a simpler inteface to the database routines.
@ -142,7 +142,7 @@ create_statement(int lineno, struct connection * connection, struct statement **
return false; return false;
var->type = type; var->type = type;
var->pointer = va_arg(ap, void *); var->pointer = va_arg(ap, char *);
/* if variable is NULL, the statement hasn't been prepared */ /* if variable is NULL, the statement hasn't been prepared */
if (var->pointer == NULL) if (var->pointer == NULL)
@ -157,12 +157,12 @@ create_statement(int lineno, struct connection * connection, struct statement **
var->offset = va_arg(ap, long); var->offset = va_arg(ap, long);
if (var->arrsize == 0 || var->varcharsize == 0) if (var->arrsize == 0 || var->varcharsize == 0)
var->value = *((void **) (var->pointer)); var->value = *((char **) (var->pointer));
else else
var->value = var->pointer; var->value = var->pointer;
var->ind_type = va_arg(ap, enum ECPGttype); var->ind_type = va_arg(ap, enum ECPGttype);
var->ind_pointer = va_arg(ap, void *); var->ind_pointer = va_arg(ap, char *);
var->ind_varcharsize = va_arg(ap, long); var->ind_varcharsize = va_arg(ap, long);
var->ind_arrsize = va_arg(ap, long); var->ind_arrsize = va_arg(ap, long);
var->ind_offset = va_arg(ap, long); var->ind_offset = va_arg(ap, long);
@ -170,7 +170,7 @@ create_statement(int lineno, struct connection * connection, struct statement **
if (var->ind_type != ECPGt_NO_INDICATOR if (var->ind_type != ECPGt_NO_INDICATOR
&& (var->ind_arrsize == 0 || var->ind_varcharsize == 0)) && (var->ind_arrsize == 0 || var->ind_varcharsize == 0))
var->ind_value = *((void **) (var->ind_pointer)); var->ind_value = *((char **) (var->ind_pointer));
else else
var->ind_value = var->ind_pointer; var->ind_value = var->ind_pointer;
@ -422,8 +422,8 @@ ECPGstore_result(const PGresult *results, int act_field,
len = var->offset * ntuples; len = var->offset * ntuples;
break; break;
} }
var->value = (void *) ECPGalloc(len, stmt->lineno); var->value = (char *) ECPGalloc(len, stmt->lineno);
*((void **) var->pointer) = var->value; *((char **) var->pointer) = var->value;
ECPGadd_mem(var->value, stmt->lineno); ECPGadd_mem(var->value, stmt->lineno);
} }
@ -431,8 +431,8 @@ ECPGstore_result(const PGresult *results, int act_field,
if ((var->ind_arrsize == 0 || var->ind_varcharsize == 0) && var->ind_value == NULL && var->ind_pointer!=NULL) if ((var->ind_arrsize == 0 || var->ind_varcharsize == 0) && var->ind_value == NULL && var->ind_pointer!=NULL)
{ {
int len = var->ind_offset * ntuples; int len = var->ind_offset * ntuples;
var->ind_value = (void *) ECPGalloc(len, stmt->lineno); var->ind_value = (char *) ECPGalloc(len, stmt->lineno);
*((void **) var->ind_pointer) = var->ind_value; *((char **) var->ind_pointer) = var->ind_value;
ECPGadd_mem(var->ind_value, stmt->lineno); ECPGadd_mem(var->ind_value, stmt->lineno);
} }

View File

@ -6,7 +6,7 @@
void ECPGadd_mem(void *ptr, int lineno); void ECPGadd_mem(void *ptr, int lineno);
bool ECPGget_data(const PGresult *, int, int, int, enum ECPGttype type, bool ECPGget_data(const PGresult *, int, int, int, enum ECPGttype type,
enum ECPGttype, void *, void *, long, long, long, bool); enum ECPGttype, char *, char *, long, long, long, bool);
struct connection *ECPGget_connection(const char *); struct connection *ECPGget_connection(const char *);
void ECPGinit_sqlca(void); void ECPGinit_sqlca(void);
char *ECPGalloc(long, int); char *ECPGalloc(long, int);

View File

@ -183,7 +183,7 @@ get_type(enum ECPGttype type)
/* Dump a type. /* Dump a type.
The type is dumped as: The type is dumped as:
type-tag <comma> - enum ECPGttype type-tag <comma> - enum ECPGttype
reference-to-variable <comma> - void * reference-to-variable <comma> - char *
size <comma> - long size of this field (if varchar) size <comma> - long size of this field (if varchar)
arrsize <comma> - long number of elements in the arr arrsize <comma> - long number of elements in the arr
offset <comma> - offset to the next element offset <comma> - offset to the next element