diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2014-02-03 16:14:13 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2014-02-03 16:14:13 +0100 |
commit | 5133cb5e2530954a23b93ee22a49273f7333e36b (patch) | |
tree | 42b7b2654c305d6a19aa426d153300ad369b788c /storage/connect/mycat.cc | |
parent | 4d5f5f4cdf8c99bf693fd78490524a72418f1f45 (diff) | |
download | mariadb-git-5133cb5e2530954a23b93ee22a49273f7333e36b.tar.gz |
This is a major update of CONNECT that goes from version 1.1 to 1.2
===================================================================
- Implement a first support of the ALTER TABLE command. This fixes MDEV-5440
but does much more than only that. See the details of how ALTER is supported
in the new documentation and also in MDEV-5440 comment.
This is done principally by implementing for CONNECT the virtual function
check_if_supported_inplace_alter.
modified:
storage/connect/connect.cc
storage/connect/global.h
storage/connect/ha_connect.cc
storage/connect/ha_connect.h
storage/connect/mysql-test/connect/r/bin.result
storage/connect/mysql-test/connect/r/csv.result
storage/connect/mysql-test/connect/r/dbf.result
storage/connect/mysql-test/connect/r/dir.result
storage/connect/mysql-test/connect/r/fix.result
storage/connect/mysql-test/connect/r/index.result
storage/connect/mysql-test/connect/r/ini.result
storage/connect/mysql-test/connect/r/occur.result
storage/connect/mysql-test/connect/r/pivot.result
storage/connect/mysql-test/connect/r/vec.result
storage/connect/mysql-test/connect/t/dbf.test
storage/connect/plugutil.c
storage/connect/user_connect.cc
- Fixes the tabname/table_name issue for XML tables. Implement
multiple files XML tables.
modified:
storage/connect/tabxml.cpp
storage/connect/tabxml.h
- Set to varchar(256) the fields of catalog tables stored
as STRBLK's (had length 0 --> CHAR(1))
Add the GetCharString function to the VALBLK class
modified:
storage/connect/ha_connect.cc
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
- Translate CONNECT error messages to system_charset
to avoid truncation on not ASCII characters.
modified:
storage/connect/ha_connect.cc
- Update version number
modified:
storage/connect/ha_connect.cc
storage/connect/mysql-test/connect/r/xml.result
- Move the TDBASE::data_charset body from xtable.h to table.cpp.
(dont' remember why)
modified:
storage/connect/table.cpp
storage/connect/xtable.h
- Other modifications are to enhance the support of OEM tables.
In particular, they can now provide column definition in dicovery.
modified:
storage/connect/colblk.h
storage/connect/global.h
storage/connect/ha_connect.cc
storage/connect/mycat.cc
storage/connect/plgcnx.h
storage/connect/plgdbsem.h
storage/connect/xtable.h
- Or to add or modify tracing.
modified:
storage/connect/filamtxt.cpp
storage/connect/ha_connect.cc
storage/connect/plgdbutl.cpp
storage/connect/tabfix.cpp
storage/connect/tabmysql.cpp
Diffstat (limited to 'storage/connect/mycat.cc')
-rw-r--r-- | storage/connect/mycat.cc | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index 092d38a142a..dc5db156af0 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -259,6 +259,89 @@ uint GetFuncID(const char *func) return fnc; } // end of GetFuncID +/***********************************************************************/ +/* OEMColumn: Get table column info for an OEM table. */ +/***********************************************************************/ +PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info) + { + typedef PQRYRES (__stdcall *XCOLDEF) (PGLOBAL, PVOID, char*, char*, bool); + const char *module, *subtype; + char c, getname[40] = "Col"; +#if defined(WIN32) + HANDLE hdll; /* Handle to the external DLL */ +#else // !WIN32 + void *hdll; /* Handle for the loaded shared library */ +#endif // !WIN32 + XCOLDEF coldef = NULL; + PQRYRES qrp = NULL; + + module = topt->module; + subtype = topt->subtype; + + if (!module || !subtype) + return NULL; + + // The exported name is always in uppercase + for (int i = 0; ; i++) { + c = subtype[i]; + getname[i + 3] = toupper(c); + if (!c) break; + } // endfor i + +#if defined(WIN32) + // Load the Dll implementing the table + if (!(hdll = LoadLibrary(module))) { + char buf[256]; + DWORD rc = GetLastError(); + + sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, module); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, + (LPTSTR)buf, sizeof(buf), NULL); + strcat(strcat(g->Message, ": "), buf); + return NULL; + } // endif hDll + + // Get the function returning an instance of the external DEF class + if (!(coldef = (XCOLDEF)GetProcAddress((HINSTANCE)hdll, getname))) { + sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname); + FreeLibrary((HMODULE)hdll); + return NULL; + } // endif coldef +#else // !WIN32 + const char *error = NULL; + + // Load the desired shared library + if (!(hdll = dlopen(Module, RTLD_LAZY))) { + error = dlerror(); + sprintf(g->Message, MSG(SHARED_LIB_ERR), Module, SVP(error)); + return NULL; + } // endif Hdll + + // Get the function returning an instance of the external DEF class + if (!(coldef = (XCOLDEF)dlsym(hdll, getname))) { + error = dlerror(); + sprintf(g->Message, MSG(GET_FUNC_ERR), getname, SVP(error)); + dlclose(hdll); + return NULL; + } // endif coldef +#endif // !WIN32 + + // Just in case the external Get function does not set error messages + sprintf(g->Message, "Error getting column info from %s", subtype); + + // Get the table column definition + qrp = coldef(g, topt, tab, db, info); + +#if defined(WIN32) + FreeLibrary((HMODULE)hdll); +#else // !WIN32 + dlclose(hdll); +#endif // !WIN32 + + return qrp; + } // end of OEMColumns + /* ------------------------- Class CATALOG --------------------------- */ /***********************************************************************/ |