#At file:///net/fimafeng09/export/home/tmp/oleja/mysql/mysql-5.1-telco-7.0-spj-scan-scan/ based on revid:jonas@stripped
3476 Ole John Aske 2011-04-14
SPJ: Minor refactoring: Remove unused 'Ndb' argument to ::NdbQueryBuilderImpl() and NdbQueryBuilder::create()
Also fixed incorrect Copyright headers in HugoQueryBuilder.cpp and HugoQueryBuilder.hpp
modified:
sql/ha_ndbcluster.cc
storage/ndb/src/ndbapi/NdbQueryBuilder.cpp
storage/ndb/src/ndbapi/NdbQueryBuilder.hpp
storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp
storage/ndb/test/include/HugoQueryBuilder.hpp
storage/ndb/test/src/HugoQueryBuilder.cpp
storage/ndb/test/tools/spj_performance_test.cpp
storage/ndb/test/tools/spj_sanity_test.cpp
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-04-12 08:57:18 +0000
+++ b/sql/ha_ndbcluster.cc 2011-04-14 08:59:45 +0000
@@ -467,8 +467,7 @@ ha_ndbcluster::make_pushed_join(ndb_push
* Parent operation is not defined before we have found the first
* appendable child.
*/
- NdbQueryBuilder* const builder =
- NdbQueryBuilder::create(*m_thd_ndb->ndb);
+ NdbQueryBuilder* const builder= NdbQueryBuilder::create();
if (unlikely (builder==NULL))
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilder.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp 2011-04-06 14:16:13 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp 2011-04-14 08:59:45 +0000
@@ -23,7 +23,6 @@
#include <Vector.hpp>
#include "signaldata/QueryTree.hpp"
-#include <Ndb.hpp>
#include "NdbDictionaryImpl.hpp"
#include <NdbRecord.hpp>
#include "AttributeHeader.hpp"
@@ -686,9 +685,9 @@ NdbQueryOperationDef::getIndex() const
* Implementation of NdbQueryBuilder factory
******************************************/
// Static method.
-NdbQueryBuilder* NdbQueryBuilder::create(Ndb& ndb)
+NdbQueryBuilder* NdbQueryBuilder::create()
{
- NdbQueryBuilderImpl* const impl = new NdbQueryBuilderImpl(ndb);
+ NdbQueryBuilderImpl* const impl = new NdbQueryBuilderImpl();
if (likely (impl != NULL))
{
if (likely(impl->getNdbError().code == 0))
@@ -1128,9 +1127,9 @@ NdbQueryBuilder::prepare()
// The (hidden) Impl of NdbQueryBuilder
////////////////////////////////////////
-NdbQueryBuilderImpl::NdbQueryBuilderImpl(Ndb& ndb)
+NdbQueryBuilderImpl::NdbQueryBuilderImpl()
: m_interface(*this),
- m_ndb(ndb), m_error(),
+ m_error(),
m_operations(),
m_operands(),
m_paramCnt(0),
@@ -2895,15 +2894,14 @@ main(int argc, const char** argv)
assert (sizeof(NdbParamOperand) == sizeof(NdbQueryOperandImpl*));
assert (sizeof(NdbLinkedOperand) == sizeof(NdbQueryOperandImpl*));
- Ndb *myNdb = 0;
- NdbQueryBuilder myBuilder(*myNdb);
+ NdbQueryBuilder* const myBuilder= NdbQueryBuilder::create();
const NdbDictionary::Table *manager = (NdbDictionary::Table*)0xDEADBEAF;
// const NdbDictionary::Index *ix = (NdbDictionary::Index*)0x11223344;
- NdbQueryDef* q1 = 0;
+ const NdbQueryDef* q1 = 0;
{
- NdbQueryBuilder* qb = &myBuilder; //myDict->getQueryBuilder();
+ NdbQueryBuilder* qb = myBuilder;
const NdbQueryOperand* managerKey[] = // Manager is indexed om {"dept_no", "emp_no"}
{ qb->constValue("d005"), // dept_no = "d005"
=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilder.hpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilder.hpp 2011-04-06 14:16:13 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.hpp 2011-04-14 08:59:45 +0000
@@ -24,7 +24,6 @@
// skip includes...and require them to be included first
// BUH!
-class Ndb;
class NdbQueryDef;
class NdbQueryDefImpl;
class NdbQueryBuilderImpl;
@@ -358,8 +357,7 @@ private:
* build phase.
*
* - The NdbQueryDef produced by the ::prepare() method has a lifetime
- * determined by the Ndb object, or until it is explicit released by
- * NdbQueryDef::release()
+ * until it is explicit released by NdbQueryDef::release()
*
*/
class NdbQueryBuilder
@@ -380,7 +378,7 @@ public:
* Allocate an instance.
* @return New instance, or NULL if allocation failed.
*/
- static NdbQueryBuilder* create(Ndb& ndb);
+ static NdbQueryBuilder* create();
/**
* Release this object and any resources held by it.
@@ -478,8 +476,7 @@ private:
* NdbQueryDef represents a ::prepare()'d object from NdbQueryBuilder.
*
* The NdbQueryDef is reusable in the sense that it may be executed multiple
- * times. Its lifetime is defined by the Ndb object which it was created with,
- * or it may be explicitely released() when no longer required.
+ * times. It is valid until it is explicitely released().
*
* The NdbQueryDef *must* be keept alive until the last thread
* which executing a query based on this NdbQueryDef has completed execution
=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp 2011-04-06 14:16:13 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp 2011-04-14 08:59:45 +0000
@@ -644,7 +644,7 @@ class NdbQueryBuilderImpl
public:
~NdbQueryBuilderImpl();
- explicit NdbQueryBuilderImpl(Ndb& ndb);
+ explicit NdbQueryBuilderImpl();
const NdbQueryDefImpl* prepare();
@@ -667,7 +667,6 @@ private:
bool contains(const NdbQueryOperationDefImpl*);
NdbQueryBuilder m_interface;
- Ndb& m_ndb;
NdbError m_error;
Vector<NdbQueryOperationDefImpl*> m_operations;
=== modified file 'storage/ndb/test/include/HugoQueryBuilder.hpp'
--- a/storage/ndb/test/include/HugoQueryBuilder.hpp 2011-04-06 14:16:13 +0000
+++ b/storage/ndb/test/include/HugoQueryBuilder.hpp 2011-04-14 08:59:45 +0000
@@ -1,6 +1,5 @@
/*
- Copyright (C) 2003 MySQL AB
- All rights reserved. Use is subject to license terms.
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -105,7 +104,7 @@ public:
OptionMask getOptionMask() const { return m_options;}
void setOptionMask(OptionMask om) { m_options = om;}
- const NdbQueryDef * createQuery(Ndb*, bool takeOwnership = false);
+ const NdbQueryDef * createQuery(bool takeOwnership = false);
private:
struct TableDef
=== modified file 'storage/ndb/test/src/HugoQueryBuilder.cpp'
--- a/storage/ndb/test/src/HugoQueryBuilder.cpp 2011-04-06 14:16:13 +0000
+++ b/storage/ndb/test/src/HugoQueryBuilder.cpp 2011-04-14 08:59:45 +0000
@@ -1,6 +1,5 @@
/*
- Copyright (C) 2003 MySQL AB
- All rights reserved. Use is subject to license terms.
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -563,9 +562,9 @@ loop:
}
const NdbQueryDef *
-HugoQueryBuilder::createQuery(Ndb* pNdb, bool takeOwnership)
+HugoQueryBuilder::createQuery(bool takeOwnership)
{
- NdbQueryBuilder* const builder = NdbQueryBuilder::create(*pNdb);
+ NdbQueryBuilder* const builder = NdbQueryBuilder::create();
if (builder == NULL)
{
ndbout << "Failed to create NdbQueryBuilder." << endl;
=== modified file 'storage/ndb/test/tools/spj_performance_test.cpp'
--- a/storage/ndb/test/tools/spj_performance_test.cpp 2011-03-31 07:44:04 +0000
+++ b/storage/ndb/test/tools/spj_performance_test.cpp 2011-04-14 08:59:45 +0000
@@ -248,7 +248,7 @@ void TestThread::run(){
}
void TestThread::doLinkedAPITest(){
- NdbQueryBuilder* const builder = NdbQueryBuilder::create(m_ndb);
+ NdbQueryBuilder* const builder = NdbQueryBuilder::create();
const NdbQueryDef* queryDef = NULL;
const Row** resultPtrs = new const Row*[m_params->m_depth+1];
=== modified file 'storage/ndb/test/tools/spj_sanity_test.cpp'
--- a/storage/ndb/test/tools/spj_sanity_test.cpp 2011-03-31 07:44:04 +0000
+++ b/storage/ndb/test/tools/spj_sanity_test.cpp 2011-04-14 08:59:45 +0000
@@ -544,7 +544,7 @@ namespace SPJSanityTest{
Query::Query(Ndb& ndb):
m_ndb(ndb),
- m_builder(NdbQueryBuilder::create(ndb)),
+ m_builder(NdbQueryBuilder::create()),
m_root(NULL),
m_queryDef(NULL),
m_query(NULL),
Attachment: [text/bzr-bundle] bzr/ole.john.aske@oracle.com-20110414085945-7wt8m96ehgzm5sv3.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch(ole.john.aske:3476) | Ole John Aske | 14 Apr |