Format rest of the sources

This commit is contained in:
Markus Mäkelä
2019-05-09 11:31:40 +03:00
parent fbd61967a7
commit de95fcc9d6
29 changed files with 384 additions and 388 deletions

View File

@ -50,12 +50,12 @@ bool maxavro_datablock_finalize(MAXAVRO_DATABLOCK* block);
/** Adding values to a datablock. The caller must ensure that the inserted /** Adding values to a datablock. The caller must ensure that the inserted
* values conform to the file schema and that the required amount of fields * values conform to the file schema and that the required amount of fields
* is added before finalizing the block. */ * is added before finalizing the block. */
bool maxavro_datablock_add_integer(MAXAVRO_DATABLOCK *file, uint64_t val); bool maxavro_datablock_add_integer(MAXAVRO_DATABLOCK* file, uint64_t val);
bool maxavro_datablock_add_string(MAXAVRO_DATABLOCK *file, const char* str); bool maxavro_datablock_add_string(MAXAVRO_DATABLOCK* file, const char* str);
bool maxavro_datablock_add_float(MAXAVRO_DATABLOCK *file, float val); bool maxavro_datablock_add_float(MAXAVRO_DATABLOCK* file, float val);
bool maxavro_datablock_add_double(MAXAVRO_DATABLOCK *file, double val); bool maxavro_datablock_add_double(MAXAVRO_DATABLOCK* file, double val);
bool maxavro_read_datablock_start(MAXAVRO_FILE *file); bool maxavro_read_datablock_start(MAXAVRO_FILE* file);
bool maxavro_verify_block(MAXAVRO_FILE *file); bool maxavro_verify_block(MAXAVRO_FILE* file);
const char* type_to_string(enum maxavro_value_type type); const char* type_to_string(enum maxavro_value_type type);
enum maxavro_value_type string_to_type(const char *str); enum maxavro_value_type string_to_type(const char* str);

View File

