ホーム › System.Search › SQLAllocHandle
SQLAllocHandle
関数指定種別のODBCハンドルを割り当てる。
シグネチャ
// ODBC32.dll
#include <windows.h>
SHORT SQLAllocHandle(
SHORT HandleType,
void* InputHandle,
void** OutputHandle
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| HandleType | SHORT | in |
| InputHandle | void* | inout |
| OutputHandle | void** | out |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll
#include <windows.h>
SHORT SQLAllocHandle(
SHORT HandleType,
void* InputHandle,
void** OutputHandle
);[DllImport("ODBC32.dll", ExactSpelling = true)]
static extern short SQLAllocHandle(
short HandleType, // SHORT
IntPtr InputHandle, // void* in/out
IntPtr OutputHandle // void** out
);<DllImport("ODBC32.dll", ExactSpelling:=True)>
Public Shared Function SQLAllocHandle(
HandleType As Short, ' SHORT
InputHandle As IntPtr, ' void* in/out
OutputHandle As IntPtr ' void** out
) As Short
End Function' HandleType : SHORT
' InputHandle : void* in/out
' OutputHandle : void** out
Declare PtrSafe Function SQLAllocHandle Lib "odbc32" ( _
ByVal HandleType As Integer, _
ByVal InputHandle As LongPtr, _
ByVal OutputHandle As LongPtr) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SQLAllocHandle = ctypes.windll.odbc32.SQLAllocHandle
SQLAllocHandle.restype = ctypes.c_short
SQLAllocHandle.argtypes = [
ctypes.c_short, # HandleType : SHORT
ctypes.POINTER(None), # InputHandle : void* in/out
ctypes.c_void_p, # OutputHandle : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ODBC32.dll')
SQLAllocHandle = Fiddle::Function.new(
lib['SQLAllocHandle'],
[
Fiddle::TYPE_SHORT, # HandleType : SHORT
Fiddle::TYPE_VOIDP, # InputHandle : void* in/out
Fiddle::TYPE_VOIDP, # OutputHandle : void** out
],
Fiddle::TYPE_SHORT)#[link(name = "odbc32")]
extern "system" {
fn SQLAllocHandle(
HandleType: i16, // SHORT
InputHandle: *mut (), // void* in/out
OutputHandle: *mut *mut () // void** out
) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ODBC32.dll")]
public static extern short SQLAllocHandle(short HandleType, IntPtr InputHandle, IntPtr OutputHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLAllocHandle' -Namespace Win32 -PassThru
# $api::SQLAllocHandle(HandleType, InputHandle, OutputHandle)#uselib "ODBC32.dll"
#func global SQLAllocHandle "SQLAllocHandle" sptr, sptr, sptr
; SQLAllocHandle HandleType, InputHandle, OutputHandle ; 戻り値は stat
; HandleType : SHORT -> "sptr"
; InputHandle : void* in/out -> "sptr"
; OutputHandle : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ODBC32.dll"
#cfunc global SQLAllocHandle "SQLAllocHandle" int, sptr, sptr
; res = SQLAllocHandle(HandleType, InputHandle, OutputHandle)
; HandleType : SHORT -> "int"
; InputHandle : void* in/out -> "sptr"
; OutputHandle : void** out -> "sptr"; SHORT SQLAllocHandle(SHORT HandleType, void* InputHandle, void** OutputHandle)
#uselib "ODBC32.dll"
#cfunc global SQLAllocHandle "SQLAllocHandle" int, intptr, intptr
; res = SQLAllocHandle(HandleType, InputHandle, OutputHandle)
; HandleType : SHORT -> "int"
; InputHandle : void* in/out -> "intptr"
; OutputHandle : void** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
procSQLAllocHandle = odbc32.NewProc("SQLAllocHandle")
)
// HandleType (SHORT), InputHandle (void* in/out), OutputHandle (void** out)
r1, _, err := procSQLAllocHandle.Call(
uintptr(HandleType),
uintptr(InputHandle),
uintptr(OutputHandle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLAllocHandle(
HandleType: Smallint; // SHORT
InputHandle: Pointer; // void* in/out
OutputHandle: Pointer // void** out
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLAllocHandle';result := DllCall("ODBC32\SQLAllocHandle"
, "Short", HandleType ; SHORT
, "Ptr", InputHandle ; void* in/out
, "Ptr", OutputHandle ; void** out
, "Short") ; return: SHORT●SQLAllocHandle(HandleType, InputHandle, OutputHandle) = DLL("ODBC32.dll", "int SQLAllocHandle(int, void*, void*)")
# 呼び出し: SQLAllocHandle(HandleType, InputHandle, OutputHandle)
# HandleType : SHORT -> "int"
# InputHandle : void* in/out -> "void*"
# OutputHandle : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。