ホーム › Storage.Jet › JetUpdate2
JetUpdate2
関数オプション指定付きで更新を確定しレコードを挿入または更新する。
シグネチャ
// ESENT.dll
#include <windows.h>
INT JetUpdate2(
JET_SESID sesid,
JET_TABLEID tableid,
void* pvBookmark, // optional
DWORD cbBookmark,
DWORD* pcbActual, // optional
DWORD grbit
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| sesid | JET_SESID | in |
| tableid | JET_TABLEID | in |
| pvBookmark | void* | outoptional |
| cbBookmark | DWORD | in |
| pcbActual | DWORD* | outoptional |
| grbit | DWORD | in |
戻り値の型: INT
各言語での呼び出し定義
// ESENT.dll
#include <windows.h>
INT JetUpdate2(
JET_SESID sesid,
JET_TABLEID tableid,
void* pvBookmark, // optional
DWORD cbBookmark,
DWORD* pcbActual, // optional
DWORD grbit
);[DllImport("ESENT.dll", ExactSpelling = true)]
static extern int JetUpdate2(
UIntPtr sesid, // JET_SESID
UIntPtr tableid, // JET_TABLEID
IntPtr pvBookmark, // void* optional, out
uint cbBookmark, // DWORD
IntPtr pcbActual, // DWORD* optional, out
uint grbit // DWORD
);<DllImport("ESENT.dll", ExactSpelling:=True)>
Public Shared Function JetUpdate2(
sesid As UIntPtr, ' JET_SESID
tableid As UIntPtr, ' JET_TABLEID
pvBookmark As IntPtr, ' void* optional, out
cbBookmark As UInteger, ' DWORD
pcbActual As IntPtr, ' DWORD* optional, out
grbit As UInteger ' DWORD
) As Integer
End Function' sesid : JET_SESID
' tableid : JET_TABLEID
' pvBookmark : void* optional, out
' cbBookmark : DWORD
' pcbActual : DWORD* optional, out
' grbit : DWORD
Declare PtrSafe Function JetUpdate2 Lib "esent" ( _
ByVal sesid As LongPtr, _
ByVal tableid As LongPtr, _
ByVal pvBookmark As LongPtr, _
ByVal cbBookmark As Long, _
ByVal pcbActual As LongPtr, _
ByVal grbit As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
JetUpdate2 = ctypes.windll.esent.JetUpdate2
JetUpdate2.restype = ctypes.c_int
JetUpdate2.argtypes = [
ctypes.c_size_t, # sesid : JET_SESID
ctypes.c_size_t, # tableid : JET_TABLEID
ctypes.POINTER(None), # pvBookmark : void* optional, out
wintypes.DWORD, # cbBookmark : DWORD
ctypes.POINTER(wintypes.DWORD), # pcbActual : DWORD* optional, out
wintypes.DWORD, # grbit : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ESENT.dll')
JetUpdate2 = Fiddle::Function.new(
lib['JetUpdate2'],
[
Fiddle::TYPE_UINTPTR_T, # sesid : JET_SESID
Fiddle::TYPE_UINTPTR_T, # tableid : JET_TABLEID
Fiddle::TYPE_VOIDP, # pvBookmark : void* optional, out
-Fiddle::TYPE_INT, # cbBookmark : DWORD
Fiddle::TYPE_VOIDP, # pcbActual : DWORD* optional, out
-Fiddle::TYPE_INT, # grbit : DWORD
],
Fiddle::TYPE_INT)#[link(name = "esent")]
extern "system" {
fn JetUpdate2(
sesid: usize, // JET_SESID
tableid: usize, // JET_TABLEID
pvBookmark: *mut (), // void* optional, out
cbBookmark: u32, // DWORD
pcbActual: *mut u32, // DWORD* optional, out
grbit: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ESENT.dll")]
public static extern int JetUpdate2(UIntPtr sesid, UIntPtr tableid, IntPtr pvBookmark, uint cbBookmark, IntPtr pcbActual, uint grbit);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetUpdate2' -Namespace Win32 -PassThru
# $api::JetUpdate2(sesid, tableid, pvBookmark, cbBookmark, pcbActual, grbit)#uselib "ESENT.dll"
#func global JetUpdate2 "JetUpdate2" sptr, sptr, sptr, sptr, sptr, sptr
; JetUpdate2 sesid, tableid, pvBookmark, cbBookmark, varptr(pcbActual), grbit ; 戻り値は stat
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; pvBookmark : void* optional, out -> "sptr"
; cbBookmark : DWORD -> "sptr"
; pcbActual : DWORD* optional, out -> "sptr"
; grbit : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ESENT.dll" #cfunc global JetUpdate2 "JetUpdate2" sptr, sptr, sptr, int, var, int ; res = JetUpdate2(sesid, tableid, pvBookmark, cbBookmark, pcbActual, grbit) ; sesid : JET_SESID -> "sptr" ; tableid : JET_TABLEID -> "sptr" ; pvBookmark : void* optional, out -> "sptr" ; cbBookmark : DWORD -> "int" ; pcbActual : DWORD* optional, out -> "var" ; grbit : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ESENT.dll" #cfunc global JetUpdate2 "JetUpdate2" sptr, sptr, sptr, int, sptr, int ; res = JetUpdate2(sesid, tableid, pvBookmark, cbBookmark, varptr(pcbActual), grbit) ; sesid : JET_SESID -> "sptr" ; tableid : JET_TABLEID -> "sptr" ; pvBookmark : void* optional, out -> "sptr" ; cbBookmark : DWORD -> "int" ; pcbActual : DWORD* optional, out -> "sptr" ; grbit : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT JetUpdate2(JET_SESID sesid, JET_TABLEID tableid, void* pvBookmark, DWORD cbBookmark, DWORD* pcbActual, DWORD grbit) #uselib "ESENT.dll" #cfunc global JetUpdate2 "JetUpdate2" intptr, intptr, intptr, int, var, int ; res = JetUpdate2(sesid, tableid, pvBookmark, cbBookmark, pcbActual, grbit) ; sesid : JET_SESID -> "intptr" ; tableid : JET_TABLEID -> "intptr" ; pvBookmark : void* optional, out -> "intptr" ; cbBookmark : DWORD -> "int" ; pcbActual : DWORD* optional, out -> "var" ; grbit : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT JetUpdate2(JET_SESID sesid, JET_TABLEID tableid, void* pvBookmark, DWORD cbBookmark, DWORD* pcbActual, DWORD grbit) #uselib "ESENT.dll" #cfunc global JetUpdate2 "JetUpdate2" intptr, intptr, intptr, int, intptr, int ; res = JetUpdate2(sesid, tableid, pvBookmark, cbBookmark, varptr(pcbActual), grbit) ; sesid : JET_SESID -> "intptr" ; tableid : JET_TABLEID -> "intptr" ; pvBookmark : void* optional, out -> "intptr" ; cbBookmark : DWORD -> "int" ; pcbActual : DWORD* optional, out -> "intptr" ; grbit : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
esent = windows.NewLazySystemDLL("ESENT.dll")
procJetUpdate2 = esent.NewProc("JetUpdate2")
)
// sesid (JET_SESID), tableid (JET_TABLEID), pvBookmark (void* optional, out), cbBookmark (DWORD), pcbActual (DWORD* optional, out), grbit (DWORD)
r1, _, err := procJetUpdate2.Call(
uintptr(sesid),
uintptr(tableid),
uintptr(pvBookmark),
uintptr(cbBookmark),
uintptr(pcbActual),
uintptr(grbit),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction JetUpdate2(
sesid: NativeUInt; // JET_SESID
tableid: NativeUInt; // JET_TABLEID
pvBookmark: Pointer; // void* optional, out
cbBookmark: DWORD; // DWORD
pcbActual: Pointer; // DWORD* optional, out
grbit: DWORD // DWORD
): Integer; stdcall;
external 'ESENT.dll' name 'JetUpdate2';result := DllCall("ESENT\JetUpdate2"
, "UPtr", sesid ; JET_SESID
, "UPtr", tableid ; JET_TABLEID
, "Ptr", pvBookmark ; void* optional, out
, "UInt", cbBookmark ; DWORD
, "Ptr", pcbActual ; DWORD* optional, out
, "UInt", grbit ; DWORD
, "Int") ; return: INT●JetUpdate2(sesid, tableid, pvBookmark, cbBookmark, pcbActual, grbit) = DLL("ESENT.dll", "int JetUpdate2(int, int, void*, dword, void*, dword)")
# 呼び出し: JetUpdate2(sesid, tableid, pvBookmark, cbBookmark, pcbActual, grbit)
# sesid : JET_SESID -> "int"
# tableid : JET_TABLEID -> "int"
# pvBookmark : void* optional, out -> "void*"
# cbBookmark : DWORD -> "dword"
# pcbActual : DWORD* optional, out -> "void*"
# grbit : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。