summaryrefslogtreecommitdiff
path: root/libmysqlpp/my-connection.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-12-31 04:59:00 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-12-31 04:59:00 +0000
commit626343c699d42aab176e740f5e75853f51290a49 (patch)
tree8cd84d4a8f7e7af739d627f9db000e8d786bb2c2 /libmysqlpp/my-connection.cpp
parentSet cxxflags specifically, not cflags (diff)
downloadlibdbpp-mysql-626343c699d42aab176e740f5e75853f51290a49.tar.bz2
libdbpp-mysql-626343c699d42aab176e740f5e75853f51290a49.tar.xz
libdbpp-mysql-626343c699d42aab176e740f5e75853f51290a49.zip
Do lots more work with compile time formatter instead runtime formatters
Diffstat (limited to 'libmysqlpp/my-connection.cpp')
-rw-r--r--libmysqlpp/my-connection.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libmysqlpp/my-connection.cpp b/libmysqlpp/my-connection.cpp
index 687572f..c25a97b 100644
--- a/libmysqlpp/my-connection.cpp
+++ b/libmysqlpp/my-connection.cpp
@@ -6,6 +6,7 @@
#include <runtimeContext.h>
#include <ucontext.h>
#include <boost/optional.hpp>
+#include <compileTimeFormatter.h>
NAMEDFACTORY("mysql", MySQL::Connection, DB::ConnectionFactory);
@@ -189,12 +190,12 @@ namespace MySQL {
};
}
+AdHocFormatter(MySQLConnectionLoadData, "LOAD DATA LOCAL INFILE 'any' INTO TABLE %? %?");
void
MySQL::Connection::beginBulkUpload(const char * table, const char * extra)
{
- static char buf[BUFSIZ];
- int len = snprintf(buf, BUFSIZ, "LOAD DATA LOCAL INFILE 'any' INTO TABLE %s %s", table, extra);
- mysql_send_query(&conn, buf, len);
+ auto sql = MySQLConnectionLoadData::get(table, extra);
+ mysql_send_query(&conn, sql.c_str(), sql.length());
ctx = boost::shared_ptr<LoadContext>(new MySQL::LoadContext(&conn));