#include "InsertStatementBuilder.h" namespace db { namespace statements { namespace builder { InsertStatementBuilder &InsertStatementBuilder::table(const std::string &table) { m_statement.body += "INSERT INTO " + table + " "; return *this; } InsertStatementBuilder &InsertStatementBuilder::columns(const std::string &cols) { m_statement.body += "(" + cols + ")\n"; return *this; } InsertStatementBuilder &InsertStatementBuilder::values() { m_statement.body += " VALUES "; return *this; } InsertStatementBuilder &InsertStatementBuilder::row(const std::string &values) { m_statement.body += " (" + values + "),\n"; return *this; } InsertStatementBuilder &InsertStatementBuilder::row(const std::vector &values) { m_statement.body += " ("; bool first = true; for(auto const& v : values) { if(first) { first = false; } else { m_statement.body += ","; } m_statement.body += v; } m_statement.body += "),\n"; return *this; } InsertStatementBuilder &InsertStatementBuilder::close() { m_statement.body.pop_back(); m_statement.body.pop_back(); m_statement.body += ";\n"; return *this; } } } }