ホーム › System.Search › SQLColAttributeW
SQLColAttributeW
関数結果セット列の指定フィールド属性を取得する(Unicode)。
シグネチャ
// ODBC32.dll (Unicode / -W)
#include <windows.h>
SHORT SQLColAttributeW(
void* hstmt,
WORD iCol,
WORD iField,
void* pCharAttr, // optional
SHORT cbDescMax,
SHORT* pcbCharAttr, // optional
void* pNumAttr // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hstmt | void* | inout |
| iCol | WORD | in |
| iField | WORD | in |
| pCharAttr | void* | outoptional |
| cbDescMax | SHORT | in |
| pcbCharAttr | SHORT* | outoptional |
| pNumAttr | void* | outoptional |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll (Unicode / -W)
#include <windows.h>
SHORT SQLColAttributeW(
void* hstmt,
WORD iCol,
WORD iField,
void* pCharAttr, // optional
SHORT cbDescMax,
SHORT* pcbCharAttr, // optional
void* pNumAttr // optional
);[DllImport("ODBC32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern short SQLColAttributeW(
IntPtr hstmt, // void* in/out
ushort iCol, // WORD
ushort iField, // WORD
IntPtr pCharAttr, // void* optional, out
short cbDescMax, // SHORT
IntPtr pcbCharAttr, // SHORT* optional, out
IntPtr pNumAttr // void* optional, out
);<DllImport("ODBC32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SQLColAttributeW(
hstmt As IntPtr, ' void* in/out
iCol As UShort, ' WORD
iField As UShort, ' WORD
pCharAttr As IntPtr, ' void* optional, out
cbDescMax As Short, ' SHORT
pcbCharAttr As IntPtr, ' SHORT* optional, out
pNumAttr As IntPtr ' void* optional, out
) As Short
End Function' hstmt : void* in/out
' iCol : WORD
' iField : WORD
' pCharAttr : void* optional, out
' cbDescMax : SHORT
' pcbCharAttr : SHORT* optional, out
' pNumAttr : void* optional, out
Declare PtrSafe Function SQLColAttributeW Lib "odbc32" ( _
ByVal hstmt As LongPtr, _
ByVal iCol As Integer, _
ByVal iField As Integer, _
ByVal pCharAttr As LongPtr, _
ByVal cbDescMax As Integer, _
ByVal pcbCharAttr As LongPtr, _
ByVal pNumAttr 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
SQLColAttributeW = ctypes.windll.odbc32.SQLColAttributeW
SQLColAttributeW.restype = ctypes.c_short
SQLColAttributeW.argtypes = [
ctypes.POINTER(None), # hstmt : void* in/out
ctypes.c_ushort, # iCol : WORD
ctypes.c_ushort, # iField : WORD
ctypes.POINTER(None), # pCharAttr : void* optional, out
ctypes.c_short, # cbDescMax : 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')
SQLColAttributeW = Fiddle::Function.new(
lib['SQLColAttributeW'],
[
Fiddle::TYPE_VOIDP, # hstmt : void* in/out
-Fiddle::TYPE_SHORT, # iCol : WORD
-Fiddle::TYPE_SHORT, # iField : WORD
Fiddle::TYPE_VOIDP, # pCharAttr : void* optional, out
Fiddle::TYPE_SHORT, # cbDescMax : SHORT
Fiddle::TYPE_VOIDP, # pcbCharAttr : SHORT* optional, out
Fiddle::TYPE_VOIDP, # pNumAttr : void* optional, out
],
Fiddle::TYPE_SHORT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "odbc32")]
extern "system" {
fn SQLColAttributeW(
hstmt: *mut (), // void* in/out
iCol: u16, // WORD
iField: u16, // WORD
pCharAttr: *mut (), // void* optional, out
cbDescMax: 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.Unicode)]
public static extern short SQLColAttributeW(IntPtr hstmt, ushort iCol, ushort iField, IntPtr pCharAttr, short cbDescMax, IntPtr pcbCharAttr, IntPtr pNumAttr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLColAttributeW' -Namespace Win32 -PassThru
# $api::SQLColAttributeW(hstmt, iCol, iField, pCharAttr, cbDescMax, pcbCharAttr, pNumAttr)#uselib "ODBC32.dll"
#func global SQLColAttributeW "SQLColAttributeW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; SQLColAttributeW hstmt, iCol, iField, pCharAttr, cbDescMax, varptr(pcbCharAttr), pNumAttr ; 戻り値は stat
; hstmt : void* in/out -> "wptr"
; iCol : WORD -> "wptr"
; iField : WORD -> "wptr"
; pCharAttr : void* optional, out -> "wptr"
; cbDescMax : SHORT -> "wptr"
; pcbCharAttr : SHORT* optional, out -> "wptr"
; pNumAttr : void* optional, out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ODBC32.dll" #cfunc global SQLColAttributeW "SQLColAttributeW" sptr, int, int, sptr, int, var, sptr ; res = SQLColAttributeW(hstmt, iCol, iField, pCharAttr, cbDescMax, pcbCharAttr, pNumAttr) ; hstmt : void* in/out -> "sptr" ; iCol : WORD -> "int" ; iField : WORD -> "int" ; pCharAttr : void* optional, out -> "sptr" ; cbDescMax : SHORT -> "int" ; pcbCharAttr : SHORT* optional, out -> "var" ; pNumAttr : void* optional, out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ODBC32.dll" #cfunc global SQLColAttributeW "SQLColAttributeW" sptr, int, int, sptr, int, sptr, sptr ; res = SQLColAttributeW(hstmt, iCol, iField, pCharAttr, cbDescMax, varptr(pcbCharAttr), pNumAttr) ; hstmt : void* in/out -> "sptr" ; iCol : WORD -> "int" ; iField : WORD -> "int" ; pCharAttr : void* optional, out -> "sptr" ; cbDescMax : SHORT -> "int" ; pcbCharAttr : SHORT* optional, out -> "sptr" ; pNumAttr : void* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; SHORT SQLColAttributeW(void* hstmt, WORD iCol, WORD iField, void* pCharAttr, SHORT cbDescMax, SHORT* pcbCharAttr, void* pNumAttr) #uselib "ODBC32.dll" #cfunc global SQLColAttributeW "SQLColAttributeW" intptr, int, int, intptr, int, var, intptr ; res = SQLColAttributeW(hstmt, iCol, iField, pCharAttr, cbDescMax, pcbCharAttr, pNumAttr) ; hstmt : void* in/out -> "intptr" ; iCol : WORD -> "int" ; iField : WORD -> "int" ; pCharAttr : void* optional, out -> "intptr" ; cbDescMax : SHORT -> "int" ; pcbCharAttr : SHORT* optional, out -> "var" ; pNumAttr : void* optional, out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; SHORT SQLColAttributeW(void* hstmt, WORD iCol, WORD iField, void* pCharAttr, SHORT cbDescMax, SHORT* pcbCharAttr, void* pNumAttr) #uselib "ODBC32.dll" #cfunc global SQLColAttributeW "SQLColAttributeW" intptr, int, int, intptr, int, intptr, intptr ; res = SQLColAttributeW(hstmt, iCol, iField, pCharAttr, cbDescMax, varptr(pcbCharAttr), pNumAttr) ; hstmt : void* in/out -> "intptr" ; iCol : WORD -> "int" ; iField : WORD -> "int" ; pCharAttr : void* optional, out -> "intptr" ; cbDescMax : 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")
procSQLColAttributeW = odbc32.NewProc("SQLColAttributeW")
)
// hstmt (void* in/out), iCol (WORD), iField (WORD), pCharAttr (void* optional, out), cbDescMax (SHORT), pcbCharAttr (SHORT* optional, out), pNumAttr (void* optional, out)
r1, _, err := procSQLColAttributeW.Call(
uintptr(hstmt),
uintptr(iCol),
uintptr(iField),
uintptr(pCharAttr),
uintptr(cbDescMax),
uintptr(pcbCharAttr),
uintptr(pNumAttr),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLColAttributeW(
hstmt: Pointer; // void* in/out
iCol: Word; // WORD
iField: Word; // WORD
pCharAttr: Pointer; // void* optional, out
cbDescMax: Smallint; // SHORT
pcbCharAttr: Pointer; // SHORT* optional, out
pNumAttr: Pointer // void* optional, out
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLColAttributeW';result := DllCall("ODBC32\SQLColAttributeW"
, "Ptr", hstmt ; void* in/out
, "UShort", iCol ; WORD
, "UShort", iField ; WORD
, "Ptr", pCharAttr ; void* optional, out
, "Short", cbDescMax ; SHORT
, "Ptr", pcbCharAttr ; SHORT* optional, out
, "Ptr", pNumAttr ; void* optional, out
, "Short") ; return: SHORT●SQLColAttributeW(hstmt, iCol, iField, pCharAttr, cbDescMax, pcbCharAttr, pNumAttr) = DLL("ODBC32.dll", "int SQLColAttributeW(void*, int, int, void*, int, void*, void*)")
# 呼び出し: SQLColAttributeW(hstmt, iCol, iField, pCharAttr, cbDescMax, pcbCharAttr, pNumAttr)
# hstmt : void* in/out -> "void*"
# iCol : WORD -> "int"
# iField : WORD -> "int"
# pCharAttr : void* optional, out -> "void*"
# cbDescMax : SHORT -> "int"
# pcbCharAttr : SHORT* optional, out -> "void*"
# pNumAttr : void* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。