Commit 50a5b4ab authored by Michael Meskes's avatar Michael Meskes

*** empty log message ***

parent d033e175
...@@ -737,3 +737,15 @@ Wed Dec 8 08:26:13 CET 1999 ...@@ -737,3 +737,15 @@ Wed Dec 8 08:26:13 CET 1999
- Clean up error handling. - Clean up error handling.
- Set ecpg version to 2.6.11. - Set ecpg version to 2.6.11.
Tue Dec 14 07:28:10 CET 1999
- Synced preproc.y with gram.y.
- Simplified string handling.
Wed Dec 15 08:10:52 CET 1999
- Fixed typo in parser.
- Included Bruce's patch to fix two more memory leaks in libecpg.
- Some cleanup in libecpg.
- Set library version to 3.0.9.
- Set ecpg version to 2.6.12.
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.53 1999/12/07 10:29:16 meskes Exp $ # $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.54 1999/12/16 06:53:10 meskes Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
NAME= ecpg NAME= ecpg
SO_MAJOR_VERSION= 3 SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 0.8 SO_MINOR_VERSION= 0.9
SRCDIR= @top_srcdir@ SRCDIR= @top_srcdir@
include $(SRCDIR)/Makefile.global include $(SRCDIR)/Makefile.global
......
...@@ -230,13 +230,14 @@ static ...@@ -230,13 +230,14 @@ static
char * char *
quote_postgres(char *arg, int lineno) quote_postgres(char *arg, int lineno)
{ {
char *res = (char *) ecpg_alloc(2 * strlen(arg) + 1, lineno); char *res = (char *) ecpg_alloc(2 * strlen(arg) + 3, lineno);
int i, int i,
ri; ri = 0;
if (!res) if (!res)
return (res); return (res);
res[ri++] = '\'';
for (i = 0, ri = 0; arg[i]; i++, ri++) for (i = 0, ri = 0; arg[i]; i++, ri++)
{ {
switch (arg[i]) switch (arg[i])
...@@ -253,6 +254,7 @@ quote_postgres(char *arg, int lineno) ...@@ -253,6 +254,7 @@ quote_postgres(char *arg, int lineno)
res[ri] = arg[i]; res[ri] = arg[i];
} }
res[ri++] = '\'';
res[ri] = '\0'; res[ri] = '\0';
return res; return res;
...@@ -498,7 +500,6 @@ ECPGexecute(struct statement * stmt) ...@@ -498,7 +500,6 @@ ECPGexecute(struct statement * stmt)
{ {
/* set slen to string length if type is char * */ /* set slen to string length if type is char * */
int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : var->varcharsize; int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : var->varcharsize;
char *tmp;
if (!(newcopy = ecpg_alloc(slen + 1, stmt->lineno))) if (!(newcopy = ecpg_alloc(slen + 1, stmt->lineno)))
return false; return false;
...@@ -506,19 +507,10 @@ ECPGexecute(struct statement * stmt) ...@@ -506,19 +507,10 @@ ECPGexecute(struct statement * stmt)
strncpy(newcopy, (char *) var->value, slen); strncpy(newcopy, (char *) var->value, slen);
newcopy[slen] = '\0'; newcopy[slen] = '\0';
if (!(mallocedval = (char *) ecpg_alloc(2 * strlen(newcopy) + 3, stmt->lineno))) mallocedval = quote_postgres(newcopy, stmt->lineno);
if (!mallocedval)
return false; return false;
strcpy(mallocedval, "'");
tmp = quote_postgres(newcopy, stmt->lineno);
if (!tmp)
return false;
strcat(mallocedval, tmp);
free(tmp);
strcat(mallocedval, "'");
free(newcopy); free(newcopy);
tobeinserted = mallocedval; tobeinserted = mallocedval;
...@@ -541,7 +533,6 @@ ECPGexecute(struct statement * stmt) ...@@ -541,7 +533,6 @@ ECPGexecute(struct statement * stmt)
{ {
struct ECPGgeneric_varchar *variable = struct ECPGgeneric_varchar *variable =
(struct ECPGgeneric_varchar *) (var->value); (struct ECPGgeneric_varchar *) (var->value);
char *tmp;
if (!(newcopy = (char *) ecpg_alloc(variable->len + 1, stmt->lineno))) if (!(newcopy = (char *) ecpg_alloc(variable->len + 1, stmt->lineno)))
return false; return false;
...@@ -549,19 +540,10 @@ ECPGexecute(struct statement * stmt) ...@@ -549,19 +540,10 @@ ECPGexecute(struct statement * stmt)
strncpy(newcopy, variable->arr, variable->len); strncpy(newcopy, variable->arr, variable->len);
newcopy[variable->len] = '\0'; newcopy[variable->len] = '\0';
if (!(mallocedval = (char *) ecpg_alloc(2 * strlen(newcopy) + 3, stmt->lineno))) mallocedval = quote_postgres(newcopy, stmt->lineno);
return false; if (!mallocedval)
strcpy(mallocedval, "'");
tmp = quote_postgres(newcopy, stmt->lineno);
if (!tmp)
return false; return false;
strcat(mallocedval, tmp);
free(tmp);
strcat(mallocedval, "'");
free(newcopy); free(newcopy);
tobeinserted = mallocedval; tobeinserted = mallocedval;
...@@ -1127,18 +1109,16 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction) ...@@ -1127,18 +1109,16 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
if (strcmp(transaction, "commit") == 0 || strcmp(transaction, "rollback") == 0) if (strcmp(transaction, "commit") == 0 || strcmp(transaction, "rollback") == 0)
{ {
struct prepared_statement *this;
con->committed = true; con->committed = true;
/* deallocate all prepared statements */ /* deallocate all prepared statements */
while(prep_stmts != NULL) { while(prep_stmts != NULL)
{
bool b = ECPGdeallocate(lineno, prep_stmts->name); bool b = ECPGdeallocate(lineno, prep_stmts->name);
if (!b) if (!b)
return false; return false;
} }
} }
return true; return true;
...@@ -1415,7 +1395,7 @@ ECPGdeallocate(int lineno, char *name) ...@@ -1415,7 +1395,7 @@ ECPGdeallocate(int lineno, char *name)
prev->next = this->next; prev->next = this->next;
else else
prep_stmts = this->next; prep_stmts = this->next;
free(this); free(this);
return true; return true;
} }
......
...@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global ...@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION=2 MAJOR_VERSION=2
MINOR_VERSION=6 MINOR_VERSION=6
PATCHLEVEL=11 PATCHLEVEL=12
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
......
This source diff could not be displayed because it is too large. You can view the blob instead.
all: test1 test2 test3 test4 perftest all: test1 test2 test3 test4 perftest
LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq -lcrypt #LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq -lcrypt
LDFLAGS=-g -I../include -I/usr/include/postgresql -L/usr/lib/postgresql -L../lib -lecpg -lpq -lcrypt
#ECPG=/usr/local/pgsql/bin/ecpg
ECPG=../preproc/ecpg -I../include
.SUFFIXES: .pgc .c .SUFFIXES: .pgc .c
...@@ -11,7 +15,7 @@ test4: test4.c ...@@ -11,7 +15,7 @@ test4: test4.c
perftest: perftest.c perftest: perftest.c
.pgc.c: .pgc.c:
/usr/local/pgsql/bin/ecpg $? $(ECPG) $?
clean: clean:
-/bin/rm test1 test2 test3 test4 perftest *.c log -/bin/rm test1 test2 test3 test4 perftest *.c log
...@@ -49,8 +49,8 @@ exec sql end declare section; ...@@ -49,8 +49,8 @@ exec sql end declare section;
exec sql insert into meskes(name, married, children) values ('Petra', '19900404', 3); exec sql insert into meskes(name, married, children) values ('Petra', '19900404', 3);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 33, '19900404', 3); exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 33, '19900404', 3);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103, 8); exec sql insert into meskes(name, born, age) values ('Carsten', 19910103, 8);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907, 5); exec sql insert into meskes(name, born, age) values ('Marc', 19930907, 6);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923, 1); exec sql insert into meskes(name, born, age) values ('Chris', 19970923, 2);
strcpy(msg, "commit"); strcpy(msg, "commit");
exec sql commit; exec sql commit;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment