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