mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Modify the connect_type_conv and connect_conv_size variables.
They were global (read-only) now they are session (not read-only) modified: storage/connect/checklvl.h storage/connect/ha_connect.cc storage/connect/myconn.cpp storage/connect/myutil.cpp storage/connect/tabutil.cpp - Suppress the compver variable on Linux compile. Was not debian reproductible because using __DATE__ and __TIME__ macros. modified: storage/connect/ha_connect.cc - ODBC LONGVARVAR type conversion now uses connect_conv_size. modified: storage/connect/odbconn.cpp
This commit is contained in:
@@ -40,4 +40,11 @@ enum USETEMP {TMP_NO = 0, /* Never */
|
|||||||
TMP_FORCE = 3, /* Forced for MAP tables */
|
TMP_FORCE = 3, /* Forced for MAP tables */
|
||||||
TMP_TEST = 4}; /* Testing value */
|
TMP_TEST = 4}; /* Testing value */
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* Following definitions indicate conversion of TEXT columns. */
|
||||||
|
/***********************************************************************/
|
||||||
|
enum TYPCONV {TPC_NO = 0, /* Never */
|
||||||
|
TPC_YES = 1, /* Always */
|
||||||
|
TPC_SKIP = 2}; /* Skip TEXT columns */
|
||||||
|
|
||||||
#endif // _CHKLVL_DEFINED_
|
#endif // _CHKLVL_DEFINED_
|
||||||
|
@@ -170,18 +170,18 @@
|
|||||||
#define SZWMIN 4194304 // Minimum work area size 4M
|
#define SZWMIN 4194304 // Minimum work area size 4M
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
char version[]= "Version 1.03.0006 January 13, 2015";
|
char version[]= "Version 1.03.0006 February 06, 2015";
|
||||||
char compver[]= "Version 1.03.0006 " __DATE__ " " __TIME__;
|
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
char compver[]= "Version 1.03.0006 " __DATE__ " " __TIME__;
|
||||||
char slash= '\\';
|
char slash= '\\';
|
||||||
#else // !WIN32
|
#else // !WIN32
|
||||||
char slash= '/';
|
char slash= '/';
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
|
|
||||||
// int trace= 0; // The general trace value
|
// int trace= 0; // The general trace value
|
||||||
ulong xconv= 0; // The type conversion option
|
// ulong xconv= 0; // The type conversion option
|
||||||
int zconv= 0; // The text conversion size
|
// int zconv= 0; // The text conversion size
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
#if defined(XMAP)
|
#if defined(XMAP)
|
||||||
@@ -289,6 +289,38 @@ static MYSQL_THDVAR_UINT(work_size,
|
|||||||
"Size of the CONNECT work area.",
|
"Size of the CONNECT work area.",
|
||||||
NULL, NULL, SZWORK, SZWMIN, UINT_MAX, 1);
|
NULL, NULL, SZWORK, SZWMIN, UINT_MAX, 1);
|
||||||
|
|
||||||
|
// Size used when converting TEXT columns to VARCHAR
|
||||||
|
static MYSQL_THDVAR_INT(conv_size,
|
||||||
|
PLUGIN_VAR_RQCMDARG, // opt
|
||||||
|
"Size used when converting TEXT columns.",
|
||||||
|
NULL, NULL, SZCONV, 0, 65500, 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Type conversion:
|
||||||
|
no: Unsupported types -> TYPE_ERROR
|
||||||
|
yes: TEXT -> VARCHAR
|
||||||
|
skip: skip unsupported type columns in Discovery
|
||||||
|
*/
|
||||||
|
const char *xconv_names[]=
|
||||||
|
{
|
||||||
|
"NO", "YES", "SKIP", NullS
|
||||||
|
};
|
||||||
|
|
||||||
|
TYPELIB xconv_typelib=
|
||||||
|
{
|
||||||
|
array_elements(xconv_names) - 1, "xconv_typelib",
|
||||||
|
xconv_names, NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ENUM(
|
||||||
|
type_conv, // name
|
||||||
|
PLUGIN_VAR_RQCMDARG, // opt
|
||||||
|
"Unsupported types conversion.", // comment
|
||||||
|
NULL, // check
|
||||||
|
NULL, // update function
|
||||||
|
0, // def (no)
|
||||||
|
&xconv_typelib); // typelib
|
||||||
|
|
||||||
#if defined(XMSG) || defined(NEWMSG)
|
#if defined(XMSG) || defined(NEWMSG)
|
||||||
const char *language_names[]=
|
const char *language_names[]=
|
||||||
{
|
{
|
||||||
@@ -317,6 +349,8 @@ static MYSQL_THDVAR_ENUM(
|
|||||||
extern "C" int GetTraceValue(void) {return THDVAR(current_thd, xtrace);}
|
extern "C" int GetTraceValue(void) {return THDVAR(current_thd, xtrace);}
|
||||||
bool ExactInfo(void) {return THDVAR(current_thd, exact_info);}
|
bool ExactInfo(void) {return THDVAR(current_thd, exact_info);}
|
||||||
USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);}
|
USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);}
|
||||||
|
int GetConvSize(void) {return THDVAR(current_thd, conv_size);}
|
||||||
|
TYPCONV GetTypeConv(void) {return (TYPCONV)THDVAR(current_thd, type_conv);}
|
||||||
uint GetWorkSize(void) {return THDVAR(current_thd, work_size);}
|
uint GetWorkSize(void) {return THDVAR(current_thd, work_size);}
|
||||||
void SetWorkSize(uint n)
|
void SetWorkSize(uint n)
|
||||||
{
|
{
|
||||||
@@ -598,7 +632,11 @@ static int connect_init_func(void *p)
|
|||||||
}
|
}
|
||||||
#endif // 0 (LINUX)
|
#endif // 0 (LINUX)
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
sql_print_information("CONNECT: %s", compver);
|
sql_print_information("CONNECT: %s", compver);
|
||||||
|
#else // !WIN32
|
||||||
|
sql_print_information("CONNECT: %s", version);
|
||||||
|
#endif // !WIN32
|
||||||
|
|
||||||
#ifdef LIBXML2_SUPPORT
|
#ifdef LIBXML2_SUPPORT
|
||||||
XmlInitParserLib();
|
XmlInitParserLib();
|
||||||
@@ -5333,9 +5371,18 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
|
|||||||
|
|
||||||
// typ must be PLG type, not SQL type
|
// typ must be PLG type, not SQL type
|
||||||
if (!(plgtyp= TranslateSQLType(typ, dec, prec, v))) {
|
if (!(plgtyp= TranslateSQLType(typ, dec, prec, v))) {
|
||||||
sprintf(g->Message, "Unsupported SQL type %d", typ);
|
if (GetTypeConv() == TPC_SKIP) {
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
// Skip this column
|
||||||
goto err;
|
sprintf(g->Message, "Column %s skipped (unsupported type %d)",
|
||||||
|
cnm, typ);
|
||||||
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
sprintf(g->Message, "Unsupported SQL type %d", typ);
|
||||||
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
|
goto err;
|
||||||
|
} // endif type_conv
|
||||||
|
|
||||||
} else
|
} else
|
||||||
typ= plgtyp;
|
typ= plgtyp;
|
||||||
|
|
||||||
@@ -6375,58 +6422,6 @@ struct st_mysql_storage_engine connect_storage_engine=
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* CONNECT global variables definitions. */
|
/* CONNECT global variables definitions. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
// Size used when converting TEXT columns to VARCHAR
|
|
||||||
#if defined(_DEBUG)
|
|
||||||
static MYSQL_SYSVAR_INT(conv_size, zconv,
|
|
||||||
PLUGIN_VAR_RQCMDARG, // opt
|
|
||||||
"Size used when converting TEXT columns.",
|
|
||||||
NULL, NULL, SZCONV, 0, 65500, 1);
|
|
||||||
#else
|
|
||||||
static MYSQL_SYSVAR_INT(conv_size, zconv,
|
|
||||||
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, // opt
|
|
||||||
"Size used when converting TEXT columns.",
|
|
||||||
NULL, NULL, SZCONV, 0, 65500, 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
Type conversion:
|
|
||||||
no: Unsupported types -> TYPE_ERROR
|
|
||||||
yes: TEXT -> VARCHAR
|
|
||||||
skip: skip unsupported type columns in Discovery
|
|
||||||
*/
|
|
||||||
const char *xconv_names[]=
|
|
||||||
{
|
|
||||||
"NO", "YES", "SKIP", NullS
|
|
||||||
};
|
|
||||||
|
|
||||||
TYPELIB xconv_typelib=
|
|
||||||
{
|
|
||||||
array_elements(xconv_names) - 1, "xconv_typelib",
|
|
||||||
xconv_names, NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(_DEBUG)
|
|
||||||
static MYSQL_SYSVAR_ENUM(
|
|
||||||
type_conv, // name
|
|
||||||
xconv, // varname
|
|
||||||
PLUGIN_VAR_RQCMDARG, // opt
|
|
||||||
"Unsupported types conversion.", // comment
|
|
||||||
NULL, // check
|
|
||||||
NULL, // update function
|
|
||||||
0, // def (no)
|
|
||||||
&xconv_typelib); // typelib
|
|
||||||
#else
|
|
||||||
static MYSQL_SYSVAR_ENUM(
|
|
||||||
type_conv, // name
|
|
||||||
xconv, // varname
|
|
||||||
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
|
|
||||||
"Unsupported types conversion.", // comment
|
|
||||||
NULL, // check
|
|
||||||
NULL, // update function
|
|
||||||
0, // def (no)
|
|
||||||
&xconv_typelib); // typelib
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(XMAP)
|
#if defined(XMAP)
|
||||||
// Using file mapping for indexes if true
|
// Using file mapping for indexes if true
|
||||||
static MYSQL_SYSVAR_BOOL(indx_map, xmap, PLUGIN_VAR_RQCMDARG,
|
static MYSQL_SYSVAR_BOOL(indx_map, xmap, PLUGIN_VAR_RQCMDARG,
|
||||||
|
@@ -51,7 +51,8 @@
|
|||||||
#define DLL_EXPORT // Items are exported from this DLL
|
#define DLL_EXPORT // Items are exported from this DLL
|
||||||
#include "myconn.h"
|
#include "myconn.h"
|
||||||
|
|
||||||
extern "C" int zconv;
|
//extern "C" int zconv;
|
||||||
|
int GetConvSize(void);
|
||||||
extern MYSQL_PLUGIN_IMPORT uint mysqld_port;
|
extern MYSQL_PLUGIN_IMPORT uint mysqld_port;
|
||||||
extern MYSQL_PLUGIN_IMPORT char *mysqld_unix_port;
|
extern MYSQL_PLUGIN_IMPORT char *mysqld_unix_port;
|
||||||
|
|
||||||
@@ -265,7 +266,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
|
|||||||
return NULL;
|
return NULL;
|
||||||
} else if (type == TYPE_STRING) {
|
} else if (type == TYPE_STRING) {
|
||||||
if (v == 'X') {
|
if (v == 'X') {
|
||||||
len = zconv;
|
len = GetConvSize();
|
||||||
sprintf(g->Message, "Column %s converted to varchar(%d)",
|
sprintf(g->Message, "Column %s converted to varchar(%d)",
|
||||||
colname, len);
|
colname, len);
|
||||||
PushWarning(g, thd);
|
PushWarning(g, thd);
|
||||||
|
@@ -26,14 +26,16 @@
|
|||||||
#include "myutil.h"
|
#include "myutil.h"
|
||||||
#define DLL_EXPORT // Items are exported from this DLL
|
#define DLL_EXPORT // Items are exported from this DLL
|
||||||
|
|
||||||
extern "C" int xconv;
|
//extern "C" int xconv;
|
||||||
|
TYPCONV GetTypeConv(void);
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Convert from MySQL type name to PlugDB type number */
|
/* Convert from MySQL type name to PlugDB type number */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
int MYSQLtoPLG(char *typname, char *var)
|
int MYSQLtoPLG(char *typname, char *var)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
|
TYPCONV xconv = GetTypeConv();
|
||||||
|
|
||||||
if (!stricmp(typname, "int") || !stricmp(typname, "mediumint") ||
|
if (!stricmp(typname, "int") || !stricmp(typname, "mediumint") ||
|
||||||
!stricmp(typname, "integer"))
|
!stricmp(typname, "integer"))
|
||||||
@@ -57,13 +59,13 @@ int MYSQLtoPLG(char *typname, char *var)
|
|||||||
type = TYPE_TINY;
|
type = TYPE_TINY;
|
||||||
else if (!stricmp(typname, "text") && var) {
|
else if (!stricmp(typname, "text") && var) {
|
||||||
switch (xconv) {
|
switch (xconv) {
|
||||||
case 1:
|
case TPC_YES:
|
||||||
type = TYPE_STRING;
|
type = TYPE_STRING;
|
||||||
*var = 'X';
|
*var = 'X';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case TPC_SKIP:
|
||||||
*var = 'K';
|
*var = 'K';
|
||||||
default:
|
default: // TPC_NO
|
||||||
type = TYPE_ERROR;
|
type = TYPE_ERROR;
|
||||||
} // endswitch xconv
|
} // endswitch xconv
|
||||||
|
|
||||||
@@ -88,7 +90,7 @@ int MYSQLtoPLG(char *typname, char *var)
|
|||||||
} else if (type == TYPE_STRING && !stricmp(typname, "varchar"))
|
} else if (type == TYPE_STRING && !stricmp(typname, "varchar"))
|
||||||
// This is to make the difference between CHAR and VARCHAR
|
// This is to make the difference between CHAR and VARCHAR
|
||||||
*var = 'V';
|
*var = 'V';
|
||||||
else if (type == TYPE_ERROR && xconv == 2)
|
else if (type == TYPE_ERROR && xconv == TPC_SKIP)
|
||||||
*var = 'K';
|
*var = 'K';
|
||||||
else
|
else
|
||||||
*var = 0;
|
*var = 0;
|
||||||
@@ -174,7 +176,7 @@ const char *PLGtoMYSQLtype(int type, bool dbf, char v)
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
int MYSQLtoPLG(int mytype, char *var)
|
int MYSQLtoPLG(int mytype, char *var)
|
||||||
{
|
{
|
||||||
int type;
|
int type, xconv = GetTypeConv();
|
||||||
|
|
||||||
switch (mytype) {
|
switch (mytype) {
|
||||||
case MYSQL_TYPE_SHORT:
|
case MYSQL_TYPE_SHORT:
|
||||||
@@ -221,7 +223,7 @@ int MYSQLtoPLG(int mytype, char *var)
|
|||||||
case MYSQL_TYPE_LONG_BLOB:
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
if (var) {
|
if (var) {
|
||||||
switch (xconv) {
|
switch (xconv) {
|
||||||
case 1:
|
case TPC_YES:
|
||||||
if (*var != 'B') {
|
if (*var != 'B') {
|
||||||
// This is a TEXT column
|
// This is a TEXT column
|
||||||
type = TYPE_STRING;
|
type = TYPE_STRING;
|
||||||
@@ -230,9 +232,9 @@ int MYSQLtoPLG(int mytype, char *var)
|
|||||||
type = TYPE_ERROR;
|
type = TYPE_ERROR;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case TPC_SKIP:
|
||||||
*var = 'K'; // Skip
|
*var = 'K'; // Skip
|
||||||
default:
|
default: // TPC_NO
|
||||||
type = TYPE_ERROR;
|
type = TYPE_ERROR;
|
||||||
} // endswitch xconv
|
} // endswitch xconv
|
||||||
|
|
||||||
|
@@ -53,6 +53,8 @@
|
|||||||
extern "C" HINSTANCE s_hModule; // Saved module handle
|
extern "C" HINSTANCE s_hModule; // Saved module handle
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
|
int GetConvSize();
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Some macro's (should be defined elsewhere to be more accessible) */
|
/* Some macro's (should be defined elsewhere to be more accessible) */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -122,7 +124,7 @@ int TranslateSQLType(int stp, int prec, int& len, char& v)
|
|||||||
case SQL_LONGVARCHAR: // (-1)
|
case SQL_LONGVARCHAR: // (-1)
|
||||||
v = 'V';
|
v = 'V';
|
||||||
type = TYPE_STRING;
|
type = TYPE_STRING;
|
||||||
len = MY_MIN(abs(len), 256);
|
len = MY_MIN(abs(len), GetConvSize());
|
||||||
break;
|
break;
|
||||||
case SQL_NUMERIC: // 2
|
case SQL_NUMERIC: // 2
|
||||||
case SQL_DECIMAL: // 3
|
case SQL_DECIMAL: // 3
|
||||||
|
@@ -54,7 +54,8 @@
|
|||||||
#include "tabutil.h"
|
#include "tabutil.h"
|
||||||
#include "ha_connect.h"
|
#include "ha_connect.h"
|
||||||
|
|
||||||
extern "C" int zconv;
|
//extern "C" int zconv;
|
||||||
|
int GetConvSize(void);
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Used by MYSQL tables to get MySQL parameters from the calling proxy */
|
/* Used by MYSQL tables to get MySQL parameters from the calling proxy */
|
||||||
@@ -132,6 +133,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
|||||||
char *fld, *colname, *chset, *fmt, v;
|
char *fld, *colname, *chset, *fmt, v;
|
||||||
int i, n, ncol = sizeof(buftyp) / sizeof(int);
|
int i, n, ncol = sizeof(buftyp) / sizeof(int);
|
||||||
int prec, len, type, scale;
|
int prec, len, type, scale;
|
||||||
|
int zconv = GetConvSize();
|
||||||
bool mysql;
|
bool mysql;
|
||||||
TABLE_SHARE *s = NULL;
|
TABLE_SHARE *s = NULL;
|
||||||
Field* *field;
|
Field* *field;
|
||||||
|
Reference in New Issue
Block a user