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

SQLGetCursorNameW

関数
ステートメントのカーソル名を取得する(Unicode)。
DLLODBC32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// ODBC32.dll  (Unicode / -W)
#include <windows.h>

SHORT SQLGetCursorNameW(
    void* hstmt,
    WORD* szCursor,   // optional
    SHORT cchCursorMax,
    SHORT* pcchCursor   // optional
);

パラメーター

名前方向
hstmtvoid*inout
szCursorWORD*outoptional
cchCursorMaxSHORTin
pcchCursorSHORT*outoptional

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll  (Unicode / -W)
#include <windows.h>

SHORT SQLGetCursorNameW(
    void* hstmt,
    WORD* szCursor,   // optional
    SHORT cchCursorMax,
    SHORT* pcchCursor   // optional
);
[DllImport("ODBC32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern short SQLGetCursorNameW(
    IntPtr hstmt,   // void* in/out
    IntPtr szCursor,   // WORD* optional, out
    short cchCursorMax,   // SHORT
    IntPtr pcchCursor   // SHORT* optional, out
);
<DllImport("ODBC32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SQLGetCursorNameW(
    hstmt As IntPtr,   ' void* in/out
    szCursor As IntPtr,   ' WORD* optional, out
    cchCursorMax As Short,   ' SHORT
    pcchCursor As IntPtr   ' SHORT* optional, out
) As Short
End Function
' hstmt : void* in/out
' szCursor : WORD* optional, out
' cchCursorMax : SHORT
' pcchCursor : SHORT* optional, out
Declare PtrSafe Function SQLGetCursorNameW Lib "odbc32" ( _
    ByVal hstmt As LongPtr, _
    ByVal szCursor As LongPtr, _
    ByVal cchCursorMax As Integer, _
    ByVal pcchCursor 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

SQLGetCursorNameW = ctypes.windll.odbc32.SQLGetCursorNameW
SQLGetCursorNameW.restype = ctypes.c_short
SQLGetCursorNameW.argtypes = [
    ctypes.POINTER(None),  # hstmt : void* in/out
    ctypes.POINTER(ctypes.c_ushort),  # szCursor : WORD* optional, out
    ctypes.c_short,  # cchCursorMax : SHORT
    ctypes.POINTER(ctypes.c_short),  # pcchCursor : SHORT* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ODBC32.dll')
SQLGetCursorNameW = Fiddle::Function.new(
  lib['SQLGetCursorNameW'],
  [
    Fiddle::TYPE_VOIDP,  # hstmt : void* in/out
    Fiddle::TYPE_VOIDP,  # szCursor : WORD* optional, out
    Fiddle::TYPE_SHORT,  # cchCursorMax : SHORT
    Fiddle::TYPE_VOIDP,  # pcchCursor : SHORT* optional, out
  ],
  Fiddle::TYPE_SHORT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "odbc32")]
extern "system" {
    fn SQLGetCursorNameW(
        hstmt: *mut (),  // void* in/out
        szCursor: *mut u16,  // WORD* optional, out
        cchCursorMax: i16,  // SHORT
        pcchCursor: *mut i16  // SHORT* optional, out
    ) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ODBC32.dll", CharSet = CharSet.Unicode)]
public static extern short SQLGetCursorNameW(IntPtr hstmt, IntPtr szCursor, short cchCursorMax, IntPtr pcchCursor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLGetCursorNameW' -Namespace Win32 -PassThru
# $api::SQLGetCursorNameW(hstmt, szCursor, cchCursorMax, pcchCursor)
#uselib "ODBC32.dll"
#func global SQLGetCursorNameW "SQLGetCursorNameW" wptr, wptr, wptr, wptr
; SQLGetCursorNameW hstmt, varptr(szCursor), cchCursorMax, varptr(pcchCursor)   ; 戻り値は stat
; hstmt : void* in/out -> "wptr"
; szCursor : WORD* optional, out -> "wptr"
; cchCursorMax : SHORT -> "wptr"
; pcchCursor : SHORT* optional, out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ODBC32.dll"
#cfunc global SQLGetCursorNameW "SQLGetCursorNameW" sptr, var, int, var
; res = SQLGetCursorNameW(hstmt, szCursor, cchCursorMax, pcchCursor)
; hstmt : void* in/out -> "sptr"
; szCursor : WORD* optional, out -> "var"
; cchCursorMax : SHORT -> "int"
; pcchCursor : SHORT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; SHORT SQLGetCursorNameW(void* hstmt, WORD* szCursor, SHORT cchCursorMax, SHORT* pcchCursor)
#uselib "ODBC32.dll"
#cfunc global SQLGetCursorNameW "SQLGetCursorNameW" intptr, var, int, var
; res = SQLGetCursorNameW(hstmt, szCursor, cchCursorMax, pcchCursor)
; hstmt : void* in/out -> "intptr"
; szCursor : WORD* optional, out -> "var"
; cchCursorMax : SHORT -> "int"
; pcchCursor : SHORT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLGetCursorNameW = odbc32.NewProc("SQLGetCursorNameW")
)

// hstmt (void* in/out), szCursor (WORD* optional, out), cchCursorMax (SHORT), pcchCursor (SHORT* optional, out)
r1, _, err := procSQLGetCursorNameW.Call(
	uintptr(hstmt),
	uintptr(szCursor),
	uintptr(cchCursorMax),
	uintptr(pcchCursor),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SHORT
function SQLGetCursorNameW(
  hstmt: Pointer;   // void* in/out
  szCursor: Pointer;   // WORD* optional, out
  cchCursorMax: Smallint;   // SHORT
  pcchCursor: Pointer   // SHORT* optional, out
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLGetCursorNameW';
result := DllCall("ODBC32\SQLGetCursorNameW"
    , "Ptr", hstmt   ; void* in/out
    , "Ptr", szCursor   ; WORD* optional, out
    , "Short", cchCursorMax   ; SHORT
    , "Ptr", pcchCursor   ; SHORT* optional, out
    , "Short")   ; return: SHORT
●SQLGetCursorNameW(hstmt, szCursor, cchCursorMax, pcchCursor) = DLL("ODBC32.dll", "int SQLGetCursorNameW(void*, void*, int, void*)")
# 呼び出し: SQLGetCursorNameW(hstmt, szCursor, cchCursorMax, pcchCursor)
# hstmt : void* in/out -> "void*"
# szCursor : WORD* optional, out -> "void*"
# cchCursorMax : SHORT -> "int"
# pcchCursor : SHORT* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。