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