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