Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ODBC API support for MongooseIM #1816

Merged
merged 4 commits into from
May 7, 2018
Merged

Fix ODBC API support for MongooseIM #1816

merged 4 commits into from
May 7, 2018

Conversation

arcusfelis
Copy link
Contributor

Proposed changes include:

Enable mssql travis build

Use arcusfelis/eodbc version of odbc application

eodbc returns types of fields

eodbc correctly handles long binaries/texts in pgsql

eodbc prints data when wrong data is written into port

Use eodbc in mongoose_rdbms_SUITE

Use return_types in eodbc to handle utf16

Use utf8mb4 encoding in mysql

Make start_services optional

Allow to enable preset on just some nodes

Update travis-setup-db.sh with license reference

Use shared odbc.ini for both mssql and pgsql

Fix mongoose_rdbms_type:get() function

Add search_body into priv/mssql2012.sql schema

Use varbinary for message field in MSSQL

Use nvarchar in mssql schema

Reduce length of some fields in mssql schema

Correcly escape varchar in mssql

Add is_integer(ArcID) check into mod_mam_odbc_async_pool_writer

Add is_integer(UserID) check to mod_mam_odbc_prefs:get_behaviour/5

Change a primary key for mam_muc_message from id to (room_id,id)

Handle duplicate error from MSSQL in mod_mam_odbc_user

Log an error with good description when sql_execute fails

Add unicode_messages_can_be_extracted test

Use several like statements when searching for multiple words

Add muclight tables

Add test_types table to postgres and mysql schemas

Add a ssl tip comment into /tools/travis-setup-db.sh

Add rdbms_SUITE in big_tests

Refactor string escaping API

Add escape_boolean

Add a comment into privacy_SUITE about kicking (non mssql)

Introduce ejabberd_c2s:process_incoming_stanza_with_conflict_check

Wait in mam_SUITE:long_text_search_request

Fix unexpected presences in last_SUITE

Fix a race condition in rest_client_SUITE

Correctly decode ID in mod_privacy_odbc:get_privacy_list

Remove application:start from rdbms_odbc:connect/2

@michalwski
Copy link
Contributor

I suggest that we drop Travis job odbc_pgsql because:

  1. Odbc layer will be tested with mssql as in this PR. odbc_pgsql job was added only to have "some" tests for the odbc layer
  2. Postgres has dedicated driver which is tested in other job
  3. It's better to have as little Travis jobs as possible and makes sense.

@fenek
Copy link
Member

fenek commented Apr 19, 2018

@michalwski 👍

@arcusfelis
Copy link
Contributor Author

We can disable the travis job, but keep preset.
Later I want to execute rdbms_SUITE with different versions of mysql, pgsql, odbc combo.
Maybe rdbms part can go to a separate repo (queries would stay).

Also, be aware, that we use a forked version of odbc. It would have more tests like in rdbms_SUITE.

But for now I think this PR is already big enough.

@codecov
Copy link

codecov bot commented Apr 20, 2018

Codecov Report

Merging #1816 into master will decrease coverage by 0.34%.
The diff coverage is 72.6%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1816      +/-   ##
==========================================
- Coverage   74.77%   74.42%   -0.35%     
==========================================
  Files         297      298       +1     
  Lines       27737    27910     +173     
==========================================
+ Hits        20740    20772      +32     
- Misses       6997     7138     +141
Impacted Files Coverage Δ
src/mod_mam_utils.erl 86.46% <ø> (-1.33%) ⬇️
src/mod_mam_odbc_async_pool_writer.erl 66.89% <ø> (ø) ⬆️
src/rdbms/rdbms_queries_mssql.erl 85.71% <ø> (+85.71%) ⬆️
src/mod_private_mysql.erl 0% <0%> (-90.48%) ⬇️
src/mod_offline_odbc.erl 84.9% <100%> (ø) ⬆️
src/mod_mam_muc_odbc_arch.erl 82.95% <100%> (+0.29%) ⬆️
src/mod_private_odbc.erl 90.47% <100%> (ø) ⬆️
src/ejabberd_rdbms.erl 89.47% <100%> (+5.26%) ⬆️
src/rdbms/mongoose_rdbms_mysql.erl 43.47% <100%> (-43.48%) ⬇️
src/mod_last_odbc.erl 85.71% <100%> (ø) ⬆️
... and 39 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 596fbc5...36303ba. Read the comment docs.

