summaryrefslogtreecommitdiff
path: root/project2/sql
diff options
context:
space:
mode:
Diffstat (limited to 'project2/sql')
-rw-r--r--project2/sql/pch.hpp1
-rw-r--r--project2/sql/rdbmsDataSource.cpp5
-rw-r--r--project2/sql/sqlCache.cpp11
-rw-r--r--project2/sql/sqlMergeTask.cpp21
-rw-r--r--project2/sql/sqlRows.cpp1
-rw-r--r--project2/sql/sqlTask.cpp5
-rw-r--r--project2/sql/sqlTest.cpp1
-rw-r--r--project2/sql/sqlWriter.cpp11
8 files changed, 24 insertions, 32 deletions
diff --git a/project2/sql/pch.hpp b/project2/sql/pch.hpp
index f1ff842..2d8e99b 100644
--- a/project2/sql/pch.hpp
+++ b/project2/sql/pch.hpp
@@ -23,7 +23,6 @@
#include "scriptLoader.h"
#include "scripts.h"
#include <boost/bind.hpp>
-#include <boost/foreach.hpp>
#include "options.h"
#include <buffer.h>
#include <column.h>
diff --git a/project2/sql/rdbmsDataSource.cpp b/project2/sql/rdbmsDataSource.cpp
index 86c6a6e..b25e8dc 100644
--- a/project2/sql/rdbmsDataSource.cpp
+++ b/project2/sql/rdbmsDataSource.cpp
@@ -5,7 +5,6 @@
#include "logger.h"
#include "scripts.h"
#include <errno.h>
-#include <boost/foreach.hpp>
SimpleMessageException(UnknownConnectionProvider);
#define LOCK(l) std::lock_guard<std::mutex> _lock##l(l)
@@ -47,7 +46,7 @@ RdbmsDataSource::RdbmsDataSource(ScriptNodePtr p) :
masterDsn(p->child("masterdsn")),
preferLocal(p->value("preferlocal", true, NULL))
{
- BOOST_FOREACH(ScriptNodePtr node, p->childrenIn("readonly")) {
+ for (ScriptNodePtr node : p->childrenIn("readonly")) {
roDSNs.insert(ReadonlyDSNs::value_type(node->value("host", NULL).as<std::string>(), node));
}
}
@@ -106,7 +105,7 @@ RdbmsDataSource::getReadonly() const
// Failed to connect to a preferred DB... carry on and try the others...
}
}
- BOOST_FOREACH(ReadonlyDSNs::value_type db, roDSNs) {
+ for (ReadonlyDSNs::value_type db : roDSNs) {
try {
return connectTo(db.second).get();
}
diff --git a/project2/sql/sqlCache.cpp b/project2/sql/sqlCache.cpp
index f20bfe4..3fca870 100644
--- a/project2/sql/sqlCache.cpp
+++ b/project2/sql/sqlCache.cpp
@@ -12,7 +12,6 @@
#include "scriptLoader.h"
#include "iHaveParameters.h"
#include "rowSet.h"
-#include <boost/foreach.hpp>
#include "options.h"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
@@ -111,7 +110,7 @@ class SqlCache : public RowSetCache {
break;
}
}
- BOOST_FOREACH(const unsigned int & c, colCols) {
+ for (const unsigned int & c : colCols) {
const DB::Column & col = (*s)[c];
col.apply(h);
ss.fields[&c - &colCols.front()] = h.variable;
@@ -169,10 +168,10 @@ class SqlCache : public RowSetCache {
void finishRow() const {
Buffer sql;
sql.appendf("INSERT INTO %s_%s_%s_rows(p2_row", HeaderTable.c_str(), n.c_str(), f.c_str());
- BOOST_FOREACH(const Values::value_type & a, attrs) {
+ for (const Values::value_type & a : attrs) {
sql.appendf(", p2attr_%s", a.first.c_str());
}
- BOOST_FOREACH(const Values::value_type & v, cols) {
+ for (const Values::value_type & v : cols) {
sql.appendf(", %s", v.first.c_str());
}
sql.appendf(") VALUES(?");
@@ -187,10 +186,10 @@ class SqlCache : public RowSetCache {
ModifyPtr m(con->newModifyCommand(sql));
unsigned int offset = 0;
m->bindParamI(offset++, row++);
- BOOST_FOREACH(const Values::value_type & a, attrs) {
+ for (const Values::value_type & a : attrs) {
boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(m.get(), offset++), a.second);
}
- BOOST_FOREACH(const Values::value_type & v, cols) {
+ for (const Values::value_type & v : cols) {
boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(m.get(), offset++), v.second);
}
m->execute();
diff --git a/project2/sql/sqlMergeTask.cpp b/project2/sql/sqlMergeTask.cpp
index f70e1ae..d0f6499 100644
--- a/project2/sql/sqlMergeTask.cpp
+++ b/project2/sql/sqlMergeTask.cpp
@@ -11,7 +11,6 @@
#include <stdio.h>
#include <stdexcept>
#include <boost/algorithm/string/join.hpp>
-#include <boost/foreach.hpp>
#include <boost/bind.hpp>
bool SqlMergeTask::defaultUseTempTable = true;
@@ -30,7 +29,7 @@ class SqlMergeInsert : IHaveParameters, public Task {
}
void execute(ExecContext * ec) const {
unsigned int col = 0;
- BOOST_FOREACH(const Parameters::value_type & v, parameters) {
+ for (const Parameters::value_type & v : parameters) {
boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(insert, col++), v.second(ec));
}
insert->execute();
@@ -93,7 +92,7 @@ SqlMergeTask::SqlMergeTask(ScriptNodePtr p) :
throw NotSupported("useview not supported with iterate fillers");
}
- BOOST_FOREACH(ScriptNodePtr e, p->childrenIn("columns")) {
+ for (ScriptNodePtr e : p->childrenIn("columns")) {
TargetColumnPtr tcp(new TargetColumn(e->get_name()));
tcp->maptable = e->value("maptable", "", NULL).as<std::string>();
if (!tcp->maptable.empty()) {
@@ -124,7 +123,7 @@ SqlMergeTask::loadComplete(const CommonObjects * co)
{
destdb = co->dataSource<RdbmsDataSource>(dataSource(NULL))->getWritable();
insCmd = insertCommand();
- BOOST_FOREACH(const Sources::value_type & i, sources) {
+ for (const Sources::value_type & i : sources) {
attach(i, insCmd);
}
}
@@ -160,14 +159,14 @@ SqlMergeTask::execute(ExecContext * ec) const
createTempKey();
}
std::set<std::string> colNames;
- BOOST_FOREACH(const TargetColumnPtr & c, cols) {
+ for (const TargetColumnPtr & c : cols) {
colNames.insert(c->column);
}
TablePatch tp(*destdb, dtablet, dtable, colNames);
tp.doDelete = doDelete(NULL);
tp.doUpdate = doUpdate(NULL);
tp.doInsert = doInsert(NULL);
- BOOST_FOREACH(const Keys::value_type & k, keys) {
+ for (const Keys::value_type & k : keys) {
tp.addKey(k);
}
tp.patch(ec, insteadOfDelete, updateWhere, patchOrder);
@@ -192,7 +191,7 @@ SqlMergeTask::createTempTable() const
dtable.c_str()));
ctt->execute();
delete ctt;
- BOOST_FOREACH(Columns::value_type c, cols) {
+ for (Columns::value_type c : cols) {
if (!c->maptable.empty()) {
DB::ModifyCommand * at = destdb->newModifyCommand(stringf(
"ALTER TABLE %s ADD COLUMN %s VARCHAR(1000)",
@@ -234,7 +233,7 @@ SqlMergeTask::createTempKey() const
delete at;
/* Indexes */
int n = 0;
- BOOST_FOREACH(const Keys::value_type & i, indexes) {
+ for (const Keys::value_type & i : indexes) {
DB::ModifyCommand * ci = destdb->newModifyCommand(stringf(
"CREATE INDEX idx_%s_%d ON %s(%s)",
dtablet.c_str(), n, dtablet.c_str(), i.c_str()));
@@ -308,7 +307,7 @@ attach(boost::intrusive_ptr<IHaveSubTasks> i, DB::ModifyCommand * insert)
i->normal.push_back(new Populate(insert));
}
else {
- BOOST_FOREACH(const IHaveSubTasks::Tasks::value_type & n, i->normal) {
+ for (const IHaveSubTasks::Tasks::value_type & n : i->normal) {
attach(boost::dynamic_pointer_cast<IHaveSubTasks>(n), insert);
attach(boost::dynamic_pointer_cast<SqlMergeInsert>(n), insert);
}
@@ -321,7 +320,7 @@ SqlMergeTask::copyToTempTable(ExecContext * ec) const
if (useView(NULL)) {
return;
}
- BOOST_FOREACH(const Sources::value_type & i, sources) {
+ for (const Sources::value_type & i : sources) {
i->execute(ec);
}
if (sqlCommand) {
@@ -347,7 +346,7 @@ SqlMergeTask::copyToTempTable(ExecContext * ec) const
cttt->execute();
delete cttt;
}
- BOOST_FOREACH(Columns::value_type c, cols) {
+ for (Columns::value_type c : cols) {
if (!c->maptable.empty()) {
DB::ModifyCommand * utt = destdb->newModifyCommand(
stringf(
diff --git a/project2/sql/sqlRows.cpp b/project2/sql/sqlRows.cpp
index 1395db9..59aa0e8 100644
--- a/project2/sql/sqlRows.cpp
+++ b/project2/sql/sqlRows.cpp
@@ -9,7 +9,6 @@
#include "scriptLoader.h"
#include "commonObjects.h"
#include <boost/date_time/gregorian/gregorian_types.hpp>
-#include <boost/foreach.hpp>
DECLARE_LOADER("sqlrows", SqlRows);
diff --git a/project2/sql/sqlTask.cpp b/project2/sql/sqlTask.cpp
index eab00d5..a98748f 100644
--- a/project2/sql/sqlTask.cpp
+++ b/project2/sql/sqlTask.cpp
@@ -1,6 +1,5 @@
#include <pch.hpp>
#include "sqlTask.h"
-#include <boost/foreach.hpp>
#include "scriptLoader.h"
#include "modifycommand.h"
#include "rdbmsDataSource.h"
@@ -41,12 +40,12 @@ SqlTask::execute(ExecContext * ec) const
unsigned int offset = 0;
sqlCommand.bindParams(ec, modify.get(), offset);
if (modify->execute() == 0) {
- BOOST_FOREACH(const SubNOEs::value_type & sq, noChangesNOEs) {
+ for (const SubNOEs::value_type & sq : noChangesNOEs) {
sq->execute(ec);
}
}
else {
- BOOST_FOREACH(const SubNOEs::value_type & sq, changesNOEs) {
+ for (const SubNOEs::value_type & sq : changesNOEs) {
sq->execute(ec);
}
}
diff --git a/project2/sql/sqlTest.cpp b/project2/sql/sqlTest.cpp
index 30b43b8..3c41fef 100644
--- a/project2/sql/sqlTest.cpp
+++ b/project2/sql/sqlTest.cpp
@@ -6,7 +6,6 @@
#include "rdbmsDataSource.h"
#include "commonObjects.h"
#include "sqlVariableBinder.h"
-#include <boost/foreach.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
DECLARE_LOADER("sqltest", SqlTest);
diff --git a/project2/sql/sqlWriter.cpp b/project2/sql/sqlWriter.cpp
index cd9108d..f654636 100644
--- a/project2/sql/sqlWriter.cpp
+++ b/project2/sql/sqlWriter.cpp
@@ -1,7 +1,6 @@
#include <pch.hpp>
#include "sqlWriter.h"
#include "scripts.h"
-#include <boost/foreach.hpp>
#include <boost/bind.hpp>
#include "sqlVariableBinder.h"
@@ -47,7 +46,7 @@ DynamicSql::SqlCommand::SqlCommand(ScriptNodePtr s)
Glib::ustring
DynamicSql::SqlCommand::getSqlFor(const Glib::ustring & f) const
{
- BOOST_FOREACH(const SqlCommand::Filters::value_type & filter, filters) {
+ for (const SqlCommand::Filters::value_type & filter : filters) {
filter.second->active = (filter.second->name == f);
}
Buffer sql;
@@ -58,7 +57,7 @@ DynamicSql::SqlCommand::getSqlFor(const Glib::ustring & f) const
void
DynamicSql::SqlCommand::writeSql(Buffer & sql) const
{
- BOOST_FOREACH(const SqlWriterPtr & w, writers) {
+ for (const SqlWriterPtr & w : writers) {
w->writeSql(sql);
}
}
@@ -66,7 +65,7 @@ DynamicSql::SqlCommand::writeSql(Buffer & sql) const
void
DynamicSql::SqlCommand::bindParams(ExecContext * ec, DB::Command * cmd, unsigned int & offset) const
{
- BOOST_FOREACH(const SqlWriterPtr & w, writers) {
+ for (const SqlWriterPtr & w : writers) {
w->bindParams(ec, cmd, offset);
}
}
@@ -84,7 +83,7 @@ void
DynamicSql::SqlFilter::writeSql(Buffer & sql) const
{
if (active) {
- BOOST_FOREACH(const SqlWriterPtr & w, writers) {
+ for (const SqlWriterPtr & w : writers) {
w->writeSql(sql);
}
}
@@ -94,7 +93,7 @@ void
DynamicSql::SqlFilter::bindParams(ExecContext * ec, DB::Command * cmd, unsigned int & offset) const
{
if (active) {
- BOOST_FOREACH(const SqlWriterPtr & w, writers) {
+ for (const SqlWriterPtr & w : writers) {
w->bindParams(ec, cmd, offset);
}
}