@ -26,7 +26,9 @@
* @param field_num Field index in the schema * @param field_num Field index in the schema
* @return JSON object or NULL if an error occurred * @return JSON object or NULL if an error occurred
*/ */
static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *field, enum maxavro_value_type type) static json_t* read_and_pack_value(MAXAVRO_FILE* file,
MAXAVRO_SCHEMA_FIELD* field,
enum maxavro_value_type type)
{ {
json_t* value = NULL; json_t* value = NULL;
switch (type) switch (type)
@ -107,7 +109,7 @@ static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *fie
case MAXAVRO_TYPE_UNION: case MAXAVRO_TYPE_UNION:
{ {
json_t *arr = (json_t*)field->extra; json_t* arr = (json_t*)field->extra;
uint64_t val = 0; uint64_t val = 0;
if (maxavro_read_integer(file, &val) && val < json_array_size(arr)) if (maxavro_read_integer(file, &val) && val < json_array_size(arr))
@ -187,7 +189,9 @@ json_t* maxavro_record_read_json(MAXAVRO_FILE* file)
{ {
for (size_t i = 0; i < file->schema->num_fields; i++) for (size_t i = 0; i < file->schema->num_fields; i++)
{ {
json_t* value = read_and_pack_value(file, &file->schema->fields[i], file->schema->fields[i].type); json_t* value = read_and_pack_value(file,
&file->schema->fields[i],
file->schema->fields[i].type);
if (value) if (value)
{ {
json_object_set_new(object, file->schema->fields[i].name, value); json_object_set_new(object, file->schema->fields[i].name, value);

View File

@ -51,8 +51,8 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
NULL, /* Thread init. */ NULL, /* Thread init. */
NULL, /* Thread finish. */ NULL, /* Thread finish. */
{ {
{"an_example_parameter", MXS_MODULE_PARAM_STRING, "a-default-value"}, {"an_example_parameter",MXS_MODULE_PARAM_STRING, "a-default-value"},
{CN_COUNT_GLOBALS, MXS_MODULE_PARAM_BOOL, "true"}, {CN_COUNT_GLOBALS, MXS_MODULE_PARAM_BOOL, "true" },
{MXS_END_MODULE_PARAMS} {MXS_END_MODULE_PARAMS}
} }
}; };

View File

@ -58,7 +58,8 @@ public:
{ {
TimePoint time_point; TimePoint time_point;
int count; int count;
Timestamp(TimePoint p, int c) : time_point(p) Timestamp(TimePoint p, int c)
: time_point(p)
, count(c) , count(c)
{ {
} }

View File

@ -38,5 +38,4 @@ std::string to_binary_size(int64_t size);
* @return The result string * @return The result string
*/ */
std::string string_printf(const char* format, ...) mxb_attribute((format (printf, 1, 2))); std::string string_printf(const char* format, ...) mxb_attribute((format (printf, 1, 2)));
} }

View File

@ -117,5 +117,4 @@ inline bool operator!=(const Host& l, const Host& r)
* @return True on success * @return True on success
*/ */
bool reverse_dns(const std::string& ip, std::string* output); bool reverse_dns(const std::string& ip, std::string* output);
} }

View File

@ -76,7 +76,7 @@ struct Result
OPERATION_TIMEDOUT = -3 // The operation timed out. OPERATION_TIMEDOUT = -3 // The operation timed out.
}; };
int code = 0; // HTTP response code int code = 0;// HTTP response code
std::string body; // Response body std::string body; // Response body
std::map<std::string, std::string> headers; // Headers attached to the response std::map<std::string, std::string> headers; // Headers attached to the response
}; };
@ -197,7 +197,7 @@ public:
* *
* @return *this. * @return *this.
*/ */
Async& operator = (const Async& rhs) Async& operator=(const Async& rhs)
{ {
std::shared_ptr<Imp> sImp(rhs.m_sImp); std::shared_ptr<Imp> sImp(rhs.m_sImp);
m_sImp.swap(sImp); m_sImp.swap(sImp);
@ -307,7 +307,5 @@ Async get_async(const std::vector<std::string>& urls,
Async get_async(const std::vector<std::string>& urls, Async get_async(const std::vector<std::string>& urls,
const std::string& user, const std::string& password, const std::string& user, const std::string& password,
const Config& config = Config()); const Config& config = Config());
} }
} }

View File

@ -51,17 +51,17 @@ public:
return prev; return prev;
} }
bool operator == (const intrusive_slist_iterator& rhs) const bool operator==(const intrusive_slist_iterator& rhs) const
{ {
return m_pT == rhs.m_pT; return m_pT == rhs.m_pT;
} }
bool operator != (const intrusive_slist_iterator& rhs) const bool operator!=(const intrusive_slist_iterator& rhs) const
{ {
return !(m_pT == rhs.m_pT); return !(m_pT == rhs.m_pT);
} }
T& operator * () const T& operator*() const
{ {
mxb_assert(m_pT); mxb_assert(m_pT);
return *m_pT; return *m_pT;
@ -70,5 +70,4 @@ public:
private: private:
T* m_pT; T* m_pT;
}; };
} }

View File

@ -17,9 +17,9 @@
namespace maxbase namespace maxbase
{ {
class PamResult class PamResult
{ {
public: public:
enum class Result enum class Result
{ {
SUCCESS, SUCCESS,
@ -30,9 +30,9 @@ namespace maxbase
Result type {Result::MISC_ERROR}; Result type {Result::MISC_ERROR};
std::string error; std::string error;
}; };
/** /**
* Check if the user & password can log into the given PAM service. This function will block until the * Check if the user & password can log into the given PAM service. This function will block until the
* operation completes. * operation completes.
* *
@ -43,6 +43,6 @@ namespace maxbase
* Typically "Password: ", which is also the default value. If set to empty, the message is not checked. * Typically "Password: ", which is also the default value. If set to empty, the message is not checked.
* @return A result struct with the result and an error message. * @return A result struct with the result and an error message.
*/ */
PamResult pam_authenticate(const std::string& user, const std::string& password, PamResult pam_authenticate(const std::string& user, const std::string& password,
const std::string& service, const std::string& expected_msg = "Password: "); const std::string& service, const std::string& expected_msg = "Password: ");
} }

View File

@ -55,7 +55,8 @@ namespace
struct TimePointLessEqual struct TimePointLessEqual
{ {
TimePoint lhs; TimePoint lhs;
TimePointLessEqual(TimePoint tp) : lhs(tp) TimePointLessEqual(TimePoint tp)
: lhs(tp)
{ {
} }
bool operator()(const EventCount::Timestamp& rhs) const bool operator()(const EventCount::Timestamp& rhs) const
@ -134,7 +135,8 @@ namespace
struct MatchEventId struct MatchEventId
{ {
std::string event_id; std::string event_id;
MatchEventId(const std::string& id) : event_id(id) MatchEventId(const std::string& id)
: event_id(id)
{ {
} }
bool operator()(const EventCount& stats) const bool operator()(const EventCount& stats) const

View File

@ -95,5 +95,4 @@ std::string string_printf(const char* format, ...)
} }
return rval; return rval;
} }
} }

