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

SQLSetCursorNameA

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

シグネチャ

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

SHORT SQLSetCursorNameA(
    void* hstmt,
    BYTE* szCursor,
    SHORT cbCursor
);

パラメーター

名前方向
hstmtvoid*inout
szCursorBYTE*in
cbCursorSHORTin

戻り値の型: SHORT

各言語での呼び出し定義

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

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

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

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

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLSetCursorNameA = odbc32.NewProc("SQLSetCursorNameA")
)

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