ホーム › System.Search › SQLGetConnectOptionW
SQLGetConnectOptionW
関数接続オプションの現在値を取得する(Unicode・非推奨)。
シグネチャ
// ODBC32.dll (Unicode / -W)
#include <windows.h>
SHORT SQLGetConnectOptionW(
void* hdbc,
WORD fOption,
void* pvParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdbc | void* | inout |
| fOption | WORD | in |
| pvParam | void* | inout |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll (Unicode / -W)
#include <windows.h>
SHORT SQLGetConnectOptionW(
void* hdbc,
WORD fOption,
void* pvParam
);[DllImport("ODBC32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern short SQLGetConnectOptionW(
IntPtr hdbc, // void* in/out
ushort fOption, // WORD
IntPtr pvParam // void* in/out
);<DllImport("ODBC32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SQLGetConnectOptionW(
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 SQLGetConnectOptionW Lib "odbc32" ( _
ByVal hdbc As LongPtr, _
ByVal fOption As Integer, _
ByVal pvParam As LongPtr) As Integer
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SQLGetConnectOptionW = ctypes.windll.odbc32.SQLGetConnectOptionW
SQLGetConnectOptionW.restype = ctypes.c_short
SQLGetConnectOptionW.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')
SQLGetConnectOptionW = Fiddle::Function.new(
lib['SQLGetConnectOptionW'],
[
Fiddle::TYPE_VOIDP, # hdbc : void* in/out
-Fiddle::TYPE_SHORT, # fOption : WORD
Fiddle::TYPE_VOIDP, # pvParam : void* in/out
],
Fiddle::TYPE_SHORT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "odbc32")]
extern "system" {
fn SQLGetConnectOptionW(
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.Unicode)]
public static extern short SQLGetConnectOptionW(IntPtr hdbc, ushort fOption, IntPtr pvParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLGetConnectOptionW' -Namespace Win32 -PassThru
# $api::SQLGetConnectOptionW(hdbc, fOption, pvParam)#uselib "ODBC32.dll"
#func global SQLGetConnectOptionW "SQLGetConnectOptionW" wptr, wptr, wptr
; SQLGetConnectOptionW hdbc, fOption, pvParam ; 戻り値は stat
; hdbc : void* in/out -> "wptr"
; fOption : WORD -> "wptr"
; pvParam : void* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ODBC32.dll"
#cfunc global SQLGetConnectOptionW "SQLGetConnectOptionW" sptr, int, sptr
; res = SQLGetConnectOptionW(hdbc, fOption, pvParam)
; hdbc : void* in/out -> "sptr"
; fOption : WORD -> "int"
; pvParam : void* in/out -> "sptr"; SHORT SQLGetConnectOptionW(void* hdbc, WORD fOption, void* pvParam)
#uselib "ODBC32.dll"
#cfunc global SQLGetConnectOptionW "SQLGetConnectOptionW" intptr, int, intptr
; res = SQLGetConnectOptionW(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")
procSQLGetConnectOptionW = odbc32.NewProc("SQLGetConnectOptionW")
)
// hdbc (void* in/out), fOption (WORD), pvParam (void* in/out)
r1, _, err := procSQLGetConnectOptionW.Call(
uintptr(hdbc),
uintptr(fOption),
uintptr(pvParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLGetConnectOptionW(
hdbc: Pointer; // void* in/out
fOption: Word; // WORD
pvParam: Pointer // void* in/out
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLGetConnectOptionW';result := DllCall("ODBC32\SQLGetConnectOptionW"
, "Ptr", hdbc ; void* in/out
, "UShort", fOption ; WORD
, "Ptr", pvParam ; void* in/out
, "Short") ; return: SHORT●SQLGetConnectOptionW(hdbc, fOption, pvParam) = DLL("ODBC32.dll", "int SQLGetConnectOptionW(void*, int, void*)")
# 呼び出し: SQLGetConnectOptionW(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)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。