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.
 
 
 
 

38 lines
1.1 KiB

#include "SelectStatementBuilder.h"
namespace db {
namespace statements {
namespace builder {
SelectStatementBuilder &SelectStatementBuilder::exists() {
m_statement.body.insert(0, "SELECT EXISTS(");
m_statement.body += " LIMIT 1);";
return *this;
}
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;
}
}
}
}