"(server, user_name) VALUES ('", SServer, "', '", SUserName, "')"]),
"(server, user_name) VALUES (",
mongoose_rdbms:use_escaped_string(SServer), ", ",
mongoose_rdbms:use_escaped_string(SUserName), ")"]),
case Res of
{updated, 1} ->
ok;
%% Ignore the race condition Duplicate entry ... for key 'uc_mam_server_user_name'
{error, duplicate_key} ->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the error checking here.
In a next PR we can use something like.

mongoose_rdbms:is_duplicate_key_error(duplicate_key) -> true;
mongoose_rdbms:is_duplicate_key_error("[FreeTDS.....) -> true;
...

Copy link
Contributor

@michalwski michalwski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a huge effort, thanks a lot @arcusfelis.
There are some comments/questions to the code which I'd like to see addressed.

Also I think it'd be good if you spent some time and sent PR to Erlang/OTP with the changes you made to extracted eodbc application.

Also we need to add to the doc what needs to be installed on the system in order to compile MongooseIM with eodbc. It didn't compile on my Mac because currently I don't have sql.h file.

.travis.yml Outdated
@@ -65,6 +67,7 @@ env:
- PRESET=internal_mnesia DB=mnesia REL_CONFIG=with-all TLS_DIST=yes
- PRESET=mysql_redis DB=mysql REL_CONFIG="with-mysql with-redis"
- PRESET=odbc_pgsql_mnesia DB=pgsql REL_CONFIG=with-odbc
- PRESET=odbc_mssql_mnesia DB=mssql REL_CONFIG=with-odbc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the above odbc_pgsql_mnesia job? There is no need to have it if we'll test ODBC layer with this newly added job.

@@ -6,7 +6,7 @@
{log_root, "{{mongooseim_log_dir}}"},
{crash_log, "crash.log"},
{handlers, [
{lager_console_backend, [info, {lager_default_formatter,[{eol, "\r\n"}]}]},
{lager_console_backend, [{level, info}]},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? I'm not saying it's wrong, I just want to know the reason.

Copy link
Contributor Author

@arcusfelis arcusfelis Apr 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because currently lager_console_backend crashes just after start and we don't have logs.

2018-04-30 11:45:07.329 [error] <0.205.0>@lager_handler_watcher:123 
Lager fatally failed to install handler lager_console_backend into lager_event,
 NOT retrying: {bad_console_config, info}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will put in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -65,7 +65,8 @@ stop_pool(Pool) ->
mongoose_rdbms_sup:remove_pool(Pool).

compile_odbc_type_helper() ->
Key = {odbc_server_type, ?MYNAME},
%% TODO This parameter should not be global, but pool-name parameterized
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the TODO still valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would require some pool refactoring, so can be a separate task.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1833 reported separately

case Res of
{updated, 1} ->
ok;
%% Ignore the race condition Duplicate entry ... for key 'uc_mam_server_user_name'
{error, duplicate_key} ->
ok;
{error, "[FreeTDS][SQL Server]Violation of UNIQUE KEY constraint" ++ _} ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I wonder if it is possible that sth else then FreeTDS is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Than we would have the current hook failed.
Overall, we need to refactor this part in the module separately.
For example, by always retrying to select key after any error here.
But I feel it's a separate PR...

@@ -282,22 +282,19 @@ write_roster_version(LUser, LServer, InTransaction) ->
%% - roster versioning is used by server and client,
%% BUT the server isn't storing versions on db OR
%% - the roster version from client don't match current version.
process_iq_get(From, To, #iq{sub_el = SubEl} = IQ) ->
process_iq_get(From, To, IQ) ->
mongoose_error:try_to_handle_iq(From, To, IQ, fun do_process_iq_get/3).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if mongoose_error is the best place for this function... I don't have suggestion for other place ATM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe mim_iq module :)

IQ#iq{type = error,
sub_el = [SubEl, mongoose_xmpp_errors:internal_server_error()]}
end.
AttrVer = xml:get_tag_attr(<<"ver">>, SubEl),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you touched this line, could you also change it to use exml_query?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really good PR for refactoring this, but OK, I did it.

%% @doc Generic error handling code
%%
%% Use these functions, instead of `try ... catch _:_ -> ok end'.
-module(mongoose_error).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe renaming this module to mongoose_iq would be better? We could later move here other IQ related functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, makes sense

Enable mssql travis build

Disable odbc_mssql_mnesia travis job

Use arcusfelis/eodbc version of odbc application

eodbc returns types of fields

eodbc correctly handles long binaries/texts in pgsql

eodbc prints data when wrong data is written into port

Use eodbc in mongoose_rdbms_SUITE

Use return_types in eodbc to handle utf16

Use utf8mb4 encoding in mysql

Make start_services optional

Allow to enable preset on just some nodes

Update travis-setup-db.sh with license reference

Use shared odbc.ini for both mssql and pgsql

Fix mongoose_rdbms_type:get() function

Add search_body into priv/mssql2012.sql schema

Use varbinary for message field in MSSQL

Use nvarchar in mssql schema

Reduce length of some fields in mssql schema

Correcly escape varchar in mssql

Add is_integer(ArcID) check into mod_mam_odbc_async_pool_writer

Add is_integer(UserID) check to mod_mam_odbc_prefs:get_behaviour/5

Change a primary key for mam_muc_message from id to (room_id,id)

Handle duplicate error from MSSQL in mod_mam_odbc_user

Log an error with good description when sql_execute fails

Add unicode_messages_can_be_extracted test

Use several like statements when searching for multiple words

Add muclight tables

Add test_types table to postgres and mysql schemas

Add a ssl tip comment into /tools/travis-setup-db.sh

Add rdbms_SUITE in big_tests

Refactor string escaping API

Add escape_boolean

Add a comment into privacy_SUITE about kicking (non mssql)

Introduce ejabberd_c2s:process_incoming_stanza_with_conflict_check

Wait in mam_SUITE:long_text_search_request

Fix unexpected presences in last_SUITE

Fix a race condition in rest_client_SUITE

Correctly decode ID in mod_privacy_odbc:get_privacy_list

Remove application:start from rdbms_odbc:connect/2

Introduce choose_get_user_roster_strategy into mod_roster

Add mongoose_iq:try_to_handle_iq/4 helper function
@arcusfelis
Copy link
Contributor Author

Comments from @michalwski were addressed.

last_server(Config) ->
escalus:story(Config, [{alice, 1}],
escalus:fresh_story(Config, [{alice, 1}],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we switch to fresh_story only for this particular test case?

Copy link
Contributor Author

@arcusfelis arcusfelis May 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because other stories want Alice and Bob to be friends

@@ -1370,6 +1373,13 @@ long_text_search_request(Config) ->
timer:sleep(50)
end, Msgs),

%% Just check than Bob receives them.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that

@@ -1370,6 +1373,13 @@ long_text_search_request(Config) ->
timer:sleep(50)
end, Msgs),

%% Just check than Bob receives them.
%% It should help, when the server is overloaded.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the CI server, because currently it may refer to MongooseIM server as well. :)

@@ -366,6 +371,8 @@ simple_story(Config, Fun) ->
).

clear_list_relogin(Config) ->
%% unexprected presence unavalable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unexpected

@@ -26,11 +26,10 @@ all_tests() ->
groupchat_message_is_not_stored,
headline_message_is_not_stored,
expired_messages_are_not_delivered,
max_offline_messages_reached
].
max_offline_messages_reached].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline here helps in quick cases disable. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really, there are still commas.

{aborted, #{reason := Reason, sql_query := SqlQuery}}
when NRestarts =:= 0 ->
%% Too many retries of outer transaction.
?ERROR_MSG("SQL transaction restarts exceeded~n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event=...?

erlang:get_stacktrace(), State]),
sql_query_internal([<<"rollback;">>], State),
{{aborted, Reason}, State};
{aborted, Reason} when NRestarts =:= 0 -> %% old format for abort
%% Too many retries of outer transaction.
?ERROR_MSG("SQL transaction restarts exceeded~n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event=...?

@@ -87,11 +87,9 @@
add_privacy_list/2,
set_privacy_list/2,
del_privacy_lists/3,
set_vcard/26,
get_vcard/2,
set_vcard/27,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F.... these REALLY should be rewritten with maps. Not in this PR though. :)

SUsername = mongoose_rdbms:escape_string(User),
SLUsername = mongoose_rdbms:escape_string(LUser),
SLServer = mongoose_rdbms:escape_string(VHost),
SVCARD = mongoose_rdbms:escape_string( exml:to_binary(VCard)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary space ( exml :)

%%% Some backends allow ArcID can be not set (riak?).
%%% This means, that there are no "jid => integer" mapping.
%%%
%%% But this module requires ArcID not be an integer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"requires ArcID not be an integer" but several lines below you mention that ArcID is required to be integer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be an integer, typo

@fenek fenek merged commit fc643d8 into master May 7, 2018
@fenek fenek deleted the mssql-travis branch May 7, 2018 11:39
@fenek fenek added this to the 3.0.0 milestone May 7, 2018
@@ -34,6 +34,13 @@ $ xcode-select --install # install compilation tools
$ brew install git erlang openssl
```

If you are planning to use ODBC to connect to MSSQL:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not if. Below libs are need to compile current MongooseIM on MacOS X even if user is not going to use ODBC and MSSQL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction, unixodbc is needed to compile, freetds is needed only to connect to MSSQL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But even though, it doesn't work on MacOS X High Sierra :( that's really sad we make our own life harder... Not everyone is using El Capitan or Sierra :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    socket = connect_to_erlang(port);
             ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:344:12: error: non-object type 'int (int, int, int)' is not assignable
    socket = connect_to_erlang(port);
    ~~~~~~ ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:345:11: warning: implicit declaration of function 'receive_msg' is invalid in C99 [-Wimplicit-function-declaration]
    msg = receive_msg(socket);
          ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:345:9: warning: incompatible integer to pointer conversion assigning to 'byte *' (aka 'char *') from 'int' [-Wint-conversion]
    msg = receive_msg(socket);
        ^ ~~~~~~~~~~~~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:354:5: warning: implicit declaration of function 'close_socket' is invalid in C99 [-Wimplicit-function-declaration]
    close_socket(socket);
    ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:378:12: error: non-object type 'int (int, int, int)' is not assignable
    socket = connect_to_erlang(port);
    ~~~~~~ ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:381:17: warning: incompatible integer to pointer conversion assigning to 'byte *' (aka 'char *') from 'int' [-Wint-conversion]
        request_buffer = receive_msg(socket);
                       ^ ~~~~~~~~~~~~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:386:2: warning: implicit declaration of function 'send_msg' is invalid in C99 [-Wimplicit-function-declaration]
        send_msg(&msg, socket); /* Send answer to erlang */
        ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:400:14: warning: incompatible pointer to integer conversion passing 'int (int, int, int)' to parameter of type 'int' [-Wint-conversion]
    shutdown(socket, 2);
             ^~~~~~
/usr/include/sys/socket.h:700:17: note: passing argument to parameter here
int     shutdown(int, int);
                    ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:1510:15: warning: unused variable 'result' [-Wunused-variable]
    SQLRETURN result;
              ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:1918:1: error: expected identifier or '('
{
^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2721:14: warning: incompatible pointer types passing 'SQLLEN **' (aka 'long **') to parameter of type 'SQLLEN *' (aka 'long *'); remove & [-Wincompatible-pointer-types]
                        blocklen, &StrLen_or_IndPtr);
                                  ^~~~~~~~~~~~~~~~~
/usr/local/include/sql.h:706:43: note: passing argument to parameter 'StrLen_or_Ind' here
                                  SQLLEN *StrLen_or_Ind);
                                          ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2724:41: warning: comparison between pointer and integer ('SQLLEN *' (aka 'long *') and 'int')
    fetched_bytes = (((StrLen_or_IndPtr == SQL_NO_TOTAL) || (StrLen_or_IndPtr > blocklen))
                       ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2724:79: warning: ordered comparison between pointer and integer ('SQLLEN *' (aka 'long *') and 'int')
    fetched_bytes = (((StrLen_or_IndPtr == SQL_NO_TOTAL) || (StrLen_or_IndPtr > blocklen))
                                                             ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2725:13: warning: pointer/integer type mismatch in conditional expression ('int' and 'SQLLEN *' (aka 'long *')) [-Wconditional-type-mismatch]
            ? (blocklen-1) : StrLen_or_IndPtr);
            ^ ~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2724:19: warning: incompatible pointer to integer conversion assigning to 'int' from 'SQLLEN *' (aka 'long *') [-Wint-conversion]
    fetched_bytes = (((StrLen_or_IndPtr == SQL_NO_TOTAL) || (StrLen_or_IndPtr > blocklen))
                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2743:5: warning: incompatible pointer types passing 'SQLLEN **' (aka 'long **') to parameter of type 'SQLLEN *' (aka 'long *'); remove & [-Wincompatible-pointer-types]
                                &StrLen_or_IndPtr);
                                ^~~~~~~~~~~~~~~~~
/usr/local/include/sql.h:706:43: note: passing argument to parameter 'StrLen_or_Ind' here
                                  SQLLEN *StrLen_or_Ind);
                                          ^
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2745:45: warning: comparison between pointer and integer ('SQLLEN *' (aka 'long *') and 'int')
        fetched_bytes = (((StrLen_or_IndPtr == SQL_NO_TOTAL) || (StrLen_or_IndPtr > blocklen))
                           ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2745:83: warning: ordered comparison between pointer and integer ('SQLLEN *' (aka 'long *') and 'int')
        fetched_bytes = (((StrLen_or_IndPtr == SQL_NO_TOTAL) || (StrLen_or_IndPtr > blocklen))
                                                                 ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2746:17: warning: pointer/integer type mismatch in conditional expression ('int' and 'SQLLEN *' (aka 'long *')) [-Wconditional-type-mismatch]
                ? (blocklen-1) : StrLen_or_IndPtr);
                ^ ~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~
/Users/michalpiotrowski/projects/MongooseIM/repo/_build/default/lib/eodbc/c_src/odbcserver.c:2745:23: warning: incompatible pointer to integer conversion assigning to 'int' from 'SQLLEN *' (aka 'long *') [-Wint-conversion]
        fetched_bytes = (((StrLen_or_IndPtr == SQL_NO_TOTAL) || (StrLen_or_IndPtr > blocklen))
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 warnings and 3 errors generated.```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also noticed by @kzemek. We're going to assign a ticket for this in upcoming sprint.

@fenek fenek restored the mssql-travis branch May 8, 2018 09:59
arcusfelis pushed a commit that referenced this pull request May 10, 2018
Fix ODBC API support for MongooseIM

Enable mssql travis build

Disable odbc_mssql_mnesia travis job

Use arcusfelis/eodbc version of odbc application

eodbc returns types of fields

eodbc correctly handles long binaries/texts in pgsql

eodbc prints data when wrong data is written into port

Use eodbc in mongoose_rdbms_SUITE

Use return_types in eodbc to handle utf16

Use utf8mb4 encoding in mysql

Make start_services optional

Allow to enable preset on just some nodes

Update travis-setup-db.sh with license reference

Use shared odbc.ini for both mssql and pgsql

Fix mongoose_rdbms_type:get() function

Add search_body into priv/mssql2012.sql schema

Use varbinary for message field in MSSQL

Use nvarchar in mssql schema

Reduce length of some fields in mssql schema

Correcly escape varchar in mssql

Add is_integer(ArcID) check into mod_mam_odbc_async_pool_writer

Add is_integer(UserID) check to mod_mam_odbc_prefs:get_behaviour/5

Change a primary key for mam_muc_message from id to (room_id,id)

Handle duplicate error from MSSQL in mod_mam_odbc_user

Log an error with good description when sql_execute fails

Add unicode_messages_can_be_extracted test

Use several like statements when searching for multiple words

Add muclight tables

Add test_types table to postgres and mysql schemas

Add a ssl tip comment into /tools/travis-setup-db.sh

Add rdbms_SUITE in big_tests

Refactor string escaping API

Add escape_boolean

Add a comment into privacy_SUITE about kicking (non mssql)

Introduce ejabberd_c2s:process_incoming_stanza_with_conflict_check

Wait in mam_SUITE:long_text_search_request

Fix unexpected presences in last_SUITE

Fix a race condition in rest_client_SUITE

Correctly decode ID in mod_privacy_odbc:get_privacy_list

Remove application:start from rdbms_odbc:connect/2

Introduce choose_get_user_roster_strategy into mod_roster

Add mongoose_iq:try_to_handle_iq/4 helper function

Add docs about how mod_mam_odbc_arch full-text search works

Retry to query ArcID in mod_mam_odbc_user after any error

Use version of eodbc that can compile on OSX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants