Skip to content

Commit 50a5b4a

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent d033e17 commit 50a5b4a

File tree

7 files changed

+955
-1014
lines changed

7 files changed

+955
-1014
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,3 +737,15 @@ Wed Dec 8 08:26:13 CET 1999
737737
- Clean up error handling.
738738
- Set ecpg version to 2.6.11.
739739

740+
Tue Dec 14 07:28:10 CET 1999
741+
742+
- Synced preproc.y with gram.y.
743+
- Simplified string handling.
744+
745+
Wed Dec 15 08:10:52 CET 1999
746+
747+
- Fixed typo in parser.
748+
- Included Bruce's patch to fix two more memory leaks in libecpg.
749+
- Some cleanup in libecpg.
750+
- Set library version to 3.0.9.
751+
- Set ecpg version to 2.6.12.

src/interfaces/ecpg/lib/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# Copyright (c) 1994, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.53 1999/12/07 10:29:16 meskes Exp $
9+
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.54 1999/12/16 06:53:10 meskes Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

1313
NAME= ecpg
1414
SO_MAJOR_VERSION= 3
15-
SO_MINOR_VERSION= 0.8
15+
SO_MINOR_VERSION= 0.9
1616

1717
SRCDIR= @top_srcdir@
1818
include $(SRCDIR)/Makefile.global

src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,14 @@ static
230230
char *
231231
quote_postgres(char *arg, int lineno)
232232
{
233-
char *res = (char *) ecpg_alloc(2 * strlen(arg) + 1, lineno);
233+
char *res = (char *) ecpg_alloc(2 * strlen(arg) + 3, lineno);
234234
int i,
235-
ri;
235+
ri = 0;
236236

237237
if (!res)
238238
return (res);
239239

240+
res[ri++] = '\'';
240241
for (i = 0, ri = 0; arg[i]; i++, ri++)
241242
{
242243
switch (arg[i])
@@ -253,6 +254,7 @@ quote_postgres(char *arg, int lineno)
253254

254255
res[ri] = arg[i];
255256
}
257+
res[ri++] = '\'';
256258
res[ri] = '\0';
257259

258260
return res;
@@ -498,27 +500,17 @@ ECPGexecute(struct statement * stmt)
498500
{
499501
/* set slen to string length if type is char * */
500502
int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : var->varcharsize;
501-
char *tmp;
502503

503504
if (!(newcopy = ecpg_alloc(slen + 1, stmt->lineno)))
504505
return false;
505506

506507
strncpy(newcopy, (char *) var->value, slen);
507508
newcopy[slen] = '\0';
508509

509-
if (!(mallocedval = (char *) ecpg_alloc(2 * strlen(newcopy) + 3, stmt->lineno)))
510+
mallocedval = quote_postgres(newcopy, stmt->lineno);
511+
if (!mallocedval)
510512
return false;
511513

512-
strcpy(mallocedval, "'");
513-
tmp = quote_postgres(newcopy, stmt->lineno);
514-
if (!tmp)
515-
return false;
516-
517-
strcat(mallocedval, tmp);
518-
free(tmp);
519-
520-
strcat(mallocedval, "'");
521-
522514
free(newcopy);
523515

524516
tobeinserted = mallocedval;
@@ -541,27 +533,17 @@ ECPGexecute(struct statement * stmt)
541533
{
542534
struct ECPGgeneric_varchar *variable =
543535
(struct ECPGgeneric_varchar *) (var->value);
544-
char *tmp;
545536

546537
if (!(newcopy = (char *) ecpg_alloc(variable->len + 1, stmt->lineno)))
547538
return false;
548539

549540
strncpy(newcopy, variable->arr, variable->len);
550541
newcopy[variable->len] = '\0';
551542

552-
if (!(mallocedval = (char *) ecpg_alloc(2 * strlen(newcopy) + 3, stmt->lineno)))
553-
return false;
554-
555-
strcpy(mallocedval, "'");
556-
tmp = quote_postgres(newcopy, stmt->lineno);
557-
if (!tmp)
543+
mallocedval = quote_postgres(newcopy, stmt->lineno);
544+
if (!mallocedval)
558545
return false;
559546

560-
strcat(mallocedval, tmp);
561-
free(tmp);
562-
563-
strcat(mallocedval, "'");
564-
565547
free(newcopy);
566548

567549
tobeinserted = mallocedval;
@@ -1127,18 +1109,16 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
11271109

11281110
if (strcmp(transaction, "commit") == 0 || strcmp(transaction, "rollback") == 0)
11291111
{
1130-
struct prepared_statement *this;
1131-
11321112
con->committed = true;
11331113

11341114
/* deallocate all prepared statements */
1135-
while(prep_stmts != NULL) {
1115+
while(prep_stmts != NULL)
1116+
{
11361117
bool b = ECPGdeallocate(lineno, prep_stmts->name);
11371118

11381119
if (!b)
11391120
return false;
11401121
}
1141-
11421122
}
11431123

11441124
return true;
@@ -1415,7 +1395,7 @@ ECPGdeallocate(int lineno, char *name)
14151395
prev->next = this->next;
14161396
else
14171397
prep_stmts = this->next;
1418-
1398+
14191399
free(this);
14201400
return true;
14211401
}

src/interfaces/ecpg/preproc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
33

44
MAJOR_VERSION=2
55
MINOR_VERSION=6
6-
PATCHLEVEL=11
6+
PATCHLEVEL=12
77

88
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
99
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy