Skip to content

Commit 72ba3cb

Browse files
author
Michael Meskes
committed
Added more SoC changes by Joachim Wieland <joe@mcknight.de>:
- SHOW statement puts result into a variable - COPY TO STDOUT works
1 parent 67cdc61 commit 72ba3cb

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,5 +2044,11 @@ Mo Jun 26 16:08:23 CEST 2006
20442044
We Jul 5 12:17:28 CEST 2006
20452045

20462046
- Fixed remaining Coverity bugs.
2047+
2048+
Fr Jul 28 11:00:51 CEST 2006
2049+
2050+
- Added more SoC changes by Joachim Wieland <joe@mcknight.de>:
2051+
- SHOW statement puts result into a variable
2052+
- COPY TO STDOUT works
20472053
- Set ecpg library version to 5.2.
20482054
- Set ecpg version to 4.2.1.

src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.52 2006/07/14 05:28:28 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.53 2006/07/28 09:08:01 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -1421,9 +1421,29 @@ ECPGexecute(struct statement * stmt)
14211421
status = false;
14221422
break;
14231423
case PGRES_COPY_OUT:
1424-
ECPGlog("ECPGexecute line %d: Got PGRES_COPY_OUT ... tossing.\n", stmt->lineno);
1425-
PQendcopy(stmt->connection->connection);
1426-
break;
1424+
{
1425+
char *buffer;
1426+
int res;
1427+
ECPGlog("ECPGexecute line %d: Got PGRES_COPY_OUT\n", stmt->lineno);
1428+
while ((res = PQgetCopyData(stmt->connection->connection,
1429+
&buffer, 0)) > 0)
1430+
{
1431+
printf("%s", buffer);
1432+
PQfreemem(buffer);
1433+
}
1434+
if (res == -1)
1435+
{
1436+
/* COPY done */
1437+
PQclear(results);
1438+
results = PQgetResult(stmt->connection->connection);
1439+
if (PQresultStatus(results) == PGRES_COMMAND_OK)
1440+
ECPGlog("ECPGexecute line %d: Got PGRES_COMMAND_OK after PGRES_COPY_OUT\n", stmt->lineno);
1441+
else
1442+
ECPGlog("ECPGexecute line %d: Got error after PGRES_COPY_OUT: %s", PQresultErrorMessage(results));
1443+
}
1444+
//PQendcopy(stmt->connection->connection);
1445+
break;
1446+
}
14271447
case PGRES_COPY_IN:
14281448
ECPGlog("ECPGexecute line %d: Got PGRES_COPY_IN ... tossing.\n", stmt->lineno);
14291449
PQendcopy(stmt->connection->connection);

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.325 2006/06/26 14:12:02 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.326 2006/07/28 09:08:01 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -1194,16 +1194,16 @@ ColId_or_Sconst: ColId { $$ = $1; }
11941194
| StringConst { $$ = $1; }
11951195
;
11961196

1197-
VariableShowStmt: SHOW var_name
1197+
VariableShowStmt: SHOW var_name ecpg_into
11981198
{ $$ = cat2_str(make_str("show"), $2); }
1199-
| SHOW TIME ZONE
1199+
| SHOW TIME ZONE ecpg_into
12001200
{ $$ = make_str("show time zone"); }
1201-
| SHOW TRANSACTION ISOLATION LEVEL
1201+
| SHOW TRANSACTION ISOLATION LEVEL ecpg_into
12021202
{ $$ = make_str("show transaction isolation level"); }
1203-
| SHOW SESSION AUTHORIZATION
1203+
| SHOW SESSION AUTHORIZATION ecpg_into
12041204
{ $$ = make_str("show session authorization"); }
12051205
| SHOW ALL
1206-
{ $$ = make_str("show all"); }
1206+
{ mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL not implemented"); }
12071207
;
12081208

12091209
VariableResetStmt: RESET var_name

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