From f07359349f86b29192419adbdd39e55b92c42e22 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Mon, 6 Jul 2015 12:33:11 +0200 Subject: Fix loosing result lines when all of this is true: The table type is MYSQL The query where clause includes an indexed column The where clause contains < or <= operator on this column Change version date modified: storage/connect/ha_connect.cc modified: storage/connect/tabmysql.cpp Add visual studio 2013 files to ignore modified: .gitignore --- .gitignore | 4 ++++ storage/connect/ha_connect.cc | 6 ++++-- storage/connect/tabmysql.cpp | 30 +++++++++++++++++++----------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index b66c9dff075..946bc25fbe7 100644 --- a/.gitignore +++ b/.gitignore @@ -281,6 +281,10 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result *.vcproj.* *.vcproj.*.* *.vcproj.*.*.* +*.vcxproj +*.vcxproj.* +*.vcxproj.*.* +*.vcxproj.*.*.* # Build results [Dd]ebug/ diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index fd907fcccbb..007b2428094 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -169,7 +169,7 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.03.0007 June 03, 2015"; + char version[]= "Version 1.03.0007 July 05, 2015"; #if defined(__WIN__) char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__; char slash= '\\'; @@ -2237,7 +2237,9 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q, case OP_EQ: case OP_GT: case OP_GE: - oom|= qry->Append((PSZ)GetValStr(op, false)); + case OP_LT: + case OP_LE: + oom |= qry->Append((PSZ)GetValStr(op, false)); break; default: oom|= qry->Append(" ??? "); diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 19a5dfd758f..053478de560 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -1059,27 +1059,35 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len) bool oom; int oldlen = Query->GetLength(); + if (op == OP_FIRST) { +#ifdef _DEBUG + assert(!key); +#endif + key_range *end_key = &To_Def->GetHandler()->save_end_range; + + key = end_key->key; + len = end_key->length; + + switch (end_key->flag) { + case HA_READ_BEFORE_KEY: op = OP_LT; break; + case HA_READ_AFTER_KEY: op = OP_LE; break; + default: key = NULL; + } // endswitch flag + + } // endif OP_FIRST + if (!key || op == OP_NEXT || Mode == MODE_UPDATE || Mode == MODE_DELETE) { +#if 0 if (!key && Mode == MODE_READX) { // This is a false indexed read m_Rc = Myc.ExecSQL(g, Query->GetStr()); Mode = MODE_READ; return (m_Rc == RC_FX) ? true : false; } // endif key +#endif // 0 return false; - } else if (op == OP_FIRST) { - if (To_CondFil) { - oom = Query->Append(" WHERE "); - - if ((oom |= Query->Append(To_CondFil->Body))) { - strcpy(g->Message, "Readkey: Out of memory"); - return true; - } // endif oom - - } // endif To_Condfil - } else { if (Myc.m_Res) Myc.FreeResult(); -- cgit v1.2.1