ホーム › System.Search › DBCOLUMNACCESS
DBCOLUMNACCESS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pData | void* | 8/4 | +0 | +0 | 列データの読み書きに使うバッファへのポインタ。 |
| columnid | DBID | 32/24 | +8 | +4 | アクセス対象列の識別子(DBID)。 |
| cbDataLen | UINT_PTR | 8/4 | +40 | +28 | 実際のデータ長(バイト数)。出力で設定される。 |
| dwStatus | DWORD | 4 | +48 | +32 | 列値の状態(DBSTATUS_*)。NULL/切捨て等を表す。 |
| cbMaxLen | UINT_PTR | 8/4 | +52 | +36 | pDataバッファの最大長(バイト数)。 |
| dwReserved | UINT_PTR | 8/4 | +60 | +40 | 予約フィールド(ポインタサイズ整数)。将来の拡張用。 |
| wType | WORD | 2 | +68 | +44 | アクセスするデータの型を示すDBTYPE値(WORD)。 |
| bPrecision | BYTE | 1 | +70 | +46 | 数値型の精度(全体桁数)。 |
| bScale | BYTE | 1 | +71 | +47 | 数値型のスケール(小数部桁数)。 |
各言語での定義
#include <windows.h>
// DBID (x64 32 / x86 24 バイト)
typedef struct DBID {
_uGuid_e__Union uGuid;
DWORD eKind;
_uName_e__Union uName;
} DBID;
// DBCOLUMNACCESS (x64 72 / x86 48 バイト)
#pragma pack(push, 2)
typedef struct DBCOLUMNACCESS {
void* pData;
DBID columnid;
UINT_PTR cbDataLen;
DWORD dwStatus;
UINT_PTR cbMaxLen;
UINT_PTR dwReserved;
WORD wType;
BYTE bPrecision;
BYTE bScale;
} DBCOLUMNACCESS;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DBID
{
public _uGuid_e__Union uGuid;
public uint eKind;
public _uName_e__Union uName;
}
[StructLayout(LayoutKind.Sequential, Pack = 2, CharSet = CharSet.Unicode)]
public struct DBCOLUMNACCESS
{
public IntPtr pData;
public DBID columnid;
public UIntPtr cbDataLen;
public uint dwStatus;
public UIntPtr cbMaxLen;
public UIntPtr dwReserved;
public ushort wType;
public byte bPrecision;
public byte bScale;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DBID
Public uGuid As _uGuid_e__Union
Public eKind As UInteger
Public uName As _uName_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=2, CharSet:=CharSet.Unicode)>
Public Structure DBCOLUMNACCESS
Public pData As IntPtr
Public columnid As DBID
Public cbDataLen As UIntPtr
Public dwStatus As UInteger
Public cbMaxLen As UIntPtr
Public dwReserved As UIntPtr
Public wType As UShort
Public bPrecision As Byte
Public bScale As Byte
End Structureimport ctypes
from ctypes import wintypes
class DBID(ctypes.Structure):
_fields_ = [
("uGuid", _uGuid_e__Union),
("eKind", wintypes.DWORD),
("uName", _uName_e__Union),
]
class DBCOLUMNACCESS(ctypes.Structure):
_pack_ = 2
_fields_ = [
("pData", ctypes.c_void_p),
("columnid", DBID),
("cbDataLen", ctypes.c_size_t),
("dwStatus", wintypes.DWORD),
("cbMaxLen", ctypes.c_size_t),
("dwReserved", ctypes.c_size_t),
("wType", ctypes.c_ushort),
("bPrecision", ctypes.c_ubyte),
("bScale", ctypes.c_ubyte),
]#[repr(C)]
pub struct DBID {
pub uGuid: _uGuid_e__Union,
pub eKind: u32,
pub uName: _uName_e__Union,
}
#[repr(C, packed(2))]
pub struct DBCOLUMNACCESS {
pub pData: *mut core::ffi::c_void,
pub columnid: DBID,
pub cbDataLen: usize,
pub dwStatus: u32,
pub cbMaxLen: usize,
pub dwReserved: usize,
pub wType: u16,
pub bPrecision: u8,
pub bScale: u8,
}import "golang.org/x/sys/windows"
type DBID struct {
uGuid _uGuid_e__Union
eKind uint32
uName _uName_e__Union
}
type DBCOLUMNACCESS struct {
pData uintptr
columnid DBID
cbDataLen uintptr
dwStatus uint32
cbMaxLen uintptr
dwReserved uintptr
wType uint16
bPrecision byte
bScale byte
}type
DBID = record
uGuid: _uGuid_e__Union;
eKind: DWORD;
uName: _uName_e__Union;
end;
DBCOLUMNACCESS = packed record
pData: Pointer;
columnid: DBID;
cbDataLen: NativeUInt;
dwStatus: DWORD;
cbMaxLen: NativeUInt;
dwReserved: NativeUInt;
wType: Word;
bPrecision: Byte;
bScale: Byte;
end;const DBID = extern struct {
uGuid: _uGuid_e__Union,
eKind: u32,
uName: _uName_e__Union,
};
const DBCOLUMNACCESS = extern struct {
pData: ?*anyopaque,
columnid: DBID,
cbDataLen: usize,
dwStatus: u32,
cbMaxLen: usize,
dwReserved: usize,
wType: u16,
bPrecision: u8,
bScale: u8,
};type
DBID {.bycopy.} = object
uGuid: _uGuid_e__Union
eKind: uint32
uName: _uName_e__Union
DBCOLUMNACCESS {.packed.} = object
pData: pointer
columnid: DBID
cbDataLen: uint
dwStatus: uint32
cbMaxLen: uint
dwReserved: uint
wType: uint16
bPrecision: uint8
bScale: uint8struct DBID
{
_uGuid_e__Union uGuid;
uint eKind;
_uName_e__Union uName;
}
align(2)
struct DBCOLUMNACCESS
{
void* pData;
DBID columnid;
size_t cbDataLen;
uint dwStatus;
size_t cbMaxLen;
size_t dwReserved;
ushort wType;
ubyte bPrecision;
ubyte bScale;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DBCOLUMNACCESS サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; pData : void* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; columnid : DBID (+4, 24byte) varptr(st)+4 を基点に操作(24byte:入れ子/配列)
; cbDataLen : UINT_PTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwStatus : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; cbMaxLen : UINT_PTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwReserved : UINT_PTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; wType : WORD (+44, 2byte) wpoke st,44,値 / 値 = wpeek(st,44)
; bPrecision : BYTE (+46, 1byte) poke st,46,値 / 値 = peek(st,46)
; bScale : BYTE (+47, 1byte) poke st,47,値 / 値 = peek(st,47)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DBCOLUMNACCESS サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; pData : void* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; columnid : DBID (+8, 32byte) varptr(st)+8 を基点に操作(32byte:入れ子/配列)
; cbDataLen : UINT_PTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; dwStatus : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; cbMaxLen : UINT_PTR (+52, 8byte) qpoke st,52,値 / qpeek(st,52) ※IronHSPのみ。3.7/3.8は lpoke st,52,下位 : lpoke st,56,上位
; dwReserved : UINT_PTR (+60, 8byte) qpoke st,60,値 / qpeek(st,60) ※IronHSPのみ。3.7/3.8は lpoke st,60,下位 : lpoke st,64,上位
; wType : WORD (+68, 2byte) wpoke st,68,値 / 値 = wpeek(st,68)
; bPrecision : BYTE (+70, 1byte) poke st,70,値 / 値 = peek(st,70)
; bScale : BYTE (+71, 1byte) poke st,71,値 / 値 = peek(st,71)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DBID
#field byte uGuid 16
#field int eKind
#field byte uName 8
#endstruct
#defstruct global DBCOLUMNACCESS, pack=2
#field intptr pData
#field DBID columnid
#field intptr cbDataLen
#field int dwStatus
#field intptr cbMaxLen
#field intptr dwReserved
#field short wType
#field byte bPrecision
#field byte bScale
#endstruct
stdim st, DBCOLUMNACCESS ; NSTRUCT 変数を確保
st->cbDataLen = 100
mes "cbDataLen=" + st->cbDataLen