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

SQLGetCursorName

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

シグネチャ

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

SHORT SQLGetCursorName(
    void* StatementHandle,
    BYTE* CursorName,   // optional
    SHORT BufferLength,
    SHORT* NameLengthPtr   // optional
);

パラメーター

名前方向
StatementHandlevoid*inout
CursorNameBYTE*outoptional
BufferLengthSHORTin
NameLengthPtrSHORT*outoptional

戻り値の型: SHORT

各言語での呼び出し定義

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

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

SQLGetCursorName = ctypes.windll.odbc32.SQLGetCursorName
SQLGetCursorName.restype = ctypes.c_short
SQLGetCursorName.argtypes = [
    ctypes.POINTER(None),  # StatementHandle : void* in/out
    ctypes.POINTER(ctypes.c_ubyte),  # CursorName : BYTE* optional, out
    ctypes.c_short,  # BufferLength : SHORT
    ctypes.POINTER(ctypes.c_short),  # NameLengthPtr : SHORT* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ODBC32.dll')
SQLGetCursorName = Fiddle::Function.new(
  lib['SQLGetCursorName'],
  [
    Fiddle::TYPE_VOIDP,  # StatementHandle : void* in/out
    Fiddle::TYPE_VOIDP,  # CursorName : BYTE* optional, out
    Fiddle::TYPE_SHORT,  # BufferLength : SHORT
    Fiddle::TYPE_VOIDP,  # NameLengthPtr : SHORT* optional, out
  ],
  Fiddle::TYPE_SHORT)
#[link(name = "odbc32")]
extern "system" {
    fn SQLGetCursorName(
        StatementHandle: *mut (),  // void* in/out
        CursorName: *mut u8,  // BYTE* optional, out
        BufferLength: i16,  // SHORT
        NameLengthPtr: *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 SQLGetCursorName(IntPtr StatementHandle, IntPtr CursorName, short BufferLength, IntPtr NameLengthPtr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLGetCursorName' -Namespace Win32 -PassThru
# $api::SQLGetCursorName(StatementHandle, CursorName, BufferLength, NameLengthPtr)
#uselib "ODBC32.dll"
#func global SQLGetCursorName "SQLGetCursorName" sptr, sptr, sptr, sptr
; SQLGetCursorName StatementHandle, varptr(CursorName), BufferLength, varptr(NameLengthPtr)   ; 戻り値は stat
; StatementHandle : void* in/out -> "sptr"
; CursorName : BYTE* optional, out -> "sptr"
; BufferLength : SHORT -> "sptr"
; NameLengthPtr : SHORT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ODBC32.dll"
#cfunc global SQLGetCursorName "SQLGetCursorName" sptr, var, int, var
; res = SQLGetCursorName(StatementHandle, CursorName, BufferLength, NameLengthPtr)
; StatementHandle : void* in/out -> "sptr"
; CursorName : BYTE* optional, out -> "var"
; BufferLength : SHORT -> "int"
; NameLengthPtr : SHORT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; SHORT SQLGetCursorName(void* StatementHandle, BYTE* CursorName, SHORT BufferLength, SHORT* NameLengthPtr)
#uselib "ODBC32.dll"
#cfunc global SQLGetCursorName "SQLGetCursorName" intptr, var, int, var
; res = SQLGetCursorName(StatementHandle, CursorName, BufferLength, NameLengthPtr)
; StatementHandle : void* in/out -> "intptr"
; CursorName : BYTE* optional, out -> "var"
; BufferLength : SHORT -> "int"
; NameLengthPtr : SHORT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLGetCursorName = odbc32.NewProc("SQLGetCursorName")
)

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