Skip to content

Commit

Permalink
Merge branch 'connect/10.0' into 10.0
Browse files Browse the repository at this point in the history
1.04.0006
  • Loading branch information
vuvova committed Apr 26, 2016
2 parents cfad394 + 10de438 commit 8b1563e
Show file tree
Hide file tree
Showing 18 changed files with 591 additions and 112 deletions.
2 changes: 1 addition & 1 deletion storage/connect/connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
return RC_FX;
} else if (x == 2) {
// Remote index
if (ptdb->ReadKey(g, op, kr))
if (op != OP_SAME && ptdb->ReadKey(g, op, kr))
return RC_FX;

goto rnd;
Expand Down
59 changes: 38 additions & 21 deletions storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@
#define JSONMAX 10 // JSON Default max grp size

extern "C" {
char version[]= "Version 1.04.0005 January 24, 2016";
char version[]= "Version 1.04.0006 March 12, 2016";
#if defined(__WIN__)
char compver[]= "Version 1.04.0005 " __DATE__ " " __TIME__;
char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
Expand Down Expand Up @@ -757,7 +757,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
sdvalout= NULL;
xmod= MODE_ANY;
istable= false;
*partname= 0;
memset(partname, 0, sizeof(partname));
bzero((char*) &xinfo, sizeof(XINFO));
valid_info= false;
valid_query_id= 0;
Expand Down Expand Up @@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s)
{
char *sv;

if (IsPartitioned() && s) {
if (IsPartitioned() && s && partname && *partname) {
sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname);
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
Expand All @@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
: table->s->connect_string;

if (cnc.length)
opval= GetRealString(strz(xp->g, cnc));
opval= strz(xp->g, cnc);
else
opval= GetListOption(xp->g, opname, options->oplist);

} else if (!stricmp(opname, "Query_String"))
opval= thd_query_string(table->in_use)->str;
Expand Down Expand Up @@ -2286,7 +2288,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
op= OP_EQ;
break;
case HA_READ_AFTER_KEY:
op= (stlen >= len) ? (!i ? OP_GT : OP_LE) : OP_GE;
op= (stlen >= len || i > 0) ? (i > 0 ? OP_LE : OP_GT) : OP_GE;
break;
case HA_READ_KEY_OR_NEXT:
op= OP_GE;
Expand Down Expand Up @@ -3121,13 +3123,14 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
#if defined(WITH_PARTITION_STORAGE_ENGINE)
if (table->part_info) {
if (GetStringOption("Filename") || GetStringOption("Tabname")
|| GetStringOption("Connect")) {
strcpy(partname, decode(g, strrchr(name, '#') + 1));
|| GetStringOption("Connect")) {
strncpy(partname, decode(g, strrchr(name, '#') + 1), sizeof(partname) - 1);
// strcpy(partname, table->part_info->curr_part_elem->partition_name);
part_id= &table->part_info->full_part_field_set;
// part_id= &table->part_info->full_part_field_set;
} else // Inward table
strcpy(partname, strrchr(name, slash) + 1);
part_id= &table->part_info->full_part_field_set; // Temporary
strncpy(partname, strrchr(name, slash) + 1, sizeof(partname) - 1);

part_id= &table->part_info->full_part_field_set; // Temporary
} // endif part_info
#endif // WITH_PARTITION_STORAGE_ENGINE
} else
Expand Down Expand Up @@ -5167,7 +5170,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
fncn= topt->catfunc;
fnc= GetFuncID(fncn);
sep= topt->separator;
spc= (!sep) ? ',' : (!strcmp(sep, "\\t")) ? '\t' : *sep;
spc= (!sep) ? ',' : *sep;
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
hdr= (int)topt->header;
tbl= topt->tablist;
Expand Down Expand Up @@ -5234,7 +5237,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
goto err;
} // endif rc


