ホーム › System.Search › SQLCompleteAsync
SQLCompleteAsync
関数非同期実行中のODBC操作の完了を確定する。
シグネチャ
// ODBC32.dll
#include <windows.h>
SHORT SQLCompleteAsync(
SHORT HandleType,
void* Handle,
SHORT* AsyncRetCodePtr
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| HandleType | SHORT | in | 対象ハンドルの種別(SQL_HANDLE_DBC/STMT)。 |
| Handle | void* | inout | 非同期処理の完了を待つ対象ハンドル。 |
| AsyncRetCodePtr | SHORT* | 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 方式にも切替可。#uselib "ODBC32.dll" #cfunc global SQLCompleteAsync "SQLCompleteAsync" int, sptr, sptr ; res = SQLCompleteAsync(HandleType, Handle, varptr(AsyncRetCodePtr)) ; HandleType : SHORT -> "int" ; Handle : void* in/out -> "sptr" ; AsyncRetCodePtr : SHORT* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; SHORT SQLCompleteAsync(SHORT HandleType, void* Handle, SHORT* AsyncRetCodePtr) #uselib "ODBC32.dll" #cfunc global SQLCompleteAsync "SQLCompleteAsync" int, intptr, intptr ; res = SQLCompleteAsync(HandleType, Handle, varptr(AsyncRetCodePtr)) ; HandleType : SHORT -> "int" ; Handle : void* in/out -> "intptr" ; AsyncRetCodePtr : SHORT* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // SHORTfunction 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)。const std = @import("std");
extern "odbc32" fn SQLCompleteAsync(
HandleType: i16, // SHORT
Handle: ?*anyopaque, // void* in/out
AsyncRetCodePtr: [*c]i16 // SHORT* out
) callconv(std.os.windows.WINAPI) i16;proc SQLCompleteAsync(
HandleType: int16, # SHORT
Handle: pointer, # void* in/out
AsyncRetCodePtr: ptr int16 # SHORT* out
): int16 {.importc: "SQLCompleteAsync", stdcall, dynlib: "ODBC32.dll".}pragma(lib, "odbc32");
extern(Windows)
short SQLCompleteAsync(
short HandleType, // SHORT
void* Handle, // void* in/out
short* AsyncRetCodePtr // SHORT* out
);ccall((:SQLCompleteAsync, "ODBC32.dll"), stdcall, Int16,
(Int16, Ptr{Cvoid}, Ptr{Int16}),
HandleType, Handle, AsyncRetCodePtr)
# HandleType : SHORT -> Int16
# Handle : void* in/out -> Ptr{Cvoid}
# AsyncRetCodePtr : SHORT* out -> Ptr{Int16}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int16_t SQLCompleteAsync(
int16_t HandleType,
void* Handle,
int16_t* AsyncRetCodePtr);
]]
local odbc32 = ffi.load("odbc32")
-- odbc32.SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr)
-- HandleType : SHORT
-- Handle : void* in/out
-- AsyncRetCodePtr : SHORT* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ODBC32.dll');
const SQLCompleteAsync = lib.func('__stdcall', 'SQLCompleteAsync', 'int16_t', ['int16_t', 'void *', 'int16_t *']);
// SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr)
// HandleType : SHORT -> 'int16_t'
// Handle : void* in/out -> 'void *'
// AsyncRetCodePtr : SHORT* out -> 'int16_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ODBC32.dll", {
SQLCompleteAsync: { parameters: ["i16", "pointer", "pointer"], result: "i16" },
});
// lib.symbols.SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr)
// HandleType : SHORT -> "i16"
// Handle : void* in/out -> "pointer"
// AsyncRetCodePtr : SHORT* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int16_t SQLCompleteAsync(
int16_t HandleType,
void* Handle,
int16_t* AsyncRetCodePtr);
C, "ODBC32.dll");
// $ffi->SQLCompleteAsync(HandleType, Handle, AsyncRetCodePtr);
// HandleType : SHORT
// Handle : void* in/out
// AsyncRetCodePtr : SHORT* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Odbc32 extends StdCallLibrary {
Odbc32 INSTANCE = Native.load("odbc32", Odbc32.class);
short SQLCompleteAsync(
short HandleType, // SHORT
Pointer Handle, // void* in/out
ShortByReference AsyncRetCodePtr // SHORT* out
);
}@[Link("odbc32")]
lib LibODBC32
fun SQLCompleteAsync = SQLCompleteAsync(
HandleType : Int16, # SHORT
Handle : Void*, # void* in/out
AsyncRetCodePtr : Int16* # SHORT* out
) : Int16
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SQLCompleteAsyncNative = Int16 Function(Int16, Pointer<Void>, Pointer<Int16>);
typedef SQLCompleteAsyncDart = int Function(int, Pointer<Void>, Pointer<Int16>);
final SQLCompleteAsync = DynamicLibrary.open('ODBC32.dll')
.lookupFunction<SQLCompleteAsyncNative, SQLCompleteAsyncDart>('SQLCompleteAsync');
// HandleType : SHORT -> Int16
// Handle : void* in/out -> Pointer<Void>
// AsyncRetCodePtr : SHORT* out -> Pointer<Int16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SQLCompleteAsync(
HandleType: Smallint; // SHORT
Handle: Pointer; // void* in/out
AsyncRetCodePtr: Pointer // SHORT* out
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLCompleteAsync';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SQLCompleteAsync"
c_SQLCompleteAsync :: Int16 -> Ptr () -> Ptr Int16 -> IO Int16
-- HandleType : SHORT -> Int16
-- Handle : void* in/out -> Ptr ()
-- AsyncRetCodePtr : SHORT* out -> Ptr Int16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let sqlcompleteasync =
foreign "SQLCompleteAsync"
(int16_t @-> (ptr void) @-> (ptr int16_t) @-> returning int16_t)
(* HandleType : SHORT -> int16_t *)
(* Handle : void* in/out -> (ptr void) *)
(* AsyncRetCodePtr : SHORT* out -> (ptr int16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library odbc32 (t "ODBC32.dll"))
(cffi:use-foreign-library odbc32)
(cffi:defcfun ("SQLCompleteAsync" sqlcomplete-async :convention :stdcall) :int16
(handle-type :int16) ; SHORT
(handle :pointer) ; void* in/out
(async-ret-code-ptr :pointer)) ; SHORT* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SQLCompleteAsync = Win32::API::More->new('ODBC32',
'short SQLCompleteAsync(short HandleType, LPVOID Handle, LPVOID AsyncRetCodePtr)');
# my $ret = $SQLCompleteAsync->Call($HandleType, $Handle, $AsyncRetCodePtr);
# HandleType : SHORT -> short
# Handle : void* in/out -> LPVOID
# AsyncRetCodePtr : SHORT* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。