- Fixed bug that reversed string length in typedefs.
- Added portability file to pgtypeslib.
variables.
- Synced parser again.
- Synced lexer.
+
+Fri May 7 15:34:05 CEST 2004
+
+ - Added portability file to pgtypeslib.
+ - Fixed bug that reversed string length in typedefs.
+ - Added additional test case.
- Set pgtypes library version to 1.2.
- Set ecpg version to 3.2.0.
- Set compat library version to 1.2.
#
# Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.18 2004/04/30 04:14:06 momjian Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.19 2004/05/07 13:42:48 meskes Exp $
#
#-------------------------------------------------------------------------
SHLIB_LINK += -lm
OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \
- $(filter rint.o, $(LIBOBJS))
+ $(filter rint.o, $(LIBOBJS)) $(filter pgstrcasecmp.o, $(LIBOBJS))
all: all-lib
rint.c: %.c : $(top_srcdir)/src/port/%.c
rm -f $@ && $(LN_S) $< .
+pgstrcasecmp.c: %.c : $(top_srcdir)/src/port/%.c
+ rm -f $@ && $(LN_S) $< .
+
install: all installdirs install-lib
installdirs:
extern void add_variable_to_tail(struct arguments **, struct variable *, struct variable *);
extern void dump_variables(struct arguments *, int);
extern struct typedefs *get_typedef(char *);
-extern void adjust_array(enum ECPGttype, char **, char **, char *, char *, int);
+extern void adjust_array(enum ECPGttype, char **, char **, char *, char *, int, bool);
extern void reset_variables(void);
extern void check_indicator(struct ECPGtype *);
extern void remove_variables(int);
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.280 2004/05/07 00:24:59 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.281 2004/05/07 13:42:49 meskes Exp $ */
/* Copyright comment */
%{
mmerror(PARSE_ERROR, ET_ERROR, errortext);
}
}
-
- adjust_array($3.type_enum, &dimension, &length, $3.type_dimension, $3.type_index, *$4?1:0);
+ adjust_array($3.type_enum, &dimension, &length, $3.type_dimension, $3.type_index, *$4?1:0, true);
this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
char *length = $3.index2; /* length of string */
char dim[14L];
- adjust_array(actual_type[struct_level].type_enum, &dimension, &length, actual_type[struct_level].type_dimension, actual_type[struct_level].type_index, strlen($1));
+ adjust_array(actual_type[struct_level].type_enum, &dimension, &length, actual_type[struct_level].type_dimension, actual_type[struct_level].type_index, strlen($1), false);
switch (actual_type[struct_level].type_enum)
{
}
}
- adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0);
+ adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0, false);
this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
mmerror(PARSE_ERROR, ET_ERROR, "Initializer not allowed in EXEC SQL VAR command");
else
{
- adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0);
+ adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0, false);
switch ($5.type_enum)
{
}
void
-adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *type_dimension, char *type_index, int pointer_len)
+adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *type_dimension, char *type_index, int pointer_len, bool type_definition)
{
if (atoi(type_index) >= 0)
{
{
snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d", pointer_len);
mmerror(PARSE_ERROR, ET_FATAL, errortext);
-/* mmerror(PARSE_ERROR, ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);*/
}
if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char)
* make sure we return length = -1 for arrays without
* given bounds
*/
- if (atoi(*dimension) < 0)
+ if (atoi(*dimension) < 0 && !type_definition)
+ /*
+ * do not change this for typedefs
+ * since it will be changed later on when the variable is defined
+ */
*length = make_str("1");
else if (atoi(*dimension) == 0)
*length = make_str("-1");
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.47 2004/04/30 04:14:06 momjian Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.48 2004/05/07 13:42:49 meskes Exp $
subdir = src/interfaces/ecpg/test
top_builddir = ../../../..
ECPG = ../preproc/ecpg -I$(srcdir)/../include
-TESTS = test1 test2 test3 test4 perftest dyntest dyntest2 test_notice \
+TESTS = test1 test2 test3 test4 test5 perftest dyntest dyntest2 test_notice \
test_code100 test_init testdynalloc num_test dt_test test_informix
ifeq ($(enable_thread_safety), yes)
TESTS += test_thread test_thread_implicit
--- /dev/null
+#include
+#include
+
+EXEC SQL typedef long mmInteger;
+EXEC SQL typedef char mmChar;
+EXEC SQL typedef short mmSmallInt;
+
+EXEC SQL BEGIN DECLARE SECTION;
+struct TBempl
+ {
+ mmInteger idnum;
+ mmChar name[21];
+ mmSmallInt accs;
+ };
+EXEC SQL END DECLARE SECTION;
+
+int main()
+{
+EXEC SQL BEGIN DECLARE SECTION;
+struct TBempl empl;
+EXEC SQL END DECLARE SECTION;
+FILE *dbgs;
+
+if ((dbgs = fopen("log", "w")) != NULL)
+ ECPGdebug(1, dbgs);
+
+empl.idnum = 1;
+EXEC SQL connect to mm;
+if (sqlca.sqlcode)
+ {
+ printf("connect error = %ld\n", sqlca.sqlcode);
+ exit(sqlca.sqlcode);
+ }
+
+EXEC SQL create table empl
+ (
+ idnum integer,
+ name char(20),
+ accs smallint
+ );
+if (sqlca.sqlcode)
+ {
+ printf("select error = %ld\n", sqlca.sqlcode);
+ exit(sqlca.sqlcode);
+ }
+
+EXEC SQL insert into empl values (1, 'first user', 20);
+if (sqlca.sqlcode)
+ {
+ printf("select error = %ld\n", sqlca.sqlcode);
+ exit(sqlca.sqlcode);
+ }
+
+EXEC SQL select name, accs
+ into :empl.name, :empl.accs
+ from empl where idnum = :empl.idnum;
+if (sqlca.sqlcode)
+ {
+ printf("select error = %ld\n", sqlca.sqlcode);
+ exit(sqlca.sqlcode);
+ }
+printf("name=%s, accs=%d\n", empl.name, empl.accs);
+EXEC SQL disconnect;
+fclose(dbgs);
+exit(0);
+}