mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Add system variables type_conv and conv_size. This addresses the eventual
conversion from TEXT to VARCHAR in PROXY and MYSQL tables. modified: storage/connect/ha_connect.cc storage/connect/myconn.cpp storage/connect/myconn.h storage/connect/myutil.cpp storage/connect/tabmysql.cpp storage/connect/tabutil.cpp - Add the xmap system variable addressing whether file mapping should be used to handle indexing. modified: storage/connect/CMakeLists.txt storage/connect/ha_connect.cc storage/connect/xindex.cpp storage/connect/xindex.h - Do take care of ~ in Linux version of _fullpath (not tested yet) modified: storage/connect/osutil.c
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
#include "ha_connect.h"
|
||||
|
||||
extern "C" int trace;
|
||||
extern "C" int zconv;
|
||||
|
||||
/************************************************************************/
|
||||
/* Used by MYSQL tables to get MySQL parameters from the calling proxy */
|
||||
@@ -129,7 +130,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
||||
FLD_LENGTH, FLD_SCALE, FLD_RADIX, FLD_NULL,
|
||||
FLD_REM, FLD_NO, FLD_CHARSET};
|
||||
unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 32, 32};
|
||||
char *fld, *fmt, v;
|
||||
char *fld, *colname, *chset, *fmt, v;
|
||||
int i, n, ncol = sizeof(buftyp) / sizeof(int);
|
||||
int prec, len, type, scale;
|
||||
bool mysql;
|
||||
@@ -176,21 +177,37 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
||||
/**********************************************************************/
|
||||
/* Now get the results into blocks. */
|
||||
/**********************************************************************/
|
||||
for (i = 0, field= s->field; *field; i++, field++) {
|
||||
for (i = 0, field= s->field; *field; field++) {
|
||||
fp= *field;
|
||||
|
||||
// Get column name
|
||||
crp = qrp->Colresp; // Column_Name
|
||||
fld = (char *)fp->field_name;
|
||||
crp->Kdata->SetValue(fld, i);
|
||||
v = 0;
|
||||
colname = (char *)fp->field_name;
|
||||
crp->Kdata->SetValue(colname, i);
|
||||
|
||||
chset = (char *)fp->charset()->name;
|
||||
v = (!strcmp(chset, "binary")) ? 'B' : 0;
|
||||
|
||||
if ((type = MYSQLtoPLG(fp->type(), &v)) == TYPE_ERROR) {
|
||||
sprintf(g->Message, "Unsupported column type %s", GetTypeName(type));
|
||||
if (v == 'K') {
|
||||
// Skip this column
|
||||
sprintf(g->Message, "Column %s skipped (unsupported type)", colname);
|
||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
||||
continue;
|
||||
} // endif v
|
||||
|
||||
sprintf(g->Message, "Column %s unsupported type", colname);
|
||||
qrp = NULL;
|
||||
break;
|
||||
} // endif type
|
||||
|
||||
if (v == 'X') {
|
||||
len = zconv;
|
||||
sprintf(g->Message, "Column %s converted to varchar(%d)",
|
||||
colname, len);
|
||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
||||
} // endif v
|
||||
|
||||
crp = crp->Next; // Data_Type
|
||||
crp->Kdata->SetValue(type, i);
|
||||
|
||||
@@ -198,8 +215,8 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
||||
crp->Nulls[i] = 'Z';
|
||||
else if (fp->flags & UNSIGNED_FLAG)
|
||||
crp->Nulls[i] = 'U';
|
||||
else
|
||||
crp->Nulls[i] = v;
|
||||
else // X means TEXT field
|
||||
crp->Nulls[i] = (v == 'X') ? 'V' : v;
|
||||
|
||||
crp = crp->Next; // Type_Name
|
||||
crp->Kdata->SetValue(GetTypeName(type), i);
|
||||
@@ -214,7 +231,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
||||
prec = len = fp->field_length;
|
||||
} // endif mysql
|
||||
|
||||
} else {
|
||||
} else if (v != 'X') {
|
||||
if (type == TYPE_DECIM)
|
||||
prec = ((Field_new_decimal*)fp)->precision;
|
||||
else
|
||||
@@ -223,7 +240,8 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
||||
|
||||
len = fp->char_length();
|
||||
fmt = NULL;
|
||||
} // endif type
|
||||
} else
|
||||
prec = len = zconv;
|
||||
|
||||
crp = crp->Next; // Precision
|
||||
crp->Kdata->SetValue(prec, i);
|
||||
@@ -259,6 +277,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
||||
|
||||
// Add this item
|
||||
qrp->Nblin++;
|
||||
i++; // Can be skipped
|
||||
} // endfor field
|
||||
|
||||
/**********************************************************************/
|
||||
|
Reference in New Issue
Block a user