MXS-1929: Take ResultSet into use
Replaced the previous RESULTSET with the new implementation. As the new ResultSet doesn't have a JSON streaming capability, the MaxInfo JSON interface has been removed. This should not be a big problem as the REST API offers the same information in a more secure and structured way.
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
|
||||
#include <maxscale/cppdefs.hh>
|
||||
#include <map>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <maxscale/resultset.hh>
|
||||
#include "routersession.hh"
|
||||
|
||||
namespace maxscale
|
||||
@ -161,10 +161,6 @@ public:
|
||||
|
||||
void handle_statement(RouterSession* pSession, GWBUF* pStatement);
|
||||
|
||||
virtual RESULT_ROW* create_row(RESULTSET* pResult_set);
|
||||
|
||||
static RESULT_ROW* create_row(RESULTSET* pResult_set, void* pThis);
|
||||
|
||||
int m_counter;
|
||||
bool m_created;
|
||||
};
|
||||
|
@ -218,13 +218,10 @@ void ResultSetBackend::handle_statement(RouterSession* pSession, GWBUF* pStateme
|
||||
|
||||
if (op == QUERY_OP_SELECT)
|
||||
{
|
||||
RESULTSET* pResult_set = resultset_create(ResultSetBackend::create_row, this);
|
||||
resultset_add_column(pResult_set, "a", 4, COL_TYPE_VARCHAR);
|
||||
|
||||
std::unique_ptr<ResultSet> set = ResultSet::create({"a"});
|
||||
set->add_row({std::to_string(++m_counter)});
|
||||
ResultSetDCB dcb;
|
||||
|
||||
resultset_stream_mysql(pResult_set, &dcb);
|
||||
resultset_free(pResult_set);
|
||||
set->write(&dcb);
|
||||
|
||||
enqueue_response(pSession, dcb.create_response());
|
||||
}
|
||||
@ -234,29 +231,6 @@ void ResultSetBackend::handle_statement(RouterSession* pSession, GWBUF* pStateme
|
||||
}
|
||||
}
|
||||
|
||||
RESULT_ROW* ResultSetBackend::create_row(RESULTSET* pResult_set)
|
||||
{
|
||||
RESULT_ROW* pRow = NULL;
|
||||
|
||||
if (!m_created)
|
||||
{
|
||||
pRow = resultset_make_row(pResult_set);
|
||||
char buffer[32];
|
||||
sprintf(buffer, "%d", ++m_counter);
|
||||
resultset_row_set(pRow, 0, buffer);
|
||||
|
||||
m_created = true;
|
||||
}
|
||||
|
||||
return pRow;
|
||||
}
|
||||
|
||||
//static
|
||||
RESULT_ROW* ResultSetBackend::create_row(RESULTSET* pResult_set, void* pThis)
|
||||
{
|
||||
return static_cast<ResultSetBackend*>(pThis)->create_row(pResult_set);
|
||||
}
|
||||
|
||||
} // mock
|
||||
|
||||
} // maxscale
|
||||
|
Reference in New Issue
Block a user