diff options
-rw-r--r-- | project2/sql/rdbmsDataSource.cpp | 15 | ||||
-rw-r--r-- | project2/sql/rdbmsDataSource.h | 2 | ||||
-rw-r--r-- | project2/sql/sqlMergeTask.cpp | 2 |
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())) |