summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-06-07 15:39:03 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-06-07 15:39:03 +0100
commitb0ea3e1156bf23b9992c8a01658fa3d8d9303275 (patch)
tree177f0e173e56d95bb3c00abaddacce3ddb4c1376
parentNon-static ICE proxy and destroy the local communicator handle (diff)
downloadproject2-b0ea3e1156bf23b9992c8a01658fa3d8d9303275.tar.bz2
project2-b0ea3e1156bf23b9992c8a01658fa3d8d9303275.tar.xz
project2-b0ea3e1156bf23b9992c8a01658fa3d8d9303275.zip
Default constructor and proper copy operator for ConnectionRef
-rw-r--r--project2/sql/rdbmsDataSource.cpp15
-rw-r--r--project2/sql/rdbmsDataSource.h2
-rw-r--r--project2/sql/sqlMergeTask.cpp2
3 files changed, 17 insertions, 2 deletions
diff --git a/project2/sql/rdbmsDataSource.cpp b/project2/sql/rdbmsDataSource.cpp
index 90dd09a..b0989b9 100644
--- a/project2/sql/rdbmsDataSource.cpp
+++ b/project2/sql/rdbmsDataSource.cpp
@@ -262,6 +262,10 @@ RdbmsDataSource::ConnectionInfo::operator<(const RdbmsDataSource::ConnectionInfo
return ((typeId < other.typeId) || ((typeId == other.typeId) && (dsn < other.dsn)));
}
+RdbmsDataSource::ConnectionRef::ConnectionRef()
+{
+}
+
RdbmsDataSource::ConnectionRef::ConnectionRef(const ConnectionPtr & c) :
conn(c)
{
@@ -275,6 +279,17 @@ RdbmsDataSource::ConnectionRef::~ConnectionRef()
conn->decRef();
}
+RdbmsDataSource::ConnectionRef &
+RdbmsDataSource::ConnectionRef::operator=(const RdbmsDataSource::ConnectionRef & other)
+{
+ if (conn)
+ conn->decRef();
+ conn = other.conn;
+ if (conn)
+ conn->incRef();
+ return *this;
+}
+
const DB::Connection *
RdbmsDataSource::ConnectionRef::operator->() const
{
diff --git a/project2/sql/rdbmsDataSource.h b/project2/sql/rdbmsDataSource.h
index 920ad05..e347961 100644
--- a/project2/sql/rdbmsDataSource.h
+++ b/project2/sql/rdbmsDataSource.h
@@ -41,9 +41,11 @@ class RdbmsDataSource : public DataSource {
class ConnectionRef {
public:
+ ConnectionRef();
ConnectionRef(const ConnectionPtr &);
~ConnectionRef();
+ ConnectionRef & operator=(const ConnectionRef &);
const DB::Connection * operator->() const;
const DB::Connection & operator*() const;
const DB::Connection * get() const;
diff --git a/project2/sql/sqlMergeTask.cpp b/project2/sql/sqlMergeTask.cpp
index df4b0c0..54d4baf 100644
--- a/project2/sql/sqlMergeTask.cpp
+++ b/project2/sql/sqlMergeTask.cpp
@@ -58,7 +58,6 @@ SqlMergeTask::SqlMergeTask(const std::string & datasource, const std::string & t
tempTableCreated(false),
sqlCommand(NULL),
insCmd(NULL),
- destdb(NULL),
dataSource(datasource),
dtable(target),
dtablet(stringf("tmp_%s_%d", dtable.c_str(), getpid()))
@@ -82,7 +81,6 @@ SqlMergeTask::SqlMergeTask(ScriptNodePtr p) :
tempTableCreated(false),
sqlCommand(NULL),
insCmd(NULL),
- destdb(NULL),
dataSource(p, "datasource"),
dtable(p->value("targettable", NULL).as<std::string>()),
dtablet(stringf("tmp_%s_%d", dtable.c_str(), getpid()))