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