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