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

SQLGetCursorNameA

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

シグネチャ

// ODBC32.dll  (ANSI / -A)
#include <windows.h>

SHORT SQLGetCursorNameA(
    void* hstmt,
    BYTE* szCursor,   // optional
    SHORT cbCursorMax,
    SHORT* pcbCursor   // optional
);

パラメーター

名前方向
hstmtvoid*inout
szCursorBYTE*outoptional
cbCursorMaxSHORTin
pcbCursorSHORT*outoptional

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll  (ANSI / -A)
#include <windows.h>

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

SQLGetCursorNameA = ctypes.windll.odbc32.SQLGetCursorNameA
SQLGetCursorNameA.restype = ctypes.c_short
SQLGetCursorNameA.argtypes = [
    ctypes.POINTER(None),  # hstmt : void* in/out
    ctypes.POINTER(ctypes.c_ubyte),  # szCursor : BYTE* optional, out
    ctypes.c_short,  # cbCursorMax : SHORT
    ctypes.POINTER(ctypes.c_short),  # pcbCursor : SHORT* optional, out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLGetCursorNameA = odbc32.NewProc("SQLGetCursorNameA")
)

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