Uncrustify maxscale
See script directory for method. The script to run in the top level MaxScale directory is called maxscale-uncrustify.sh, which uses another script, list-src, from the same directory (so you need to set your PATH). The uncrustify version was 0.66.
This commit is contained in:
@ -7,31 +7,33 @@
|
||||
|
||||
#include "testconnections.h"
|
||||
|
||||
static int show_mysql_error(MYSQL *mysql)
|
||||
static int show_mysql_error(MYSQL* mysql)
|
||||
{
|
||||
printf("Error(%d) [%s] \"%s\"\n", mysql_errno(mysql),
|
||||
printf("Error(%d) [%s] \"%s\"\n",
|
||||
mysql_errno(mysql),
|
||||
mysql_sqlstate(mysql),
|
||||
mysql_error(mysql));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int show_stmt_error(MYSQL_STMT *stmt)
|
||||
static int show_stmt_error(MYSQL_STMT* stmt)
|
||||
{
|
||||
printf("Error(%d) [%s] \"%s\"\n", mysql_stmt_errno(stmt),
|
||||
printf("Error(%d) [%s] \"%s\"\n",
|
||||
mysql_stmt_errno(stmt),
|
||||
mysql_stmt_sqlstate(stmt),
|
||||
mysql_stmt_error(stmt));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bind_by_column(MYSQL *mysql)
|
||||
int bind_by_column(MYSQL* mysql)
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_STMT* stmt;
|
||||
MYSQL_BIND bind[3];
|
||||
|
||||
/* Data for insert */
|
||||
const char *surnames[] = {"Widenius", "Axmark", "N.N."};
|
||||
const char* surnames[] = {"Widenius", "Axmark", "N.N."};
|
||||
unsigned long surnames_length[] = {8, 6, 4};
|
||||
const char *forenames[] = {"Monty", "David", "will be replaced by default value"};
|
||||
const char* forenames[] = {"Monty", "David", "will be replaced by default value"};
|
||||
char forename_ind[] = {STMT_INDICATOR_NTS, STMT_INDICATOR_NTS, STMT_INDICATOR_DEFAULT};
|
||||
char id_ind[] = {STMT_INDICATOR_NULL, STMT_INDICATOR_NULL, STMT_INDICATOR_NULL};
|
||||
unsigned int array_size = 3;
|
||||
@ -41,7 +43,8 @@ int bind_by_column(MYSQL *mysql)
|
||||
return show_mysql_error(mysql);
|
||||
}
|
||||
|
||||
if (mysql_query(mysql, "CREATE TABLE test.bulk_example1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY," \
|
||||
if (mysql_query(mysql,
|
||||
"CREATE TABLE test.bulk_example1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY," \
|
||||
"forename CHAR(30) NOT NULL DEFAULT 'unknown', surname CHAR(30))"))
|
||||
{
|
||||
return show_mysql_error(mysql);
|
||||
@ -87,7 +90,7 @@ int bind_by_column(MYSQL *mysql)
|
||||
return show_mysql_error(mysql);
|
||||
}
|
||||
|
||||
MYSQL_RES *res = mysql_store_result(mysql);
|
||||
MYSQL_RES* res = mysql_store_result(mysql);
|
||||
|
||||
if (res == NULL || mysql_num_rows(res) != 3)
|
||||
{
|
||||
@ -103,26 +106,26 @@ int bind_by_column(MYSQL *mysql)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bind_by_row(MYSQL *mysql)
|
||||
int bind_by_row(MYSQL* mysql)
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_STMT* stmt;
|
||||
MYSQL_BIND bind[3];
|
||||
|
||||
struct st_data
|
||||
{
|
||||
unsigned long id;
|
||||
char id_ind;
|
||||
char forename[30];
|
||||
char forename_ind;
|
||||
char surname[30];
|
||||
char surname_ind;
|
||||
char id_ind;
|
||||
char forename[30];
|
||||
char forename_ind;
|
||||
char surname[30];
|
||||
char surname_ind;
|
||||
};
|
||||
|
||||
struct st_data data[] =
|
||||
{
|
||||
{0, STMT_INDICATOR_NULL, "Monty", STMT_INDICATOR_NTS, "Widenius", STMT_INDICATOR_NTS},
|
||||
{0, STMT_INDICATOR_NULL, "David", STMT_INDICATOR_NTS, "Axmark", STMT_INDICATOR_NTS},
|
||||
{0, STMT_INDICATOR_NULL, "default", STMT_INDICATOR_DEFAULT, "N.N.", STMT_INDICATOR_NTS},
|
||||
{0, STMT_INDICATOR_NULL, "Monty", STMT_INDICATOR_NTS, "Widenius", STMT_INDICATOR_NTS },
|
||||
{0, STMT_INDICATOR_NULL, "David", STMT_INDICATOR_NTS, "Axmark", STMT_INDICATOR_NTS },
|
||||
{0, STMT_INDICATOR_NULL, "default", STMT_INDICATOR_DEFAULT, "N.N.", STMT_INDICATOR_NTS },
|
||||
};
|
||||
|
||||
unsigned int array_size = 3;
|
||||
@ -133,7 +136,8 @@ int bind_by_row(MYSQL *mysql)
|
||||
show_mysql_error(mysql);
|
||||
}
|
||||
|
||||
if (mysql_query(mysql, "CREATE TABLE bulk_example2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"\
|
||||
if (mysql_query(mysql,
|
||||
"CREATE TABLE bulk_example2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY," \
|
||||
"forename CHAR(30) NOT NULL DEFAULT 'unknown', surname CHAR(30))"))
|
||||
{
|
||||
show_mysql_error(mysql);
|
||||
@ -183,7 +187,7 @@ int bind_by_row(MYSQL *mysql)
|
||||
return show_mysql_error(mysql);
|
||||
}
|
||||
|
||||
MYSQL_RES *res = mysql_store_result(mysql);
|
||||
MYSQL_RES* res = mysql_store_result(mysql);
|
||||
|
||||
if (res == NULL || mysql_num_rows(res) != 3)
|
||||
{
|
||||
@ -209,16 +213,20 @@ int main(int argc, char** argv)
|
||||
test.tprintf("Testing column-wise binding with a direct connection");
|
||||
test.add_result(bind_by_column(test.repl->nodes[0]), "Bulk inserts with a direct connection should work");
|
||||
test.tprintf("Testing column-wise binding with readwritesplit");
|
||||
test.add_result(bind_by_column(test.maxscales->conn_rwsplit[0]), "Bulk inserts with readwritesplit should work");
|
||||
test.add_result(bind_by_column(test.maxscales->conn_rwsplit[0]),
|
||||
"Bulk inserts with readwritesplit should work");
|
||||
test.tprintf("Testing column-wise binding with readconnroute");
|
||||
test.add_result(bind_by_column(test.maxscales->conn_master[0]), "Bulk inserts with readconnroute should work");
|
||||
test.add_result(bind_by_column(test.maxscales->conn_master[0]),
|
||||
"Bulk inserts with readconnroute should work");
|
||||
|
||||
test.tprintf("Testing row-wise binding with a direct connection");
|
||||
test.add_result(bind_by_row(test.repl->nodes[0]), "Bulk inserts with a direct connection should work");
|
||||
test.tprintf("Testing row-wise binding with readwritesplit");
|
||||
test.add_result(bind_by_row(test.maxscales->conn_rwsplit[0]), "Bulk inserts with readwritesplit should work");
|
||||
test.add_result(bind_by_row(test.maxscales->conn_rwsplit[0]),
|
||||
"Bulk inserts with readwritesplit should work");
|
||||
test.tprintf("Testing row-wise binding with readconnroute");
|
||||
test.add_result(bind_by_row(test.maxscales->conn_master[0]), "Bulk inserts with readconnroute should work");
|
||||
test.add_result(bind_by_row(test.maxscales->conn_master[0]),
|
||||
"Bulk inserts with readconnroute should work");
|
||||
|
||||
test.maxscales->close_maxscale_connections(0);
|
||||
return test.global_result;
|
||||
|
||||
Reference in New Issue
Block a user