ホーム › System.Search › SQLGetStmtAttr
SQLGetStmtAttr
関数ステートメント属性の現在値を取得する。
シグネチャ
// ODBC32.dll (ANSI / -A)
#include <windows.h>
SHORT SQLGetStmtAttr(
void* StatementHandle,
INT Attribute,
void* Value, // optional
INT BufferLength,
INT* StringLength // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| StatementHandle | void* | inout |
| Attribute | INT | in |
| Value | void* | outoptional |
| BufferLength | INT | in |
| StringLength | INT* | outoptional |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll (ANSI / -A)
#include <windows.h>
SHORT SQLGetStmtAttr(
void* StatementHandle,
INT Attribute,
void* Value, // optional
INT BufferLength,
INT* StringLength // optional
);[DllImport("ODBC32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern short SQLGetStmtAttr(
IntPtr StatementHandle, // void* in/out
int Attribute, // INT
IntPtr Value, // void* optional, out
int BufferLength, // INT
IntPtr StringLength // INT* optional, out
);<DllImport("ODBC32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SQLGetStmtAttr(
StatementHandle As IntPtr, ' void* in/out
Attribute As Integer, ' INT
Value As IntPtr, ' void* optional, out
BufferLength As Integer, ' INT
StringLength As IntPtr ' INT* optional, out
) As Short
End Function' StatementHandle : void* in/out
' Attribute : INT
' Value : void* optional, out
' BufferLength : INT
' StringLength : INT* optional, out
Declare PtrSafe Function SQLGetStmtAttr Lib "odbc32" ( _
ByVal StatementHandle As LongPtr, _
ByVal Attribute As Long, _
ByVal Value As LongPtr, _
ByVal BufferLength As Long, _
ByVal StringLength As LongPtr) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SQLGetStmtAttr = ctypes.windll.odbc32.SQLGetStmtAttr
SQLGetStmtAttr.restype = ctypes.c_short
SQLGetStmtAttr.argtypes = [
ctypes.POINTER(None), # StatementHandle : void* in/out
ctypes.c_int, # Attribute : INT
ctypes.POINTER(None), # Value : void* optional, out
ctypes.c_int, # BufferLength : INT
ctypes.POINTER(ctypes.c_int), # StringLength : INT* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ODBC32.dll')
SQLGetStmtAttr = Fiddle::Function.new(
lib['SQLGetStmtAttr'],
[
Fiddle::TYPE_VOIDP, # StatementHandle : void* in/out
Fiddle::TYPE_INT, # Attribute : INT
Fiddle::TYPE_VOIDP, # Value : void* optional, out
Fiddle::TYPE_INT, # BufferLength : INT
Fiddle::TYPE_VOIDP, # StringLength : INT* optional, out
],
Fiddle::TYPE_SHORT)#[link(name = "odbc32")]
extern "system" {
fn SQLGetStmtAttr(
StatementHandle: *mut (), // void* in/out
Attribute: i32, // INT
Value: *mut (), // void* optional, out
BufferLength: i32, // INT
StringLength: *mut i32 // INT* optional, out
) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ODBC32.dll", CharSet = CharSet.Ansi)]
public static extern short SQLGetStmtAttr(IntPtr StatementHandle, int Attribute, IntPtr Value, int BufferLength, IntPtr StringLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLGetStmtAttr' -Namespace Win32 -PassThru
# $api::SQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength)#uselib "ODBC32.dll"
#func global SQLGetStmtAttr "SQLGetStmtAttr" sptr, sptr, sptr, sptr, sptr
; SQLGetStmtAttr StatementHandle, Attribute, Value, BufferLength, varptr(StringLength) ; 戻り値は stat
; StatementHandle : void* in/out -> "sptr"
; Attribute : INT -> "sptr"
; Value : void* optional, out -> "sptr"
; BufferLength : INT -> "sptr"
; StringLength : INT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ODBC32.dll" #cfunc global SQLGetStmtAttr "SQLGetStmtAttr" sptr, int, sptr, int, var ; res = SQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength) ; StatementHandle : void* in/out -> "sptr" ; Attribute : INT -> "int" ; Value : void* optional, out -> "sptr" ; BufferLength : INT -> "int" ; StringLength : INT* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ODBC32.dll" #cfunc global SQLGetStmtAttr "SQLGetStmtAttr" sptr, int, sptr, int, sptr ; res = SQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, varptr(StringLength)) ; StatementHandle : void* in/out -> "sptr" ; Attribute : INT -> "int" ; Value : void* optional, out -> "sptr" ; BufferLength : INT -> "int" ; StringLength : INT* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; SHORT SQLGetStmtAttr(void* StatementHandle, INT Attribute, void* Value, INT BufferLength, INT* StringLength) #uselib "ODBC32.dll" #cfunc global SQLGetStmtAttr "SQLGetStmtAttr" intptr, int, intptr, int, var ; res = SQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength) ; StatementHandle : void* in/out -> "intptr" ; Attribute : INT -> "int" ; Value : void* optional, out -> "intptr" ; BufferLength : INT -> "int" ; StringLength : INT* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; SHORT SQLGetStmtAttr(void* StatementHandle, INT Attribute, void* Value, INT BufferLength, INT* StringLength) #uselib "ODBC32.dll" #cfunc global SQLGetStmtAttr "SQLGetStmtAttr" intptr, int, intptr, int, intptr ; res = SQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, varptr(StringLength)) ; StatementHandle : void* in/out -> "intptr" ; Attribute : INT -> "int" ; Value : void* optional, out -> "intptr" ; BufferLength : INT -> "int" ; StringLength : INT* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
procSQLGetStmtAttr = odbc32.NewProc("SQLGetStmtAttr")
)
// StatementHandle (void* in/out), Attribute (INT), Value (void* optional, out), BufferLength (INT), StringLength (INT* optional, out)
r1, _, err := procSQLGetStmtAttr.Call(
uintptr(StatementHandle),
uintptr(Attribute),
uintptr(Value),
uintptr(BufferLength),
uintptr(StringLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLGetStmtAttr(
StatementHandle: Pointer; // void* in/out
Attribute: Integer; // INT
Value: Pointer; // void* optional, out
BufferLength: Integer; // INT
StringLength: Pointer // INT* optional, out
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLGetStmtAttr';result := DllCall("ODBC32\SQLGetStmtAttr"
, "Ptr", StatementHandle ; void* in/out
, "Int", Attribute ; INT
, "Ptr", Value ; void* optional, out
, "Int", BufferLength ; INT
, "Ptr", StringLength ; INT* optional, out
, "Short") ; return: SHORT●SQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength) = DLL("ODBC32.dll", "int SQLGetStmtAttr(void*, int, void*, int, void*)")
# 呼び出し: SQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength)
# StatementHandle : void* in/out -> "void*"
# Attribute : INT -> "int"
# Value : void* optional, out -> "void*"
# BufferLength : INT -> "int"
# StringLength : INT* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。