<commit_before>-module(boss_db_adapter_mysql).
-behaviour(boss_db_adapter).
-export([start/0, start/1, stop/1, find/2, find/7]).
-export([count/3, counter/2, incr/3, delete/2, save_record/2]).
-export([push/2, pop/2, dump/1, execute/2, transaction/2]).

start() ->
    start([]).

start(Options) ->
    DBHost = proplists:get_value(db_host, Options, "localhost"),
    DBPort = proplists:get_value(db_port, Options, 3306),
    DBUsername = proplists:get_value(db_username, Options, "guest"),
    DBPassword = proplists:get_value(db_password, Options, ""),
    DBDatabase = proplists:get_value(db_database, Options, "test"),
    mysql:start(boss_pool, DBHost, DBPort, DBUsername, DBPassword, DBDatabase, undefined, utf8),
    {ok, boss_pool}.

stop(_Pid) -> ok.

find(Pid, Id) when is_list(Id) ->
    {Type, TableName, TableId} = infer_type_from_id(Id),
    Res = mysql:fetch(Pid, ["SELECT * FROM ", TableName,
            " WHERE id = ", pack_value(TableId)]),
    case Res of
        {data, MysqlRes} ->
            case mysql:get_result_rows(MysqlRes) of
                [] -> undefined;
                [Row] ->
                    Columns = mysql:get_result_field_info(MysqlRes),
                    case model_is_loaded(Type) of
                        true -> activate_record(Row, Columns, Type);
                        false -> {error, {module_not_loaded, Type}}<commit_msg>Re-suppress DB log messages in MySQL<commit_after>-module(boss_db_adapter_mysql).
-behaviour(boss_db_adapter).
-export([start/0, start/1, stop/1, find/2, find/7]).
-export([count/3, counter/2, incr/3, delete/2, save_record/2]).
-export([push/2, pop/2, dump/1, execute/2, transaction/2]).

start() ->
    start([]).

start(Options) ->
    DBHost = proplists:get_value(db_host, Options, "localhost"),
    DBPort = proplists:get_value(db_port, Options, 3306),
    DBUsername = proplists:get_value(db_username, Options, "guest"),
    DBPassword = proplists:get_value(db_password, Options, ""),
    DBDatabase = proplists:get_value(db_database, Options, "test"),
    mysql:start(boss_pool, DBHost, DBPort, DBUsername, DBPassword, DBDatabase, fun(_, _, _, _) -> ok end, utf8),
    {ok, boss_pool}.

stop(_Pid) -> ok.

find(Pid, Id) when is_list(Id) ->
    {Type, TableName, TableId} = infer_type_from_id(Id),
    Res = mysql:fetch(Pid, ["SELECT * FROM ", TableName,
            " WHERE id = ", pack_value(TableId)]),
    case Res of
        {data, MysqlRes} ->
            case mysql:get_result_rows(MysqlRes) of
                [] -> undefined;
                [Row] ->
                    Columns = mysql:get_result_field_info(MysqlRes),
                    case model_is_loaded(Type) of
                        true -> activate_record(Row, Columns, Type);
                        false -> {error, {module_not_loaded, Type}}
{'fraction_non_alphanumeric': 0.14923241699393075, 'fraction_numerical': 0.014280614066404856, 'mean_word_length': 2.9243697478991595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2004183', 'n_tokens_mistral': 969, 'n_tokens_neox': 961, 'n_words': 186}