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