ホーム › System.Search › DBBINDING
DBBINDING
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| iOrdinal | UINT_PTR | 8/4 | +0 | +0 | バインド対象の列(または引数)の序数(1始まり)。 |
| obValue | UINT_PTR | 8/4 | +8 | +4 | コンシューマバッファ内での値部のオフセット(バイト数)。 |
| obLength | UINT_PTR | 8/4 | +16 | +8 | コンシューマバッファ内での長さ部のオフセット(バイト数)。 |
| obStatus | UINT_PTR | 8/4 | +24 | +12 | コンシューマバッファ内での状態(DBSTATUS)部のオフセット(バイト数)。 |
| pTypeInfo | ITypeInfo* | 8/4 | +32 | +16 | 列の型情報(ITypeInfo)へのポインタ。NULL可。 |
| pObject | DBOBJECT* | 8/4 | +40 | +20 | オブジェクトとしてバインドする場合のDBOBJECT記述へのポインタ。NULL可。 |
| pBindExt | DBBINDEXT* | 8/4 | +48 | +24 | バインド拡張情報(DBBINDEXT)へのポインタ。NULL可。 |
| dwPart | DWORD | 4 | +56 | +28 | バインドする部分(値/長さ/状態)を示すフラグ(DBPART_*)。 |
| dwMemOwner | DWORD | 4 | +60 | +32 | メモリ所有者(クライアント/プロバイダ)を示す値(DBMEMOWNER_*)。 |
| eParamIO | DWORD | 4 | +64 | +36 | パラメータの入出力方向(DBPARAMIO_*)。入力/出力/双方向を表す。 |
| cbMaxLen | UINT_PTR | 8/4 | +68 | +40 | 値部に確保された最大バイト長。 |
| dwFlags | DWORD | 4 | +76 | +44 | バインドに関する追加フラグ(DBBINDFLAG_*)。 |
| wType | WORD | 2 | +80 | +48 | バインドするデータの型を示すDBTYPE値(WORD)。 |
| bPrecision | BYTE | 1 | +82 | +50 | 数値型の精度(全体桁数)。 |
| bScale | BYTE | 1 | +83 | +51 | 数値型のスケール(小数部桁数)。 |
各言語での定義
#include <windows.h>
// DBBINDING (x64 84 / x86 52 バイト)
#pragma pack(push, 2)
typedef struct DBBINDING {
UINT_PTR iOrdinal;
UINT_PTR obValue;
UINT_PTR obLength;
UINT_PTR obStatus;
ITypeInfo* pTypeInfo;
DBOBJECT* pObject;
DBBINDEXT* pBindExt;
DWORD dwPart;
DWORD dwMemOwner;
DWORD eParamIO;
UINT_PTR cbMaxLen;
DWORD dwFlags;
WORD wType;
BYTE bPrecision;
BYTE bScale;
} DBBINDING;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 2, CharSet = CharSet.Unicode)]
public struct DBBINDING
{
public UIntPtr iOrdinal;
public UIntPtr obValue;
public UIntPtr obLength;
public UIntPtr obStatus;
public IntPtr pTypeInfo;
public IntPtr pObject;
public IntPtr pBindExt;
public uint dwPart;
public uint dwMemOwner;
public uint eParamIO;
public UIntPtr cbMaxLen;
public uint dwFlags;
public ushort wType;
public byte bPrecision;
public byte bScale;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=2, CharSet:=CharSet.Unicode)>
Public Structure DBBINDING
Public iOrdinal As UIntPtr
Public obValue As UIntPtr
Public obLength As UIntPtr
Public obStatus As UIntPtr
Public pTypeInfo As IntPtr
Public pObject As IntPtr
Public pBindExt As IntPtr
Public dwPart As UInteger
Public dwMemOwner As UInteger
Public eParamIO As UInteger
Public cbMaxLen As UIntPtr
Public dwFlags As UInteger
Public wType As UShort
Public bPrecision As Byte
Public bScale As Byte
End Structureimport ctypes
from ctypes import wintypes
class DBBINDING(ctypes.Structure):
_pack_ = 2
_fields_ = [
("iOrdinal", ctypes.c_size_t),
("obValue", ctypes.c_size_t),
("obLength", ctypes.c_size_t),
("obStatus", ctypes.c_size_t),
("pTypeInfo", ctypes.c_void_p),
("pObject", ctypes.c_void_p),
("pBindExt", ctypes.c_void_p),
("dwPart", wintypes.DWORD),
("dwMemOwner", wintypes.DWORD),
("eParamIO", wintypes.DWORD),
("cbMaxLen", ctypes.c_size_t),
("dwFlags", wintypes.DWORD),
("wType", ctypes.c_ushort),
("bPrecision", ctypes.c_ubyte),
("bScale", ctypes.c_ubyte),
]#[repr(C, packed(2))]
pub struct DBBINDING {
pub iOrdinal: usize,
pub obValue: usize,
pub obLength: usize,
pub obStatus: usize,
pub pTypeInfo: *mut core::ffi::c_void,
pub pObject: *mut core::ffi::c_void,
pub pBindExt: *mut core::ffi::c_void,
pub dwPart: u32,
pub dwMemOwner: u32,
pub eParamIO: u32,
pub cbMaxLen: usize,
pub dwFlags: u32,
pub wType: u16,
pub bPrecision: u8,
pub bScale: u8,
}import "golang.org/x/sys/windows"
type DBBINDING struct {
iOrdinal uintptr
obValue uintptr
obLength uintptr
obStatus uintptr
pTypeInfo uintptr
pObject uintptr
pBindExt uintptr
dwPart uint32
dwMemOwner uint32
eParamIO uint32
cbMaxLen uintptr
dwFlags uint32
wType uint16
bPrecision byte
bScale byte
}type
DBBINDING = packed record
iOrdinal: NativeUInt;
obValue: NativeUInt;
obLength: NativeUInt;
obStatus: NativeUInt;
pTypeInfo: Pointer;
pObject: Pointer;
pBindExt: Pointer;
dwPart: DWORD;
dwMemOwner: DWORD;
eParamIO: DWORD;
cbMaxLen: NativeUInt;
dwFlags: DWORD;
wType: Word;
bPrecision: Byte;
bScale: Byte;
end;const DBBINDING = extern struct {
iOrdinal: usize,
obValue: usize,
obLength: usize,
obStatus: usize,
pTypeInfo: ?*anyopaque,
pObject: ?*anyopaque,
pBindExt: ?*anyopaque,
dwPart: u32,
dwMemOwner: u32,
eParamIO: u32,
cbMaxLen: usize,
dwFlags: u32,
wType: u16,
bPrecision: u8,
bScale: u8,
};type
DBBINDING {.packed.} = object
iOrdinal: uint
obValue: uint
obLength: uint
obStatus: uint
pTypeInfo: pointer
pObject: pointer
pBindExt: pointer
dwPart: uint32
dwMemOwner: uint32
eParamIO: uint32
cbMaxLen: uint
dwFlags: uint32
wType: uint16
bPrecision: uint8
bScale: uint8align(2)
struct DBBINDING
{
size_t iOrdinal;
size_t obValue;
size_t obLength;
size_t obStatus;
void* pTypeInfo;
void* pObject;
void* pBindExt;
uint dwPart;
uint dwMemOwner;
uint eParamIO;
size_t cbMaxLen;
uint dwFlags;
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 レイアウト)
; DBBINDING サイズ: 52 バイト(x86)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; iOrdinal : UINT_PTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; obValue : UINT_PTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; obLength : UINT_PTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; obStatus : UINT_PTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; pTypeInfo : ITypeInfo* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; pObject : DBOBJECT* (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; pBindExt : DBBINDEXT* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; dwPart : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwMemOwner : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; eParamIO : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; cbMaxLen : UINT_PTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwFlags : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; wType : WORD (+48, 2byte) wpoke st,48,値 / 値 = wpeek(st,48)
; bPrecision : BYTE (+50, 1byte) poke st,50,値 / 値 = peek(st,50)
; bScale : BYTE (+51, 1byte) poke st,51,値 / 値 = peek(st,51)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DBBINDING サイズ: 84 バイト(x64)
dim st, 21 ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; iOrdinal : UINT_PTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; obValue : UINT_PTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; obLength : UINT_PTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; obStatus : UINT_PTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pTypeInfo : ITypeInfo* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pObject : DBOBJECT* (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; pBindExt : DBBINDEXT* (+48, 8byte) varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; dwPart : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; dwMemOwner : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; eParamIO : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; cbMaxLen : UINT_PTR (+68, 8byte) qpoke st,68,値 / qpeek(st,68) ※IronHSPのみ。3.7/3.8は lpoke st,68,下位 : lpoke st,72,上位
; dwFlags : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; wType : WORD (+80, 2byte) wpoke st,80,値 / 値 = wpeek(st,80)
; bPrecision : BYTE (+82, 1byte) poke st,82,値 / 値 = peek(st,82)
; bScale : BYTE (+83, 1byte) poke st,83,値 / 値 = peek(st,83)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DBBINDING, pack=2
#field intptr iOrdinal
#field intptr obValue
#field intptr obLength
#field intptr obStatus
#field intptr pTypeInfo
#field intptr pObject
#field intptr pBindExt
#field int dwPart
#field int dwMemOwner
#field int eParamIO
#field intptr cbMaxLen
#field int dwFlags
#field short wType
#field byte bPrecision
#field byte bScale
#endstruct
stdim st, DBBINDING ; NSTRUCT 変数を確保
st->iOrdinal = 100
mes "iOrdinal=" + st->iOrdinal