added sqlite query result and enhanced column generator and value extractor
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#ifndef QUERY_ACCESS_HPP
|
||||
#define QUERY_ACCESS_HPP
|
||||
|
||||
#include "matador/utils/cascade_type.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace matador::utils {
|
||||
|
||||
enum class cascade_type;
|
||||
|
||||
template < class Type, template < class ... > class ContainerType >
|
||||
class container;
|
||||
|
||||
|
||||
@@ -15,5 +15,35 @@ namespace matador::utils {
|
||||
*/
|
||||
void replace_all(std::string &in, const std::string &from, const std::string &to);
|
||||
|
||||
const std::string& to_string(const std::string &str);
|
||||
|
||||
/**
|
||||
* Joins a range of elements as string within a list
|
||||
* with a given delimiter and writes it to the
|
||||
* given stream
|
||||
*
|
||||
* @tparam R Type og the range (e.g. map, list, vector, etc)
|
||||
* @param range The range with the elements to join
|
||||
* @param delim The delimiter for the elements
|
||||
* @return The ostream reference
|
||||
*/
|
||||
template < class R >
|
||||
std::string join(R &range, const std::string &delim)
|
||||
{
|
||||
std::string result {};
|
||||
if (range.size() < 2) {
|
||||
for (const auto &i : range) {
|
||||
result += to_string(i);
|
||||
}
|
||||
} else {
|
||||
auto it = range.begin();
|
||||
result += to_string(*it++);
|
||||
for (;it != range.end(); ++it) {
|
||||
result += delim + to_string(*it);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
#endif //QUERY_STRING_HPP
|
||||
|
||||
Reference in New Issue
Block a user