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

SQLSpecialColumnsW

関数
行を一意に識別する列などの情報を返す(Unicode)。
DLLODBC32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// ODBC32.dll  (Unicode / -W)
#include <windows.h>

SHORT SQLSpecialColumnsW(
    void* hstmt,
    WORD fColType,
    WORD* szCatalogName,   // optional
    SHORT cchCatalogName,
    WORD* szSchemaName,   // optional
    SHORT cchSchemaName,
    WORD* szTableName,   // optional
    SHORT cchTableName,
    WORD fScope,
    WORD fNullable
);

パラメーター

名前方向
hstmtvoid*inout
fColTypeWORDin
szCatalogNameWORD*inoptional
cchCatalogNameSHORTin
szSchemaNameWORD*inoptional
cchSchemaNameSHORTin
szTableNameWORD*inoptional
cchTableNameSHORTin
fScopeWORDin
fNullableWORDin

戻り値の型: SHORT

各言語での呼び出し定義

// ODBC32.dll  (Unicode / -W)
#include <windows.h>

SHORT SQLSpecialColumnsW(
    void* hstmt,
    WORD fColType,
    WORD* szCatalogName,   // optional
    SHORT cchCatalogName,
    WORD* szSchemaName,   // optional
    SHORT cchSchemaName,
    WORD* szTableName,   // optional
    SHORT cchTableName,
    WORD fScope,
    WORD fNullable
);
[DllImport("ODBC32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern short SQLSpecialColumnsW(
    IntPtr hstmt,   // void* in/out
    ushort fColType,   // WORD
    IntPtr szCatalogName,   // WORD* optional
    short cchCatalogName,   // SHORT
    IntPtr szSchemaName,   // WORD* optional
    short cchSchemaName,   // SHORT
    IntPtr szTableName,   // WORD* optional
    short cchTableName,   // SHORT
    ushort fScope,   // WORD
    ushort fNullable   // WORD
);
<DllImport("ODBC32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SQLSpecialColumnsW(
    hstmt As IntPtr,   ' void* in/out
    fColType As UShort,   ' WORD
    szCatalogName As IntPtr,   ' WORD* optional
    cchCatalogName As Short,   ' SHORT
    szSchemaName As IntPtr,   ' WORD* optional
    cchSchemaName As Short,   ' SHORT
    szTableName As IntPtr,   ' WORD* optional
    cchTableName As Short,   ' SHORT
    fScope As UShort,   ' WORD
    fNullable As UShort   ' WORD
) As Short
End Function
' hstmt : void* in/out
' fColType : WORD
' szCatalogName : WORD* optional
' cchCatalogName : SHORT
' szSchemaName : WORD* optional
' cchSchemaName : SHORT
' szTableName : WORD* optional
' cchTableName : SHORT
' fScope : WORD
' fNullable : WORD
Declare PtrSafe Function SQLSpecialColumnsW Lib "odbc32" ( _
    ByVal hstmt As LongPtr, _
    ByVal fColType As Integer, _
    ByVal szCatalogName As LongPtr, _
    ByVal cchCatalogName As Integer, _
    ByVal szSchemaName As LongPtr, _
    ByVal cchSchemaName As Integer, _
    ByVal szTableName As LongPtr, _
    ByVal cchTableName As Integer, _
    ByVal fScope As Integer, _
    ByVal fNullable As Integer) As Integer
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SQLSpecialColumnsW = ctypes.windll.odbc32.SQLSpecialColumnsW
SQLSpecialColumnsW.restype = ctypes.c_short
SQLSpecialColumnsW.argtypes = [
    ctypes.POINTER(None),  # hstmt : void* in/out
    ctypes.c_ushort,  # fColType : WORD
    ctypes.POINTER(ctypes.c_ushort),  # szCatalogName : WORD* optional
    ctypes.c_short,  # cchCatalogName : SHORT
    ctypes.POINTER(ctypes.c_ushort),  # szSchemaName : WORD* optional
    ctypes.c_short,  # cchSchemaName : SHORT
    ctypes.POINTER(ctypes.c_ushort),  # szTableName : WORD* optional
    ctypes.c_short,  # cchTableName : SHORT
    ctypes.c_ushort,  # fScope : WORD
    ctypes.c_ushort,  # fNullable : WORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ODBC32.dll')
SQLSpecialColumnsW = Fiddle::Function.new(
  lib['SQLSpecialColumnsW'],
  [
    Fiddle::TYPE_VOIDP,  # hstmt : void* in/out
    -Fiddle::TYPE_SHORT,  # fColType : WORD
    Fiddle::TYPE_VOIDP,  # szCatalogName : WORD* optional
    Fiddle::TYPE_SHORT,  # cchCatalogName : SHORT
    Fiddle::TYPE_VOIDP,  # szSchemaName : WORD* optional
    Fiddle::TYPE_SHORT,  # cchSchemaName : SHORT
    Fiddle::TYPE_VOIDP,  # szTableName : WORD* optional
    Fiddle::TYPE_SHORT,  # cchTableName : SHORT
    -Fiddle::TYPE_SHORT,  # fScope : WORD
    -Fiddle::TYPE_SHORT,  # fNullable : WORD
  ],
  Fiddle::TYPE_SHORT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "odbc32")]
extern "system" {
    fn SQLSpecialColumnsW(
        hstmt: *mut (),  // void* in/out
        fColType: u16,  // WORD
        szCatalogName: *mut u16,  // WORD* optional
        cchCatalogName: i16,  // SHORT
        szSchemaName: *mut u16,  // WORD* optional
        cchSchemaName: i16,  // SHORT
        szTableName: *mut u16,  // WORD* optional
        cchTableName: 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.Unicode)]
public static extern short SQLSpecialColumnsW(IntPtr hstmt, ushort fColType, IntPtr szCatalogName, short cchCatalogName, IntPtr szSchemaName, short cchSchemaName, IntPtr szTableName, short cchTableName, ushort fScope, ushort fNullable);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ODBC32_SQLSpecialColumnsW' -Namespace Win32 -PassThru
# $api::SQLSpecialColumnsW(hstmt, fColType, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, fScope, fNullable)
#uselib "ODBC32.dll"
#func global SQLSpecialColumnsW "SQLSpecialColumnsW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; SQLSpecialColumnsW hstmt, fColType, varptr(szCatalogName), cchCatalogName, varptr(szSchemaName), cchSchemaName, varptr(szTableName), cchTableName, fScope, fNullable   ; 戻り値は stat
; hstmt : void* in/out -> "wptr"
; fColType : WORD -> "wptr"
; szCatalogName : WORD* optional -> "wptr"
; cchCatalogName : SHORT -> "wptr"
; szSchemaName : WORD* optional -> "wptr"
; cchSchemaName : SHORT -> "wptr"
; szTableName : WORD* optional -> "wptr"
; cchTableName : SHORT -> "wptr"
; fScope : WORD -> "wptr"
; fNullable : WORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ODBC32.dll"
#cfunc global SQLSpecialColumnsW "SQLSpecialColumnsW" sptr, int, var, int, var, int, var, int, int, int
; res = SQLSpecialColumnsW(hstmt, fColType, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, fScope, fNullable)
; hstmt : void* in/out -> "sptr"
; fColType : WORD -> "int"
; szCatalogName : WORD* optional -> "var"
; cchCatalogName : SHORT -> "int"
; szSchemaName : WORD* optional -> "var"
; cchSchemaName : SHORT -> "int"
; szTableName : WORD* optional -> "var"
; cchTableName : SHORT -> "int"
; fScope : WORD -> "int"
; fNullable : WORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; SHORT SQLSpecialColumnsW(void* hstmt, WORD fColType, WORD* szCatalogName, SHORT cchCatalogName, WORD* szSchemaName, SHORT cchSchemaName, WORD* szTableName, SHORT cchTableName, WORD fScope, WORD fNullable)
#uselib "ODBC32.dll"
#cfunc global SQLSpecialColumnsW "SQLSpecialColumnsW" intptr, int, var, int, var, int, var, int, int, int
; res = SQLSpecialColumnsW(hstmt, fColType, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, fScope, fNullable)
; hstmt : void* in/out -> "intptr"
; fColType : WORD -> "int"
; szCatalogName : WORD* optional -> "var"
; cchCatalogName : SHORT -> "int"
; szSchemaName : WORD* optional -> "var"
; cchSchemaName : SHORT -> "int"
; szTableName : WORD* optional -> "var"
; cchTableName : SHORT -> "int"
; fScope : WORD -> "int"
; fNullable : WORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	odbc32 = windows.NewLazySystemDLL("ODBC32.dll")
	procSQLSpecialColumnsW = odbc32.NewProc("SQLSpecialColumnsW")
)

