diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2006-02-10 17:40:22 +0100 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2006-02-10 17:40:22 +0100 |
commit | 26287714d5c2096ad04375769d49e0d972e4be59 (patch) | |
tree | 025d5a61e7e7053be75d39d01e4a7e24ac99c6c3 /sql/ha_ndbcluster.cc | |
parent | 523d97f4ddfe695ca6134a65d93a24f388e52a4c (diff) | |
download | mariadb-git-26287714d5c2096ad04375769d49e0d972e4be59.tar.gz |
Bug #17249 ndb, delete statement with join where clause fails when table do not have pk
Bug #17257 ndb, update fails for inner joins if tables do not have Primary Key
change: the allocated area by setValue may not be around for later, store hidden key in special member variable instead
mysql-test/r/ndb_basic.result:
Bug #17249 delete statement with join where clause fails when table do not have pk
Bug #17257 update fails for inner joins if tables do not have Primary Key
mysql-test/t/ndb_basic.test:
Bug #17249 delete statement with join where clause fails when table do not have pk
Bug #17257 update fails for inner joins if tables do not have Primary Key
sql/ha_ndbcluster.cc:
Bug #17249 delete statement with join where clause fails when table do not have pk
Bug #17257 update fails for inner joins if tables do not have Primary Key
change: the allocated area by setValue may not be around for later, store hidden key in special member variable instead
sql/ha_ndbcluster.h:
Bug #17249 delete statement with join where clause fails when table do not have pk
Bug #17257 update fails for inner joins if tables do not have Primary Key
change: the allocated area by setValue may not be around for later, store hidden key in special member variable instead
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r-- | sql/ha_ndbcluster.cc | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 6a80ba83017..876d5d2f8fd 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -45,8 +45,6 @@ static const int max_transactions= 256; static const char *ha_ndb_ext=".ndb"; -#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8 - #define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0 #define NDB_AUTO_INCREMENT_RETRIES 10 @@ -747,7 +745,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, } // Used for hidden key only - m_value[fieldnr].rec= ndb_op->getValue(fieldnr, NULL); + m_value[fieldnr].rec= ndb_op->getValue(fieldnr, m_ref); DBUG_RETURN(m_value[fieldnr].rec == NULL); } @@ -2098,13 +2096,10 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) DBUG_PRINT("info", ("Using hidden key")); // Require that the PK for this record has previously been - // read into m_value - uint no_fields= table->fields; - NdbRecAttr* rec= m_value[no_fields].rec; - DBUG_ASSERT(rec); - DBUG_DUMP("key", (char*)rec->aRef(), NDB_HIDDEN_PRIMARY_KEY_LENGTH); + // read into m_ref + DBUG_DUMP("key", m_ref, NDB_HIDDEN_PRIMARY_KEY_LENGTH); - if (set_hidden_key(op, no_fields, rec->aRef())) + if (set_hidden_key(op, table->fields, m_ref)) ERR_RETURN(op->getNdbError()); } else @@ -2181,11 +2176,8 @@ int ha_ndbcluster::delete_row(const byte *record) { // This table has no primary key, use "hidden" primary key DBUG_PRINT("info", ("Using hidden key")); - uint no_fields= table->fields; - NdbRecAttr* rec= m_value[no_fields].rec; - DBUG_ASSERT(rec != NULL); - if (set_hidden_key(op, no_fields, rec->aRef())) + if (set_hidden_key(op, table->fields, m_ref)) ERR_RETURN(op->getNdbError()); } else @@ -2792,7 +2784,7 @@ void ha_ndbcluster::position(const byte *record) hidden_col->getAutoIncrement() && rec != NULL && ref_length == NDB_HIDDEN_PRIMARY_KEY_LENGTH); - memcpy(ref, (const void*)rec->aRef(), ref_length); + memcpy(ref, m_ref, ref_length); } DBUG_DUMP("ref", (char*)ref, ref_length); |