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