diff --git a/lib/firebirdex/connection.ex b/lib/firebirdex/connection.ex index 74b32e4..eed7f27 100644 --- a/lib/firebirdex/connection.ex +++ b/lib/firebirdex/connection.ex @@ -20,7 +20,13 @@ defmodule Firebirdex.Connection do database = to_charlist(opts[:database]) case :efirebirdsql_protocol.connect(hostname, username, password, database, opts) do {:ok, conn} -> - {:ok, %__MODULE__{conn: conn, transaction_status: :transaction}} + auto_commit = Keyword.get(opts, :auto_commit, true) + case :efirebirdsql_protocol.begin_transaction(auto_commit, conn) do + {:ok, conn} -> + {:ok, %__MODULE__{conn: conn, transaction_status: :transaction}} + {:error, number, reason, _conn} -> + {:error, %Error{number: number, reason: reason}} + end {:error, number, reason, _conn} -> {:error, %Error{number: number, reason: reason}} end diff --git a/mix.exs b/mix.exs index 5494b5c..758abde 100644 --- a/mix.exs +++ b/mix.exs @@ -44,7 +44,7 @@ defmodule Firebirdex.Mixfile do {:db_connection, "~> 2.4"}, {:decimal, "~> 2.0"}, {:timex, "~> 3.7"}, - {:efirebirdsql, "~> 0.8.5"}, + {:efirebirdsql, "~> 0.9"}, {:codepagex, "~> 0.1.6"}, {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} ] diff --git a/mix.lock b/mix.lock index c729fae..8114130 100644 --- a/mix.lock +++ b/mix.lock @@ -6,7 +6,7 @@ "db_connection": {:hex, :db_connection, "2.4.2", "f92e79aff2375299a16bcb069a14ee8615c3414863a6fef93156aee8e86c2ff3", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4fe53ca91b99f55ea249693a0229356a08f4d1a7931d8ffa79289b145fe83668"}, "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, "earmark_parser": {:hex, :earmark_parser, "1.4.26", "f4291134583f373c7d8755566122908eb9662df4c4b63caa66a0eabe06569b0a", [:mix], [], "hexpm", "48d460899f8a0c52c5470676611c01f64f3337bad0b26ddab43648428d94aabc"}, - "efirebirdsql": {:hex, :efirebirdsql, "0.8.5", "159f10b282debd6f76a6e083aa09e5dac9577228ed079ccc1c0ec8d412a35598", [:rebar3], [], "hexpm", "2e7de57740611bff1d222da1e344b772dbdc8b65138c4a60abd17670fca80c2b"}, + "efirebirdsql": {:hex, :efirebirdsql, "0.9.0", "4ccce7c2d708a89907395173db4e4e9e3a4498d36e540bc78869a171f5e85f56", [:rebar3], [], "hexpm", "13ae67827b90887126da1fbcfc4d11442463732b659d672ab88d0d1895fde8d2"}, "ex_doc": {:hex, :ex_doc, "0.28.4", "001a0ea6beac2f810f1abc3dbf4b123e9593eaa5f00dd13ded024eae7c523298", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bf85d003dd34911d89c8ddb8bda1a958af3471a274a4c2150a9c01c78ac3f8ed"}, "gettext": {:hex, :gettext, "0.20.0", "75ad71de05f2ef56991dbae224d35c68b098dd0e26918def5bb45591d5c8d429", [:mix], [], "hexpm", "1c03b177435e93a47441d7f681a7040bd2a816ece9e2666d1c9001035121eb3d"}, "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"},