Current section
18 Versions
Jump to
Current section
18 Versions
Compare versions
14
files changed
+485
additions
-69
deletions
| @@ -37,8 +37,10 @@ of the protocol feature that allows faster execution. | |
| 37 37 | - **epgsql** maintains backwards compatibility with the original driver API |
| 38 38 | - **epgsqla** delivers complete results as regular erlang messages |
| 39 39 | - **epgsqli** delivers results as messages incrementally (row by row) |
| 40 | + All API interfaces can be used with the same connection: eg, connection opened with `epgsql` |
| 41 | + can be queried with `epgsql` / `epgsqla` / `epgsqli` in any combinations. |
| 40 42 | - internal queue of client requests, so you don't need to wait for the response |
| 41 | - to send the next request |
| 43 | + to send the next request (pipelining) |
| 42 44 | - single process to hold driver state and receive socket data |
| 43 45 | - execution of several parsed statements as a batch |
| 44 46 | - binding timestamps in `erlang:now()` format |
| @@ -70,7 +72,7 @@ connect(Opts) -> {ok, Connection :: epgsql:connection()} | {error, Reason :: epg | |
| 70 72 | database => iodata(), |
| 71 73 | port => inet:port_number(), |
| 72 74 | ssl => boolean() | required, |
| 73 | - ssl_opts => [ssl:ssl_option()], % @see OTP ssl app, ssl_api.hrl |
| 75 | + ssl_opts => [ssl:tls_client_option()], % @see OTP ssl documentation |
| 74 76 | tcp_opts => [gen_tcp:option()], % @see OTP gen_tcp module documentation |
| 75 77 | timeout => timeout(), % socket connect timeout, default: 5000 ms |
| 76 78 | async => pid() | atom(), % process to receive LISTEN/NOTIFY msgs |
| @@ -713,5 +715,4 @@ NOTE 2: It's possible to run tests on exact postgres version by changing $PATH l | |
| 713 715 | |
| 714 716 | `PATH=$PATH:/usr/lib/postgresql/9.5/bin/ make test` |
| 715 717 | |
| 716 | - [](https://travis-ci.org/epgsql/epgsql) |
| 717 | - [](https://travis-ci.org/epgsql/epgsql) |
| 718 | + [](https://github.com/epgsql/epgsql/actions/workflows/ci.yml) |
| @@ -8,6 +8,8 @@ | |
| 8 8 | <<"src/commands/epgsql_cmd_bind.erl">>, |
| 9 9 | <<"src/commands/epgsql_cmd_close.erl">>, |
| 10 10 | <<"src/commands/epgsql_cmd_connect.erl">>, |
| 11 | + <<"src/commands/epgsql_cmd_copy_done.erl">>, |
| 12 | + <<"src/commands/epgsql_cmd_copy_from_stdin.erl">>, |
| 11 13 | <<"src/commands/epgsql_cmd_describe_portal.erl">>, |
| 12 14 | <<"src/commands/epgsql_cmd_describe_statement.erl">>, |
| 13 15 | <<"src/commands/epgsql_cmd_equery.erl">>, |
| @@ -34,14 +36,15 @@ | |
| 34 36 | <<"src/datatypes/epgsql_codec_timerange.erl">>, |
| 35 37 | <<"src/datatypes/epgsql_codec_uuid.erl">>,<<"src/epgsql.app.src">>, |
| 36 38 | <<"src/epgsql.erl">>,<<"src/epgsql_binary.erl">>,<<"src/epgsql_codec.erl">>, |
| 37 | - <<"src/epgsql_command.erl">>,<<"src/epgsql_errcodes.erl">>, |
| 38 | - <<"src/epgsql_fdatetime.erl">>,<<"src/epgsql_idatetime.erl">>, |
| 39 | - <<"src/epgsql_oid_db.erl">>,<<"src/epgsql_replication.hrl">>, |
| 40 | - <<"src/epgsql_sasl_prep_profile.erl">>,<<"src/epgsql_scram.erl">>, |
| 41 | - <<"src/epgsql_sock.erl">>,<<"src/epgsql_wire.erl">>,<<"src/epgsqla.erl">>, |
| 42 | - <<"src/epgsqli.erl">>,<<"src/ewkb.erl">>]}. |
| 39 | + <<"src/epgsql_command.erl">>,<<"src/epgsql_copy.hrl">>, |
| 40 | + <<"src/epgsql_errcodes.erl">>,<<"src/epgsql_fdatetime.erl">>, |
| 41 | + <<"src/epgsql_idatetime.erl">>,<<"src/epgsql_oid_db.erl">>, |
| 42 | + <<"src/epgsql_replication.hrl">>,<<"src/epgsql_sasl_prep_profile.erl">>, |
| 43 | + <<"src/epgsql_scram.erl">>,<<"src/epgsql_sock.erl">>, |
| 44 | + <<"src/epgsql_wire.erl">>,<<"src/epgsqla.erl">>,<<"src/epgsqli.erl">>, |
| 45 | + <<"src/ewkb.erl">>]}. |
| 43 46 | {<<"licenses">>,[<<"BSD">>]}. |
| 44 47 | {<<"links">>,[{<<"Github">>,<<"https://github.com/epgsql/epgsql">>}]}. |
| 45 48 | {<<"name">>,<<"epgsql">>}. |
| 46 49 | {<<"requirements">>,[]}. |
| 47 | - {<<"version">>,<<"4.5.0">>}. |
| 50 | + {<<"version">>,<<"4.6.0">>}. |
| @@ -41,10 +41,16 @@ | |
| 41 41 | -define(PARAMETER_DESCRIPTION, $t). |
| 42 42 | -define(ROW_DESCRIPTION, $T). |
| 43 43 | -define(READY_FOR_QUERY, $Z). |
| 44 | - -define(COPY_BOTH_RESPONSE, $W). |
| 45 | - -define(COPY_DATA, $d). |
| 46 44 | -define(TERMINATE, $X). |
| 47 45 | |
| 46 | + % Copy protocol |
| 47 | + -define(COPY_DATA, $d). |
| 48 | + -define(COPY_DONE, $c). |
| 49 | + -define(COPY_FAIL, $f). |
| 50 | + -define(COPY_IN_RESPONSE, $G). |
| 51 | + -define(COPY_OUT_RESPONSE, $H). |
| 52 | + -define(COPY_BOTH_RESPONSE, $W). |
| 53 | + |
| 48 54 | % CopyData replication messages |
| 49 55 | -define(X_LOG_DATA, $w). |
| 50 56 | -define(PRIMARY_KEEPALIVE_MESSAGE, $k). |
| @@ -11,7 +11,7 @@ | |
| 11 11 | ]} |
| 12 12 | ]}, |
| 13 13 | {lint, [ |
| 14 | - {plugins, [rebar3_lint]} |
| 14 | + {plugins, [{rebar3_lint, "0.2.0"}]} |
| 15 15 | ]} |
| 16 16 | ]}. |
| 17 17 | |
| @@ -26,9 +26,15 @@ | |
| 26 26 | ruleset => erl_files, |
| 27 27 | rules => |
| 28 28 | [{elvis_style, line_length, #{limit => 120}}, |
| 29 | - {elvis_style, god_modules, #{limit => 41}}, |
| 29 | + {elvis_style, god_modules, #{ignore => [epgsql, epgsqla, epgsqli, epgsql_sock, epgsql_wire]}}, |
| 30 30 | {elvis_style, dont_repeat_yourself, #{min_complexity => 11}}, |
| 31 31 | {elvis_style, state_record_and_type, disable} % epgsql_sock |
| 32 32 | ]} |
| 33 33 | ] |
| 34 34 | }. |
| 35 | + |
| 36 | + {dialyzer, |
| 37 | + [ |
| 38 | + {warnings, [unknown]}, |
| 39 | + {plt_apps, all_deps} |
| 40 | + ]}. |
| @@ -86,7 +86,7 @@ execute(PgSock, #connect{stage = auth, auth_send = {PacketType, Data}} = St) -> | |
| 86 86 | {send, PacketType, Data, PgSock, St#connect{auth_send = undefined}}. |
| 87 87 | |
| 88 88 | -spec open_socket([{atom(), any()}], epgsql:connect_opts()) -> |
| 89 | - {ok , gen_tcp | ssl, port() | ssl:sslsocket()} | {error, any()}. |
| 89 | + {ok , gen_tcp | ssl, gen_tcp:socket() | ssl:sslsocket()} | {error, any()}. |
| 90 90 | open_socket(SockOpts, #{host := Host} = ConnectOpts) -> |
| 91 91 | Timeout = maps:get(timeout, ConnectOpts, 5000), |
| 92 92 | Deadline = deadline(Timeout), |
| @@ -123,7 +123,7 @@ maybe_ssl(Sock, Flag, ConnectOpts, Deadline) -> | |
| 123 123 | {ok, <<$S>>} -> |
| 124 124 | SslOpts = maps:get(ssl_opts, ConnectOpts, []), |
| 125 125 | Timeout = timeout(Deadline), |
| 126 | - case ssl:connect(Sock, SslOpts, Timeout) of |
| 126 | + case ssl:connect(Sock, [{active, false} | SslOpts], Timeout) of |
| 127 127 | {ok, Sock2} -> |
| 128 128 | {ok, ssl, Sock2}; |
| 129 129 | {error, Reason} -> |
Loading more files…