ホーム › System.Search › SQLSetCursorNameW
SQLSetCursorNameW
関数ステートメントにカーソル名を設定する(Unicode)。
シグネチャ
// ODBC32.dll (Unicode / -W)
#include <windows.h>
SHORT SQLSetCursorNameW(
void* hstmt,
WORD* szCursor,
SHORT cchCursor
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hstmt | void* | inout |
| szCursor | WORD* | in |
| cchCursor | SHORT | in |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll (Unicode / -W)
#include <windows.h>
SHORT SQLSetCursorNameW(
void* hstmt,
WORD* szCursor,
SHORT cchCursor
);[DllImport("ODBC32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern short SQLSetCursorNameW(
IntPtr hstmt, // void* in/out
ref ushort szCursor, // WORD*
short cchCursor // SHORT
);<DllImport("ODBC32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SQLSetCursorNameW(
hstmt As IntPtr, ' void* in/out
ByRef szCursor As UShort, ' WORD*
cchCursor As Short ' SHORT
) As Short
End Function' hstmt : void* in/out
' szCursor : WORD*
' cchCursor : SHORT
Declare PtrSafe Function SQLSetCursorNameW Lib "odbc32" ( _
ByVal hstmt As LongPtr, _
ByRef szCursor As Integer, _
ByVal cchCursor As Integer) 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
SQLSetCursorNameW = ctypes.windll.odbc32.SQLSetCursorNameW
SQLSetCursorNameW.restype = ctypes.c_short
SQLSetCursorNameW.argtypes = [
ctypes.POINTER(None), # hstmt : void* in/out
ctypes.POINTER(ctypes.c_ushort), # szCursor : WORD*
ctypes.c_short, # cchCursor : SHORT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ODBC32.dll')
SQLSetCursorNameW = Fiddle::Function.new(
lib['SQLSetCursorNameW'],
[
Fiddle::TYPE_VOIDP, # hstmt : void* in/out
Fiddle::TYPE_VOIDP, # szCursor : WORD*
Fiddle::TYPE_SHORT, # cchCursor : SHORT
],
Fiddle::TYPE_SHORT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "odbc32")]
extern "system" {
fn SQLSetCursorNameW(
hstmt: *mut (), // void* in/out
szCursor: *mut u16, // WORD*
cchCursor: i16 // SHORT
) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ODBC32.dll", CharSet = CharSet.Unicode)]
public static extern short SQLSetCursorNameW(IntPtr hstmt, ref ushort szCursor, short cchCursor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLSetCursorNameW' -Namespace Win32 -PassThru
# $api::SQLSetCursorNameW(hstmt, szCursor, cchCursor)#uselib "ODBC32.dll"
#func global SQLSetCursorNameW "SQLSetCursorNameW" wptr, wptr, wptr
; SQLSetCursorNameW hstmt, varptr(szCursor), cchCursor ; 戻り値は stat
; hstmt : void* in/out -> "wptr"
; szCursor : WORD* -> "wptr"
; cchCursor : SHORT -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ODBC32.dll" #cfunc global SQLSetCursorNameW "SQLSetCursorNameW" sptr, var, int ; res = SQLSetCursorNameW(hstmt, szCursor, cchCursor) ; hstmt : void* in/out -> "sptr" ; szCursor : WORD* -> "var" ; cchCursor : SHORT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ODBC32.dll" #cfunc global SQLSetCursorNameW "SQLSetCursorNameW" sptr, sptr, int ; res = SQLSetCursorNameW(hstmt, varptr(szCursor), cchCursor) ; hstmt : void* in/out -> "sptr" ; szCursor : WORD* -> "sptr" ; cchCursor : SHORT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; SHORT SQLSetCursorNameW(void* hstmt, WORD* szCursor, SHORT cchCursor) #uselib "ODBC32.dll" #cfunc global SQLSetCursorNameW "SQLSetCursorNameW" intptr, var, int ; res = SQLSetCursorNameW(hstmt, szCursor, cchCursor) ; hstmt : void* in/out -> "intptr" ; szCursor : WORD* -> "var" ; cchCursor : SHORT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; SHORT SQLSetCursorNameW(void* hstmt, WORD* szCursor, SHORT cchCursor) #uselib "ODBC32.dll" #cfunc global SQLSetCursorNameW "SQLSetCursorNameW" intptr, intptr, int ; res = SQLSetCursorNameW(hstmt, varptr(szCursor), cchCursor) ; hstmt : void* in/out -> "intptr" ; szCursor : WORD* -> "intptr" ; cchCursor : SHORT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
procSQLSetCursorNameW = odbc32.NewProc("SQLSetCursorNameW")
)
// hstmt (void* in/out), szCursor (WORD*), cchCursor (SHORT)
r1, _, err := procSQLSetCursorNameW.Call(
uintptr(hstmt),
uintptr(szCursor),
uintptr(cchCursor),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLSetCursorNameW(
hstmt: Pointer; // void* in/out
szCursor: Pointer; // WORD*
cchCursor: Smallint // SHORT
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLSetCursorNameW';result := DllCall("ODBC32\SQLSetCursorNameW"
, "Ptr", hstmt ; void* in/out
, "Ptr", szCursor ; WORD*
, "Short", cchCursor ; SHORT
, "Short") ; return: SHORT●SQLSetCursorNameW(hstmt, szCursor, cchCursor) = DLL("ODBC32.dll", "int SQLSetCursorNameW(void*, void*, int)")
# 呼び出し: SQLSetCursorNameW(hstmt, szCursor, cchCursor)
# hstmt : void* in/out -> "void*"
# szCursor : WORD* -> "void*"
# cchCursor : SHORT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。