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