From: Mark Wilson <markwilson@wilsonnet.technology>
Subject: Re: Odd Behaviour
Date: Tue, 18 Jan 2022 05:50:34 -0800 (PST) [thread overview]
Message-ID: <2e5eeb92-cc9b-43ae-8718-5cdd9774baf3n@googlegroups.com> (raw)
In-Reply-To: <2306ce86-b1da-4448-a77a-9be0f5cec9f6n@googlegroups.com>
Just for completeness, this is what I end up doing
SPEC:
--------------------------------------------------------------------------------
function SQL_OK
(rc : in SQLRETURN)
return Boolean
with
Global => null,
Depends => (SQL_OK'Result => (rc)),
Post => (SQL_OK'Result =
(rc = SQL_SUCCESS or rc = SQL_SUCCESS_WITH_INFO));
--------------------------------------------------------------------------------
procedure SQLAllocEnv
(hEnv : in out SQLHENV;
Result : out SQLRETURN)
with
Inline,
Global => (Output => Environment),
Depends => ((Result, hEnv, Environment) => (hEnv)),
Pre => (SQLHANDLE (hEnv) = SQL_NULL_HANDLE),
Post => (if SQL_OK (Result) then
SQLHANDLE(hEnv) /= SQL_NULL_HANDLE
else
SQLHANDLE(hEnv) = SQL_NULL_HANDLE);
--------------------------------------------------------------------------------
procedure SQLAllocDbc
(hEnv : in SQLHENV;
hDbc : in out SQLHDBC;
Result : out SQLRETURN)
with
Inline,
Global => (Input => Environment,
Output => Database_Connection),
Depends => ((Result, hDbc, Database_Connection) =>
(hEnv, hDbc, Environment)),
Pre => (SQLHANDLE (hEnv) /= SQL_NULL_HANDLE and
SQLHANDLE (hDbc) = SQL_NULL_HANDLE),
Post => (if SQL_OK (Result) then
SQLHANDLE(hDbc) /= SQL_NULL_HANDLE
else
SQLHANDLE(hDbc) = SQL_NULL_HANDLE);
--------------------------------------------------------------------------------
BODY:
--------------------------------------------------------------------------------
function SQLAllocHandle
(HandleType : in SQL_HANDLE_TYPE;
InputHandle : in SQLHANDLE;
OutputHandlePtr : in out SQLHANDLE)
return SQLRETURN
with
Import => True,
Convention => C,
External_Name => "SQLAllocHandle";
--------------------------------------------------------------------------------
function SQL_OK
(rc : in SQLRETURN)
return Boolean
is
(rc = SQL_SUCCESS or rc = SQL_SUCCESS_WITH_INFO);
--------------------------------------------------------------------------------
procedure SQLAllocEnv
(hEnv : in out SQLHENV;
Result : out SQLRETURN)
is
begin
Result := SQLAllocHandle
(HandleType => SQL_HANDLE_ENV,
InputHandle => SQL_NULL_HANDLE,
OutputHandlePtr => SQLHANDLE (hEnv));
end SQLAllocEnv;
--------------------------------------------------------------------------------
procedure SQLAllocDbc
(hEnv : in SQLHENV;
hDbc : in out SQLHDBC;
Result : out SQLRETURN)
is
begin
Result := SQLAllocHandle
(HandleType => SQL_HANDLE_DBC,
InputHandle => SQLHANDLE (hEnv),
OutputHandlePtr => SQLHANDLE (hDbc));
end SQLAllocDbc;
--------------------------------------------------------------------------------
Thanks for the help!
next prev parent reply other threads:[~2022-01-18 13:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 11:05 Odd Behaviour Mark Wilson
2022-01-18 11:16 ` Marius Amado-Alves
2022-01-18 11:21 ` Mark Wilson
2022-01-18 11:24 ` Mark Wilson
2022-01-18 11:28 ` Jeffrey R.Carter
2022-01-18 11:35 ` Mark Wilson
2022-01-18 11:48 ` Jeffrey R.Carter
2022-01-18 11:51 ` Mark Wilson
2022-01-18 12:08 ` Mark Wilson
2022-01-18 12:18 ` Mark Wilson
2022-01-18 12:27 ` Mark Wilson
2022-01-18 13:50 ` Mark Wilson [this message]
2022-01-18 12:25 ` Jeffrey R.Carter
2022-01-18 12:30 ` Mark Wilson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox