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