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