ホーム › System.Search › SQLSetEnvAttr
SQLSetEnvAttr
関数環境属性に値を設定する。
シグネチャ
// ODBC32.dll
#include <windows.h>
SHORT SQLSetEnvAttr(
void* EnvironmentHandle,
INT Attribute,
void* Value, // optional
INT StringLength
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| EnvironmentHandle | void* | inout |
| Attribute | INT | in |
| Value | void* | inoptional |
| StringLength | INT | in |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll
#include <windows.h>
SHORT SQLSetEnvAttr(
void* EnvironmentHandle,
INT Attribute,
void* Value, // optional
INT StringLength
);[DllImport("ODBC32.dll", ExactSpelling = true)]
static extern short SQLSetEnvAttr(
IntPtr EnvironmentHandle, // void* in/out
int Attribute, // INT
IntPtr Value, // void* optional
int StringLength // INT
);<DllImport("ODBC32.dll", ExactSpelling:=True)>
Public Shared Function SQLSetEnvAttr(
EnvironmentHandle As IntPtr, ' void* in/out
Attribute As Integer, ' INT
Value As IntPtr, ' void* optional
StringLength As Integer ' INT
) As Short
End Function' EnvironmentHandle : void* in/out
' Attribute : INT
' Value : void* optional
' StringLength : INT
Declare PtrSafe Function SQLSetEnvAttr Lib "odbc32" ( _
ByVal EnvironmentHandle 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
SQLSetEnvAttr = ctypes.windll.odbc32.SQLSetEnvAttr
SQLSetEnvAttr.restype = ctypes.c_short
SQLSetEnvAttr.argtypes = [
ctypes.POINTER(None), # EnvironmentHandle : 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')
SQLSetEnvAttr = Fiddle::Function.new(
lib['SQLSetEnvAttr'],
[
Fiddle::TYPE_VOIDP, # EnvironmentHandle : 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 SQLSetEnvAttr(
EnvironmentHandle: *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")]
public static extern short SQLSetEnvAttr(IntPtr EnvironmentHandle, int Attribute, IntPtr Value, int StringLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLSetEnvAttr' -Namespace Win32 -PassThru
# $api::SQLSetEnvAttr(EnvironmentHandle, Attribute, Value, StringLength)#uselib "ODBC32.dll"
#func global SQLSetEnvAttr "SQLSetEnvAttr" sptr, sptr, sptr, sptr
; SQLSetEnvAttr EnvironmentHandle, Attribute, Value, StringLength ; 戻り値は stat
; EnvironmentHandle : void* in/out -> "sptr"
; Attribute : INT -> "sptr"
; Value : void* optional -> "sptr"
; StringLength : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ODBC32.dll"
#cfunc global SQLSetEnvAttr "SQLSetEnvAttr" sptr, int, sptr, int
; res = SQLSetEnvAttr(EnvironmentHandle, Attribute, Value, StringLength)
; EnvironmentHandle : void* in/out -> "sptr"
; Attribute : INT -> "int"
; Value : void* optional -> "sptr"
; StringLength : INT -> "int"; SHORT SQLSetEnvAttr(void* EnvironmentHandle, INT Attribute, void* Value, INT StringLength)
#uselib "ODBC32.dll"
#cfunc global SQLSetEnvAttr "SQLSetEnvAttr" intptr, int, intptr, int
; res = SQLSetEnvAttr(EnvironmentHandle, Attribute, Value, StringLength)
; EnvironmentHandle : 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")
procSQLSetEnvAttr = odbc32.NewProc("SQLSetEnvAttr")
)
// EnvironmentHandle (void* in/out), Attribute (INT), Value (void* optional), StringLength (INT)
r1, _, err := procSQLSetEnvAttr.Call(
uintptr(EnvironmentHandle),
uintptr(Attribute),
uintptr(Value),
uintptr(StringLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLSetEnvAttr(
EnvironmentHandle: Pointer; // void* in/out
Attribute: Integer; // INT
Value: Pointer; // void* optional
StringLength: Integer // INT
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLSetEnvAttr';result := DllCall("ODBC32\SQLSetEnvAttr"
, "Ptr", EnvironmentHandle ; void* in/out
, "Int", Attribute ; INT
, "Ptr", Value ; void* optional
, "Int", StringLength ; INT
, "Short") ; return: SHORT●SQLSetEnvAttr(EnvironmentHandle, Attribute, Value, StringLength) = DLL("ODBC32.dll", "int SQLSetEnvAttr(void*, int, void*, int)")
# 呼び出し: SQLSetEnvAttr(EnvironmentHandle, Attribute, Value, StringLength)
# EnvironmentHandle : void* in/out -> "void*"
# Attribute : INT -> "int"
# Value : void* optional -> "void*"
# StringLength : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。