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

SQLFreeStmt

関数
ステートメントハンドルのリソースを解放または再設定する。
DLLODBC32.dll呼出規約winapi

シグネチャ

// ODBC32.dll
#include <windows.h>

SHORT SQLFreeStmt(
    void* StatementHandle,
    WORD Option
);

パラメーター

名前方向
StatementHandlevoid*inout
OptionWORDin

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll
#include <windows.h>

SHORT SQLFreeStmt(
    void* StatementHandle,
    WORD Option
);
[DllImport("ODBC32.dll", ExactSpelling = true)]
static extern short SQLFreeStmt(
    IntPtr StatementHandle,   // void* in/out
    ushort Option   // WORD
);
<DllImport("ODBC32.dll", ExactSpelling:=True)>
Public Shared Function SQLFreeStmt(
    StatementHandle As IntPtr,   ' void* in/out
    [Option] As UShort   ' WORD
) As Short
End Function
' StatementHandle : void* in/out
' Option : WORD
Declare PtrSafe Function SQLFreeStmt Lib "odbc32" ( _
    ByVal StatementHandle As LongPtr, _
    ByVal Option As Integer) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SQLFreeStmt = ctypes.windll.odbc32.SQLFreeStmt
SQLFreeStmt.restype = ctypes.c_short
SQLFreeStmt.argtypes = [
    ctypes.POINTER(None),  # StatementHandle : void* in/out
    ctypes.c_ushort,  # Option : WORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ODBC32.dll')
SQLFreeStmt = Fiddle::Function.new(
  lib['SQLFreeStmt'],
  [
    Fiddle::TYPE_VOIDP,  # StatementHandle : void* in/out
    -Fiddle::TYPE_SHORT,  # Option : WORD
  ],
  Fiddle::TYPE_SHORT)
#[link(name = "odbc32")]
extern "system" {
    fn SQLFreeStmt(
        StatementHandle: *mut (),  // void* in/out
        Option: u16  // WORD
    ) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ODBC32.dll")]
public static extern short SQLFreeStmt(IntPtr StatementHandle, ushort Option);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLFreeStmt' -Namespace Win32 -PassThru
# $api::SQLFreeStmt(StatementHandle, Option)
#uselib "ODBC32.dll"
#func global SQLFreeStmt "SQLFreeStmt" sptr, sptr
; SQLFreeStmt StatementHandle, Option   ; 戻り値は stat
; StatementHandle : void* in/out -> "sptr"
; Option : WORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ODBC32.dll"
#cfunc global SQLFreeStmt "SQLFreeStmt" sptr, int
; res = SQLFreeStmt(StatementHandle, Option)
; StatementHandle : void* in/out -> "sptr"
; Option : WORD -> "int"
; SHORT SQLFreeStmt(void* StatementHandle, WORD Option)
#uselib "ODBC32.dll"
#cfunc global SQLFreeStmt "SQLFreeStmt" intptr, int
; res = SQLFreeStmt(StatementHandle, Option)
; StatementHandle : void* in/out -> "intptr"
; Option : WORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLFreeStmt = odbc32.NewProc("SQLFreeStmt")
)

// StatementHandle (void* in/out), Option (WORD)
r1, _, err := procSQLFreeStmt.Call(
	uintptr(StatementHandle),
	uintptr(Option),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SHORT
function SQLFreeStmt(
  StatementHandle: Pointer;   // void* in/out
  Option: Word   // WORD
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLFreeStmt';
result := DllCall("ODBC32\SQLFreeStmt"
    , "Ptr", StatementHandle   ; void* in/out
    , "UShort", Option   ; WORD
    , "Short")   ; return: SHORT
●SQLFreeStmt(StatementHandle, Option) = DLL("ODBC32.dll", "int SQLFreeStmt(void*, int)")
# 呼び出し: SQLFreeStmt(StatementHandle, Option)
# StatementHandle : void* in/out -> "void*"
# Option : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。