mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
- Allow PROXY based tables to specify MySQL access parameters when the
object table is not a CONNECT table. This was the case in previous versions but was no more possible with recent changes. modified: storage/connect/mycat.cc storage/connect/tabmysql.cpp storage/connect/tabutil.cpp
This commit is contained in:
@ -120,6 +120,7 @@ TABTYPE GetTypeID(const char *type)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef MYSQL_SUPPORT
|
#ifdef MYSQL_SUPPORT
|
||||||
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL
|
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL
|
||||||
|
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL
|
||||||
#endif
|
#endif
|
||||||
: (!stricmp(type, "DIR")) ? TAB_DIR
|
: (!stricmp(type, "DIR")) ? TAB_DIR
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -65,6 +65,9 @@ void PrintResult(PGLOBAL, PSEM, PQRYRES);
|
|||||||
extern "C" int trace;
|
extern "C" int trace;
|
||||||
extern MYSQL_PLUGIN_IMPORT uint mysqld_port;
|
extern MYSQL_PLUGIN_IMPORT uint mysqld_port;
|
||||||
|
|
||||||
|
// This function is located in tabutil.cpp
|
||||||
|
void Remove_tshp(PCATLG cat);
|
||||||
|
|
||||||
/* -------------- Implementation of the MYSQLDEF class --------------- */
|
/* -------------- Implementation of the MYSQLDEF class --------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -280,6 +283,11 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
|||||||
|
|
||||||
Desc = "MySQL Table";
|
Desc = "MySQL Table";
|
||||||
|
|
||||||
|
if (!stricmp(am, "MYPRX"))
|
||||||
|
// MYSQL access from a PROXY table,
|
||||||
|
// we must get parms from the calling table
|
||||||
|
Remove_tshp(Cat);
|
||||||
|
|
||||||
if (!url || !*url) {
|
if (!url || !*url) {
|
||||||
// Not using the connection URL
|
// Not using the connection URL
|
||||||
Hostname = Cat->GetStringCatInfo(g, "Host", "localhost");
|
Hostname = Cat->GetStringCatInfo(g, "Host", "localhost");
|
||||||
|
@ -56,6 +56,15 @@
|
|||||||
|
|
||||||
extern "C" int trace;
|
extern "C" int trace;
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* Used by MYSQL tables to get MySQL parameters from the calling proxy */
|
||||||
|
/* table (PROXY, TBL, XCL, or OCCUR) when used by one of these. */
|
||||||
|
/************************************************************************/
|
||||||
|
void Remove_tshp(PCATLG cat)
|
||||||
|
{
|
||||||
|
((MYCAT*)cat)->GetHandler()->tshp = NULL;
|
||||||
|
} // end of Remove_thsp
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* GetTableShare: allocates and open a table share. */
|
/* GetTableShare: allocates and open a table share. */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
@ -315,7 +324,7 @@ PTDB TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp)
|
|||||||
if (mysql) {
|
if (mysql) {
|
||||||
#if defined(MYSQL_SUPPORT)
|
#if defined(MYSQL_SUPPORT)
|
||||||
// Access sub-table via MySQL API
|
// Access sub-table via MySQL API
|
||||||
if (!(tdbp= cat->GetTable(g, tabp, MODE_READ, "MYSQL"))) {
|
if (!(tdbp= cat->GetTable(g, tabp, MODE_READ, "MYPRX"))) {
|
||||||
sprintf(g->Message, "Cannot access %s.%s", db, name);
|
sprintf(g->Message, "Cannot access %s.%s", db, name);
|
||||||
goto err;
|
goto err;
|
||||||
} // endif Define
|
} // endif Define
|
||||||
|
Reference in New Issue
Block a user