Zendesk's Maxwell Compatibility (#119)
* Binlog router: Introduce maxwell_compatibility flag * Binlog router: Handle 'server vars' query This is a step towards using MaxScale with Zendesk's Maxwell. * Binlog router: Handle results charset query * Binlog router: Handle sql_mode query * Binlog router: Handle server_id query * Binlog router: Handle 'binlog vars' queries * Binlog router: Handle @@lower_case_table_names query * Binlog router: Handle @@global.binlog_checksum query * Binlog router: DRY Maxwell SQL queries
This commit is contained in:

committed by
MassimilianoPinto

parent
fdc66c660c
commit
825782799f
@ -700,10 +700,54 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
tests++;
|
||||
|
||||
/**
|
||||
* Verify SQL query initial comment skipping function works on a real use case.
|
||||
*/
|
||||
const char *mysql_connector_j_actual = blr_skip_leading_sql_comments("/* mysql-connector-java-5.1.39 ( Revision: 3289a357af6d09ecc1a10fd3c26e95183e5790ad ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout");
|
||||
const char *mysql_connector_j_expected = "SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout";
|
||||
if (strcmp(mysql_connector_j_actual, mysql_connector_j_expected) == 0)
|
||||
{
|
||||
printf("Test %d PASSED", tests);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Test %d FAILED: Actual result: %s", tests, mysql_connector_j_actual);
|
||||
return 1;
|
||||
}
|
||||
|
||||
tests++;
|
||||
|
||||
const char *no_comment_query_actual = blr_skip_leading_sql_comments("SELECT foo FROM bar LIMIT 1");
|
||||
const char *no_comment_query_expected = "SELECT foo FROM bar LIMIT 1";
|
||||
if (strcmp(no_comment_query_actual, no_comment_query_expected) == 0)
|
||||
{
|
||||
printf("Test %d PASSED", tests);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Test %d FAILED: Actual result: %s", tests, no_comment_query_actual);
|
||||
return 1;
|
||||
}
|
||||
|
||||
tests++;
|
||||
|
||||
const char *unclosed_comment_query_actual = blr_skip_leading_sql_comments("/* SELECT foo FROM bar LIMIT 1");
|
||||
const char *unclosed_comment_query_expected = "";
|
||||
if (strcmp(unclosed_comment_query_actual, unclosed_comment_query_expected) == 0)
|
||||
{
|
||||
printf("Test %d PASSED", tests);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Test %d FAILED: Actual result: %s", tests, no_comment_query_actual);
|
||||
return 1;
|
||||
}
|
||||
|
||||
mxs_log_flush_sync();
|
||||
mxs_log_finish();
|
||||
|
||||
MXS_FREE(inst);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user