Win32 API 日本語リファレンス
ホームStorage.Jet › JET_COLUMNDEF

JET_COLUMNDEF

構造体
サイズx64: 28 バイト / x86: 28 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
cbStructDWORD4+0+0この構造体のバイトサイズ。
columnidDWORD4+4+4作成後に返される列の識別子。入力時は0でよい。
coltypDWORD4+8+8列のデータ型を示す値(JET_coltypLong等)。
wCountryWORD2+12+12国コード(非推奨)。テキスト列の照合に用いた旧フィールド。
langidWORD2+14+14テキスト列の言語ID(LANGID)。
cpWORD2+16+16テキスト列のコードページ。
wCollateWORD2+18+18照合順序(予約/非推奨)。
cbMaxDWORD4+20+20列に格納可能な最大バイト長。
grbitDWORD4+24+24列の属性を示すフラグ群(固定長、自動増分等)。

各言語での定義

#include <windows.h>

// JET_COLUMNDEF  (x64 28 / x86 28 バイト)
typedef struct JET_COLUMNDEF {
    DWORD cbStruct;
    DWORD columnid;
    DWORD coltyp;
    WORD wCountry;
    WORD langid;
    WORD cp;
    WORD wCollate;
    DWORD cbMax;
    DWORD grbit;
} JET_COLUMNDEF;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct JET_COLUMNDEF
{
    public uint cbStruct;
    public uint columnid;
    public uint coltyp;
    public ushort wCountry;
    public ushort langid;
    public ushort cp;
    public ushort wCollate;
    public uint cbMax;
    public uint grbit;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure JET_COLUMNDEF
    Public cbStruct As UInteger
    Public columnid As UInteger
    Public coltyp As UInteger
    Public wCountry As UShort
    Public langid As UShort
    Public cp As UShort
    Public wCollate As UShort
    Public cbMax As UInteger
    Public grbit As UInteger
End Structure
import ctypes
from ctypes import wintypes

class JET_COLUMNDEF(ctypes.Structure):
    _fields_ = [
        ("cbStruct", wintypes.DWORD),
        ("columnid", wintypes.DWORD),
        ("coltyp", wintypes.DWORD),
        ("wCountry", ctypes.c_ushort),
        ("langid", ctypes.c_ushort),
        ("cp", ctypes.c_ushort),
        ("wCollate", ctypes.c_ushort),
        ("cbMax", wintypes.DWORD),
        ("grbit", wintypes.DWORD),
    ]
#[repr(C)]
pub struct JET_COLUMNDEF {
    pub cbStruct: u32,
    pub columnid: u32,
    pub coltyp: u32,
    pub wCountry: u16,
    pub langid: u16,
    pub cp: u16,
    pub wCollate: u16,
    pub cbMax: u32,
    pub grbit: u32,
}
import "golang.org/x/sys/windows"

type JET_COLUMNDEF struct {
	cbStruct uint32
	columnid uint32
	coltyp uint32
	wCountry uint16
	langid uint16
	cp uint16
	wCollate uint16
	cbMax uint32
	grbit uint32
}
type
  JET_COLUMNDEF = record
    cbStruct: DWORD;
    columnid: DWORD;
    coltyp: DWORD;
    wCountry: Word;
    langid: Word;
    cp: Word;
    wCollate: Word;
    cbMax: DWORD;
    grbit: DWORD;
  end;
const JET_COLUMNDEF = extern struct {
    cbStruct: u32,
    columnid: u32,
    coltyp: u32,
    wCountry: u16,
    langid: u16,
    cp: u16,
    wCollate: u16,
    cbMax: u32,
    grbit: u32,
};
type
  JET_COLUMNDEF {.bycopy.} = object
    cbStruct: uint32
    columnid: uint32
    coltyp: uint32
    wCountry: uint16
    langid: uint16
    cp: uint16
    wCollate: uint16
    cbMax: uint32
    grbit: uint32
struct JET_COLUMNDEF
{
    uint cbStruct;
    uint columnid;
    uint coltyp;
    ushort wCountry;
    ushort langid;
    ushort cp;
    ushort wCollate;
    uint cbMax;
    uint grbit;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; JET_COLUMNDEF サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; columnid : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; coltyp : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; wCountry : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; langid : WORD (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; cp : WORD (+16, 2byte)  wpoke st,16,値  /  値 = wpeek(st,16)
; wCollate : WORD (+18, 2byte)  wpoke st,18,値  /  値 = wpeek(st,18)
; cbMax : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; grbit : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global JET_COLUMNDEF
    #field int cbStruct
    #field int columnid
    #field int coltyp
    #field short wCountry
    #field short langid
    #field short cp
    #field short wCollate
    #field int cbMax
    #field int grbit
#endstruct

stdim st, JET_COLUMNDEF        ; NSTRUCT 変数を確保
st->cbStruct = 100
mes "cbStruct=" + st->cbStruct