ホーム › System.Search › SQLSetPos
SQLSetPos
関数結果セット内のカーソル位置を設定し行を操作する。
シグネチャ
// ODBC32.dll
#include <windows.h>
SHORT SQLSetPos(
void* hstmt,
WORD irow,
WORD fOption,
WORD fLock
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hstmt | void* | inout |
| irow | WORD | in |
| fOption | WORD | in |
| fLock | WORD | in |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll
#include <windows.h>
SHORT SQLSetPos(
void* hstmt,
WORD irow,
WORD fOption,
WORD fLock
);[DllImport("ODBC32.dll", ExactSpelling = true)]
static extern short SQLSetPos(
IntPtr hstmt, // void* in/out
ushort irow, // WORD
ushort fOption, // WORD
ushort fLock // WORD
);<DllImport("ODBC32.dll", ExactSpelling:=True)>
Public Shared Function SQLSetPos(
hstmt As IntPtr, ' void* in/out
irow As UShort, ' WORD
fOption As UShort, ' WORD
fLock As UShort ' WORD
) As Short
End Function' hstmt : void* in/out
' irow : WORD
' fOption : WORD
' fLock : WORD
Declare PtrSafe Function SQLSetPos Lib "odbc32" ( _
ByVal hstmt As LongPtr, _
ByVal irow As Integer, _
ByVal fOption As Integer, _
ByVal fLock As Integer) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SQLSetPos = ctypes.windll.odbc32.SQLSetPos
SQLSetPos.restype = ctypes.c_short
SQLSetPos.argtypes = [
ctypes.POINTER(None), # hstmt : void* in/out
ctypes.c_ushort, # irow : WORD
ctypes.c_ushort, # fOption : WORD
ctypes.c_ushort, # fLock : WORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ODBC32.dll')
SQLSetPos = Fiddle::Function.new(
lib['SQLSetPos'],
[
Fiddle::TYPE_VOIDP, # hstmt : void* in/out
-Fiddle::TYPE_SHORT, # irow : WORD
-Fiddle::TYPE_SHORT, # fOption : WORD
-Fiddle::TYPE_SHORT, # fLock : WORD
],
Fiddle::TYPE_SHORT)#[link(name = "odbc32")]
extern "system" {
fn SQLSetPos(
hstmt: *mut (), // void* in/out
irow: u16, // WORD
fOption: u16, // WORD
fLock: u16 // WORD
) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ODBC32.dll")]
public static extern short SQLSetPos(IntPtr hstmt, ushort irow, ushort fOption, ushort fLock);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLSetPos' -Namespace Win32 -PassThru
# $api::SQLSetPos(hstmt, irow, fOption, fLock)#uselib "ODBC32.dll"
#func global SQLSetPos "SQLSetPos" sptr, sptr, sptr, sptr
; SQLSetPos hstmt, irow, fOption, fLock ; 戻り値は stat
; hstmt : void* in/out -> "sptr"
; irow : WORD -> "sptr"
; fOption : WORD -> "sptr"
; fLock : WORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ODBC32.dll"
#cfunc global SQLSetPos "SQLSetPos" sptr, int, int, int
; res = SQLSetPos(hstmt, irow, fOption, fLock)
; hstmt : void* in/out -> "sptr"
; irow : WORD -> "int"
; fOption : WORD -> "int"
; fLock : WORD -> "int"; SHORT SQLSetPos(void* hstmt, WORD irow, WORD fOption, WORD fLock)
#uselib "ODBC32.dll"
#cfunc global SQLSetPos "SQLSetPos" intptr, int, int, int
; res = SQLSetPos(hstmt, irow, fOption, fLock)
; hstmt : void* in/out -> "intptr"
; irow : WORD -> "int"
; fOption : WORD -> "int"
; fLock : WORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
procSQLSetPos = odbc32.NewProc("SQLSetPos")
)
// hstmt (void* in/out), irow (WORD), fOption (WORD), fLock (WORD)
r1, _, err := procSQLSetPos.Call(
uintptr(hstmt),
uintptr(irow),
uintptr(fOption),
uintptr(fLock),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLSetPos(
hstmt: Pointer; // void* in/out
irow: Word; // WORD
fOption: Word; // WORD
fLock: Word // WORD
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLSetPos';result := DllCall("ODBC32\SQLSetPos"
, "Ptr", hstmt ; void* in/out
, "UShort", irow ; WORD
, "UShort", fOption ; WORD
, "UShort", fLock ; WORD
, "Short") ; return: SHORT●SQLSetPos(hstmt, irow, fOption, fLock) = DLL("ODBC32.dll", "int SQLSetPos(void*, int, int, int)")
# 呼び出し: SQLSetPos(hstmt, irow, fOption, fLock)
# hstmt : void* in/out -> "void*"
# irow : WORD -> "int"
# fOption : WORD -> "int"
# fLock : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。