mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
Cosmetic changes to dblink.
This commit is contained in:
@ -116,6 +116,7 @@ typedef struct remoteConnHashEnt
|
|||||||
var_ = NULL; \
|
var_ = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DBLINK_RES_INTERNALERROR(p2) \
|
#define DBLINK_RES_INTERNALERROR(p2) \
|
||||||
do { \
|
do { \
|
||||||
msg = pstrdup(PQerrorMessage(conn)); \
|
msg = pstrdup(PQerrorMessage(conn)); \
|
||||||
@ -123,6 +124,7 @@ typedef struct remoteConnHashEnt
|
|||||||
PQclear(res); \
|
PQclear(res); \
|
||||||
elog(ERROR, "%s: %s", p2, msg); \
|
elog(ERROR, "%s: %s", p2, msg); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DBLINK_RES_ERROR(p2) \
|
#define DBLINK_RES_ERROR(p2) \
|
||||||
do { \
|
do { \
|
||||||
msg = pstrdup(PQerrorMessage(conn)); \
|
msg = pstrdup(PQerrorMessage(conn)); \
|
||||||
@ -133,6 +135,7 @@ typedef struct remoteConnHashEnt
|
|||||||
errmsg("%s", p2), \
|
errmsg("%s", p2), \
|
||||||
errdetail("%s", msg))); \
|
errdetail("%s", msg))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DBLINK_RES_ERROR_AS_NOTICE(p2) \
|
#define DBLINK_RES_ERROR_AS_NOTICE(p2) \
|
||||||
do { \
|
do { \
|
||||||
msg = pstrdup(PQerrorMessage(conn)); \
|
msg = pstrdup(PQerrorMessage(conn)); \
|
||||||
@ -143,6 +146,7 @@ typedef struct remoteConnHashEnt
|
|||||||
errmsg("%s", p2), \
|
errmsg("%s", p2), \
|
||||||
errdetail("%s", msg))); \
|
errdetail("%s", msg))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DBLINK_CONN_NOT_AVAIL \
|
#define DBLINK_CONN_NOT_AVAIL \
|
||||||
do { \
|
do { \
|
||||||
if(conname) \
|
if(conname) \
|
||||||
@ -154,6 +158,7 @@ typedef struct remoteConnHashEnt
|
|||||||
(errcode(ERRCODE_CONNECTION_DOES_NOT_EXIST), \
|
(errcode(ERRCODE_CONNECTION_DOES_NOT_EXIST), \
|
||||||
errmsg("connection not available"))); \
|
errmsg("connection not available"))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DBLINK_GET_CONN \
|
#define DBLINK_GET_CONN \
|
||||||
do { \
|
do { \
|
||||||
char *conname_or_str = GET_STR(PG_GETARG_TEXT_P(0)); \
|
char *conname_or_str = GET_STR(PG_GETARG_TEXT_P(0)); \
|
||||||
@ -2039,7 +2044,7 @@ createConnHash(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
createNewConnection(const char *name, remoteConn * con)
|
createNewConnection(const char *name, remoteConn *rconn)
|
||||||
{
|
{
|
||||||
remoteConnHashEnt *hentry;
|
remoteConnHashEnt *hentry;
|
||||||
bool found;
|
bool found;
|
||||||
@ -2058,7 +2063,7 @@ createNewConnection(const char *name, remoteConn * con)
|
|||||||
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
||||||
errmsg("duplicate connection name")));
|
errmsg("duplicate connection name")));
|
||||||
|
|
||||||
hentry->rcon = con;
|
hentry->rcon = rconn;
|
||||||
strncpy(hentry->name, name, NAMEDATALEN - 1);
|
strncpy(hentry->name, name, NAMEDATALEN - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user