From 15f39a3daaf5d128b2be9fb02c1a5e932af02d68 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Thu, 9 Feb 2012 13:20:23 -0500 Subject: Convert tabs to spaces. --- src/mysqlerl.c | 26 +++++++++++++------------- src/mysqlerl.erl | 2 +- test/database.conf | 10 +++++----- test/mysqlerl_SUITE.erl | 26 +++++++++++++------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/mysqlerl.c b/src/mysqlerl.c index d349bf1..5c67517 100644 --- a/src/mysqlerl.c +++ b/src/mysqlerl.c @@ -185,7 +185,7 @@ make_rows(my_ulonglong count) exit(3); default: logmsg("ERROR: Couldn't fetch a row (%d): %s", - mysql_stmt_errno(sth), mysql_stmt_error(sth)); + mysql_stmt_errno(sth), mysql_stmt_error(sth)); exit(3); } } @@ -275,17 +275,17 @@ handle_query(ETERM *cmd) mysql_stmt_errno(handle), mysql_stmt_error(handle)); } else if (mysql_stmt_execute(handle)) { resp = erl_format("{error, {mysql_error, ~i, ~s}}", - mysql_stmt_errno(handle), mysql_stmt_error(handle)); + mysql_stmt_errno(handle), mysql_stmt_error(handle)); } else { set_mysql_results(handle); if (results) { resp = handle_mysql_result(results); } else { if (mysql_num_fields(results) == 0) - resp = erl_format("{updated, ~i}", numrows); + resp = erl_format("{updated, ~i}", numrows); else - resp = erl_format("{error, {mysql_error, ~i, ~s}}", - mysql_stmt_errno(handle), mysql_stmt_error(handle)); + resp = erl_format("{error, {mysql_error, ~i, ~s}}", + mysql_stmt_errno(handle), mysql_stmt_error(handle)); } } @@ -381,13 +381,13 @@ handle_param_query(ETERM *msg) value = erl_element(2, p); if (ERL_IS_TUPLE(type)) { - // Parameter Type + Size: {Type, Size} + // Parameter Type + Size: {Type, Size} ETERM *t_type, *t_size; char *t; - unsigned long size; + unsigned long size; t_size = erl_element(2, type); - size = ERL_INT_VALUE(t_size); + size = ERL_INT_VALUE(t_size); bind[i].buffer_length = size; erl_free_term(t_size); @@ -441,7 +441,7 @@ handle_param_query(ETERM *msg) free(val); } } else if (strncmp(t, VARCHAR_SQL, strlen(VARCHAR_SQL)) == 0) { - (void)bind_string(&bind[i], value, size); + (void)bind_string(&bind[i], value, size); } else { logmsg("ERROR: Unknown sized type: {%s, %d}", t, bind[i].buffer_length); @@ -478,9 +478,9 @@ handle_param_query(ETERM *msg) if (ERL_IS_ATOM(value) && strncmp((char *)ERL_ATOM_PTR(value), NULL_SQL, strlen(NULL_SQL)) == 0) - bind[i].is_null = &TRUTHY; + bind[i].is_null = &TRUTHY; else - bind[i].is_null = &FALSY; + bind[i].is_null = &FALSY; erl_free_term(value); erl_free_term(type); @@ -509,7 +509,7 @@ handle_param_query(ETERM *msg) } for (i = 0; i < param_count; i++) { - free(bind[i].length); + free(bind[i].length); free(bind[i].buffer); } free(bind); @@ -549,7 +549,7 @@ handle_select_count(ETERM *msg) resp = erl_format("{ok, ~i}", mysql_stmt_affected_rows(handle)); } else { resp = erl_format("{error, {mysql_error, ~i, ~s}}", - mysql_stmt_errno(handle), mysql_stmt_error(handle)); + mysql_stmt_errno(handle), mysql_stmt_error(handle)); } } erl_free(q); diff --git a/src/mysqlerl.erl b/src/mysqlerl.erl index 0f9e77e..d6a3cf6 100644 --- a/src/mysqlerl.erl +++ b/src/mysqlerl.erl @@ -52,7 +52,7 @@ commit(Ref, rollback, Timeout) -> {num_rows, _} -> ok; Other -> Other end. - + %% Arguments: %% Host = string() %% Port = integer() diff --git a/test/database.conf b/test/database.conf index 61b208d..a9c0e90 100644 --- a/test/database.conf +++ b/test/database.conf @@ -1,10 +1,10 @@ %% -*- Erlang -*- {db_info, [{name, "mysqlerl_test"}, - {host, "localhost"}, - {port, undefined}, - {username, "root"}, - {password, undefined}, - {options, []}]}. + {host, "localhost"}, + {port, undefined}, + {username, "root"}, + {password, undefined}, + {options, []}]}. {insert_data, "INSERT INTO user (username, password) VALUES (bjc, MD5('test')), (siobain, MD5('test2'))"}. diff --git a/test/mysqlerl_SUITE.erl b/test/mysqlerl_SUITE.erl index dc677b9..58591f8 100644 --- a/test/mysqlerl_SUITE.erl +++ b/test/mysqlerl_SUITE.erl @@ -113,11 +113,11 @@ end_per_group(_GroupName, _Config) -> init_per_testcase(_TestCase, Config) -> DBInfo = ct:get_config(db_info), {ok, DBRef} = mysqlerl:connect(?config(host, DBInfo), - ?config(port, DBInfo), - ?config(name, DBInfo), - ?config(username, DBInfo), - ?config(password, DBInfo), - ?config(options, DBInfo)), + ?config(port, DBInfo), + ?config(name, DBInfo), + ?config(username, DBInfo), + ?config(password, DBInfo), + ?config(options, DBInfo)), [{db_ref, DBRef} | Config]. %%-------------------------------------------------------------------- @@ -186,42 +186,42 @@ app_stops(_Config) -> describe_table(Config) -> io:format("describe_table ~p", [Config]), {ok, Description} = mysqlerl:describe_table(?config(db_ref, Config), - "user"), + "user"), [{"username", {sql_varchar, 20}}, {"password", {sql_varchar, 64}}] = Description. sql_query(Config) -> {selected, ?COLS, Rows} = mysqlerl:sql_query(?config(db_ref, Config), - ?Q), + ?Q), [{"bjc", _}, {"siobain", _}] = Rows. param_query(Config) -> {selected, ?COLS, Rows} = mysqlerl:param_query(?config(db_ref, Config), - "SELECT * FROM user WHERE username=?", - [{{sql_varchar, 20}, "bjc"}]), + "SELECT * FROM user WHERE username=?", + [{{sql_varchar, 20}, "bjc"}]), [{"bjc", _}] = Rows. select_count(Config) -> {ok, 2} = mysqlerl:select_count(?config(db_ref, Config), - "SELECT username FROM user"). + "SELECT username FROM user"). select_next(Config) -> mysqlerl:select_count(?config(db_ref, Config), ?Q), {selected, ?COLS, Rows} = mysqlerl:select(?config(db_ref, Config), - next, 1), + next, 1), [{"bjc", _}] = Rows. select_absolute(Config) -> mysqlerl:select_count(?config(db_ref, Config), ?Q), mysqlerl:next(?config(db_ref, Config)), {selected, ?COLS, Rows} = mysqlerl:select(?config(db_ref, Config), - {absolute, 1}, 1), + {absolute, 1}, 1), [{"bjc", _}] = Rows. select_relative(Config) -> mysqlerl:select_count(?config(db_ref, Config), ?Q), mysqlerl:next(?config(db_ref, Config)), {selected, ?COLS, Rows} = mysqlerl:select(?config(db_ref, Config), - {relative, 1}, 1), + {relative, 1}, 1), [{"siobain", _}] = Rows. first(Config) -> -- cgit v1.2.3