Commit 43752dbf authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix a bug of MYSQL table type. When (REMOTE) indexed, local indexing was

  wrongly used for UPDATE and DELETE.
modified:
  storage/connect/ha_connect.cc
  storage/connect/tabmysql.cpp
parent 70160c22
...@@ -1674,7 +1674,11 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q, ...@@ -1674,7 +1674,11 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
KEY_PART_INFO *kpart; KEY_PART_INFO *kpart;
if (active_index == MAX_KEY) if (active_index == MAX_KEY)
return 0; return false;
else if (!key) {
strcpy(g->Message, "MakeKeyWhere: No key");
return true;
} // endif key
strcat(qry, " WHERE ("); strcat(qry, " WHERE (");
kfp= &table->key_info[active_index]; kfp= &table->key_info[active_index];
...@@ -2438,12 +2442,13 @@ int ha_connect::index_init(uint idx, bool sorted) ...@@ -2438,12 +2442,13 @@ int ha_connect::index_init(uint idx, bool sorted)
htrc("index_init: this=%p idx=%u sorted=%d\n", this, idx, sorted); htrc("index_init: this=%p idx=%u sorted=%d\n", this, idx, sorted);
if (GetIndexType(GetRealType()) == 2) { if (GetIndexType(GetRealType()) == 2) {
// This is a remote index if (xmod == MODE_READ)
xmod= MODE_READX; // This is a remote index
xmod= MODE_READX;
if (!(rc= rnd_init(0))) { if (!(rc= rnd_init(0))) {
active_index= idx; active_index= (xmod == MODE_READX) ? idx : MAX_KEY;
indexing= 2; // TO DO: mul? indexing= (xmod == MODE_READX) ? 2 : 0; // TO DO: mul?
} //endif rc } //endif rc
DBUG_RETURN(rc); DBUG_RETURN(rc);
......
...@@ -1012,7 +1012,7 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len) ...@@ -1012,7 +1012,7 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
{ {
int oldlen = strlen(Query); int oldlen = strlen(Query);
if (op == OP_NEXT) if (!key || op == OP_NEXT)
return false; return false;
else if (op == OP_FIRST) { else if (op == OP_FIRST) {
if (To_CondFil) if (To_CondFil)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment