ホーム › System.Search › SQLSpecialColumnsA
SQLSpecialColumnsA
関数行を一意に識別する列や更新で変化する列の情報を取得する。
シグネチャ
// ODBC32.dll (ANSI / -A)
#include <windows.h>
SHORT SQLSpecialColumnsA(
void* hstmt,
WORD fColType,
BYTE* szCatalogName, // optional
SHORT cbCatalogName,
BYTE* szSchemaName, // optional
SHORT cbSchemaName,
BYTE* szTableName, // optional
SHORT cbTableName,
WORD fScope,
WORD fNullable
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hstmt | void* | inout | ODBCのステートメントハンドル。特殊列の結果セットを返す。 |
| fColType | WORD | in | 取得する列の種類。SQL_BEST_ROWIDまたはSQL_ROWVERを指定する。 |
| szCatalogName | BYTE* | inoptional | 検索対象のカタログ名。NULL指定可。 |
| cbCatalogName | SHORT | in | szCatalogNameのバイト数。SQL_NTSでNUL終端とみなす。 |
| szSchemaName | BYTE* | inoptional | 検索対象のスキーマ名。NULL指定可。 |
| cbSchemaName | SHORT | in | szSchemaNameのバイト数。SQL_NTSでNUL終端とみなす。 |
| szTableName | BYTE* | inoptional | 検索対象のテーブル名。 |
| cbTableName | SHORT | in | szTableNameのバイト数。SQL_NTSでNUL終端とみなす。 |
| fScope | WORD | in | 行IDの有効範囲。SQL_SCOPE_CURROW等を指定する。 |
| fNullable | WORD | in | NULL列を含めるか。SQL_NO_NULLSまたはSQL_NULLABLE。 |
戻り値の型: SHORT
各言語での呼び出し定義
// ODBC32.dll (ANSI / -A)
#include <windows.h>
SHORT SQLSpecialColumnsA(
void* hstmt,
WORD fColType,
BYTE* szCatalogName, // optional
SHORT cbCatalogName,
BYTE* szSchemaName, // optional
SHORT cbSchemaName,
BYTE* szTableName, // optional
SHORT cbTableName,
WORD fScope,
WORD fNullable
);[DllImport("ODBC32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern short SQLSpecialColumnsA(
IntPtr hstmt, // void* in/out
ushort fColType, // WORD
IntPtr szCatalogName, // BYTE* optional
short cbCatalogName, // SHORT
IntPtr szSchemaName, // BYTE* optional
short cbSchemaName, // SHORT
IntPtr szTableName, // BYTE* optional
short cbTableName, // SHORT
ushort fScope, // WORD
ushort fNullable // WORD
);<DllImport("ODBC32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SQLSpecialColumnsA(
hstmt As IntPtr, ' void* in/out
fColType As UShort, ' WORD
szCatalogName As IntPtr, ' BYTE* optional
cbCatalogName As Short, ' SHORT
szSchemaName As IntPtr, ' BYTE* optional
cbSchemaName As Short, ' SHORT
szTableName As IntPtr, ' BYTE* optional
cbTableName As Short, ' SHORT
fScope As UShort, ' WORD
fNullable As UShort ' WORD
) As Short
End Function' hstmt : void* in/out
' fColType : WORD
' szCatalogName : BYTE* optional
' cbCatalogName : SHORT
' szSchemaName : BYTE* optional
' cbSchemaName : SHORT
' szTableName : BYTE* optional
' cbTableName : SHORT
' fScope : WORD
' fNullable : WORD
Declare PtrSafe Function SQLSpecialColumnsA Lib "odbc32" ( _
ByVal hstmt As LongPtr, _
ByVal fColType As Integer, _
ByVal szCatalogName As LongPtr, _
ByVal cbCatalogName As Integer, _
ByVal szSchemaName As LongPtr, _
ByVal cbSchemaName As Integer, _
ByVal szTableName As LongPtr, _
ByVal cbTableName As Integer, _
ByVal fScope As Integer, _
ByVal fNullable As Integer) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SQLSpecialColumnsA = ctypes.windll.odbc32.SQLSpecialColumnsA
SQLSpecialColumnsA.restype = ctypes.c_short
SQLSpecialColumnsA.argtypes = [
ctypes.POINTER(None), # hstmt : void* in/out
ctypes.c_ushort, # fColType : WORD
ctypes.POINTER(ctypes.c_ubyte), # szCatalogName : BYTE* optional
ctypes.c_short, # cbCatalogName : SHORT
ctypes.POINTER(ctypes.c_ubyte), # szSchemaName : BYTE* optional
ctypes.c_short, # cbSchemaName : SHORT
ctypes.POINTER(ctypes.c_ubyte), # szTableName : BYTE* optional
ctypes.c_short, # cbTableName : SHORT
ctypes.c_ushort, # fScope : WORD
ctypes.c_ushort, # fNullable : WORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ODBC32.dll')
SQLSpecialColumnsA = Fiddle::Function.new(
lib['SQLSpecialColumnsA'],
[
Fiddle::TYPE_VOIDP, # hstmt : void* in/out
-Fiddle::TYPE_SHORT, # fColType : WORD
Fiddle::TYPE_VOIDP, # szCatalogName : BYTE* optional
Fiddle::TYPE_SHORT, # cbCatalogName : SHORT
Fiddle::TYPE_VOIDP, # szSchemaName : BYTE* optional
Fiddle::TYPE_SHORT, # cbSchemaName : SHORT
Fiddle::TYPE_VOIDP, # szTableName : BYTE* optional
Fiddle::TYPE_SHORT, # cbTableName : SHORT
-Fiddle::TYPE_SHORT, # fScope : WORD
-Fiddle::TYPE_SHORT, # fNullable : WORD
],
Fiddle::TYPE_SHORT)#[link(name = "odbc32")]
extern "system" {
fn SQLSpecialColumnsA(
hstmt: *mut (), // void* in/out
fColType: u16, // WORD
szCatalogName: *mut u8, // BYTE* optional
cbCatalogName: i16, // SHORT
szSchemaName: *mut u8, // BYTE* optional
cbSchemaName: i16, // SHORT
szTableName: *mut u8, // BYTE* optional
cbTableName: i16, // SHORT
fScope: u16, // WORD
fNullable: u16 // WORD
) -> i16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ODBC32.dll", CharSet = CharSet.Ansi)]
public static extern short SQLSpecialColumnsA(IntPtr hstmt, ushort fColType, IntPtr szCatalogName, short cbCatalogName, IntPtr szSchemaName, short cbSchemaName, IntPtr szTableName, short cbTableName, ushort fScope, ushort fNullable);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLSpecialColumnsA' -Namespace Win32 -PassThru
# $api::SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable)#uselib "ODBC32.dll"
#func global SQLSpecialColumnsA "SQLSpecialColumnsA" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; SQLSpecialColumnsA hstmt, fColType, varptr(szCatalogName), cbCatalogName, varptr(szSchemaName), cbSchemaName, varptr(szTableName), cbTableName, fScope, fNullable ; 戻り値は stat
; hstmt : void* in/out -> "sptr"
; fColType : WORD -> "sptr"
; szCatalogName : BYTE* optional -> "sptr"
; cbCatalogName : SHORT -> "sptr"
; szSchemaName : BYTE* optional -> "sptr"
; cbSchemaName : SHORT -> "sptr"
; szTableName : BYTE* optional -> "sptr"
; cbTableName : SHORT -> "sptr"
; fScope : WORD -> "sptr"
; fNullable : WORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ODBC32.dll" #cfunc global SQLSpecialColumnsA "SQLSpecialColumnsA" sptr, int, var, int, var, int, var, int, int, int ; res = SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable) ; hstmt : void* in/out -> "sptr" ; fColType : WORD -> "int" ; szCatalogName : BYTE* optional -> "var" ; cbCatalogName : SHORT -> "int" ; szSchemaName : BYTE* optional -> "var" ; cbSchemaName : SHORT -> "int" ; szTableName : BYTE* optional -> "var" ; cbTableName : SHORT -> "int" ; fScope : WORD -> "int" ; fNullable : WORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ODBC32.dll" #cfunc global SQLSpecialColumnsA "SQLSpecialColumnsA" sptr, int, sptr, int, sptr, int, sptr, int, int, int ; res = SQLSpecialColumnsA(hstmt, fColType, varptr(szCatalogName), cbCatalogName, varptr(szSchemaName), cbSchemaName, varptr(szTableName), cbTableName, fScope, fNullable) ; hstmt : void* in/out -> "sptr" ; fColType : WORD -> "int" ; szCatalogName : BYTE* optional -> "sptr" ; cbCatalogName : SHORT -> "int" ; szSchemaName : BYTE* optional -> "sptr" ; cbSchemaName : SHORT -> "int" ; szTableName : BYTE* optional -> "sptr" ; cbTableName : SHORT -> "int" ; fScope : WORD -> "int" ; fNullable : WORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; SHORT SQLSpecialColumnsA(void* hstmt, WORD fColType, BYTE* szCatalogName, SHORT cbCatalogName, BYTE* szSchemaName, SHORT cbSchemaName, BYTE* szTableName, SHORT cbTableName, WORD fScope, WORD fNullable) #uselib "ODBC32.dll" #cfunc global SQLSpecialColumnsA "SQLSpecialColumnsA" intptr, int, var, int, var, int, var, int, int, int ; res = SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable) ; hstmt : void* in/out -> "intptr" ; fColType : WORD -> "int" ; szCatalogName : BYTE* optional -> "var" ; cbCatalogName : SHORT -> "int" ; szSchemaName : BYTE* optional -> "var" ; cbSchemaName : SHORT -> "int" ; szTableName : BYTE* optional -> "var" ; cbTableName : SHORT -> "int" ; fScope : WORD -> "int" ; fNullable : WORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; SHORT SQLSpecialColumnsA(void* hstmt, WORD fColType, BYTE* szCatalogName, SHORT cbCatalogName, BYTE* szSchemaName, SHORT cbSchemaName, BYTE* szTableName, SHORT cbTableName, WORD fScope, WORD fNullable) #uselib "ODBC32.dll" #cfunc global SQLSpecialColumnsA "SQLSpecialColumnsA" intptr, int, intptr, int, intptr, int, intptr, int, int, int ; res = SQLSpecialColumnsA(hstmt, fColType, varptr(szCatalogName), cbCatalogName, varptr(szSchemaName), cbSchemaName, varptr(szTableName), cbTableName, fScope, fNullable) ; hstmt : void* in/out -> "intptr" ; fColType : WORD -> "int" ; szCatalogName : BYTE* optional -> "intptr" ; cbCatalogName : SHORT -> "int" ; szSchemaName : BYTE* optional -> "intptr" ; cbSchemaName : SHORT -> "int" ; szTableName : BYTE* optional -> "intptr" ; cbTableName : SHORT -> "int" ; fScope : WORD -> "int" ; fNullable : WORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
procSQLSpecialColumnsA = odbc32.NewProc("SQLSpecialColumnsA")
)
// hstmt (void* in/out), fColType (WORD), szCatalogName (BYTE* optional), cbCatalogName (SHORT), szSchemaName (BYTE* optional), cbSchemaName (SHORT), szTableName (BYTE* optional), cbTableName (SHORT), fScope (WORD), fNullable (WORD)
r1, _, err := procSQLSpecialColumnsA.Call(
uintptr(hstmt),
uintptr(fColType),
uintptr(szCatalogName),
uintptr(cbCatalogName),
uintptr(szSchemaName),
uintptr(cbSchemaName),
uintptr(szTableName),
uintptr(cbTableName),
uintptr(fScope),
uintptr(fNullable),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SHORTfunction SQLSpecialColumnsA(
hstmt: Pointer; // void* in/out
fColType: Word; // WORD
szCatalogName: Pointer; // BYTE* optional
cbCatalogName: Smallint; // SHORT
szSchemaName: Pointer; // BYTE* optional
cbSchemaName: Smallint; // SHORT
szTableName: Pointer; // BYTE* optional
cbTableName: Smallint; // SHORT
fScope: Word; // WORD
fNullable: Word // WORD
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLSpecialColumnsA';result := DllCall("ODBC32\SQLSpecialColumnsA"
, "Ptr", hstmt ; void* in/out
, "UShort", fColType ; WORD
, "Ptr", szCatalogName ; BYTE* optional
, "Short", cbCatalogName ; SHORT
, "Ptr", szSchemaName ; BYTE* optional
, "Short", cbSchemaName ; SHORT
, "Ptr", szTableName ; BYTE* optional
, "Short", cbTableName ; SHORT
, "UShort", fScope ; WORD
, "UShort", fNullable ; WORD
, "Short") ; return: SHORT●SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable) = DLL("ODBC32.dll", "int SQLSpecialColumnsA(void*, int, void*, int, void*, int, void*, int, int, int)")
# 呼び出し: SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable)
# hstmt : void* in/out -> "void*"
# fColType : WORD -> "int"
# szCatalogName : BYTE* optional -> "void*"
# cbCatalogName : SHORT -> "int"
# szSchemaName : BYTE* optional -> "void*"
# cbSchemaName : SHORT -> "int"
# szTableName : BYTE* optional -> "void*"
# cbTableName : SHORT -> "int"
# fScope : WORD -> "int"
# fNullable : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "odbc32" fn SQLSpecialColumnsA(
hstmt: ?*anyopaque, // void* in/out
fColType: u16, // WORD
szCatalogName: [*c]u8, // BYTE* optional
cbCatalogName: i16, // SHORT
szSchemaName: [*c]u8, // BYTE* optional
cbSchemaName: i16, // SHORT
szTableName: [*c]u8, // BYTE* optional
cbTableName: i16, // SHORT
fScope: u16, // WORD
fNullable: u16 // WORD
) callconv(std.os.windows.WINAPI) i16;proc SQLSpecialColumnsA(
hstmt: pointer, # void* in/out
fColType: uint16, # WORD
szCatalogName: ptr uint8, # BYTE* optional
cbCatalogName: int16, # SHORT
szSchemaName: ptr uint8, # BYTE* optional
cbSchemaName: int16, # SHORT
szTableName: ptr uint8, # BYTE* optional
cbTableName: int16, # SHORT
fScope: uint16, # WORD
fNullable: uint16 # WORD
): int16 {.importc: "SQLSpecialColumnsA", stdcall, dynlib: "ODBC32.dll".}pragma(lib, "odbc32");
extern(Windows)
short SQLSpecialColumnsA(
void* hstmt, // void* in/out
ushort fColType, // WORD
ubyte* szCatalogName, // BYTE* optional
short cbCatalogName, // SHORT
ubyte* szSchemaName, // BYTE* optional
short cbSchemaName, // SHORT
ubyte* szTableName, // BYTE* optional
short cbTableName, // SHORT
ushort fScope, // WORD
ushort fNullable // WORD
);ccall((:SQLSpecialColumnsA, "ODBC32.dll"), stdcall, Int16,
(Ptr{Cvoid}, UInt16, Ptr{UInt8}, Int16, Ptr{UInt8}, Int16, Ptr{UInt8}, Int16, UInt16, UInt16),
hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable)
# hstmt : void* in/out -> Ptr{Cvoid}
# fColType : WORD -> UInt16
# szCatalogName : BYTE* optional -> Ptr{UInt8}
# cbCatalogName : SHORT -> Int16
# szSchemaName : BYTE* optional -> Ptr{UInt8}
# cbSchemaName : SHORT -> Int16
# szTableName : BYTE* optional -> Ptr{UInt8}
# cbTableName : SHORT -> Int16
# fScope : WORD -> UInt16
# fNullable : WORD -> UInt16
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int16_t SQLSpecialColumnsA(
void* hstmt,
uint16_t fColType,
uint8_t* szCatalogName,
int16_t cbCatalogName,
uint8_t* szSchemaName,
int16_t cbSchemaName,
uint8_t* szTableName,
int16_t cbTableName,
uint16_t fScope,
uint16_t fNullable);
]]
local odbc32 = ffi.load("odbc32")
-- odbc32.SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable)
-- hstmt : void* in/out
-- fColType : WORD
-- szCatalogName : BYTE* optional
-- cbCatalogName : SHORT
-- szSchemaName : BYTE* optional
-- cbSchemaName : SHORT
-- szTableName : BYTE* optional
-- cbTableName : SHORT
-- fScope : WORD
-- fNullable : WORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ODBC32.dll');
const SQLSpecialColumnsA = lib.func('__stdcall', 'SQLSpecialColumnsA', 'int16_t', ['void *', 'uint16_t', 'uint8_t *', 'int16_t', 'uint8_t *', 'int16_t', 'uint8_t *', 'int16_t', 'uint16_t', 'uint16_t']);
// SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable)
// hstmt : void* in/out -> 'void *'
// fColType : WORD -> 'uint16_t'
// szCatalogName : BYTE* optional -> 'uint8_t *'
// cbCatalogName : SHORT -> 'int16_t'
// szSchemaName : BYTE* optional -> 'uint8_t *'
// cbSchemaName : SHORT -> 'int16_t'
// szTableName : BYTE* optional -> 'uint8_t *'
// cbTableName : SHORT -> 'int16_t'
// fScope : WORD -> 'uint16_t'
// fNullable : WORD -> 'uint16_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ODBC32.dll", {
SQLSpecialColumnsA: { parameters: ["pointer", "u16", "pointer", "i16", "pointer", "i16", "pointer", "i16", "u16", "u16"], result: "i16" },
});
// lib.symbols.SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable)
// hstmt : void* in/out -> "pointer"
// fColType : WORD -> "u16"
// szCatalogName : BYTE* optional -> "pointer"
// cbCatalogName : SHORT -> "i16"
// szSchemaName : BYTE* optional -> "pointer"
// cbSchemaName : SHORT -> "i16"
// szTableName : BYTE* optional -> "pointer"
// cbTableName : SHORT -> "i16"
// fScope : WORD -> "u16"
// fNullable : WORD -> "u16"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int16_t SQLSpecialColumnsA(
void* hstmt,
uint16_t fColType,
uint8_t* szCatalogName,
int16_t cbCatalogName,
uint8_t* szSchemaName,
int16_t cbSchemaName,
uint8_t* szTableName,
int16_t cbTableName,
uint16_t fScope,
uint16_t fNullable);
C, "ODBC32.dll");
// $ffi->SQLSpecialColumnsA(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable);
// hstmt : void* in/out
// fColType : WORD
// szCatalogName : BYTE* optional
// cbCatalogName : SHORT
// szSchemaName : BYTE* optional
// cbSchemaName : SHORT
// szTableName : BYTE* optional
// cbTableName : SHORT
// fScope : WORD
// fNullable : 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, W32APIOptions.ASCII_OPTIONS);
short SQLSpecialColumnsA(
Pointer hstmt, // void* in/out
short fColType, // WORD
byte[] szCatalogName, // BYTE* optional
short cbCatalogName, // SHORT
byte[] szSchemaName, // BYTE* optional
short cbSchemaName, // SHORT
byte[] szTableName, // BYTE* optional
short cbTableName, // SHORT
short fScope, // WORD
short fNullable // WORD
);
}@[Link("odbc32")]
lib LibODBC32
fun SQLSpecialColumnsA = SQLSpecialColumnsA(
hstmt : Void*, # void* in/out
fColType : UInt16, # WORD
szCatalogName : UInt8*, # BYTE* optional
cbCatalogName : Int16, # SHORT
szSchemaName : UInt8*, # BYTE* optional
cbSchemaName : Int16, # SHORT
szTableName : UInt8*, # BYTE* optional
cbTableName : Int16, # SHORT
fScope : UInt16, # WORD
fNullable : 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 SQLSpecialColumnsANative = Int16 Function(Pointer<Void>, Uint16, Pointer<Uint8>, Int16, Pointer<Uint8>, Int16, Pointer<Uint8>, Int16, Uint16, Uint16);
typedef SQLSpecialColumnsADart = int Function(Pointer<Void>, int, Pointer<Uint8>, int, Pointer<Uint8>, int, Pointer<Uint8>, int, int, int);
final SQLSpecialColumnsA = DynamicLibrary.open('ODBC32.dll')
.lookupFunction<SQLSpecialColumnsANative, SQLSpecialColumnsADart>('SQLSpecialColumnsA');
// hstmt : void* in/out -> Pointer<Void>
// fColType : WORD -> Uint16
// szCatalogName : BYTE* optional -> Pointer<Uint8>
// cbCatalogName : SHORT -> Int16
// szSchemaName : BYTE* optional -> Pointer<Uint8>
// cbSchemaName : SHORT -> Int16
// szTableName : BYTE* optional -> Pointer<Uint8>
// cbTableName : SHORT -> Int16
// fScope : WORD -> Uint16
// fNullable : WORD -> Uint16
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SQLSpecialColumnsA(
hstmt: Pointer; // void* in/out
fColType: Word; // WORD
szCatalogName: Pointer; // BYTE* optional
cbCatalogName: Smallint; // SHORT
szSchemaName: Pointer; // BYTE* optional
cbSchemaName: Smallint; // SHORT
szTableName: Pointer; // BYTE* optional
cbTableName: Smallint; // SHORT
fScope: Word; // WORD
fNullable: Word // WORD
): Smallint; stdcall;
external 'ODBC32.dll' name 'SQLSpecialColumnsA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SQLSpecialColumnsA"
c_SQLSpecialColumnsA :: Ptr () -> Word16 -> Ptr Word8 -> Int16 -> Ptr Word8 -> Int16 -> Ptr Word8 -> Int16 -> Word16 -> Word16 -> IO Int16
-- hstmt : void* in/out -> Ptr ()
-- fColType : WORD -> Word16
-- szCatalogName : BYTE* optional -> Ptr Word8
-- cbCatalogName : SHORT -> Int16
-- szSchemaName : BYTE* optional -> Ptr Word8
-- cbSchemaName : SHORT -> Int16
-- szTableName : BYTE* optional -> Ptr Word8
-- cbTableName : SHORT -> Int16
-- fScope : WORD -> Word16
-- fNullable : WORD -> Word16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let sqlspecialcolumnsa =
foreign "SQLSpecialColumnsA"
((ptr void) @-> uint16_t @-> (ptr uint8_t) @-> int16_t @-> (ptr uint8_t) @-> int16_t @-> (ptr uint8_t) @-> int16_t @-> uint16_t @-> uint16_t @-> returning int16_t)
(* hstmt : void* in/out -> (ptr void) *)
(* fColType : WORD -> uint16_t *)
(* szCatalogName : BYTE* optional -> (ptr uint8_t) *)
(* cbCatalogName : SHORT -> int16_t *)
(* szSchemaName : BYTE* optional -> (ptr uint8_t) *)
(* cbSchemaName : SHORT -> int16_t *)
(* szTableName : BYTE* optional -> (ptr uint8_t) *)
(* cbTableName : SHORT -> int16_t *)
(* fScope : WORD -> uint16_t *)
(* fNullable : 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 ("SQLSpecialColumnsA" sqlspecial-columns-a :convention :stdcall) :int16
(hstmt :pointer) ; void* in/out
(f-col-type :uint16) ; WORD
(sz-catalog-name :pointer) ; BYTE* optional
(cb-catalog-name :int16) ; SHORT
(sz-schema-name :pointer) ; BYTE* optional
(cb-schema-name :int16) ; SHORT
(sz-table-name :pointer) ; BYTE* optional
(cb-table-name :int16) ; SHORT
(f-scope :uint16) ; WORD
(f-nullable :uint16)) ; WORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SQLSpecialColumnsA = Win32::API::More->new('ODBC32',
'short SQLSpecialColumnsA(LPVOID hstmt, WORD fColType, LPVOID szCatalogName, short cbCatalogName, LPVOID szSchemaName, short cbSchemaName, LPVOID szTableName, short cbTableName, WORD fScope, WORD fNullable)');
# my $ret = $SQLSpecialColumnsA->Call($hstmt, $fColType, $szCatalogName, $cbCatalogName, $szSchemaName, $cbSchemaName, $szTableName, $cbTableName, $fScope, $fNullable);
# hstmt : void* in/out -> LPVOID
# fColType : WORD -> WORD
# szCatalogName : BYTE* optional -> LPVOID
# cbCatalogName : SHORT -> short
# szSchemaName : BYTE* optional -> LPVOID
# cbSchemaName : SHORT -> short
# szTableName : BYTE* optional -> LPVOID
# cbTableName : SHORT -> short
# fScope : WORD -> WORD
# fNullable : WORD -> WORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f SQLSpecialColumnsW (Unicode版) — 行を一意に識別する列などの情報を返す(Unicode)。