View File

@ -271,5 +271,4 @@ bool reverse_dns(const std::string& ip, std::string* output)
} }
return success; return success;
} }
} }

View File

@ -117,7 +117,7 @@ size_t header_callback(char* ptr, size_t size, size_t nmemb, void* userdata)
CURL* get_easy_curl(const std::string& url, CURL* get_easy_curl(const std::string& url,
const std::string& user, const std::string& password, const std::string& user, const std::string& password,
const Config& config, const Config& config,
Result *pRes, Result* pRes,
char* pErrbuf) char* pErrbuf)
{ {
CURL* pCurl = curl_easy_init(); CURL* pCurl = curl_easy_init();
@ -126,8 +126,10 @@ CURL* get_easy_curl(const std::string& url,
if (pCurl) if (pCurl)
{ {
checked_curl_setopt(pCurl, CURLOPT_NOSIGNAL, 1); checked_curl_setopt(pCurl, CURLOPT_NOSIGNAL, 1);
checked_curl_setopt(pCurl, CURLOPT_CONNECTTIMEOUT, config.connect_timeout_s);// For connection phase checked_curl_setopt(pCurl, CURLOPT_CONNECTTIMEOUT, config.connect_timeout_s); // For connection
checked_curl_setopt(pCurl, CURLOPT_TIMEOUT, config.timeout_s); // For data transfer phase // phase
checked_curl_setopt(pCurl, CURLOPT_TIMEOUT, config.timeout_s); // For data transfer
// phase
checked_curl_setopt(pCurl, CURLOPT_ERRORBUFFER, pErrbuf); checked_curl_setopt(pCurl, CURLOPT_ERRORBUFFER, pErrbuf);
checked_curl_setopt(pCurl, CURLOPT_WRITEFUNCTION, write_callback); checked_curl_setopt(pCurl, CURLOPT_WRITEFUNCTION, write_callback);
checked_curl_setopt(pCurl, CURLOPT_WRITEDATA, &pRes->body); checked_curl_setopt(pCurl, CURLOPT_WRITEDATA, &pRes->body);
@ -169,7 +171,7 @@ struct Context
} }
mxb::http::Result* pResult; mxb::http::Result* pResult;
Errbuf * pErrbuf; Errbuf* pErrbuf;
}; };
class ReadyImp : public Async::Imp class ReadyImp : public Async::Imp
@ -228,7 +230,7 @@ public:
for (auto& item : m_curls) for (auto& item : m_curls)
{ {
CURL* pCurl = item.first; CURL* pCurl = item.first;
MXB_AT_DEBUG(CURLMcode rv =) curl_multi_remove_handle(m_pCurlm, pCurl); MXB_AT_DEBUG(CURLMcode rv = ) curl_multi_remove_handle(m_pCurlm, pCurl);
mxb_assert(rv == CURLM_OK); mxb_assert(rv == CURLM_OK);
curl_easy_cleanup(pCurl); curl_easy_cleanup(pCurl);
} }
@ -440,7 +442,6 @@ private:
int m_still_running; int m_still_running;
long m_wait_no_more_than; long m_wait_no_more_than;
}; };
} }
@ -614,7 +615,5 @@ const char* to_string(Async::status_t status)
mxb_assert(!true); mxb_assert(!true);
return "Unknown"; return "Unknown";
} }
} }
} }

View File

@ -97,7 +97,6 @@ int conversation_func(int num_msg,
} }
return rval; return rval;
} }
} }
namespace maxbase namespace maxbase
@ -171,5 +170,4 @@ PamResult pam_authenticate(const string& user, const string& password, const str
pam_end(pam_handle, pam_status); pam_end(pam_handle, pam_status);
return result; return result;
} }
} }

View File

@ -19,7 +19,6 @@ namespace
{ {
thread_local char errbuf[512]; // Enough for all errors thread_local char errbuf[512]; // Enough for all errors
} }
const char* mxb_strerror(int error) const char* mxb_strerror(int error)
@ -73,5 +72,4 @@ char* trim(char* str)
{ {
return ltrim(rtrim(str)); return ltrim(rtrim(str));
} }
} }

