10 #include "pol_global_config.h" 15 #include "../clib/Header_Windows.h" 18 #include <mysql/mysql.h> 25 #include "../bscript/bobject.h" 26 #include "../clib/compilerspecifics.h" 27 #include "../clib/message_queue.h" 28 #include "../clib/rawtypes.h" 49 void set( MYSQL_RES* result );
60 BSQLRow( RES_WRAPPER resultset );
63 BSQLRow( RES_WRAPPER _result, MYSQL_ROW _row, MYSQL_FIELD* _fields );
72 virtual std::string
getStringRep() const POL_OVERRIDE {
return "SQLRow"; }
75 return sizeof( *this ) +
sizeof( MYSQL_FIELD );
77 virtual const char*
typeOf() const POL_OVERRIDE {
return "SQLRow"; }
78 virtual u8 typeOfInt() const POL_OVERRIDE {
return OTSQLRow; }
79 virtual bool isTrue() const POL_OVERRIDE {
return _row != 0; };
95 int num_fields()
const;
96 int affected_rows()
const;
97 const char* field_name(
unsigned int index )
const;
103 return sizeof( *this ) +
sizeof( MYSQL_FIELD );
105 virtual const char*
typeOf() const POL_OVERRIDE {
return "SQLResultSet"; }
106 virtual u8 typeOfInt() const POL_OVERRIDE {
return OTSQLResultSet; }
130 bool connect(
const char* host,
const char* user,
const char* passwd );
131 bool query(
const std::string query );
132 bool query(
const std::string query,
const QueryParams params );
133 bool select_db(
const char* db );
137 std::string getLastError()
const;
138 int getLastErrNo()
const;
139 std::shared_ptr<ConnectionWrapper> getConnection()
const;
149 virtual size_t sizeEstimate() const POL_OVERRIDE {
return sizeof( *this ) + _error.capacity(); }
150 virtual const char*
typeOf() const POL_OVERRIDE {
return "SQLConnection"; }
151 virtual u8 typeOfInt() const POL_OVERRIDE {
return OTSQLConnection; }
156 std::shared_ptr<ConnectionWrapper>
_conn;
165 void set( MYSQL* conn );
176 typedef std::function<void()>
msg;
182 void push( msg&& msg_ );
virtual size_t sizeEstimate() const POL_OVERRIDE
Clib::message_queue< msg > msg_queue
virtual size_t sizeEstimate() const POL_OVERRIDE
virtual u8 typeOfInt() const POL_OVERRIDE
virtual const char * typeOf() const POL_OVERRIDE
virtual u8 typeOfInt() const POL_OVERRIDE
virtual size_t sizeEstimate() const POL_OVERRIDE
std::shared_ptr< QueryParam > QueryParams
std::function< void()> msg
virtual const char * typeOf() const POL_OVERRIDE
virtual u8 typeOfInt() const POL_OVERRIDE
std::shared_ptr< ResultWrapper > RES_WRAPPER
virtual const char * typeOf() const POL_OVERRIDE
virtual std::string getStringRep() const POL_OVERRIDE
std::vector< std::string > QueryParam
std::shared_ptr< ConnectionWrapper > _conn
virtual bool isTrue() const POL_OVERRIDE