Win32 API 日本語リファレンス
ホームSystem.Search › SQLCompleteAsync

SQLCompleteAsync

関数
非同期実行中のODBC操作の完了を確定する。
DLLODBC32.dll呼出規約winapi

シグネチャ

// ODBC32.dll
#include <windows.h>

SHORT SQLCompleteAsync(
    SHORT HandleType,
    void* Handle,
    SHORT* AsyncRetCodePtr
);

パラメーター

名前方向
HandleTypeSHORTin
Handlevoid*inout
AsyncRetCodePtrSHORT*out

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll
#include <windows.h>

SHORT SQLCompleteAsync(
    SHORT HandleType,
    void* Handle,
    SHORT* AsyncRetCodePtr
);
[DllImport("ODBC32.dll", ExactSpelling = true)]
static extern short SQLCompleteAsync(
    short HandleType,   // SHORT
    IntPtr Handle,   // void* in/out
    out short AsyncRetCodePtr   // SHORT* out
);
<DllImport("ODBC32.dll", ExactSpelling:=True)>
Public Shared Function SQLCompleteAsync(
    HandleType As Short,   ' SHORT
    Handle As IntPtr,   ' void* in/out
    <Out> ByRef AsyncRetCodePtr As Short   ' SHORT* out
) As Short
End Function
' HandleType : SHORT
' Handle : void* in/out
' AsyncRetCodePtr : SHORT* out
Declare PtrSafe Function SQLCompleteAsync Lib "odbc32" ( _
    ByVal HandleType As Integer, _
    ByVal Handle As LongPtr, _
    ByRef AsyncRetCodePtr As Integer) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SQLCompleteAsync = ctypes.windll.odbc32.SQLCompleteAsync
SQLCompleteAsync.restype = ctypes.c_short
SQLCompleteAsync.argtypes = [
    ctypes.c_short,  # HandleType : SHORT
    ctypes.POINTER(None),  # Handle : void* in/out
    ctypes.POINTER(ctypes.c_short),  # AsyncRetCodePtr : SHORT* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ODBC32.dll')
SQLCompleteAsync = Fiddle::Function.new(
  lib['SQLCompleteAsync'],
  [
    Fiddle::TYPE_SHORT,  # HandleType : SHORT
    Fiddle::TYPE_VOIDP,  # Handle : void* in/out
    Fiddle::TYPE_VOIDP,  # AsyncRetCodePtr : SHORT* out
  ],
  Fiddle::TYPE_SHORT)
#[link(name = "odbc32")]
extern "system" {
    fn SQLCompleteAsync(
        HandleType: i16,  // SHORT
        Handle: *mut (),  // void* in/out
        AsyncRetCodePtr: *mut i16  // SHORT* out
    ) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ODBC32.dll")]
public static extern short SQLCompleteAsync(short HandleType, IntPtr Handle, out short AsyncRetCodePtr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLCompleteAsync' -Namespace Win32 -PassThru
# $api::SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr)
#uselib "ODBC32.dll"
#func global SQLCompleteAsync "SQLCompleteAsync" sptr, sptr, sptr
; SQLCompleteAsync HandleType, Handle, varptr(AsyncRetCodePtr)   ; 戻り値は stat
; HandleType : SHORT -> "sptr"
; Handle : void* in/out -> "sptr"
; AsyncRetCodePtr : SHORT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ODBC32.dll"
#cfunc global SQLCompleteAsync "SQLCompleteAsync" int, sptr, var
; res = SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr)
; HandleType : SHORT -> "int"
; Handle : void* in/out -> "sptr"
; AsyncRetCodePtr : SHORT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; SHORT SQLCompleteAsync(SHORT HandleType, void* Handle, SHORT* AsyncRetCodePtr)
#uselib "ODBC32.dll"
#cfunc global SQLCompleteAsync "SQLCompleteAsync" int, intptr, var
; res = SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr)
; HandleType : SHORT -> "int"
; Handle : void* in/out -> "intptr"
; AsyncRetCodePtr : SHORT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLCompleteAsync = odbc32.NewProc("SQLCompleteAsync")
)

// HandleType (SHORT), Handle (void* in/out), AsyncRetCodePtr (SHORT* out)
r1, _, err := procSQLCompleteAsync.Call(
	uintptr(HandleType),
	uintptr(Handle),
	uintptr(AsyncRetCodePtr),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SHORT
function SQLCompleteAsync(
  HandleType: Smallint;   // SHORT
  Handle: Pointer;   // void* in/out
  AsyncRetCodePtr: Pointer   // SHORT* out
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLCompleteAsync';
result := DllCall("ODBC32\SQLCompleteAsync"
    , "Short", HandleType   ; SHORT
    , "Ptr", Handle   ; void* in/out
    , "Ptr", AsyncRetCodePtr   ; SHORT* out
    , "Short")   ; return: SHORT
●SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr) = DLL("ODBC32.dll", "int SQLCompleteAsync(int, void*, void*)")
# 呼び出し: SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr)
# HandleType : SHORT -> "int"
# Handle : void* in/out -> "void*"
# AsyncRetCodePtr : SHORT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。