summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2012-12-02 18:01:55 +0000
committerrandomdan <randomdan@localhost>2012-12-02 18:01:55 +0000
commitf64cb8b599e41432236108783b1ae2573c497f94 (patch)
tree6577967d32df7fc9090332436b2a6af1ccce7c29
parentAdd a basic MySQL connector, not fully functional, but will suffice for p2tv (diff)
downloadproject2-f64cb8b599e41432236108783b1ae2573c497f94.tar.bz2
project2-f64cb8b599e41432236108783b1ae2573c497f94.tar.xz
project2-f64cb8b599e41432236108783b1ae2573c497f94.zip
Keep the same DB connection throughout the bulk load process
-rw-r--r--project2/sql/sqlBulkLoad.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/project2/sql/sqlBulkLoad.cpp b/project2/sql/sqlBulkLoad.cpp
index 4d9604a..b26b0c8 100644
--- a/project2/sql/sqlBulkLoad.cpp
+++ b/project2/sql/sqlBulkLoad.cpp
@@ -23,11 +23,12 @@ class SqlBulkLoad : public Task {
void execute() const
{
- db->getWritable().beginBulkUpload(targetTable(), extras());
+ const DB::Connection & wdb = db->getWritable();
+ wdb.beginBulkUpload(targetTable(), extras());
ScopeObject tidy([]{},
- [=]{ db->getWritable().endBulkUpload(NULL); },
- [=]{ db->getWritable().endBulkUpload("Stack unwind in progress"); });
- stream->runStream(boost::bind(&DB::Connection::bulkUploadData, &db->getWritable(), _1, _2));
+ [&]{ wdb.endBulkUpload(NULL); },
+ [&]{ wdb.endBulkUpload("Stack unwind in progress"); });
+ stream->runStream(boost::bind(&DB::Connection::bulkUploadData, &wdb, _1, _2));
}
const Variable dataSource;