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

SQLSetScrollOptions

関数
スクロールカーソルの並行性とキーセット動作を設定する(非推奨)。
DLLODBC32.dll呼出規約winapi

シグネチャ

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

SHORT SQLSetScrollOptions(
    void* hstmt,
    WORD fConcurrency,
    INT crowKeyset,
    WORD crowRowset
);

パラメーター

名前方向説明
hstmtvoid*inout対象のステートメントハンドル。非推奨でステートメント属性に置換された。
fConcurrencyWORDin並行性制御。SQL_CONCUR_READ_ONLY/LOCK/ROWVER/VALUES。
crowKeysetINTinキーセットのサイズ(行数)。動的カーソル等の特殊値も指定可。
crowRowsetWORDin行セットのサイズ(一度に取得する行数)。

戻り値の型: SHORT

各言語での呼び出し定義

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

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

SQLSetScrollOptions = ctypes.windll.odbc32.SQLSetScrollOptions
SQLSetScrollOptions.restype = ctypes.c_short
SQLSetScrollOptions.argtypes = [
    ctypes.POINTER(None),  # hstmt : void* in/out
    ctypes.c_ushort,  # fConcurrency : WORD
    ctypes.c_int,  # crowKeyset : INT
    ctypes.c_ushort,  # crowRowset : WORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLSetScrollOptions = odbc32.NewProc("SQLSetScrollOptions")
)

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

extern "odbc32" fn SQLSetScrollOptions(
    hstmt: ?*anyopaque, // void* in/out
    fConcurrency: u16, // WORD
    crowKeyset: i32, // INT
    crowRowset: u16 // WORD
) callconv(std.os.windows.WINAPI) i16;
proc SQLSetScrollOptions(
    hstmt: pointer,  # void* in/out
    fConcurrency: uint16,  # WORD
    crowKeyset: int32,  # INT
    crowRowset: uint16  # WORD
): int16 {.importc: "SQLSetScrollOptions", stdcall, dynlib: "ODBC32.dll".}
pragma(lib, "odbc32");
extern(Windows)
short SQLSetScrollOptions(
    void* hstmt,   // void* in/out
    ushort fConcurrency,   // WORD
    int crowKeyset,   // INT
    ushort crowRowset   // WORD
);
ccall((:SQLSetScrollOptions, "ODBC32.dll"), stdcall, Int16,
      (Ptr{Cvoid}, UInt16, Int32, UInt16),
      hstmt, fConcurrency, crowKeyset, crowRowset)
# hstmt : void* in/out -> Ptr{Cvoid}
# fConcurrency : WORD -> UInt16
# crowKeyset : INT -> Int32
# crowRowset : WORD -> UInt16
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int16_t SQLSetScrollOptions(
    void* hstmt,
    uint16_t fConcurrency,
    int32_t crowKeyset,
    uint16_t crowRowset);
]]
local odbc32 = ffi.load("odbc32")
-- odbc32.SQLSetScrollOptions(hstmt, fConcurrency, crowKeyset, crowRowset)
-- hstmt : void* in/out
-- fConcurrency : WORD
-- crowKeyset : INT
-- crowRowset : WORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('ODBC32.dll');
const SQLSetScrollOptions = lib.func('__stdcall', 'SQLSetScrollOptions', 'int16_t', ['void *', 'uint16_t', 'int32_t', 'uint16_t']);
// SQLSetScrollOptions(hstmt, fConcurrency, crowKeyset, crowRowset)
// hstmt : void* in/out -> 'void *'
// fConcurrency : WORD -> 'uint16_t'
// crowKeyset : INT -> 'int32_t'
// crowRowset : WORD -> 'uint16_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ODBC32.dll", {
  SQLSetScrollOptions: { parameters: ["pointer", "u16", "i32", "u16"], result: "i16" },
});
// lib.symbols.SQLSetScrollOptions(hstmt, fConcurrency, crowKeyset, crowRowset)
// hstmt : void* in/out -> "pointer"
// fConcurrency : WORD -> "u16"
// crowKeyset : INT -> "i32"
// crowRowset : WORD -> "u16"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int16_t SQLSetScrollOptions(
    void* hstmt,
    uint16_t fConcurrency,
    int32_t crowKeyset,
    uint16_t crowRowset);
C, "ODBC32.dll");
// $ffi->SQLSetScrollOptions(hstmt, fConcurrency, crowKeyset, crowRowset);
// hstmt : void* in/out
// fConcurrency : WORD
// crowKeyset : INT
// crowRowset : WORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Odbc32 extends StdCallLibrary {
    Odbc32 INSTANCE = Native.load("odbc32", Odbc32.class);
    short SQLSetScrollOptions(
        Pointer hstmt,   // void* in/out
        short fConcurrency,   // WORD
        int crowKeyset,   // INT
        short crowRowset   // WORD
    );
}
@[Link("odbc32")]
lib LibODBC32
  fun SQLSetScrollOptions = SQLSetScrollOptions(
    hstmt : Void*,   # void* in/out
    fConcurrency : UInt16,   # WORD
    crowKeyset : Int32,   # INT
    crowRowset : UInt16   # WORD
  ) : Int16
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SQLSetScrollOptionsNative = Int16 Function(Pointer<Void>, Uint16, Int32, Uint16);
typedef SQLSetScrollOptionsDart = int Function(Pointer<Void>, int, int, int);
final SQLSetScrollOptions = DynamicLibrary.open('ODBC32.dll')
    .lookupFunction<SQLSetScrollOptionsNative, SQLSetScrollOptionsDart>('SQLSetScrollOptions');
// hstmt : void* in/out -> Pointer<Void>
// fConcurrency : WORD -> Uint16
// crowKeyset : INT -> Int32
// crowRowset : WORD -> Uint16
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SQLSetScrollOptions(
  hstmt: Pointer;   // void* in/out
  fConcurrency: Word;   // WORD
  crowKeyset: Integer;   // INT
  crowRowset: Word   // WORD
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLSetScrollOptions';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SQLSetScrollOptions"
  c_SQLSetScrollOptions :: Ptr () -> Word16 -> Int32 -> Word16 -> IO Int16
-- hstmt : void* in/out -> Ptr ()
-- fConcurrency : WORD -> Word16
-- crowKeyset : INT -> Int32
-- crowRowset : WORD -> Word16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let sqlsetscrolloptions =
  foreign "SQLSetScrollOptions"
    ((ptr void) @-> uint16_t @-> int32_t @-> uint16_t @-> returning int16_t)
(* hstmt : void* in/out -> (ptr void) *)
(* fConcurrency : WORD -> uint16_t *)
(* crowKeyset : INT -> int32_t *)
(* crowRowset : WORD -> uint16_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library odbc32 (t "ODBC32.dll"))
(cffi:use-foreign-library odbc32)

(cffi:defcfun ("SQLSetScrollOptions" sqlset-scroll-options :convention :stdcall) :int16
  (hstmt :pointer)   ; void* in/out
  (f-concurrency :uint16)   ; WORD
  (crow-keyset :int32)   ; INT
  (crow-rowset :uint16))   ; WORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SQLSetScrollOptions = Win32::API::More->new('ODBC32',
    'short SQLSetScrollOptions(LPVOID hstmt, WORD fConcurrency, int crowKeyset, WORD crowRowset)');
# my $ret = $SQLSetScrollOptions->Call($hstmt, $fConcurrency, $crowKeyset, $crowRowset);
# hstmt : void* in/out -> LPVOID
# fConcurrency : WORD -> WORD
# crowKeyset : INT -> int
# crowRowset : WORD -> WORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。