diff options
author | randomdan <randomdan@localhost> | 2013-11-22 20:37:10 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-11-22 20:37:10 +0000 |
commit | d221ec1e96a9187be84251fd72cae0f63ad12e67 (patch) | |
tree | a920578160545138fb2667ce67d8283b3939aaec | |
parent | GCC 4.8 compat fixes (diff) | |
download | project2-d221ec1e96a9187be84251fd72cae0f63ad12e67.tar.bz2 project2-d221ec1e96a9187be84251fd72cae0f63ad12e67.tar.xz project2-d221ec1e96a9187be84251fd72cae0f63ad12e67.zip |
Fixups to make more friendly with external projects
-rw-r--r-- | project2/Jamfile.jam | 3 | ||||
-rw-r--r-- | project2/common/genLoader.h | 6 | ||||
-rw-r--r-- | project2/common/iHaveSubTasks.h | 1 | ||||
-rw-r--r-- | project2/common/variables.cpp | 7 | ||||
-rw-r--r-- | project2/common/variables.h | 1 | ||||
-rw-r--r-- | project2/sql/Jamfile.jam | 2 | ||||
-rw-r--r-- | project2/sql/connectionLoader.h | 2 | ||||
-rw-r--r-- | project2/sql/sqlMergeTask.cpp | 25 | ||||
-rw-r--r-- | project2/sql/sqlMergeTask.h | 21 |
9 files changed, 52 insertions, 16 deletions
diff --git a/project2/Jamfile.jam b/project2/Jamfile.jam index c1a7c24..f21ede2 100644 --- a/project2/Jamfile.jam +++ b/project2/Jamfile.jam @@ -33,4 +33,7 @@ package.install installp2con : : console//p2console ; package.install installp2cgi : : cgi//p2cgi ; package.install installp2fcgi : : cgi//p2fcgi ; package.install installp2daemon : : daemon//p2daemon ; +package.install installheaders : <install-source-root>. : : : [ glob-tree *.h ] ; +package.install installheadersmisc : : : : [ glob ../libmisc/*.h ] ; +package.install installheadersdb : : : : [ glob ../libdbpp/*.h ] ; diff --git a/project2/common/genLoader.h b/project2/common/genLoader.h index e5ff43e..2e4300b 100644 --- a/project2/common/genLoader.h +++ b/project2/common/genLoader.h @@ -21,14 +21,16 @@ class GenLoader : public ComponentLoader { virtual Impl * create(const Params & ...) const = 0; + template <class E = NotSupported> inline static Impl * createNew(const KeyType & n, const Params & ... p) { - return InstanceMap<Self, KeyType>::template Get<NotSupported>(n)->create(p...); + return InstanceMap<Self, KeyType>::template Get<E>(n)->create(p...); } + template <class E = NotSupported> inline static boost::shared_ptr<Self> getFor(const KeyType & n) { - return InstanceMap<Self, KeyType>::template Get<NotSupported>(n); + return InstanceMap<Self, KeyType>::template Get<E>(n); } }; diff --git a/project2/common/iHaveSubTasks.h b/project2/common/iHaveSubTasks.h index d13a890..3e7d16c 100644 --- a/project2/common/iHaveSubTasks.h +++ b/project2/common/iHaveSubTasks.h @@ -9,7 +9,6 @@ class IHaveSubTasks : public NoOutputExecute { typedef ANONORDEREDSTORAGEOF(NoOutputExecute) Tasks; IHaveSubTasks(ScriptNodePtr p); - IHaveSubTasks(const std::string & n); virtual ~IHaveSubTasks(); virtual void execute(ExecContext * ec) const = 0; diff --git a/project2/common/variables.cpp b/project2/common/variables.cpp index a8ca808..42a596e 100644 --- a/project2/common/variables.cpp +++ b/project2/common/variables.cpp @@ -111,6 +111,13 @@ VariableImpl::~VariableImpl() { } +Variable & +Variable::operator=(const VariableType & vt) +{ + var = new VariableFixed(vt); + return *this; +} + Variable Variable::makeParent(const Glib::ustring & name, bool attr, unsigned int dep) { diff --git a/project2/common/variables.h b/project2/common/variables.h index b57ee81..7e9da3d 100644 --- a/project2/common/variables.h +++ b/project2/common/variables.h @@ -35,6 +35,7 @@ class Variable { static Variable makeParent(const Glib::ustring & name, bool attr, unsigned int depth); VariableType operator()(ExecContext * ec) const { return var->value(ec); } + Variable & operator=(const VariableType &); private: Variable(VariableImpl *); diff --git a/project2/sql/Jamfile.jam b/project2/sql/Jamfile.jam index ca82d21..ea879fb 100644 --- a/project2/sql/Jamfile.jam +++ b/project2/sql/Jamfile.jam @@ -54,5 +54,7 @@ lib p2sql : <library>../common//p2common <library>../lib//p2lib <include>../../libmisc + : : + <include>. ; diff --git a/project2/sql/connectionLoader.h b/project2/sql/connectionLoader.h index 9fb7149..efd90cd 100644 --- a/project2/sql/connectionLoader.h +++ b/project2/sql/connectionLoader.h @@ -2,7 +2,7 @@ #define CONNECTIONLOADER_H #include "scriptLoader.h" -#include "../libdbpp/connection.h" +#include <connection.h> typedef GenLoader<DB::Connection, std::string, std::string> ConnectionLoader; diff --git a/project2/sql/sqlMergeTask.cpp b/project2/sql/sqlMergeTask.cpp index c5eb93c..d4e22c7 100644 --- a/project2/sql/sqlMergeTask.cpp +++ b/project2/sql/sqlMergeTask.cpp @@ -43,6 +43,26 @@ DECLARE_LOADER("sqlmerge", SqlMergeTask); DECLARE_LOADER("sqlmergeinsert", SqlMergeInsert); // Conversion logic +SqlMergeTask::SqlMergeTask(const std::string & datasource, const std::string & target) : + SourceObject(__PRETTY_FUNCTION__), + Task(NULL), + updateWhere(NULL), + patchOrder(Null()), + earlyKeys(VariableType(false)), + useView(VariableType(false)), + doDelete(true), + doUpdate(true), + doInsert(true), + tempTableCreated(false), + sqlCommand(NULL), + insCmd(NULL), + destdb(NULL), + dataSource(datasource), + dtable(target), + dtablet(stringf("tmp_%s_%d", dtable.c_str(), getpid())) +{ +} + SqlMergeTask::SqlMergeTask(ScriptNodePtr p) : SourceObject(p), Task(p), @@ -104,9 +124,10 @@ SqlMergeTask::loadComplete(const CommonObjects * co) } } -SqlMergeTask::TargetColumn::TargetColumn(const Column & c) : +SqlMergeTask::TargetColumn::TargetColumn(const Column & c, bool key) : column(c), - mapcolumn(c) + mapcolumn(c), + isKey(key) { } diff --git a/project2/sql/sqlMergeTask.h b/project2/sql/sqlMergeTask.h index 6b74ccd..7fe385a 100644 --- a/project2/sql/sqlMergeTask.h +++ b/project2/sql/sqlMergeTask.h @@ -28,7 +28,7 @@ class SqlMergeTask : public Task { public: bool operator()(const TargetColumnPtr & a, const TargetColumnPtr & b) const; }; - TargetColumn(const Column &); + TargetColumn(const Column &, bool isKey = false); Column column; Column mapcolumn; @@ -41,6 +41,7 @@ class SqlMergeTask : public Task { typedef std::set<Column> Keys; SqlMergeTask(ScriptNodePtr p); + SqlMergeTask(const std::string & datasource, const std::string & target); virtual ~SqlMergeTask(); virtual void loadComplete(const CommonObjects *); @@ -48,13 +49,13 @@ class SqlMergeTask : public Task { Columns cols; Keys keys; Keys indexes; - const boost::intrusive_ptr<DynamicSql::SqlCommand> updateWhere; - const Variable patchOrder; - const Variable earlyKeys; - const Variable useView; - const Variable doDelete; - const Variable doUpdate; - const Variable doInsert; + boost::intrusive_ptr<DynamicSql::SqlCommand> updateWhere; + Variable patchOrder; + Variable earlyKeys; + Variable useView; + Variable doDelete; + Variable doUpdate; + Variable doInsert; private: virtual void copyToTempTable(ExecContext * ec) const; @@ -63,14 +64,14 @@ class SqlMergeTask : public Task { void createTempKey() const; mutable bool tempTableCreated; - typedef ANONSTORAGEOF(Iterate) Sources; - Sources sources; + typedef ANONSTORAGEOF(IHaveSubTasks) Sources; DynamicSql::SqlCommand * sqlCommand; protected: DB::ModifyCommand * insertCommand() const; DB::ModifyCommand * insCmd; public: + Sources sources; const DB::Connection * destdb; const Variable dataSource; const Table dtable; |