Commit 61141013 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix regression bug on "select max(length(nom)) from emp1" when:

  The emp1 table type is MYSQL
  nom is an indexed column
parent f0735934
...@@ -1058,12 +1058,13 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len) ...@@ -1058,12 +1058,13 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
{ {
bool oom; bool oom;
int oldlen = Query->GetLength(); int oldlen = Query->GetLength();
PHC hc = To_Def->GetHandler();
if (op == OP_FIRST) { if (op == OP_FIRST && hc->end_range) {
#ifdef _DEBUG #ifdef _DEBUG
assert(!key); assert(!key);
#endif #endif
key_range *end_key = &To_Def->GetHandler()->save_end_range; key_range *end_key = &hc->save_end_range;
key = end_key->key; key = end_key->key;
len = end_key->length; len = end_key->length;
...@@ -1078,21 +1079,20 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len) ...@@ -1078,21 +1079,20 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
if (!key || op == OP_NEXT || if (!key || op == OP_NEXT ||
Mode == MODE_UPDATE || Mode == MODE_DELETE) { Mode == MODE_UPDATE || Mode == MODE_DELETE) {
#if 0
if (!key && Mode == MODE_READX) { if (!key && Mode == MODE_READX) {
// This is a false indexed read // This is a false indexed read
m_Rc = Myc.ExecSQL(g, Query->GetStr()); m_Rc = Myc.ExecSQL(g, Query->GetStr());
Mode = MODE_READ; Mode = MODE_READ;
return (m_Rc == RC_FX) ? true : false; return (m_Rc == RC_FX) ? true : false;
} // endif key } // endif key
#endif // 0
return false; return false;
} else { } else {
if (Myc.m_Res) if (Myc.m_Res)
Myc.FreeResult(); Myc.FreeResult();
To_Def->GetHandler()->MakeKeyWhere(g, Query, op, '`', key, len); if (hc->MakeKeyWhere(g, Query, op, '`', key, len))
return true;
if (To_CondFil) { if (To_CondFil) {
oom = Query->Append(" AND ("); oom = Query->Append(" AND (");
......
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