Skip to content

Commit

Permalink
unallocate_statement
Browse files Browse the repository at this point in the history
  • Loading branch information
nakagami committed Jul 16, 2023
1 parent 5cef7a5 commit d13479c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/firebirdex/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,8 @@ defmodule Firebirdex.Connection do
def handle_prepare(%Query{} = query, _opts, state) do
charset = econn(state.conn, :charset)

{:ok, stmt} = :efirebirdsql_protocol.allocate_statement(state.conn)
case :efirebirdsql_protocol.prepare_statement(Encoding.from_string!(to_string(query), charset), state.conn, stmt) do
{:ok, stmt} ->
{:ok, %Query{query | stmt: stmt, charset: charset}, %__MODULE__{state | conn: state.conn, transaction_status: :transaction}}
{:error, number, reason} ->
{:error, %Error{number: number, reason: reason, statement: query.statement}, %__MODULE__{state | conn: state.conn, transaction_status: :transaction}}
end
{:ok, stmt} = :efirebirdsql_protocol.unallocate_statement(to_string(query))
{:ok, %Query{query | stmt: stmt, charset: charset}, %__MODULE__{state | conn: state.conn, transaction_status: :transaction}}
end

defp convert_param(%Decimal{} = value, _charset) do
Expand Down

0 comments on commit d13479c

Please sign in to comment.