View File

@ -103,8 +103,8 @@ int test_multi_http()
{ {
cout << __func__ << endl; cout << __func__ << endl;
vector<string> urls = { "http://www.example.com/", "http://www.example.com/", "http://non-existent.xyz" }; vector<string> urls = {"http://www.example.com/", "http://www.example.com/", "http://non-existent.xyz"};
vector<bool> expected_successes = { true, true, false }; vector<bool> expected_successes = {true, true, false};
vector<mxb::http::Result> results = mxb::http::get(urls); vector<mxb::http::Result> results = mxb::http::get(urls);
int rv = check_results(urls, expected_successes, results); int rv = check_results(urls, expected_successes, results);
@ -118,8 +118,8 @@ int test_async_http()
int rv = EXIT_FAILURE; int rv = EXIT_FAILURE;
vector<string> urls = { "http://www.example.com/", "http://www.example.com/", "http://non-existent.xyz" }; vector<string> urls = {"http://www.example.com/", "http://www.example.com/", "http://non-existent.xyz"};
vector<bool> expected_successes = { true, true, false }; vector<bool> expected_successes = {true, true, false};
mxb::http::Async http = mxb::http::get_async(urls); mxb::http::Async http = mxb::http::get_async(urls);
while (http.perform(0) == mxb::http::Async::PENDING) while (http.perform(0) == mxb::http::Async::PENDING)
@ -148,7 +148,6 @@ int test_async_http()
return rv == EXIT_FAILURE ? 1 : 0; return rv == EXIT_FAILURE ? 1 : 0;
} }
} }
uint64_t time_since_epoch_ms() uint64_t time_since_epoch_ms()

View File

@ -116,7 +116,6 @@ int test_rtrim()
cout << "rtrim()" << endl; cout << "rtrim()" << endl;
return test(rtrim_testcases, n_rtrim_testcases, mxb::rtrim); return test(rtrim_testcases, n_rtrim_testcases, mxb::rtrim);
} }
} }
int main(int argc, char* argv[]) int main(int argc, char* argv[])

View File

@ -333,5 +333,4 @@ bool QueryResult::ConversionError::error() const
{ {
return !m_target_type.empty(); return !m_target_type.empty();
} }
} }

View File

@ -3603,8 +3603,8 @@ int32_t qc_mysql_set_options(uint32_t options)
extern "C" extern "C"
{ {
MXS_MODULE* MXS_CREATE_MODULE() MXS_MODULE* MXS_CREATE_MODULE()
{ {
static QUERY_CLASSIFIER qc = static QUERY_CLASSIFIER qc =
{ {
qc_mysql_setup, qc_mysql_setup,
@ -3655,5 +3655,5 @@ extern "C"
}; };
return &info; return &info;
} }
} }

View File

