ホーム › System.Search › SQLColAttributesW
SQLColAttributesW
関数結果セット列の記述属性を取得する(Unicode・非推奨)。
シグネチャ
// ODBC32.dll (Unicode / -W)
#include <windows.h>
SHORT SQLColAttributesW(
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 (Unicode / -W)
#include <windows.h>
SHORT SQLColAttributesW(
void* hstmt,
WORD icol,
WORD fDescType,
void* rgbDesc, // optional
SHORT cbDescMax,
SHORT* pcbDesc, // optional
INT* pfDesc // optional
);[DllImport("ODBC32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern short SQLColAttributesW(
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.Unicode, ExactSpelling:=True)>
Public Shared Function SQLColAttributesW(
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 SQLColAttributesW 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
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SQLColAttributesW = ctypes.windll.odbc32.SQLColAttributesW
SQLColAttributesW.restype = ctypes.c_short
SQLColAttributesW.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')
SQLColAttributesW = Fiddle::Function.new(
lib['SQLColAttributesW'],
[
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)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "odbc32")]
extern "system" {
fn SQLColAttributesW(
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.Unicode)]
public static extern short SQLColAttributesW(IntPtr hstmt, ushort icol, ushort fDescType, IntPtr rgbDesc, short cbDescMax, IntPtr pcbDesc, IntPtr pfDesc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLColAttributesW' -Namespace Win32 -PassThru
# $api::SQLColAttributesW(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc)#uselib "ODBC32.dll"
#func global SQLColAttributesW "SQLColAttributesW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; SQLColAttributesW hstmt, icol, fDescType, rgbDesc, cbDescMax, varptr(pcbDesc), varptr(pfDesc) ; 戻り値は stat
; hstmt : void* in/out -> "wptr"
; icol : WORD -> "wptr"
; fDescType : WORD -> "wptr"
; rgbDesc : void* optional, out -> "wptr"
; cbDescMax : SHORT -> "wptr"
; pcbDesc : SHORT* optional, out -> "wptr"
; pfDesc : INT* optional, out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ODBC32.dll" #cfunc global SQLColAttributesW "SQLColAttributesW" sptr, int, int, sptr, int, var, var ; res = SQLColAttributesW(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 SQLColAttributesW "SQLColAttributesW" sptr, int, int, sptr, int, sptr, sptr ; res = SQLColAttributesW(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 SQLColAttributesW(void* hstmt, WORD icol, WORD fDescType, void* rgbDesc, SHORT cbDescMax, SHORT* pcbDesc, INT* pfDesc) #uselib "ODBC32.dll" #cfunc global SQLColAttributesW "SQLColAttributesW" intptr, int, int, intptr, int, var, var ; res = SQLColAttributesW(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 SQLColAttributesW(void* hstmt, WORD icol, WORD fDescType, void* rgbDesc, SHORT cbDescMax, SHORT* pcbDesc, INT* pfDesc) #uselib "ODBC32.dll" #cfunc global SQLColAttributesW "SQLColAttributesW" intptr, int, int, intptr, int, intptr, intptr ; res = SQLColAttributesW(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")
procSQLColAttributesW = odbc32.NewProc("SQLColAttributesW")
)
// hstmt (void* in/out), icol (WORD), fDescType (WORD), rgbDesc (void* optional, out), cbDescMax (SHORT), pcbDesc (SHORT* optional, out), pfDesc (INT* optional, out)
r1, _, err := procSQLColAttributesW.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 SQLColAttributesW(
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 'SQLColAttributesW';result := DllCall("ODBC32\SQLColAttributesW"
, "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●SQLColAttributesW(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc) = DLL("ODBC32.dll", "int SQLColAttributesW(void*, int, int, void*, int, void*, void*)")
# 呼び出し: SQLColAttributesW(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)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。