Win32 API 日本語リファレンス
ホームSystem.Search › SQLSetDescFieldW

SQLSetDescFieldW

関数
記述子レコードの指定フィールドに値を設定する(Unicode)。
DLLODBC32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// ODBC32.dll  (Unicode / -W)
#include <windows.h>

SHORT SQLSetDescFieldW(
    void* DescriptorHandle,
    SHORT RecNumber,
    SHORT FieldIdentifier,
    void* Value,
    INT BufferLength
);

パラメーター

名前方向
DescriptorHandlevoid*inout
RecNumberSHORTin
FieldIdentifierSHORTin
Valuevoid*inout
BufferLengthINTin

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll  (Unicode / -W)
#include <windows.h>

SHORT SQLSetDescFieldW(
    void* DescriptorHandle,
    SHORT RecNumber,
    SHORT FieldIdentifier,
    void* Value,
    INT BufferLength
);
[DllImport("ODBC32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern short SQLSetDescFieldW(
    IntPtr DescriptorHandle,   // void* in/out
    short RecNumber,   // SHORT
    short FieldIdentifier,   // SHORT
    IntPtr Value,   // void* in/out
    int BufferLength   // INT
);
<DllImport("ODBC32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SQLSetDescFieldW(
    DescriptorHandle As IntPtr,   ' void* in/out
    RecNumber As Short,   ' SHORT
    FieldIdentifier As Short,   ' SHORT
    Value As IntPtr,   ' void* in/out
    BufferLength As Integer   ' INT
) As Short
End Function
' DescriptorHandle : void* in/out
' RecNumber : SHORT
' FieldIdentifier : SHORT
' Value : void* in/out
' BufferLength : INT
Declare PtrSafe Function SQLSetDescFieldW Lib "odbc32" ( _
    ByVal DescriptorHandle As LongPtr, _
    ByVal RecNumber As Integer, _
    ByVal FieldIdentifier As Integer, _
    ByVal Value As LongPtr, _
    ByVal BufferLength As Long) 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

SQLSetDescFieldW = ctypes.windll.odbc32.SQLSetDescFieldW
SQLSetDescFieldW.restype = ctypes.c_short
SQLSetDescFieldW.argtypes = [
    ctypes.POINTER(None),  # DescriptorHandle : void* in/out
    ctypes.c_short,  # RecNumber : SHORT
    ctypes.c_short,  # FieldIdentifier : SHORT
    ctypes.POINTER(None),  # Value : void* in/out
    ctypes.c_int,  # BufferLength : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ODBC32.dll')
SQLSetDescFieldW = Fiddle::Function.new(
  lib['SQLSetDescFieldW'],
  [
    Fiddle::TYPE_VOIDP,  # DescriptorHandle : void* in/out
    Fiddle::TYPE_SHORT,  # RecNumber : SHORT
    Fiddle::TYPE_SHORT,  # FieldIdentifier : SHORT
    Fiddle::TYPE_VOIDP,  # Value : void* in/out
    Fiddle::TYPE_INT,  # BufferLength : INT
  ],
  Fiddle::TYPE_SHORT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "odbc32")]
extern "system" {
    fn SQLSetDescFieldW(
        DescriptorHandle: *mut (),  // void* in/out
        RecNumber: i16,  // SHORT
        FieldIdentifier: i16,  // SHORT
        Value: *mut (),  // void* in/out
        BufferLength: i32  // INT
    ) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ODBC32.dll", CharSet = CharSet.Unicode)]
public static extern short SQLSetDescFieldW(IntPtr DescriptorHandle, short RecNumber, short FieldIdentifier, IntPtr Value, int BufferLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLSetDescFieldW' -Namespace Win32 -PassThru
# $api::SQLSetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength)
#uselib "ODBC32.dll"
#func global SQLSetDescFieldW "SQLSetDescFieldW" wptr, wptr, wptr, wptr, wptr
; SQLSetDescFieldW DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength   ; 戻り値は stat
; DescriptorHandle : void* in/out -> "wptr"
; RecNumber : SHORT -> "wptr"
; FieldIdentifier : SHORT -> "wptr"
; Value : void* in/out -> "wptr"
; BufferLength : INT -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ODBC32.dll"
#cfunc global SQLSetDescFieldW "SQLSetDescFieldW" sptr, int, int, sptr, int
; res = SQLSetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength)
; DescriptorHandle : void* in/out -> "sptr"
; RecNumber : SHORT -> "int"
; FieldIdentifier : SHORT -> "int"
; Value : void* in/out -> "sptr"
; BufferLength : INT -> "int"
; SHORT SQLSetDescFieldW(void* DescriptorHandle, SHORT RecNumber, SHORT FieldIdentifier, void* Value, INT BufferLength)
#uselib "ODBC32.dll"
#cfunc global SQLSetDescFieldW "SQLSetDescFieldW" intptr, int, int, intptr, int
; res = SQLSetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength)
; DescriptorHandle : void* in/out -> "intptr"
; RecNumber : SHORT -> "int"
; FieldIdentifier : SHORT -> "int"
; Value : void* in/out -> "intptr"
; BufferLength : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLSetDescFieldW = odbc32.NewProc("SQLSetDescFieldW")
)

// DescriptorHandle (void* in/out), RecNumber (SHORT), FieldIdentifier (SHORT), Value (void* in/out), BufferLength (INT)
r1, _, err := procSQLSetDescFieldW.Call(
	uintptr(DescriptorHandle),
	uintptr(RecNumber),
	uintptr(FieldIdentifier),
	uintptr(Value),
	uintptr(BufferLength),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SHORT
function SQLSetDescFieldW(
  DescriptorHandle: Pointer;   // void* in/out
  RecNumber: Smallint;   // SHORT
  FieldIdentifier: Smallint;   // SHORT
  Value: Pointer;   // void* in/out
  BufferLength: Integer   // INT
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLSetDescFieldW';
result := DllCall("ODBC32\SQLSetDescFieldW"
    , "Ptr", DescriptorHandle   ; void* in/out
    , "Short", RecNumber   ; SHORT
    , "Short", FieldIdentifier   ; SHORT
    , "Ptr", Value   ; void* in/out
    , "Int", BufferLength   ; INT
    , "Short")   ; return: SHORT
●SQLSetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength) = DLL("ODBC32.dll", "int SQLSetDescFieldW(void*, int, int, void*, int)")
# 呼び出し: SQLSetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength)
# DescriptorHandle : void* in/out -> "void*"
# RecNumber : SHORT -> "int"
# FieldIdentifier : SHORT -> "int"
# Value : void* in/out -> "void*"
# BufferLength : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。