Skip to content

Commit 9e76b4c

Browse files
author
Michael Meskes
committed
And one more:
Connection identifier has to be unique
1 parent 72ba3cb commit 9e76b4c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,5 +2050,6 @@ Fr Jul 28 11:00:51 CEST 2006
20502050
- Added more SoC changes by Joachim Wieland <joe@mcknight.de>:
20512051
- SHOW statement puts result into a variable
20522052
- COPY TO STDOUT works
2053+
- Connection identifier has to be unique
20532054
- Set ecpg library version to 5.2.
20542055
- Set ecpg version to 4.2.1.

src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.30 2006/06/21 11:38:07 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.31 2006/07/28 10:10:42 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -295,12 +295,21 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
295295

296296
}
297297

298-
if ((this = (struct connection *) ECPGalloc(sizeof(struct connection), lineno)) == NULL)
299-
return false;
300-
301298
if (dbname == NULL && connection_name == NULL)
302299
connection_name = "DEFAULT";
303300

301+
/* check if the identifier is unique */
302+
if (ECPGget_connection(connection_name))
303+
{
304+
ECPGfree(dbname);
305+
ECPGlog("connect: connection identifier %s is already in use\n",
306+
connection_name);
307+
return false;
308+
}
309+
310+
if ((this = (struct connection *) ECPGalloc(sizeof(struct connection), lineno)) == NULL)
311+
return false;
312+
304313
if (dbname != NULL)
305314
{
306315
/* get the detail information out of dbname */

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