Drizzled Public API Documentation

drizzle_plugin::json_server::SQLToJsonGenerator Class Reference

#include <sql_to_json_generator.h>

Public Member Functions

 SQLToJsonGenerator (Json::Value &json_out, const char *schema, const char *table, SQLExecutor *sqlExecutor)
 
void generateSQLErrorJson ()
 
void generateJson (enum evhttp_cmd_type type)
 
Json::Value getJson () const
 

Private Member Functions

void generateGetJson ()
 
void generatePostJson ()
 
void generateDeleteJson ()
 

Private Attributes

Json::Value _json_out
 
SQLExecutor_sql_executor
 
const char * _schema
 
const char * _table
 

Detailed Description

Generate output json object.

Definition at line 44 of file sql_to_json_generator.h.

Constructor & Destructor Documentation

drizzle_plugin::json_server::SQLToJsonGenerator::SQLToJsonGenerator ( Json::Value json_out,
const char *  schema,
const char *  table,
SQLExecutor sqlExecutor 
)

Constructor

Parameters
json_inThe input json object.
schemaThe schema that was used.
tableThe table that was used.
sqlExecutorSQLExecutor instance that contains the result set or error from an executed sql query.

Definition at line 33 of file sql_to_json_generator.cc.

Member Function Documentation

void drizzle_plugin::json_server::SQLToJsonGenerator::generateDeleteJson ( )
private

Used to generate json string corresponds to DELETE request.

Definition at line 111 of file sql_to_json_generator.cc.

void drizzle_plugin::json_server::SQLToJsonGenerator::generateGetJson ( )
private

Used to generate json string corresponds to GET request.

Definition at line 64 of file sql_to_json_generator.cc.

References Json::Value::append(), drizzled::sql::ResultSet::getColumnInfo(), and Json::Reader::parse().

void drizzle_plugin::json_server::SQLToJsonGenerator::generateJson ( enum evhttp_cmd_type  type)

Used to generate a json string corresponds to request type.

Parameters
typeGET, POST or DELETE.

Definition at line 54 of file sql_to_json_generator.cc.

Referenced by drizzle_plugin::json_server::DBAccess::execute().

void drizzle_plugin::json_server::SQLToJsonGenerator::generatePostJson ( )
private

Used to generate json string corresponds to POST request.

Definition at line 105 of file sql_to_json_generator.cc.

void drizzle_plugin::json_server::SQLToJsonGenerator::generateSQLErrorJson ( )

Used to generate error json string.

Definition at line 42 of file sql_to_json_generator.cc.

Referenced by drizzle_plugin::json_server::DBAccess::execute().

Json::Value drizzle_plugin::json_server::SQLToJsonGenerator::getJson ( ) const
inline

Used to get the output json object.

Returns
a json object.

Definition at line 69 of file sql_to_json_generator.h.

Referenced by drizzle_plugin::json_server::DBAccess::execute().

Member Data Documentation

Json::Value drizzle_plugin::json_server::SQLToJsonGenerator::_json_out
private

Stores output json object.

Todo:
Note that building the returned json string as a Json::Value object first - basically this is a full copy of the result_set - is inefficient for larger result sets. Better would be to find a streaming json parser. However, it should be notable that Execute API already stores the result set in a std::vector anyway, so we are not making the situation worse here.

Definition at line 84 of file sql_to_json_generator.h.

const char* drizzle_plugin::json_server::SQLToJsonGenerator::_schema
private

Stores schema being used.

Definition at line 92 of file sql_to_json_generator.h.

SQLExecutor* drizzle_plugin::json_server::SQLToJsonGenerator::_sql_executor
private

Stores instance of sqlExecutor object.

Definition at line 88 of file sql_to_json_generator.h.

const char* drizzle_plugin::json_server::SQLToJsonGenerator::_table
private

Stores table being used.

Definition at line 96 of file sql_to_json_generator.h.


The documentation for this class was generated from the following files: