!31 Remove '-fPIE' option when make mysql_fdw.

Merge pull request !31 from TotaJ/bugfix/mysql_fdw
This commit is contained in:
opengauss-bot
2020-07-18 16:09:03 +08:00
committed by Gitee
2 changed files with 13 additions and 10 deletions

View File

@ -2,8 +2,8 @@ diff --git connection.c connection.c
index cb9b90d..0fdd890 100644
--- connection.c
+++ connection.c
@@ -23,8 +23,10 @@
#include "mpg_wchar.h"
@@ -20,8 +20,10 @@
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "utils/hsearch.h"
+#include "utils/inval.h"
@ -13,7 +13,7 @@ index cb9b90d..0fdd890 100644
/* Length of host */
#define HOST_LEN 256
@@ -46,6 +48,9 @@ typedef struct ConnCacheEntry
@@ -43,6 +45,9 @@ typedef struct ConnCacheEntry
{
ConnCacheKey key; /* hash key (must be first) */
MYSQL *conn; /* connection to foreign server, or NULL */
@ -23,7 +23,7 @@ index cb9b90d..0fdd890 100644
} ConnCacheEntry;
/*
@@ -53,6 +58,8 @@ typedef struct ConnCacheEntry
@@ -50,6 +55,8 @@ typedef struct ConnCacheEntry
*/
static HTAB *ConnectionHash = NULL;
@ -32,7 +32,7 @@ index cb9b90d..0fdd890 100644
/*
* mysql_get_connection:
* Get a connection which can be used to execute queries on
@@ -80,6 +87,15 @@ mysql_get_connection(ForeignServer *server, UserMapping *user, mysql_opt *opt)
@@ -77,6 +84,15 @@ mysql_get_connection(ForeignServer *server, UserMapping *user, mysql_opt *opt)
ConnectionHash = hash_create("mysql_fdw connections", 8,
&ctl,
HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
@ -48,7 +48,7 @@ index cb9b90d..0fdd890 100644
}
/* Create hash key for the entry. Assume no pad bytes in key struct */
@@ -95,8 +111,22 @@ mysql_get_connection(ForeignServer *server, UserMapping *user, mysql_opt *opt)
@@ -92,8 +108,22 @@ mysql_get_connection(ForeignServer *server, UserMapping *user, mysql_opt *opt)
/* initialize new hashtable entry (key is already filled in) */
entry->conn = NULL;
}
@ -71,7 +71,7 @@ index cb9b90d..0fdd890 100644
entry->conn = mysql_connect(
opt->svr_address,
opt->svr_username,
@@ -113,6 +143,35 @@ mysql_get_connection(ForeignServer *server, UserMapping *user, mysql_opt *opt)
@@ -110,6 +140,35 @@ mysql_get_connection(ForeignServer *server, UserMapping *user, mysql_opt *opt)
);
elog(DEBUG3, "new mysql_fdw connection %p for server \"%s\"",
entry->conn, server->servername);
@ -107,7 +107,7 @@ index cb9b90d..0fdd890 100644
}
return entry->conn;
}
@@ -233,3 +292,36 @@ mysql_connect(
@@ -230,3 +289,36 @@ mysql_connect(
return conn;
}

View File

@ -1,5 +1,5 @@
diff --git Makefile Makefile
index d5e7b36..4cd59e9 100644
index d5e7b36..34667e1 100644
--- Makefile
+++ Makefile
@@ -31,6 +31,8 @@ else
@ -20,7 +20,7 @@ index d5e7b36..4cd59e9 100644
ifdef USE_PGXS
PG_CONFIG = pg_config
@@ -48,13 +50,12 @@ include $(PGXS)
@@ -48,14 +50,15 @@ include $(PGXS)
ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif
@ -36,7 +36,10 @@ index d5e7b36..4cd59e9 100644
+top_builddir = ../../../../../
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
+exclude_option=-fPIE
+override CPPFLAGS := $(filter-out $(exclude_option),$(CPPFLAGS))
endif
diff --git connection.cpp connection.cpp
index a517a73..3fc2f20 100644
--- connection.cpp