ホーム › System.Search › bcp_moretext
bcp_moretext
関数可変長列の続きのデータを一括コピーに送信する。
シグネチャ
// odbcbcp.dll
#include <windows.h>
SHORT bcp_moretext(
void* param0,
INT param1,
BYTE* param2
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| param0 | void* | inout | BCP操作のODBC接続ハンドル。 |
| param1 | INT | in | 今回送信するデータのバイト数。 |
| param2 | BYTE* | inout | 送信するデータチャンクへのポインタ。大きなテキスト/イメージを分割送信する。 |
戻り値の型: SHORT
各言語での呼び出し定義
// odbcbcp.dll
#include <windows.h>
SHORT bcp_moretext(
void* param0,
INT param1,
BYTE* param2
);[DllImport("odbcbcp.dll", ExactSpelling = true)]
static extern short bcp_moretext(
IntPtr param0, // void* in/out
int param1, // INT
IntPtr param2 // BYTE* in/out
);<DllImport("odbcbcp.dll", ExactSpelling:=True)>
Public Shared Function bcp_moretext(
param0 As IntPtr, ' void* in/out
param1 As Integer, ' INT
param2 As IntPtr ' BYTE* in/out
) As Short
End Function' param0 : void* in/out
' param1 : INT
' param2 : BYTE* in/out
Declare PtrSafe Function bcp_moretext Lib "odbcbcp" ( _
ByVal param0 As LongPtr, _
ByVal param1 As Long, _
ByVal param2 As LongPtr) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
bcp_moretext = ctypes.windll.odbcbcp.bcp_moretext
bcp_moretext.restype = ctypes.c_short
bcp_moretext.argtypes = [
ctypes.POINTER(None), # param0 : void* in/out
ctypes.c_int, # param1 : INT
ctypes.POINTER(ctypes.c_ubyte), # param2 : BYTE* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('odbcbcp.dll')
bcp_moretext = Fiddle::Function.new(
lib['bcp_moretext'],
[
Fiddle::TYPE_VOIDP, # param0 : void* in/out
Fiddle::TYPE_INT, # param1 : INT
Fiddle::TYPE_VOIDP, # param2 : BYTE* in/out
],
Fiddle::TYPE_SHORT)#[link(name = "odbcbcp")]
extern "system" {
fn bcp_moretext(
param0: *mut (), // void* in/out
param1: i32, // INT
param2: *mut u8 // BYTE* in/out
) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("odbcbcp.dll")]
public static extern short bcp_moretext(IntPtr param0, int param1, IntPtr param2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'odbcbcp_bcp_moretext' -Namespace Win32 -PassThru
# $api::bcp_moretext(param0, param1, param2)#uselib "odbcbcp.dll"
#func global bcp_moretext "bcp_moretext" sptr, sptr, sptr
; bcp_moretext param0, param1, varptr(param2) ; 戻り値は stat
; param0 : void* in/out -> "sptr"
; param1 : INT -> "sptr"
; param2 : BYTE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "odbcbcp.dll" #cfunc global bcp_moretext "bcp_moretext" sptr, int, var ; res = bcp_moretext(param0, param1, param2) ; param0 : void* in/out -> "sptr" ; param1 : INT -> "int" ; param2 : BYTE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "odbcbcp.dll" #cfunc global bcp_moretext "bcp_moretext" sptr, int, sptr ; res = bcp_moretext(param0, param1, varptr(param2)) ; param0 : void* in/out -> "sptr" ; param1 : INT -> "int" ; param2 : BYTE* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; SHORT bcp_moretext(void* param0, INT param1, BYTE* param2) #uselib "odbcbcp.dll" #cfunc global bcp_moretext "bcp_moretext" intptr, int, var ; res = bcp_moretext(param0, param1, param2) ; param0 : void* in/out -> "intptr" ; param1 : INT -> "int" ; param2 : BYTE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; SHORT bcp_moretext(void* param0, INT param1, BYTE* param2) #uselib "odbcbcp.dll" #cfunc global bcp_moretext "bcp_moretext" intptr, int, intptr ; res = bcp_moretext(param0, param1, varptr(param2)) ; param0 : void* in/out -> "intptr" ; param1 : INT -> "int" ; param2 : BYTE* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
odbcbcp = windows.NewLazySystemDLL("odbcbcp.dll")
procbcp_moretext = odbcbcp.NewProc("bcp_moretext")
)
// param0 (void* in/out), param1 (INT), param2 (BYTE* in/out)
r1, _, err := procbcp_moretext.Call(
uintptr(param0),
uintptr(param1),
uintptr(param2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction bcp_moretext(
param0: Pointer; // void* in/out
param1: Integer; // INT
param2: Pointer // BYTE* in/out
): Smallint; stdcall;
external 'odbcbcp.dll' name 'bcp_moretext';result := DllCall("odbcbcp\bcp_moretext"
, "Ptr", param0 ; void* in/out
, "Int", param1 ; INT
, "Ptr", param2 ; BYTE* in/out
, "Short") ; return: SHORT●bcp_moretext(param0, param1, param2) = DLL("odbcbcp.dll", "int bcp_moretext(void*, int, void*)")
# 呼び出し: bcp_moretext(param0, param1, param2)
# param0 : void* in/out -> "void*"
# param1 : INT -> "int"
# param2 : BYTE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "odbcbcp" fn bcp_moretext(
param0: ?*anyopaque, // void* in/out
param1: i32, // INT
param2: [*c]u8 // BYTE* in/out
) callconv(std.os.windows.WINAPI) i16;proc bcp_moretext(
param0: pointer, # void* in/out
param1: int32, # INT
param2: ptr uint8 # BYTE* in/out
): int16 {.importc: "bcp_moretext", stdcall, dynlib: "odbcbcp.dll".}pragma(lib, "odbcbcp");
extern(Windows)
short bcp_moretext(
void* param0, // void* in/out
int param1, // INT
ubyte* param2 // BYTE* in/out
);ccall((:bcp_moretext, "odbcbcp.dll"), stdcall, Int16,
(Ptr{Cvoid}, Int32, Ptr{UInt8}),
param0, param1, param2)
# param0 : void* in/out -> Ptr{Cvoid}
# param1 : INT -> Int32
# param2 : BYTE* in/out -> Ptr{UInt8}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int16_t bcp_moretext(
void* param0,
int32_t param1,
uint8_t* param2);
]]
local odbcbcp = ffi.load("odbcbcp")
-- odbcbcp.bcp_moretext(param0, param1, param2)
-- param0 : void* in/out
-- param1 : INT
-- param2 : BYTE* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('odbcbcp.dll');
const bcp_moretext = lib.func('__stdcall', 'bcp_moretext', 'int16_t', ['void *', 'int32_t', 'uint8_t *']);
// bcp_moretext(param0, param1, param2)
// param0 : void* in/out -> 'void *'
// param1 : INT -> 'int32_t'
// param2 : BYTE* in/out -> 'uint8_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("odbcbcp.dll", {
bcp_moretext: { parameters: ["pointer", "i32", "pointer"], result: "i16" },
});
// lib.symbols.bcp_moretext(param0, param1, param2)
// param0 : void* in/out -> "pointer"
// param1 : INT -> "i32"
// param2 : BYTE* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int16_t bcp_moretext(
void* param0,
int32_t param1,
uint8_t* param2);
C, "odbcbcp.dll");
// $ffi->bcp_moretext(param0, param1, param2);
// param0 : void* in/out
// param1 : INT
// param2 : BYTE* in/out
// 構造体/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 Odbcbcp extends StdCallLibrary {
Odbcbcp INSTANCE = Native.load("odbcbcp", Odbcbcp.class);
short bcp_moretext(
Pointer param0, // void* in/out
int param1, // INT
byte[] param2 // BYTE* in/out
);
}@[Link("odbcbcp")]
lib Libodbcbcp
fun bcp_moretext = bcp_moretext(
param0 : Void*, # void* in/out
param1 : Int32, # INT
param2 : UInt8* # BYTE* in/out
) : Int16
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef bcp_moretextNative = Int16 Function(Pointer<Void>, Int32, Pointer<Uint8>);
typedef bcp_moretextDart = int Function(Pointer<Void>, int, Pointer<Uint8>);
final bcp_moretext = DynamicLibrary.open('odbcbcp.dll')
.lookupFunction<bcp_moretextNative, bcp_moretextDart>('bcp_moretext');
// param0 : void* in/out -> Pointer<Void>
// param1 : INT -> Int32
// param2 : BYTE* in/out -> Pointer<Uint8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function bcp_moretext(
param0: Pointer; // void* in/out
param1: Integer; // INT
param2: Pointer // BYTE* in/out
): Smallint; stdcall;
external 'odbcbcp.dll' name 'bcp_moretext';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "bcp_moretext"
c_bcp_moretext :: Ptr () -> Int32 -> Ptr Word8 -> IO Int16
-- param0 : void* in/out -> Ptr ()
-- param1 : INT -> Int32
-- param2 : BYTE* in/out -> Ptr Word8
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let bcp_moretext =
foreign "bcp_moretext"
((ptr void) @-> int32_t @-> (ptr uint8_t) @-> returning int16_t)
(* param0 : void* in/out -> (ptr void) *)
(* param1 : INT -> int32_t *)
(* param2 : BYTE* in/out -> (ptr uint8_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library odbcbcp (t "odbcbcp.dll"))
(cffi:use-foreign-library odbcbcp)
(cffi:defcfun ("bcp_moretext" bcp-moretext :convention :stdcall) :int16
(param0 :pointer) ; void* in/out
(param1 :int32) ; INT
(param2 :pointer)) ; BYTE* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $bcp_moretext = Win32::API::More->new('odbcbcp',
'short bcp_moretext(LPVOID param0, int param1, LPVOID param2)');
# my $ret = $bcp_moretext->Call($param0, $param1, $param2);
# param0 : void* in/out -> LPVOID
# param1 : INT -> int
# param2 : BYTE* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。