ClickHouse/libs/libmysqlxx/include/mysqlxx/Query.h

56 lines
795 B
C
Raw Normal View History

2011-03-03 19:57:34 +00:00
#ifndef MYSQLXX_QUERY_H
#define MYSQLXX_QUERY_H
#include <sstream>
#include <mysqlxx/UseQueryResult.h>
#include <mysqlxx/StoreQueryResult.h>
namespace mysqlxx
{
class Query
{
public:
Query(Connection & conn_, const std::string & query_string);
Query(const Query & other);
2011-03-05 20:47:46 +00:00
Query & operator= (const Query & other);
2011-03-03 19:57:34 +00:00
void reset();
void execute();
UseQueryResult use();
StoreQueryResult store();
2011-03-05 16:56:30 +00:00
UInt64 insertID();
/// Для совместимости
UInt64 insert_id() { return insertID(); }
2011-03-04 20:58:19 +00:00
std::string str()
{
return query_stream.str();
}
2011-03-05 20:47:46 +00:00
std::ostream & ostr()
{
return query_stream;
}
2011-03-03 19:57:34 +00:00
template <typename T>
2011-03-04 20:58:19 +00:00
Query & operator<< (const T & x)
2011-03-03 19:57:34 +00:00
{
query_stream << x;
return *this;
}
private:
Connection & conn;
std::stringstream query_stream;
};
}
#endif