ホーム › System.Search › SQLGetDescFieldW
SQLGetDescFieldW
関数記述子レコードの指定フィールド値を取得する(Unicode)。
シグネチャ
// ODBC32.dll (Unicode / -W)
#include <windows.h>
SHORT SQLGetDescFieldW(
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 (Unicode / -W)
#include <windows.h>
SHORT SQLGetDescFieldW(
void* hdesc,
SHORT iRecord,
SHORT iField,
void* rgbValue, // optional
INT cbBufferLength,
INT* StringLength // optional
);[DllImport("ODBC32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern short SQLGetDescFieldW(
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.Unicode, ExactSpelling:=True)>
Public Shared Function SQLGetDescFieldW(
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 SQLGetDescFieldW 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
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SQLGetDescFieldW = ctypes.windll.odbc32.SQLGetDescFieldW
SQLGetDescFieldW.restype = ctypes.c_short
SQLGetDescFieldW.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')
SQLGetDescFieldW = Fiddle::Function.new(
lib['SQLGetDescFieldW'],
[
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)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "odbc32")]
extern "system" {
fn SQLGetDescFieldW(
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.Unicode)]
public static extern short SQLGetDescFieldW(IntPtr hdesc, short iRecord, short iField, IntPtr rgbValue, int cbBufferLength, IntPtr StringLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLGetDescFieldW' -Namespace Win32 -PassThru
# $api::SQLGetDescFieldW(hdesc, iRecord, iField, rgbValue, cbBufferLength, StringLength)#uselib "ODBC32.dll"
#func global SQLGetDescFieldW "SQLGetDescFieldW" wptr, wptr, wptr, wptr, wptr, wptr
; SQLGetDescFieldW hdesc, iRecord, iField, rgbValue, cbBufferLength, varptr(StringLength) ; 戻り値は stat
; hdesc : void* in/out -> "wptr"
; iRecord : SHORT -> "wptr"
; iField : SHORT -> "wptr"
; rgbValue : void* optional, out -> "wptr"
; cbBufferLength : INT -> "wptr"
; StringLength : INT* optional, out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ODBC32.dll" #cfunc global SQLGetDescFieldW "SQLGetDescFieldW" sptr, int, int, sptr, int, var ; res = SQLGetDescFieldW(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 SQLGetDescFieldW "SQLGetDescFieldW" sptr, int, int, sptr, int, sptr ; res = SQLGetDescFieldW(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 SQLGetDescFieldW(void* hdesc, SHORT iRecord, SHORT iField, void* rgbValue, INT cbBufferLength, INT* StringLength) #uselib "ODBC32.dll" #cfunc global SQLGetDescFieldW "SQLGetDescFieldW" intptr, int, int, intptr, int, var ; res = SQLGetDescFieldW(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 SQLGetDescFieldW(void* hdesc, SHORT iRecord, SHORT iField, void* rgbValue, INT cbBufferLength, INT* StringLength) #uselib "ODBC32.dll" #cfunc global SQLGetDescFieldW "SQLGetDescFieldW" intptr, int, int, intptr, int, intptr ; res = SQLGetDescFieldW(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")
procSQLGetDescFieldW = odbc32.NewProc("SQLGetDescFieldW")
)
// hdesc (void* in/out), iRecord (SHORT), iField (SHORT), rgbValue (void* optional, out), cbBufferLength (INT), StringLength (INT* optional, out)
r1, _, err := procSQLGetDescFieldW.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 SQLGetDescFieldW(
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 'SQLGetDescFieldW';result := DllCall("ODBC32\SQLGetDescFieldW"
, "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●SQLGetDescFieldW(hdesc, iRecord, iField, rgbValue, cbBufferLength, StringLength) = DLL("ODBC32.dll", "int SQLGetDescFieldW(void*, int, int, void*, int, void*)")
# 呼び出し: SQLGetDescFieldW(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)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。