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

SQLDisconnect

関数
データソースとの接続を切断する。
DLLODBC32.dll呼出規約winapi

シグネチャ

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

SHORT SQLDisconnect(
    void* ConnectionHandle
);

パラメーター

名前方向
ConnectionHandlevoid*inout

戻り値の型: SHORT

各言語での呼び出し定義

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

SHORT SQLDisconnect(
    void* ConnectionHandle
);
[DllImport("ODBC32.dll", ExactSpelling = true)]
static extern short SQLDisconnect(
    IntPtr ConnectionHandle   // void* in/out
);
<DllImport("ODBC32.dll", ExactSpelling:=True)>
Public Shared Function SQLDisconnect(
    ConnectionHandle As IntPtr   ' void* in/out
) As Short
End Function
' ConnectionHandle : void* in/out
Declare PtrSafe Function SQLDisconnect 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

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

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

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLDisconnect = odbc32.NewProc("SQLDisconnect")
)

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