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