Commit b80b2921 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix crash when sorting a TBL table with thread=yes.

  This was because Tablist can be NULL when no lacal tables are in the list.
  modified:   storage/connect/tabtbl.cpp
  modified:   storage/connect/mysql-test/connect/r/tbl.result
  modified:   storage/connect/mysql-test/connect/t/tbl.test
parent 7829cefa
...@@ -153,7 +153,7 @@ SELECT * FROM t2; ...@@ -153,7 +153,7 @@ SELECT * FROM t2;
v v
22 22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';; CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
SELECT * FROM total; SELECT * FROM total order by v desc;
v v
22 22
11 11
......
...@@ -63,7 +63,7 @@ SELECT * FROM t2; ...@@ -63,7 +63,7 @@ SELECT * FROM t2;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT'; --eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
SELECT * FROM total; SELECT * FROM total order by v desc;
DROP TABLE total; DROP TABLE total;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void) ...@@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void)
for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext()) for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext())
((PTDBASE)tabp->GetTo_Tdb())->ResetDB(); ((PTDBASE)tabp->GetTo_Tdb())->ResetDB();
Tdbp = (PTDBASE)Tablist->GetTo_Tdb(); Tdbp = (Tablist) ? (PTDBASE)Tablist->GetTo_Tdb() : NULL;
Crp = 0; Crp = 0;
} // end of ResetDB } // end of ResetDB
...@@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g) ...@@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g)
/* Table already open, replace it at its beginning. */ /* Table already open, replace it at its beginning. */
/*******************************************************************/ /*******************************************************************/
ResetDB(); ResetDB();
return Tdbp->OpenDB(g); // Re-open fist table return (Tdbp) ? Tdbp->OpenDB(g) : false; // Re-open fist table
} // endif use } // endif use
#if 0 #if 0
......
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