if (!tab) {
if (ttp == TAB_TBL) {
// Make tab the first table of the list
Expand Down Expand Up @@ -5303,8 +5305,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TAB_CSV:
if (!fn && fnc != FNC_NO)
sprintf(g->Message, "Missing %s file name", topt->type);
else
ok= true;
else if (sep && strlen(sep) > 1)
sprintf(g->Message, "Invalid separator %s", sep);
else
ok= true;

break;
case TAB_MYSQL:
Expand Down Expand Up @@ -5985,7 +5989,19 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(rc);
} // endif lrecl

} // endif type
} // endif type JSON

if (type == TAB_CSV) {
const char *sep = options->separator;

if (sep && strlen(sep) > 1) {
sprintf(g->Message, "Invalid separator %s", sep);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_INTERNAL_ERROR;
DBUG_RETURN(rc);
} // endif sep

} // endif type CSV

// Check column types
for (field= table_arg->field; *field; field++) {
Expand Down Expand Up @@ -6136,7 +6152,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,

strcpy(dbpath, name);
p= strrchr(dbpath, slash);
strcpy(partname, ++p);
strncpy(partname, ++p, sizeof(partname) - 1);
strcat(strcat(strcpy(buf, p), "."), lwt);
*p= 0;
} else {
Expand Down Expand Up @@ -6187,7 +6203,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,

#if defined(WITH_PARTITION_STORAGE_ENGINE)
if (part_info && !inward)
strcpy(partname, decode(g, strrchr(name, '#') + 1));
strncpy(partname, decode(g, strrchr(name, '#') + 1), sizeof(partname) - 1);
// strcpy(partname, part_info->curr_part_elem->partition_name);
#endif // WITH_PARTITION_STORAGE_ENGINE

Expand Down Expand Up @@ -6228,8 +6244,9 @@ int ha_connect::create(const char *name, TABLE *table_arg,

#if defined(WITH_PARTITION_STORAGE_ENGINE)
if (part_info)
strcpy(partname,
decode(g, strrchr(name, (inward ? slash : '#')) + 1));
strncpy(partname,
decode(g, strrchr(name, (inward ? slash : '#')) + 1),
sizeof(partname) - 1);
#endif // WITH_PARTITION_STORAGE_ENGINE

if ((rc= optimize(table->in_use, NULL))) {
Expand Down Expand Up @@ -6773,7 +6790,7 @@ maria_declare_plugin(connect)
0x0104, /* version number (1.04) */
NULL, /* status variables */
connect_system_variables, /* system variables */
"1.04.0005", /* string version */
"1.04.0006", /* string version */
MariaDB_PLUGIN_MATURITY_BETA /* maturity */
}
maria_declare_plugin_end;
2 changes: 1 addition & 1 deletion storage/connect/ha_connect.h
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ int index_prev(uchar *buf);
PVAL sdvalin4; // Used to convert date values
PVAL sdvalout; // Used to convert date values
bool istable; // True for table handler
char partname[64]; // The partition name
char partname[65]; // The partition name
MODE xmod; // Table mode
XINFO xinfo; // The table info structure
bool valid_info; // True if xinfo is valid
Expand Down
11 changes: 8 additions & 3 deletions storage/connect/myconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,11 +959,16 @@ void MYSQLC::FreeResult(void)
/***********************************************************************/
/* Place the cursor at the beginning of the result set. */
/***********************************************************************/
void MYSQLC::Rewind(void)
int MYSQLC::Rewind(PGLOBAL g, PSZ sql)
{
if (m_Res)
DataSeek(0);
int rc = RC_OK;

if (m_Res)
DataSeek(0);
else if (sql)
rc = ExecSQL(g, sql);

return rc;
} // end of Rewind

/***********************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion storage/connect/myconn.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DllItem MYSQLC {
int Fetch(PGLOBAL g, int pos);
char *GetCharField(int i);
int GetFieldLength(int i);
void Rewind(void);
int Rewind(PGLOBAL g, PSZ sql);
void FreeResult(void);
void Close(void);

Expand Down
Loading

0 comments on commit 8b1563e

Please sign in to comment.