summaryrefslogtreecommitdiff
path: root/storage/connect/tabjdbc.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2019-02-03 15:19:04 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2019-02-03 15:19:04 +0100
commita0e26599a3a772ccaa06410c722a770e300b5bb8 (patch)
treee8b9ccbbdd42d67d6417f1816e0b707e5814720b /storage/connect/tabjdbc.cpp
parentbece44be4fea1c2b0fed0e53c80ab18485335eb8 (diff)
downloadmariadb-git-a0e26599a3a772ccaa06410c722a770e300b5bb8.tar.gz
- Fix MDEV-13136: enhance CREATE SERVER MyServerName
FOREIGN DATA WRAPPER to work with CONNECT engine modified: storage/connect/tabjdbc.cpp - Add a function to retrieve User variable value (DEVELOPMENT only) modified: storage/connect/ha_connect.cc modified: storage/connect/jsonudf.cpp modified: storage/connect/jsonudf.h modified: storage/connect/tabjdbc.cpp
Diffstat (limited to 'storage/connect/tabjdbc.cpp')
-rw-r--r--storage/connect/tabjdbc.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp
index c6b2802c1f6..789daff6fcd 100644
--- a/storage/connect/tabjdbc.cpp
+++ b/storage/connect/tabjdbc.cpp
@@ -72,7 +72,6 @@
#include "tabext.h"
#include "tabjdbc.h"
#include "tabmul.h"
-//#include "reldef.h"
#include "tabcol.h"
#include "valblk.h"
#include "ha_connect.h"
@@ -89,6 +88,9 @@ extern int num_read, num_there, num_eq[2]; // Statistics
/* External function. */
/***********************************************************************/
bool ExactInfo(void);
+#if defined(DEVELOPMENT)
+extern char *GetUserVariable(PGLOBAL g, const uchar *varname);
+#endif // DEVELOPMENT
/* -------------------------- Class JDBCDEF -------------------------- */
@@ -147,10 +149,6 @@ int JDBCDEF::ParseURL(PGLOBAL g, char *url, bool b)
return RC_FX;
Tabname = p;
-// } else if (b) {
-// // Otherwise, straight server name,
-// Tabname = GetStringCatInfo(g, "Name", NULL);
-// Tabname = GetStringCatInfo(g, "Tabname", Tabname);
} // endif
if (trace(1))
@@ -165,6 +163,11 @@ int JDBCDEF::ParseURL(PGLOBAL g, char *url, bool b)
return RC_FX;
} // endif server
+#if defined(DEVELOPMENT)
+ if (*server->host == '@') {
+ Url = GetUserVariable(g, (const uchar*)&server->host[1]);
+ } else
+#endif // 0
if (strncmp(server->host, "jdbc:", 5)) {
// Now make the required URL
Url = (PSZ)PlugSubAlloc(g, NULL, 0);
@@ -191,6 +194,9 @@ int JDBCDEF::ParseURL(PGLOBAL g, char *url, bool b)
if (!Password && server->password)
Password = PlugDup(g, server->password);
+ Driver = PlugDup(g, GetListOption(g, "Driver", server->owner, NULL));
+ Wrapname = PlugDup(g, GetListOption(g, "Wrapper", server->owner, NULL));
+ Memory = atoi(GetListOption(g, "Memory", server->owner, "0"));
return RC_NF;
} // endif
@@ -208,7 +214,6 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if (EXTDEF::DefineAM(g, am, poff))
return true;
- Driver = GetStringCatInfo(g, "Driver", NULL);
Desc = Url = GetStringCatInfo(g, "Connect", NULL);
if (!Url && !Catfunc) {
@@ -228,7 +233,10 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true;
} // endif rc
- Wrapname = GetStringCatInfo(g, "Wrapper", NULL);
+ // Default values may have been set in ParseURL
+ Memory = GetIntCatInfo("Memory", Memory);
+ Driver = GetStringCatInfo(g, "Driver", Driver);
+ Wrapname = GetStringCatInfo(g, "Wrapper", Wrapname);
return false;
} // end of DefineAM