Format source code
Formatted all of the source code that was not accordance with the coding style. This was caused by merges from 2.2 into 2.3.
This commit is contained in:
@ -4,19 +4,19 @@
|
|||||||
|
|
||||||
#include "testconnections.h"
|
#include "testconnections.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
TestConnections::require_repl_version("10.2.0");
|
TestConnections::require_repl_version("10.2.0");
|
||||||
TestConnections test(argc, argv);
|
TestConnections test(argc, argv);
|
||||||
|
|
||||||
auto batch = [&](std::vector<std::string> queries){
|
auto batch = [&](std::vector<std::string> queries) {
|
||||||
test.maxscales->connect();
|
test.maxscales->connect();
|
||||||
for (const auto& a: queries)
|
for (const auto& a : queries)
|
||||||
{
|
{
|
||||||
test.try_query(test.maxscales->conn_rwsplit[0], "%s", a.c_str());
|
test.try_query(test.maxscales->conn_rwsplit[0], "%s", a.c_str());
|
||||||
}
|
}
|
||||||
test.maxscales->disconnect();
|
test.maxscales->disconnect();
|
||||||
};
|
};
|
||||||
|
|
||||||
batch({"CREATE USER 'test' IDENTIFIED BY 'test'",
|
batch({"CREATE USER 'test' IDENTIFIED BY 'test'",
|
||||||
"GRANT SELECT ON *.* TO test",
|
"GRANT SELECT ON *.* TO test",
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "testconnections.h"
|
#include "testconnections.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
TestConnections test(argc, argv);
|
TestConnections test(argc, argv);
|
||||||
test.repl->connect();
|
test.repl->connect();
|
||||||
|
|||||||
@ -628,7 +628,7 @@ void TestConnections::process_template(int m, const char* template_name, const c
|
|||||||
{
|
{
|
||||||
ss
|
ss
|
||||||
<<
|
<<
|
||||||
" -e \"s|type=server|type=server\\nssl=required\\nssl_cert=/###access_homedir###/certs/client-cert.pem\\nssl_key=/###access_homedir###/certs/client-key.pem\\nssl_ca_cert=/###access_homedir###/certs/ca.pem|g\" ";
|
" -e \"s|type=server|type=server\\nssl=required\\nssl_cert=/###access_homedir###/certs/client-cert.pem\\nssl_key=/###access_homedir###/certs/client-key.pem\\nssl_ca_cert=/###access_homedir###/certs/ca.pem|g\" ";
|
||||||
}
|
}
|
||||||
|
|
||||||
ss << " -e \"s/###threads###/" << threads << "/\" ";
|
ss << " -e \"s/###threads###/" << threads << "/\" ";
|
||||||
|
|||||||
@ -1409,27 +1409,27 @@ void append_field_info(json_t* pParent,
|
|||||||
json_t* pFields = json_array();
|
json_t* pFields = json_array();
|
||||||
|
|
||||||
std::for_each(begin, end, [pFields](const QC_FIELD_INFO& info) {
|
std::for_each(begin, end, [pFields](const QC_FIELD_INFO& info) {
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
if (info.database)
|
if (info.database)
|
||||||
{
|
{
|
||||||
name += info.database;
|
name += info.database;
|
||||||
name += '.';
|
name += '.';
|
||||||
mxb_assert(info.table);
|
mxb_assert(info.table);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.table)
|
if (info.table)
|
||||||
{
|
{
|
||||||
name += info.table;
|
name += info.table;
|
||||||
name += '.';
|
name += '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
mxb_assert(info.column);
|
mxb_assert(info.column);
|
||||||
|
|
||||||
name += info.column;
|
name += info.column;
|
||||||
|
|
||||||
json_array_append_new(pFields, json_string(name.c_str()));
|
json_array_append_new(pFields, json_string(name.c_str()));
|
||||||
});
|
});
|
||||||
|
|
||||||
json_object_set_new(pParent, zName, pFields);
|
json_object_set_new(pParent, zName, pFields);
|
||||||
}
|
}
|
||||||
@ -1452,18 +1452,17 @@ void append_function_info(json_t* pParams, GWBUF* pBuffer)
|
|||||||
qc_get_function_info(pBuffer, &begin, &n);
|
qc_get_function_info(pBuffer, &begin, &n);
|
||||||
|
|
||||||
std::for_each(begin, begin + n, [pFunctions](const QC_FUNCTION_INFO& info) {
|
std::for_each(begin, begin + n, [pFunctions](const QC_FUNCTION_INFO& info) {
|
||||||
json_t* pFunction = json_object();
|
json_t* pFunction = json_object();
|
||||||
|
|
||||||
json_object_set_new(pFunction, CN_NAME, json_string(info.name));
|
json_object_set_new(pFunction, CN_NAME, json_string(info.name));
|
||||||
|
|
||||||
append_field_info(pFunction, CN_ARGUMENTS, info.fields, info.fields + info.n_fields);
|
append_field_info(pFunction, CN_ARGUMENTS, info.fields, info.fields + info.n_fields);
|
||||||
|
|
||||||
json_array_append_new(pFunctions, pFunction);
|
json_array_append_new(pFunctions, pFunction);
|
||||||
});
|
});
|
||||||
|
|
||||||
json_object_set_new(pParams, CN_FUNCTIONS, pFunctions);
|
json_object_set_new(pParams, CN_FUNCTIONS, pFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<json_t> qc_classify_as_json(const char* zHost, const std::string& statement)
|
std::unique_ptr<json_t> qc_classify_as_json(const char* zHost, const std::string& statement)
|
||||||
|
|||||||
@ -934,7 +934,7 @@ static bool roles_are_available(MYSQL* conn, SERVICE* service, SERVER* server)
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool have_mdev13453_problem(MYSQL *con, SERVER *server)
|
static bool have_mdev13453_problem(MYSQL* con, SERVER* server)
|
||||||
{
|
{
|
||||||
bool rval = false;
|
bool rval = false;
|
||||||
|
|
||||||
@ -968,14 +968,14 @@ static bool have_mdev13453_problem(MYSQL *con, SERVER *server)
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool query_and_process_users(const char* query, MYSQL *con, sqlite3* handle, SERVICE* service, int* users)
|
bool query_and_process_users(const char* query, MYSQL* con, sqlite3* handle, SERVICE* service, int* users)
|
||||||
{
|
{
|
||||||
bool rval = false;
|
bool rval = false;
|
||||||
|
|
||||||
if (mxs_mysql_query(con, "USE mysql") == 0 && // Set default database in case we use CTEs
|
if (mxs_mysql_query(con, "USE mysql") == 0 // Set default database in case we use CTEs
|
||||||
mxs_mysql_query(con, query) == 0)
|
&& mxs_mysql_query(con, query) == 0)
|
||||||
{
|
{
|
||||||
MYSQL_RES *result = mysql_store_result(con);
|
MYSQL_RES* result = mysql_store_result(con);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -275,8 +275,8 @@ int MySQLSendHandshake(DCB* dcb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MySQLProtocol *protocol = DCB_PROTOCOL(dcb, MySQLProtocol);
|
MySQLProtocol* protocol = DCB_PROTOCOL(dcb, MySQLProtocol);
|
||||||
GWBUF *buf;
|
GWBUF* buf;
|
||||||
std::string version = get_version_string(dcb->service);
|
std::string version = get_version_string(dcb->service);
|
||||||
|
|
||||||
gw_generate_random_str(server_scramble, GW_MYSQL_SCRAMBLE_SIZE);
|
gw_generate_random_str(server_scramble, GW_MYSQL_SCRAMBLE_SIZE);
|
||||||
@ -311,11 +311,12 @@ int MySQLSendHandshake(DCB* dcb)
|
|||||||
int plugin_name_len = strlen(plugin_name);
|
int plugin_name_len = strlen(plugin_name);
|
||||||
|
|
||||||
mysql_payload_size =
|
mysql_payload_size =
|
||||||
sizeof(mysql_protocol_version) + (version.length() + 1) + sizeof(mysql_thread_id_num) + 8 +
|
sizeof(mysql_protocol_version) + (version.length() + 1) + sizeof(mysql_thread_id_num) + 8
|
||||||
sizeof(/* mysql_filler */ uint8_t) + sizeof(mysql_server_capabilities_one) + sizeof(mysql_server_language) +
|
+ sizeof( /* mysql_filler */ uint8_t) + sizeof(mysql_server_capabilities_one)
|
||||||
sizeof(mysql_server_status) + sizeof(mysql_server_capabilities_two) + sizeof(mysql_scramble_len) +
|
+ sizeof(mysql_server_language)
|
||||||
sizeof(mysql_filler_ten) + 12 + sizeof(/* mysql_last_byte */ uint8_t) + plugin_name_len +
|
+ sizeof(mysql_server_status) + sizeof(mysql_server_capabilities_two) + sizeof(mysql_scramble_len)
|
||||||
sizeof(/* mysql_last_byte */ uint8_t);
|
+ sizeof(mysql_filler_ten) + 12 + sizeof( /* mysql_last_byte */ uint8_t) + plugin_name_len
|
||||||
|
+ sizeof( /* mysql_last_byte */ uint8_t);
|
||||||
|
|
||||||
// allocate memory for packet header + payload
|
// allocate memory for packet header + payload
|
||||||
if ((buf = gwbuf_alloc(sizeof(mysql_packet_header) + mysql_payload_size)) == NULL)
|
if ((buf = gwbuf_alloc(sizeof(mysql_packet_header) + mysql_payload_size)) == NULL)
|
||||||
@ -340,7 +341,7 @@ int MySQLSendHandshake(DCB* dcb)
|
|||||||
mysql_handshake_payload = mysql_handshake_payload + sizeof(mysql_protocol_version);
|
mysql_handshake_payload = mysql_handshake_payload + sizeof(mysql_protocol_version);
|
||||||
|
|
||||||
// write server version plus 0 filler
|
// write server version plus 0 filler
|
||||||
strcpy((char *)mysql_handshake_payload, version.c_str());
|
strcpy((char*)mysql_handshake_payload, version.c_str());
|
||||||
mysql_handshake_payload = mysql_handshake_payload + version.length();
|
mysql_handshake_payload = mysql_handshake_payload + version.length();
|
||||||
|
|
||||||
*mysql_handshake_payload = 0x00;
|
*mysql_handshake_payload = 0x00;
|
||||||
|
|||||||
Reference in New Issue
Block a user