Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dfb12a9

Browse files
author
Michael Meskes
committed
Removed multibyte stuff since client does not know about encoding in the backendFixed quoting bug reported by Sascha Demetrio (sd@b-comp.de).
1 parent 4f82ab4 commit dfb12a9

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/interfaces/ecpg/ChangeLog

+6
Original file line numberDiff line numberDiff line change
@@ -989,5 +989,11 @@ Wed Oct 25 08:53:07 CEST 2000
989989
Wed Oct 25 21:22:17 CEST 2000
990990

991991
- Synced gram.y and preproc.y.
992+
993+
Son Oct 29 11:26:06 CET 2000
994+
995+
- Removed multibyte stuff since client does not know about encoding
996+
in the backend.
997+
- Fixed quoting bug reported by Sascha Demetrio (sd@b-comp.de).
992998
- Set ecpg version to 2.8.0.
993999
- Set library version to 3.2.0.

src/interfaces/ecpg/lib/execute.c

+12-4
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ quote_postgres(char *arg, int lineno)
102102
return (res);
103103

104104
res[ri++] = '\'';
105+
105106
for (i = 0; arg[i]; i++, ri++)
106107
{
107108
switch (arg[i])
@@ -118,6 +119,7 @@ quote_postgres(char *arg, int lineno)
118119

119120
res[ri] = arg[i];
120121
}
122+
121123
res[ri++] = '\'';
122124
res[ri] = '\0';
123125

@@ -247,10 +249,17 @@ next_insert(char *text)
247249
char *ptr = text;
248250
bool string = false;
249251

252+
printf("%s\n", text);
250253
for (; *ptr != '\0' && (*ptr != '?' || string); ptr++)
251-
if (*ptr == '\'' && *(ptr - 1) != '\\')
252-
string = string ? false : true;
254+
{
255+
if (*ptr == '\\') /* escape character */
256+
ptr++;
257+
else
258+
if (*ptr == '\'' )
259+
string = string ? false : true;
260+
}
253261

262+
printf("%s\n", ptr);
254263
return (*ptr == '\0') ? NULL : ptr;
255264
}
256265

@@ -704,7 +713,6 @@ ECPGexecute(struct statement * stmt)
704713
strcpy(newcopy, copiedquery);
705714
if ((p = next_insert(newcopy + hostvarl)) == NULL)
706715
{
707-
708716
/*
709717
* We have an argument but we dont have the matched up string
710718
* in the string
@@ -995,7 +1003,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
9951003
*
9961004
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
9971005
*
998-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.12 2000/10/02 16:15:53 momjian Exp $
1006+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.13 2000/10/29 09:44:58 meskes Exp $
9991007
*/
10001008

10011009
PGconn *ECPG_internal_get_connection(char *name);

src/interfaces/ecpg/preproc/preproc.y

-14
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
#include "extern.h"
1313

14-
#ifdef MULTIBYTE
15-
#include "mb/pg_wchar.h"
16-
#endif
17-
1814
/*
1915
* Variables containing simple states.
2016
*/
@@ -838,11 +834,7 @@ VariableSetStmt: SET ColId TO var_value
838834
}
839835
| SET NAMES opt_encoding
840836
{
841-
#ifdef MULTIBYTE
842837
$$ = cat2_str(make_str("set names"), $3);
843-
#else
844-
mmerror(ET_ERROR, "SET NAMES is not supported.");
845-
#endif
846838
}
847839
;
848840

@@ -2252,16 +2244,10 @@ createdb_opt_location: LOCATION '=' StringConst { $$ = cat2_str(make_str("locat
22522244

22532245
createdb_opt_encoding: ENCODING '=' PosIntStringConst
22542246
{
2255-
#ifndef MULTIBYTE
2256-
mmerror(ET_ERROR, "Multi-byte support is not enabled.");
2257-
#endif
22582247
$$ = cat2_str(make_str("encoding ="), $3);
22592248
}
22602249
| ENCODING '=' DEFAULT
22612250
{
2262-
#ifndef MULTIBYTE
2263-
mmerror(ET_ERROR, "Multi-byte support is not enabled.");
2264-
#endif
22652251
$$ = make_str("encoding = default");
22662252
}
22672253
| /*EMPTY*/ { $$ = NULL; }

0 commit comments

Comments
 (0)