Win32 API 日本語リファレンス
ホームSystem.Search › SQLFreeConnect

SQLFreeConnect

関数
接続ハンドルを解放する(非推奨)。
DLLODBC32.dll呼出規約winapi

シグネチャ

// ODBC32.dll
#include <windows.h>

SHORT SQLFreeConnect(
    void* ConnectionHandle
);

パラメーター

名前方向
ConnectionHandlevoid*inout

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll
#include <windows.h>

SHORT SQLFreeConnect(
    void* ConnectionHandle
);
[DllImport("ODBC32.dll", ExactSpelling = true)]
static extern short SQLFreeConnect(
    IntPtr ConnectionHandle   // void* in/out
);
<DllImport("ODBC32.dll", ExactSpelling:=True)>
Public Shared Function SQLFreeConnect(
    ConnectionHandle As IntPtr   ' void* in/out
) As Short
End Function
' ConnectionHandle : void* in/out
Declare PtrSafe Function SQLFreeConnect Lib "odbc32" ( _
    ByVal ConnectionHandle As LongPtr) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SQLFreeConnect = ctypes.windll.odbc32.SQLFreeConnect
SQLFreeConnect.restype = ctypes.c_short
SQLFreeConnect.argtypes = [
    ctypes.POINTER(None),  # ConnectionHandle : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ODBC32.dll')
SQLFreeConnect = Fiddle::Function.new(
  lib['SQLFreeConnect'],
  [
    Fiddle::TYPE_VOIDP,  # ConnectionHandle : void* in/out
  ],
  Fiddle::TYPE_SHORT)
#[link(name = "odbc32")]
extern "system" {
    fn SQLFreeConnect(
        ConnectionHandle: *mut ()  // void* in/out
    ) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ODBC32.dll")]
public static extern short SQLFreeConnect(IntPtr ConnectionHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLFreeConnect' -Namespace Win32 -PassThru
# $api::SQLFreeConnect(ConnectionHandle)
#uselib "ODBC32.dll"
#func global SQLFreeConnect "SQLFreeConnect" sptr
; SQLFreeConnect ConnectionHandle   ; 戻り値は stat
; ConnectionHandle : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ODBC32.dll"
#cfunc global SQLFreeConnect "SQLFreeConnect" sptr
; res = SQLFreeConnect(ConnectionHandle)
; ConnectionHandle : void* in/out -> "sptr"
; SHORT SQLFreeConnect(void* ConnectionHandle)
#uselib "ODBC32.dll"
#cfunc global SQLFreeConnect "SQLFreeConnect" intptr
; res = SQLFreeConnect(ConnectionHandle)
; ConnectionHandle : void* in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLFreeConnect = odbc32.NewProc("SQLFreeConnect")
)

// ConnectionHandle (void* in/out)
r1, _, err := procSQLFreeConnect.Call(
	uintptr(ConnectionHandle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SHORT
function SQLFreeConnect(
  ConnectionHandle: Pointer   // void* in/out
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLFreeConnect';
result := DllCall("ODBC32\SQLFreeConnect"
    , "Ptr", ConnectionHandle   ; void* in/out
    , "Short")   ; return: SHORT
●SQLFreeConnect(ConnectionHandle) = DLL("ODBC32.dll", "int SQLFreeConnect(void*)")
# 呼び出し: SQLFreeConnect(ConnectionHandle)
# ConnectionHandle : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。