diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index 5a7f53977c7..b46c014fba6 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -120,6 +120,7 @@ TABTYPE GetTypeID(const char *type) #endif #ifdef MYSQL_SUPPORT : (!stricmp(type, "MYSQL")) ? TAB_MYSQL + : (!stricmp(type, "MYPRX")) ? TAB_MYSQL #endif : (!stricmp(type, "DIR")) ? TAB_DIR #ifdef WIN32 diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 495324b74f7..2af1055e8e1 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -65,6 +65,9 @@ void PrintResult(PGLOBAL, PSEM, PQRYRES); extern "C" int trace; extern MYSQL_PLUGIN_IMPORT uint mysqld_port; +// This function is located in tabutil.cpp +void Remove_tshp(PCATLG cat); + /* -------------- Implementation of the MYSQLDEF class --------------- */ /***********************************************************************/ @@ -280,6 +283,11 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) 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) { // Not using the connection URL Hostname = Cat->GetStringCatInfo(g, "Host", "localhost"); diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index 5706ca7aeba..76885aeedce 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -56,6 +56,15 @@ 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. */ /************************************************************************/ @@ -315,7 +324,7 @@ PTDB TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp) if (mysql) { #if defined(MYSQL_SUPPORT) // 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); goto err; } // endif Define