You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
963 B
32 lines
963 B
#include "SelectStatementBuilder.h"
|
|
|
|
namespace db {
|
|
namespace statements {
|
|
namespace builder {
|
|
SelectStatementBuilder &SelectStatementBuilder::columns(const std::string &cols) {
|
|
m_statement.body += "SELECT " + cols;
|
|
return *this;
|
|
}
|
|
|
|
SelectStatementBuilder &SelectStatementBuilder::from_table(const std::string &table) {
|
|
m_statement.body += " FROM " + table + " ";
|
|
return *this;
|
|
}
|
|
|
|
SelectStatementBuilder &SelectStatementBuilder::inner_join(const std::string &table, const std::string &on) {
|
|
m_statement.body += " INNER JOIN " + table + " ON " + on;
|
|
return *this;
|
|
}
|
|
|
|
SelectStatementBuilder &SelectStatementBuilder::where(const std::string &where) {
|
|
m_statement.body += " WHERE " + where;
|
|
return *this;
|
|
}
|
|
|
|
SelectStatementBuilder &SelectStatementBuilder::close() {
|
|
m_statement.body += ";\n";
|
|
return *this;
|
|
}
|
|
}
|
|
}
|
|
}
|