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