ホーム › System.Search › SQLGetConnectOptionA
SQLGetConnectOptionA
関数ODBC接続オプションの現在値を取得する。
シグネチャ
// ODBC32.dll (ANSI / -A)
#include <windows.h>
SHORT SQLGetConnectOptionA(
void* hdbc,
WORD fOption,
void* pvParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdbc | void* | inout |
| fOption | WORD | in |
| pvParam | void* | inout |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll (ANSI / -A)
#include <windows.h>
SHORT SQLGetConnectOptionA(
void* hdbc,
WORD fOption,
void* pvParam
);[DllImport("ODBC32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern short SQLGetConnectOptionA(
IntPtr hdbc, // void* in/out
ushort fOption, // WORD
IntPtr pvParam // void* in/out
);<DllImport("ODBC32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SQLGetConnectOptionA(
hdbc As IntPtr, ' void* in/out
fOption As UShort, ' WORD
pvParam As IntPtr ' void* in/out
) As Short
End Function' hdbc : void* in/out
' fOption : WORD
' pvParam : void* in/out
Declare PtrSafe Function SQLGetConnectOptionA Lib "odbc32" ( _
ByVal hdbc As LongPtr, _
ByVal fOption As Integer, _
ByVal pvParam As LongPtr) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SQLGetConnectOptionA = ctypes.windll.odbc32.SQLGetConnectOptionA
SQLGetConnectOptionA.restype = ctypes.c_short
SQLGetConnectOptionA.argtypes = [
ctypes.POINTER(None), # hdbc : void* in/out
ctypes.c_ushort, # fOption : WORD
ctypes.POINTER(None), # pvParam : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ODBC32.dll')
SQLGetConnectOptionA = Fiddle::Function.new(
lib['SQLGetConnectOptionA'],
[
Fiddle::TYPE_VOIDP, # hdbc : void* in/out
-Fiddle::TYPE_SHORT, # fOption : WORD
Fiddle::TYPE_VOIDP, # pvParam : void* in/out
],
Fiddle::TYPE_SHORT)#[link(name = "odbc32")]
extern "system" {
fn SQLGetConnectOptionA(
hdbc: *mut (), // void* in/out
fOption: u16, // WORD
pvParam: *mut () // void* in/out
) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ODBC32.dll", CharSet = CharSet.Ansi)]
public static extern short SQLGetConnectOptionA(IntPtr hdbc, ushort fOption, IntPtr pvParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLGetConnectOptionA' -Namespace Win32 -PassThru
# $api::SQLGetConnectOptionA(hdbc, fOption, pvParam)#uselib "ODBC32.dll"
#func global SQLGetConnectOptionA "SQLGetConnectOptionA" sptr, sptr, sptr
; SQLGetConnectOptionA hdbc, fOption, pvParam ; 戻り値は stat
; hdbc : void* in/out -> "sptr"
; fOption : WORD -> "sptr"
; pvParam : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ODBC32.dll"
#cfunc global SQLGetConnectOptionA "SQLGetConnectOptionA" sptr, int, sptr
; res = SQLGetConnectOptionA(hdbc, fOption, pvParam)
; hdbc : void* in/out -> "sptr"
; fOption : WORD -> "int"
; pvParam : void* in/out -> "sptr"; SHORT SQLGetConnectOptionA(void* hdbc, WORD fOption, void* pvParam)
#uselib "ODBC32.dll"
#cfunc global SQLGetConnectOptionA "SQLGetConnectOptionA" intptr, int, intptr
; res = SQLGetConnectOptionA(hdbc, fOption, pvParam)
; hdbc : void* in/out -> "intptr"
; fOption : WORD -> "int"
; pvParam : void* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
procSQLGetConnectOptionA = odbc32.NewProc("SQLGetConnectOptionA")
)
// hdbc (void* in/out), fOption (WORD), pvParam (void* in/out)
r1, _, err := procSQLGetConnectOptionA.Call(
uintptr(hdbc),
uintptr(fOption),
uintptr(pvParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLGetConnectOptionA(
hdbc: Pointer; // void* in/out
fOption: Word; // WORD
pvParam: Pointer // void* in/out
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLGetConnectOptionA';result := DllCall("ODBC32\SQLGetConnectOptionA"
, "Ptr", hdbc ; void* in/out
, "UShort", fOption ; WORD
, "Ptr", pvParam ; void* in/out
, "Short") ; return: SHORT●SQLGetConnectOptionA(hdbc, fOption, pvParam) = DLL("ODBC32.dll", "int SQLGetConnectOptionA(void*, int, void*)")
# 呼び出し: SQLGetConnectOptionA(hdbc, fOption, pvParam)
# hdbc : void* in/out -> "void*"
# fOption : WORD -> "int"
# pvParam : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。