2011-03-03 19:57:34 +00:00
|
|
|
#ifndef MYSQLXX_QUERY_H
|
|
|
|
#define MYSQLXX_QUERY_H
|
|
|
|
|
2011-03-10 20:31:02 +00:00
|
|
|
#include <ostream>
|
2011-03-03 19:57:34 +00:00
|
|
|
|
|
|
|
#include <mysqlxx/UseQueryResult.h>
|
|
|
|
#include <mysqlxx/StoreQueryResult.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace mysqlxx
|
|
|
|
{
|
|
|
|
|
2011-03-10 20:31:02 +00:00
|
|
|
class Query : public std::ostream
|
2011-03-03 19:57:34 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-03-09 20:11:29 +00:00
|
|
|
Query(Connection * conn_, const std::string & query_string);
|
2011-03-03 19:57:34 +00:00
|
|
|
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()
|
|
|
|
{
|
2011-03-10 20:31:02 +00:00
|
|
|
return query_buf.str();
|
2011-03-03 19:57:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-03-09 20:11:29 +00:00
|
|
|
Connection * conn;
|
2011-03-10 20:31:02 +00:00
|
|
|
std::stringbuf query_buf;
|
2011-03-03 19:57:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|