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

SQLParamOptions

関数
複数行パラメータの一括処理を設定する(非推奨)。
DLLODBC32.dll呼出規約winapi

シグネチャ

// ODBC32.dll
#include <windows.h>

SHORT SQLParamOptions(
    void* hstmt,
    DWORD crow,
    DWORD* pirow
);

パラメーター

名前方向
hstmtvoid*inout
crowDWORDin
pirowDWORD*inout

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll
#include <windows.h>

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

SQLParamOptions = ctypes.windll.odbc32.SQLParamOptions
SQLParamOptions.restype = ctypes.c_short
SQLParamOptions.argtypes = [
    ctypes.POINTER(None),  # hstmt : void* in/out
    wintypes.DWORD,  # crow : DWORD
    ctypes.POINTER(wintypes.DWORD),  # pirow : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLParamOptions = odbc32.NewProc("SQLParamOptions")
)

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