// hstmt (void* in/out), fColType (WORD), szCatalogName (WORD* optional), cchCatalogName (SHORT), szSchemaName (WORD* optional), cchSchemaName (SHORT), szTableName (WORD* optional), cchTableName (SHORT), fScope (WORD), fNullable (WORD)
r1, _, err := procSQLSpecialColumnsW.Call(
	uintptr(hstmt),
	uintptr(fColType),
	uintptr(szCatalogName),
	uintptr(cchCatalogName),
	uintptr(szSchemaName),
	uintptr(cchSchemaName),
	uintptr(szTableName),
	uintptr(cchTableName),
	uintptr(fScope),
	uintptr(fNullable),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SHORT
function SQLSpecialColumnsW(
  hstmt: Pointer;   // void* in/out
  fColType: Word;   // WORD
  szCatalogName: Pointer;   // WORD* optional
  cchCatalogName: Smallint;   // SHORT
  szSchemaName: Pointer;   // WORD* optional
  cchSchemaName: Smallint;   // SHORT
  szTableName: Pointer;   // WORD* optional
  cchTableName: Smallint;   // SHORT
  fScope: Word;   // WORD
  fNullable: Word   // WORD
): Smallint; stdcall;
  external 'ODBC32.dll' name 'SQLSpecialColumnsW';
result := DllCall("ODBC32\SQLSpecialColumnsW"
    , "Ptr", hstmt   ; void* in/out
    , "UShort", fColType   ; WORD
    , "Ptr", szCatalogName   ; WORD* optional
    , "Short", cchCatalogName   ; SHORT
    , "Ptr", szSchemaName   ; WORD* optional
    , "Short", cchSchemaName   ; SHORT
    , "Ptr", szTableName   ; WORD* optional
    , "Short", cchTableName   ; SHORT
    , "UShort", fScope   ; WORD
    , "UShort", fNullable   ; WORD
    , "Short")   ; return: SHORT
●SQLSpecialColumnsW(hstmt, fColType, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, fScope, fNullable) = DLL("ODBC32.dll", "int SQLSpecialColumnsW(void*, int, void*, int, void*, int, void*, int, int, int)")
# 呼び出し: SQLSpecialColumnsW(hstmt, fColType, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, fScope, fNullable)
# hstmt : void* in/out -> "void*"
# fColType : WORD -> "int"
# szCatalogName : WORD* optional -> "void*"
# cchCatalogName : SHORT -> "int"
# szSchemaName : WORD* optional -> "void*"
# cchSchemaName : SHORT -> "int"
# szTableName : WORD* optional -> "void*"
# cchTableName : SHORT -> "int"
# fScope : WORD -> "int"
# fNullable : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。