<commit_before>%%% The MIT License (MIT)
%%% Copyright (c) 2022 <NAME><<EMAIL>>

-module(efirebirdsql_charset_tests).

-include_lib("eunit/include/eunit.hrl").
-include("efirebirdsql.hrl").

charset_test() ->
    DbName = lists:flatten(io_lib:format("/tmp/~p.fdb", [erlang:system_time()])),
    {ok, C} = efirebirdsql:connect(
        "localhost", os:getenv("ISC_USER", "sysdba"), os:getenv("ISC_PASSWORD", "<PASSWORD>"), DbName,
        [{createdb, true}, {charset, cp932}]),
    ok = efirebirdsql:execute(C, <<"select RDB$CHARACTER_SET_NAME from RDB$DATABASE">>),
    ?assertEqual({ok, [{<<"RDB$CHARACTER_SET_NAME">>, <<"SJIS_0208">>}]}, efirebirdsql:fetchone(C)),

    ok = efirebirdsql:close(C),
    ok.<commit_msg>add default_charset_test<commit_after>%%% The MIT License (MIT)
%%% Copyright (c) 2022 <NAME><<EMAIL>>

-module(efirebirdsql_charset_tests).

-include_lib("eunit/include/eunit.hrl").
-include("efirebirdsql.hrl").

default_charset_test() ->
    DbName = lists:flatten(io_lib:format("/tmp/~p.fdb", [erlang:system_time()])),
    {ok, C} = efirebirdsql:connect(
        "localhost", os:getenv("ISC_USER", "sysdba"), os:getenv("ISC_PASSWORD", "<PASSWORD>"), DbName,
        [{createdb, true}]),
    ok = efirebirdsql:execute(C, <<"select RDB$CHARACTER_SET_NAME from RDB$DATABASE">>),
    ?assertEqual({ok, [{<<"RDB$CHARACTER_SET_NAME">>, <<"UTF8">>}]}, efirebirdsql:fetchone(C)),

    ok = efirebirdsql:close(C),
    ok.

charset_test() ->
    DbName = lists:flatten(io_lib:format("/tmp/~p.fdb", [erlang:system_time()])),
    {ok, C} = efirebirdsql:connect(
        "localhost", os:getenv("ISC_USER", "sysdba"), os:getenv("ISC_PASSWORD", "<PASSWORD>"), DbName,
        [{createdb, true}, {charset, cp932}]),
    ok = efirebirdsql:execute(C, <<"select RDB$CHARACTER_SET_NAME from RDB$DATABASE">>),
    ?assertEqual({ok, [{<<"RDB$CHARACTER_SET_NAME">>, <<"SJIS_0208">>}]}, efirebirdsql:fetchone(C)),

    ok = efirebirdsql:close(C),
    ok.
{'fraction_non_alphanumeric': 0.21311475409836064, 'fraction_numerical': 0.0117827868852459, 'mean_word_length': 5.642857142857143, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 33, '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': '3205864', 'n_tokens_mistral': 801, 'n_tokens_neox': 762, 'n_words': 112}