ホーム › System.Search › SSERRORINFO
SSERRORINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pwszMessage | LPWSTR | 8/4 | +0 | +0 | エラーメッセージ本文。NULL 終端ワイド文字列。 |
| pwszServer | LPWSTR | 8/4 | +8 | +4 | エラーが発生したサーバー名。NULL 終端ワイド文字列。 |
| pwszProcedure | LPWSTR | 8/4 | +16 | +8 | エラーが発生したストアドプロシージャ名。NULL 終端ワイド文字列。 |
| lNative | INT | 4 | +24 | +12 | データソース固有のネイティブエラーコード。 |
| bState | BYTE | 1 | +28 | +16 | SQL Server エラーの状態番号。 |
| bClass | BYTE | 1 | +29 | +17 | エラーの重大度クラス。 |
| wLineNumber | WORD | 2 | +30 | +18 | エラーが発生したプロシージャ内の行番号。 |
各言語での定義
#include <windows.h>
// SSERRORINFO (x64 32 / x86 20 バイト)
typedef struct SSERRORINFO {
LPWSTR pwszMessage;
LPWSTR pwszServer;
LPWSTR pwszProcedure;
INT lNative;
BYTE bState;
BYTE bClass;
WORD wLineNumber;
} SSERRORINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SSERRORINFO
{
public IntPtr pwszMessage;
public IntPtr pwszServer;
public IntPtr pwszProcedure;
public int lNative;
public byte bState;
public byte bClass;
public ushort wLineNumber;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SSERRORINFO
Public pwszMessage As IntPtr
Public pwszServer As IntPtr
Public pwszProcedure As IntPtr
Public lNative As Integer
Public bState As Byte
Public bClass As Byte
Public wLineNumber As UShort
End Structureimport ctypes
from ctypes import wintypes
class SSERRORINFO(ctypes.Structure):
_fields_ = [
("pwszMessage", ctypes.c_void_p),
("pwszServer", ctypes.c_void_p),
("pwszProcedure", ctypes.c_void_p),
("lNative", ctypes.c_int),
("bState", ctypes.c_ubyte),
("bClass", ctypes.c_ubyte),
("wLineNumber", ctypes.c_ushort),
]#[repr(C)]
pub struct SSERRORINFO {
pub pwszMessage: *mut core::ffi::c_void,
pub pwszServer: *mut core::ffi::c_void,
pub pwszProcedure: *mut core::ffi::c_void,
pub lNative: i32,
pub bState: u8,
pub bClass: u8,
pub wLineNumber: u16,
}import "golang.org/x/sys/windows"
type SSERRORINFO struct {
pwszMessage uintptr
pwszServer uintptr
pwszProcedure uintptr
lNative int32
bState byte
bClass byte
wLineNumber uint16
}type
SSERRORINFO = record
pwszMessage: Pointer;
pwszServer: Pointer;
pwszProcedure: Pointer;
lNative: Integer;
bState: Byte;
bClass: Byte;
wLineNumber: Word;
end;const SSERRORINFO = extern struct {
pwszMessage: ?*anyopaque,
pwszServer: ?*anyopaque,
pwszProcedure: ?*anyopaque,
lNative: i32,
bState: u8,
bClass: u8,
wLineNumber: u16,
};type
SSERRORINFO {.bycopy.} = object
pwszMessage: pointer
pwszServer: pointer
pwszProcedure: pointer
lNative: int32
bState: uint8
bClass: uint8
wLineNumber: uint16struct SSERRORINFO
{
void* pwszMessage;
void* pwszServer;
void* pwszProcedure;
int lNative;
ubyte bState;
ubyte bClass;
ushort wLineNumber;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SSERRORINFO サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; pwszMessage : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pwszServer : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pwszProcedure : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lNative : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; bState : BYTE (+16, 1byte) poke st,16,値 / 値 = peek(st,16)
; bClass : BYTE (+17, 1byte) poke st,17,値 / 値 = peek(st,17)
; wLineNumber : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SSERRORINFO サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; pwszMessage : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; pwszServer : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pwszProcedure : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; lNative : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; bState : BYTE (+28, 1byte) poke st,28,値 / 値 = peek(st,28)
; bClass : BYTE (+29, 1byte) poke st,29,値 / 値 = peek(st,29)
; wLineNumber : WORD (+30, 2byte) wpoke st,30,値 / 値 = wpeek(st,30)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SSERRORINFO
#field intptr pwszMessage
#field intptr pwszServer
#field intptr pwszProcedure
#field int lNative
#field byte bState
#field byte bClass
#field short wLineNumber
#endstruct
stdim st, SSERRORINFO ; NSTRUCT 変数を確保
st->lNative = 100
mes "lNative=" + st->lNative