#At file:///home/oa136780/mysql/mysql-5.1-telco-7.0-spj/ based on revid:ole.john.aske@stripped
2905 Ole John Aske 2009-06-29
Moved ::getQueryOperationIx() from 'class NdbQueryDef' to 'class NdbQueryOperationImplDef'
modified:
storage/ndb/include/ndbapi/NdbQueryBuilder.hpp
storage/ndb/src/ndbapi/NdbQueryBuilder.cpp
storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp
storage/ndb/src/ndbapi/NdbQueryOperation.cpp
=== modified file 'storage/ndb/include/ndbapi/NdbQueryBuilder.hpp'
--- a/storage/ndb/include/ndbapi/NdbQueryBuilder.hpp 2009-06-26 12:01:17 +0000
+++ b/storage/ndb/include/ndbapi/NdbQueryBuilder.hpp 2009-06-29 10:21:13 +0000
@@ -322,9 +322,6 @@ public:
const NdbQueryOperationDef* getQueryOperation(const char* ident) const;
const NdbQueryOperationDef* getQueryOperation(Uint32 index) const;
- // Get the ordinal position of a operation within this queryDef
- int getQueryOperationIx(const NdbQueryOperationDef*) const;
-
// Remove this NdbQueryDef including operation and operands it contains
//void release(); Just delete it instead ?
=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilder.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp 2009-06-26 14:36:25 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp 2009-06-29 10:21:13 +0000
@@ -252,49 +252,8 @@ private:
// Implementation of NdbQueryOperation interface
////////////////////////////////////////////////
-class NdbQueryOperationDefImpl
-{
-public:
- Uint32 getNoOfParentOperations() const
- { return m_parents.size(); };
-
- const NdbQueryOperationDef* getParentOperation(Uint32 i) const
- { return m_parents[i]; };
-
- Uint32 getNoOfChildOperations() const
- { return m_children.size(); };
-
- const NdbQueryOperationDef* getChildOperation(Uint32 i) const
- { return m_children[i]; };
-
- const NdbDictionary::Table* getTable() const
- { return m_table; };
-
- void addParent(const NdbQueryOperationDef *);
- void addChild(const NdbQueryOperationDef *);
-
-protected:
- virtual ~NdbQueryOperationDefImpl() {};
- friend NdbQueryBuilderImpl::~NdbQueryBuilderImpl();
- friend NdbQueryDefImpl::~NdbQueryDefImpl();
-
- NdbQueryOperationDefImpl (
- const NdbDictionary::Table* table,
- const char* ident)
- : m_table(table), m_ident(ident),
- m_parents(), m_children()
- {};
-
-private:
- const NdbDictionary::Table* const m_table;
- const char* const m_ident;
-
- // parent / child vectors are indexes into m_operation vector
- // which contains the real pointers to parent/child operations
- Vector<const NdbQueryOperationDef*> m_parents;
- Vector<const NdbQueryOperationDef*> m_children;
-
-}; // class NdbQueryOperationDefImpl
+// Common Baseclass 'class NdbQueryOperationDefImp' is
+// defined in "NdbQueryBuilderImpl.hpp"
class NdbQueryLookupOperationDefImpl :
@@ -313,16 +272,18 @@ private:
NdbQueryLookupOperationDefImpl (
const NdbDictionary::Table* table,
const NdbQueryOperand* const keys[],
- const char* ident)
- : NdbQueryLookupOperationDef(this), NdbQueryOperationDefImpl(table,ident),
+ const char* ident,
+ Uint32 ix)
+ : NdbQueryLookupOperationDef(this), NdbQueryOperationDefImpl(table,ident,ix),
m_index(0), m_keys(keys)
{};
NdbQueryLookupOperationDefImpl (
const NdbDictionary::Index* index,
const NdbDictionary::Table* table,
const NdbQueryOperand* const keys[],
- const char* ident)
- : NdbQueryLookupOperationDef(this), NdbQueryOperationDefImpl(table,ident),
+ const char* ident,
+ Uint32 ix)
+ : NdbQueryLookupOperationDef(this), NdbQueryOperationDefImpl(table,ident,ix),
m_index(index), m_keys(keys)
{};
@@ -339,8 +300,9 @@ public:
virtual ~NdbQueryScanOperationDefImpl() {};
NdbQueryScanOperationDefImpl (
const NdbDictionary::Table* table,
- const char* ident)
- : NdbQueryOperationDefImpl(table,ident)
+ const char* ident,
+ Uint32 ix)
+ : NdbQueryOperationDefImpl(table,ident,ix)
{};
}; // class NdbQueryScanOperationDefImpl
@@ -354,8 +316,9 @@ private:
virtual ~NdbQueryTableScanOperationDefImpl() {};
NdbQueryTableScanOperationDefImpl (
const NdbDictionary::Table* table,
- const char* ident)
- : NdbQueryTableScanOperationDef(this), NdbQueryScanOperationDefImpl(table,ident)
+ const char* ident,
+ Uint32 ix)
+ : NdbQueryTableScanOperationDef(this), NdbQueryScanOperationDefImpl(table,ident,ix)
{};
}; // class NdbQueryTableScanOperationDefImpl
@@ -376,8 +339,9 @@ private:
const NdbDictionary::Index* index,
const NdbDictionary::Table* table,
const NdbQueryIndexBound* bound,
- const char* ident)
- : NdbQueryIndexScanOperationDef(this), NdbQueryScanOperationDefImpl(table,ident),
+ const char* ident,
+ Uint32 ix)
+ : NdbQueryIndexScanOperationDef(this), NdbQueryScanOperationDefImpl(table,ident,ix),
m_index(index), m_bound(bound)
{};
@@ -412,17 +376,6 @@ NdbQueryDef::getQueryOperation(const cha
{ return NULL; // FIXME
}
-int
-NdbQueryDef::getQueryOperationIx(const NdbQueryOperationDef* opDef) const
-{
- for (int i=0; i<m_pimpl->m_operations.size(); ++i)
- { if (m_pimpl->m_operations[i] == opDef)
- return i;
- }
- return -1;
-}
-
-
/*************************************************************************
* Glue layer between NdbQueryOperand interface and its Impl'ementation.
************************************************************************/
@@ -720,7 +673,8 @@ NdbQueryBuilder::readTuple(const NdbDict
returnErrIf(keys[keyfields]!=NULL, 4802);
NdbQueryLookupOperationDefImpl* op =
- new NdbQueryLookupOperationDefImpl(table,keys,ident);
+ new NdbQueryLookupOperationDefImpl(table,keys,ident,
+ m_pimpl->m_operations.size());
returnErrIf(op==0, 4000);
int keyindex = 0;
@@ -758,7 +712,8 @@ NdbQueryBuilder::readTuple(const NdbDict
returnErrIf(table==0 || index==0 || keys==0, 4800); // Required non-NULL arguments
NdbQueryLookupOperationDefImpl* op =
- new NdbQueryLookupOperationDefImpl(index,table,keys,ident);
+ new NdbQueryLookupOperationDefImpl(index,table,keys,ident,
+ m_pimpl->m_operations.size());
returnErrIf(op==0, 4000);
m_pimpl->m_operations.push_back(op);
@@ -775,7 +730,8 @@ NdbQueryBuilder::scanTable(const NdbDict
returnErrIf(table==0, 4800); // Required non-NULL arguments
NdbQueryTableScanOperationDefImpl* op =
- new NdbQueryTableScanOperationDefImpl(table,ident);
+ new NdbQueryTableScanOperationDefImpl(table,ident,
+ m_pimpl->m_operations.size());
returnErrIf(op==0, 4000);
m_pimpl->m_operations.push_back(op);
@@ -794,7 +750,8 @@ NdbQueryBuilder::scanIndex(const NdbDict
returnErrIf(table==0 || index==0 || bound==0, 4800); // Required non-NULL arguments
NdbQueryIndexScanOperationDefImpl* op =
- new NdbQueryIndexScanOperationDefImpl(index,table,bound,ident);
+ new NdbQueryIndexScanOperationDefImpl(index,table,bound,ident,
+ m_pimpl->m_operations.size());
returnErrIf(op==0, 4000);
m_pimpl->m_operations.push_back(op);
=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp 2009-06-26 12:01:17 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp 2009-06-29 10:21:13 +0000
@@ -23,9 +23,14 @@
#include <Vector.hpp>
#include "NdbQueryBuilder.hpp"
+#include "NdbDictionary.hpp"
+
+// Forward declared
class NdbQueryBuilderImpl;
+
+
class NdbQueryDefImpl : public NdbQueryDef
{
friend class NdbQueryDef;
@@ -78,4 +83,55 @@ private:
+class NdbQueryOperationDefImpl
+{
+public:
+ // Get the ordinal position of this operation within the query
+ Uint32 getQueryOperationIx() const
+ { return m_ix; };
+
+ Uint32 getNoOfParentOperations() const
+ { return m_parents.size(); };
+
+ const NdbQueryOperationDef* getParentOperation(Uint32 i) const
+ { return m_parents[i]; };
+
+ Uint32 getNoOfChildOperations() const
+ { return m_children.size(); };
+
+ const NdbQueryOperationDef* getChildOperation(Uint32 i) const
+ { return m_children[i]; };
+
+ const NdbDictionary::Table* getTable() const
+ { return m_table; };
+
+ void addParent(const NdbQueryOperationDef *);
+ void addChild(const NdbQueryOperationDef *);
+
+protected:
+ virtual ~NdbQueryOperationDefImpl() {};
+ friend NdbQueryBuilderImpl::~NdbQueryBuilderImpl();
+ friend NdbQueryDefImpl::~NdbQueryDefImpl();
+
+ NdbQueryOperationDefImpl (
+ const NdbDictionary::Table* table,
+ const char* ident,
+ Uint32 ix)
+ : m_table(table), m_ident(ident), m_ix(ix),
+ m_parents(), m_children()
+ {};
+
+private:
+ const NdbDictionary::Table* const m_table;
+ const char* const m_ident; // Optional name specified by aplication
+ const Uint32 m_ix; // Index if this operation within operation array
+
+ // parent / child vectors contains dependencies as defined
+ // with linkedValues
+ Vector<const NdbQueryOperationDef*> m_parents;
+ Vector<const NdbQueryOperationDef*> m_children;
+
+}; // class NdbQueryOperationDefImpl
+
+
#endif
=== modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2009-06-26 14:36:25 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2009-06-29 10:21:13 +0000
@@ -20,7 +20,7 @@
#include "NdbQueryOperationImpl.hpp"
#include <ndb_global.h>
#include "NdbQueryBuilder.hpp"
-#include "NdbDictionaryImpl.hpp"
+#include "NdbQueryBuilderImpl.hpp"
NdbQuery::NdbQuery(NdbQueryImpl *pimpl):
@@ -242,8 +242,8 @@ NdbQueryImpl::NdbQueryImpl(NdbTransactio
for (Uint32 p=0; p<def->getNoOfParentOperations(); ++p)
{
const NdbQueryOperationDef* parent = def->getParentOperation(p);
- int ix = queryDef.getQueryOperationIx(parent);
- assert (ix >=0 && ix < i);
+ Uint32 ix = parent->getImpl().getQueryOperationIx();
+ assert (ix < m_operations.size());
op->m_parents.push_back(m_operations[ix]);
m_operations[ix]->m_children.push_back(op);
}
Attachment: [text/bzr-bundle] bzr/ole.john.aske@sun.com-20090629102113-w7j1jn910xkdh3om.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0-spj branch (ole.john.aske:2905) | Ole John Aske | 29 Jun |