@ -192,13 +192,13 @@ static const char* get_token_symbol(int token);
extern "C" extern "C"
{ {
extern void exposed_sqlite3ExprDelete(sqlite3* db, Expr* pExpr); extern void exposed_sqlite3ExprDelete(sqlite3* db, Expr* pExpr);
extern void exposed_sqlite3ExprListDelete(sqlite3* db, ExprList* pList); extern void exposed_sqlite3ExprListDelete(sqlite3* db, ExprList* pList);
extern void exposed_sqlite3IdListDelete(sqlite3* db, IdList* pList); extern void exposed_sqlite3IdListDelete(sqlite3* db, IdList* pList);
extern void exposed_sqlite3SrcListDelete(sqlite3* db, SrcList* pList); extern void exposed_sqlite3SrcListDelete(sqlite3* db, SrcList* pList);
extern void exposed_sqlite3SelectDelete(sqlite3* db, Select* p); extern void exposed_sqlite3SelectDelete(sqlite3* db, Select* p);
extern void exposed_sqlite3BeginTrigger(Parse* pParse, extern void exposed_sqlite3BeginTrigger(Parse* pParse,
Token* pName1, Token* pName1,
Token* pName2, Token* pName2,
int tr_tm, int tr_tm,
@ -208,25 +208,25 @@ extern "C"
Expr* pWhen, Expr* pWhen,
int isTemp, int isTemp,
int noErr); int noErr);
extern void exposed_sqlite3FinishTrigger(Parse* pParse, extern void exposed_sqlite3FinishTrigger(Parse* pParse,
TriggerStep* pStepList, TriggerStep* pStepList,
Token* pAll); Token* pAll);
extern int exposed_sqlite3Dequote(char* z); extern int exposed_sqlite3Dequote(char* z);
extern int exposed_sqlite3EndTable(Parse*, Token*, Token*, u8, Select*); extern int exposed_sqlite3EndTable(Parse*, Token*, Token*, u8, Select*);
extern void exposed_sqlite3Insert(Parse* pParse, extern void exposed_sqlite3Insert(Parse* pParse,
SrcList* pTabList, SrcList* pTabList,
Select* pSelect, Select* pSelect,
IdList* pColumns, IdList* pColumns,
int onError); int onError);
extern int exposed_sqlite3Select(Parse* pParse, Select* p, SelectDest* pDest); extern int exposed_sqlite3Select(Parse* pParse, Select* p, SelectDest* pDest);
extern void exposed_sqlite3StartTable(Parse* pParse,/* Parser context */ extern void exposed_sqlite3StartTable(Parse* pParse, /* Parser context */
Token* pName1,/* First part of the name of the table or view */ Token* pName1, /* First part of the name of the table or view */
Token* pName2,/* Second part of the name of the table or view */ Token* pName2, /* Second part of the name of the table or view */
int isTemp, /* True if this is a TEMP table */ int isTemp, /* True if this is a TEMP table */
int isView, /* True if this is a VIEW */ int isView, /* True if this is a VIEW */
int isVirtual,/* True if this is a VIRTUAL table */ int isVirtual, /* True if this is a VIRTUAL table */
int noErr); /* Do nothing if table already exists */ int noErr); /* Do nothing if table already exists */
extern void exposed_sqlite3Update(Parse* pParse, extern void exposed_sqlite3Update(Parse* pParse,
SrcList* pTabList, SrcList* pTabList,
ExprList* pChanges, ExprList* pChanges,
Expr* pWhere, Expr* pWhere,
@ -1268,7 +1268,10 @@ public:
if (pSrc->a[i].pSelect) if (pSrc->a[i].pSelect)
{ {
update_field_infos_from_select(aliases, context | QC_FIELD_SUBQUERY, pSrc->a[i].pSelect, pExclude); update_field_infos_from_select(aliases,
context | QC_FIELD_SUBQUERY,
pSrc->a[i].pSelect,
pExclude);
} }
#ifdef QC_COLLECT_NAMES_FROM_USING #ifdef QC_COLLECT_NAMES_FROM_USING
@ -1613,13 +1616,15 @@ public:
} }
} }
void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement */ void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement
* */
Token* pName1, /* The name of the trigger */ Token* pName1, /* The name of the trigger */
Token* pName2, /* The name of the trigger */ Token* pName2, /* The name of the trigger */
int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */ int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */ int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
IdList* pColumns, /* column list if this is an UPDATE OF trigger */ IdList* pColumns, /* column list if this is an UPDATE OF trigger */
SrcList* pTableName, /* The name of the table/view the trigger applies to */ SrcList* pTableName, /* The name of the table/view the trigger applies to
* */
Expr* pWhen, /* WHEN clause */ Expr* pWhen, /* WHEN clause */
int isTemp, /* True if the TEMPORARY keyword is present */ int isTemp, /* True if the TEMPORARY keyword is present */
int noErr) /* Suppress errors if the trigger already exists */ int noErr) /* Suppress errors if the trigger already exists */
@ -3431,12 +3436,12 @@ public:
extern "C" extern "C"
{ {
extern void mxs_sqlite3AlterFinishAddColumn(Parse*, Token*); extern void mxs_sqlite3AlterFinishAddColumn(Parse*, Token*);
extern void mxs_sqlite3AlterBeginAddColumn(Parse*, SrcList*); extern void mxs_sqlite3AlterBeginAddColumn(Parse*, SrcList*);
extern void mxs_sqlite3Analyze(Parse*, SrcList*); extern void mxs_sqlite3Analyze(Parse*, SrcList*);
extern void mxs_sqlite3BeginTransaction(Parse*, int token, int type); extern void mxs_sqlite3BeginTransaction(Parse*, int token, int type);
extern void mxs_sqlite3CommitTransaction(Parse*); extern void mxs_sqlite3CommitTransaction(Parse*);
extern void mxs_sqlite3CreateIndex(Parse*, extern void mxs_sqlite3CreateIndex(Parse*,
Token*, Token*,
Token*, Token*,
SrcList*, SrcList*,
@ -3446,7 +3451,7 @@ extern "C"
Expr*, Expr*,
int, int,
int); int);
extern void mxs_sqlite3BeginTrigger(Parse*, extern void mxs_sqlite3BeginTrigger(Parse*,
Token*, Token*,
Token*, Token*,
int, int,
@ -3456,53 +3461,53 @@ extern "C"
Expr*, Expr*,
int, int,
int); int);
extern void mxs_sqlite3FinishTrigger(Parse*, TriggerStep*, Token*); extern void mxs_sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);
extern void mxs_sqlite3CreateView(Parse*, Token*, Token*, Token*, ExprList*, Select*, int, int); extern void mxs_sqlite3CreateView(Parse*, Token*, Token*, Token*, ExprList*, Select*, int, int);
extern void mxs_sqlite3DeleteFrom(Parse* pParse, SrcList* pTabList, Expr* pWhere, SrcList* pUsing); extern void mxs_sqlite3DeleteFrom(Parse* pParse, SrcList* pTabList, Expr* pWhere, SrcList* pUsing);
extern void mxs_sqlite3DropIndex(Parse*, SrcList*, SrcList*, int); extern void mxs_sqlite3DropIndex(Parse*, SrcList*, SrcList*, int);
extern void mxs_sqlite3DropTable(Parse*, SrcList*, int, int, int); extern void mxs_sqlite3DropTable(Parse*, SrcList*, int, int, int);
extern void mxs_sqlite3EndTable(Parse*, Token*, Token*, u8, Select*, SrcList*); extern void mxs_sqlite3EndTable(Parse*, Token*, Token*, u8, Select*, SrcList*);
extern void mxs_sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, ExprList*); extern void mxs_sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, ExprList*);
extern void mxs_sqlite3RollbackTransaction(Parse*); extern void mxs_sqlite3RollbackTransaction(Parse*);
extern void mxs_sqlite3Savepoint(Parse* pParse, int op, Token* pName); extern void mxs_sqlite3Savepoint(Parse* pParse, int op, Token* pName);
extern int mxs_sqlite3Select(Parse*, Select*, SelectDest*); extern int mxs_sqlite3Select(Parse*, Select*, SelectDest*);
extern void mxs_sqlite3StartTable(Parse*, Token*, Token*, int, int, int, int); extern void mxs_sqlite3StartTable(Parse*, Token*, Token*, int, int, int, int);
extern void mxs_sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); extern void mxs_sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);
extern void maxscaleCollectInfoFromSelect(Parse*, Select*, int); extern void maxscaleCollectInfoFromSelect(Parse*, Select*, int);
extern void maxscaleAlterTable(Parse*, mxs_alter_t command, SrcList*, Token*); extern void maxscaleAlterTable(Parse*, mxs_alter_t command, SrcList*, Token*);
extern void maxscaleCall(Parse*, SrcList* pName, ExprList* pExprList); extern void maxscaleCall(Parse*, SrcList* pName, ExprList* pExprList);
extern void maxscaleCheckTable(Parse*, SrcList* pTables); extern void maxscaleCheckTable(Parse*, SrcList* pTables);
extern void maxscaleCreateSequence(Parse*, Token* pDatabase, Token* pTable); extern void maxscaleCreateSequence(Parse*, Token* pDatabase, Token* pTable);
extern void maxscaleDeclare(Parse* pParse); extern void maxscaleDeclare(Parse* pParse);
extern void maxscaleDeallocate(Parse*, Token* pName); extern void maxscaleDeallocate(Parse*, Token* pName);
extern void maxscaleDo(Parse*, ExprList* pEList); extern void maxscaleDo(Parse*, ExprList* pEList);
extern void maxscaleDrop(Parse*, int what, Token* pDatabase, Token* pName); extern void maxscaleDrop(Parse*, int what, Token* pDatabase, Token* pName);
extern void maxscaleExecute(Parse*, Token* pName, int type_mask); extern void maxscaleExecute(Parse*, Token* pName, int type_mask);
extern void maxscaleExecuteImmediate(Parse*, Token* pName, ExprSpan* pExprSpan, int type_mask); extern void maxscaleExecuteImmediate(Parse*, Token* pName, ExprSpan* pExprSpan, int type_mask);
extern void maxscaleExplain(Parse*, Token* pNext); extern void maxscaleExplain(Parse*, Token* pNext);
extern void maxscaleFlush(Parse*, Token* pWhat); extern void maxscaleFlush(Parse*, Token* pWhat);
extern void maxscaleHandler(Parse*, mxs_handler_t, SrcList* pFullName, Token* pName); extern void maxscaleHandler(Parse*, mxs_handler_t, SrcList* pFullName, Token* pName);
extern void maxscaleLoadData(Parse*, SrcList* pFullName, int local); extern void maxscaleLoadData(Parse*, SrcList* pFullName, int local);
extern void maxscaleLock(Parse*, mxs_lock_t, SrcList*); extern void maxscaleLock(Parse*, mxs_lock_t, SrcList*);
extern void maxscalePrepare(Parse*, Token* pName, Expr* pStmt); extern void maxscalePrepare(Parse*, Token* pName, Expr* pStmt);
extern void maxscalePrivileges(Parse*, int kind); extern void maxscalePrivileges(Parse*, int kind);
extern void maxscaleRenameTable(Parse*, SrcList* pTables); extern void maxscaleRenameTable(Parse*, SrcList* pTables);
extern void maxscaleReset(Parse*, int what); extern void maxscaleReset(Parse*, int what);
extern void maxscaleSet(Parse*, int scope, mxs_set_t kind, ExprList*); extern void maxscaleSet(Parse*, int scope, mxs_set_t kind, ExprList*);
extern void maxscaleShow(Parse*, MxsShow* pShow); extern void maxscaleShow(Parse*, MxsShow* pShow);
extern void maxscaleTruncate(Parse*, Token* pDatabase, Token* pName); extern void maxscaleTruncate(Parse*, Token* pDatabase, Token* pName);
extern void maxscaleUse(Parse*, Token*); extern void maxscaleUse(Parse*, Token*);
extern void maxscale_update_function_info(const char* name, const Expr* pExpr); extern void maxscale_update_function_info(const char* name, const Expr* pExpr);
// 'unsigned int' and not 'uint32_t' because 'uint32_t' is unknown in sqlite3 context. // 'unsigned int' and not 'uint32_t' because 'uint32_t' is unknown in sqlite3 context.
extern void maxscale_set_type_mask(unsigned int type_mask); extern void maxscale_set_type_mask(unsigned int type_mask);
extern int maxscaleComment(); extern int maxscaleComment();
extern int maxscaleKeyword(int token); extern int maxscaleKeyword(int token);
extern void maxscaleSetStatusCap(int cap); extern void maxscaleSetStatusCap(int cap);
extern int maxscaleTranslateKeyword(int token); extern int maxscaleTranslateKeyword(int token);
} }
/** /**
@ -5323,8 +5328,8 @@ QC_STMT_RESULT qc_sqlite_get_result_from_info(const QC_STMT_INFO* pInfo)
extern "C" extern "C"
{ {
MXS_MODULE* MXS_CREATE_MODULE() MXS_MODULE* MXS_CREATE_MODULE()
{ {
static QUERY_CLASSIFIER qc = static QUERY_CLASSIFIER qc =
{ {
qc_sqlite_setup, qc_sqlite_setup,
@ -5375,5 +5380,5 @@ extern "C"
}; };
return &info; return &info;
} }
} }

View File

@ -70,8 +70,7 @@ int test()
string valid_json("SELECT Json_Array(56, 3.1416, 'My name is \"Foo\"', NULL)"); string valid_json("SELECT Json_Array(56, 3.1416, 'My name is \"Foo\"', NULL)");
string invalid_json("SELECT Json_Foo(56, 3.1416, 'My name is \"Foo\"', NULL)"); string invalid_json("SELECT Json_Foo(56, 3.1416, 'My name is \"Foo\"', NULL)");
auto encode_version = [](const SERVER::Version& sv) -> uint64_t auto encode_version = [](const SERVER::Version& sv) -> uint64_t {
{
return sv.major * 10000 + sv.minor * 100 + sv.patch; return sv.major * 10000 + sv.minor * 100 + sv.patch;
}; };