From a2bb99397d678e23b0b91373a5893e1fba78a64a Mon Sep 17 00:00:00 2001
From: "tomas@poseidon.ndb.mysql.com" <>
Date: Thu, 24 Nov 2005 14:57:14 +0100
Subject: [PATCH] added missing errorcode handling in NdbIndexStat causing test
 failure

---
 mysql-test/t/disabled.def               | 1 -
 storage/ndb/src/ndbapi/NdbIndexStat.cpp | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 9f84643c6b..fe95a543fb 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -15,4 +15,3 @@ rpl_relayrotate : Unstable test case, bug#12429
 rpl_until       : Unstable test case, bug#12429
 rpl_deadlock    : Unstable test case, bug#12429
 kill            : Unstable test case, bug#9712
-ndb_alter_table : Martin will fix
diff --git a/storage/ndb/src/ndbapi/NdbIndexStat.cpp b/storage/ndb/src/ndbapi/NdbIndexStat.cpp
index 2d47024956..8740b80a81 100644
--- a/storage/ndb/src/ndbapi/NdbIndexStat.cpp
+++ b/storage/ndb/src/ndbapi/NdbIndexStat.cpp
@@ -423,11 +423,13 @@ NdbIndexStat::records_in_range(NdbDictionary::Index* index, NdbIndexScanOperatio
     NdbTransaction* trans = op->m_transConnection;
     if (op->interpret_exit_last_row() == -1 ||
         op->getValue(NdbDictionary::Column::RECORDS_IN_RANGE, (char*)out) == 0) {
+      m_error = op->getNdbError();
       DBUG_PRINT("error", ("op:%d", op->getNdbError().code));
       DBUG_RETURN(-1);
     }
     if (trans->execute(NdbTransaction::NoCommit,
                        NdbTransaction::AbortOnError, forceSend) == -1) {
+      m_error = trans->getNdbError();
       DBUG_PRINT("error", ("trans:%d op:%d", trans->getNdbError().code,
                            op->getNdbError().code));
       DBUG_RETURN(-1);
@@ -443,6 +445,7 @@ NdbIndexStat::records_in_range(NdbDictionary::Index* index, NdbIndexScanOperatio
       cnt++;
     }
     if (ret == -1) {
+      m_error = op->getNdbError();
       DBUG_PRINT("error", ("trans:%d op:%d", trans->getNdbError().code,
                            op->getNdbError().code));
       DBUG_RETURN(-1);
-- 
2.30.9