목차

Search

  1. 서문
  2. 변환 언어
  3. 상수
  4. 연산자
  5. 변수
  6. 날짜
  7. 함수
  8. 사용자 지정 함수 작성
  9. 사용자 지정 함수 API 참조

변환 언어 참조

변환 언어 참조

2단계. 헤더 파일 작성

2단계. 헤더 파일 작성

C를 사용하여 모든 함수를 선언하는 헤더 파일을 작성합니다. 하나의 헤더 파일을 하나 이상의 사용자 지정 함수에 사용합니다.
다음 예는 ECHO 사용자 지정 함수에 대한 echo.h 헤더 파일을 보여 줍니다.
#ifndef __ECHO_PLUGIN_HPP #define __ECHO_PLUGIN_HPP #if defined(WIN32) #if defined SAMPLE_EXPR_EXPORTS #define SAMPLE_EXPR_SPEC __declspec(dllexport) #else #define SAMPLE_EXPR_SPEC __declspec(dllimport) #endif #else #define SAMPLE_EXPR_SPEC #endif // method to get description of Echo function extern "C" SAMPLE_EXPR_SPEC IUNICHAR * getDescriptionEcho(IUNICHAR* ns, IUNICHAR* sFuncName); // method to get prototype of Echo function extern "C" SAMPLE_EXPR_SPEC IUNICHAR * getPrototypeEcho(IUNICHAR* ns, IUNICHAR* sFuncName); // method to validate usage of Echo function extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS validateFunctionEcho(IUNICHAR* ns, IUNICHAR* sFuncName, IUINT32 numArgs, INFA_EXPR_OPD_METADATA** inputArgList, INFA_EXPR_OPD_METADATA* retValue); //method to generate SQL code for pushdown optimization extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS pushdownFunctionEcho(IUNICHAR* sNameSpace, IUNICHAR* sFuncName, IUINT32 numArgs, INFA_EXPR_OPD_METADATA** inputArgList, EDatabaseType dbType, EPushdownMode pushdownMode, IUNICHAR** sGenSql); // method to process row for Echo function extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_ROWSTATUS processRowEcho(INFA_EXPR_FUNCTION_INSTANCE_HANDLE *fnInstance, IUNICHAR **errMsg); // method to do module level initialization for Echo function extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS moduleInitEcho(INFA_EXPR_MODULE_HANDLE *modHandle); // method to do module level deinitialization for Echo function extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS moduleDeinitEcho(INFA_EXPR_MODULE_HANDLE *modHandle); // method to do function level initialization for Echo function extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS functionInitEcho(INFA_EXPR_FUNCTION_HANDLE *funHandle); // method to do function level deinitialization for Echo function extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS functionDeinitEcho(INFA_EXPR_FUNCTION_HANDLE *funHandle); // method to do function instance level initialization for Echo function extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS functionInstInitEcho(INFA_EXPR_FUNCTION_INSTANCE_HANDLE *funInstHandle); // method to do function instance level deinitialization for Echo function extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS functionInstDeinitEcho(INFA_EXPR_FUNCTION_INSTANCE_HANDLE *funInstHandle); /** These are all plugin callbacks, which have been implemented to get various module, function level interfaces */ // method to get plugin version extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS INFA_EXPR_GetPluginVersion(INFA_VERSION* sdkVersion, INFA_VERSION* pluginVersion); // method to delete the string allocated by this plugin. used for deleting the error // messages extern "C" SAMPLE_EXPR_SPEC void INFA_EXPR_DestroyString(IUNICHAR *); // method to get validation interfaces extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS INFA_EXPR_ValidateGetUserInterface( IUNICHAR* ns, IUNICHAR* sFuncName, INFA_EXPR_VALIDATE_METHODS* functions); // method to get module interfaces extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS INFA_EXPR_ModuleGetUserInterface(INFA_EXPR_LIB_METHODS* functions); // method to get function interfaces extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS INFA_EXPR_FunctionGetUserInterface(IUNICHAR* nameSpaceName, IUNICHAR* functionName, INFA_EXPR_FUNCTION_METHODS* functions); // method to get function instance interfaces extern "C" SAMPLE_EXPR_SPEC INFA_EXPR_STATUS INFA_EXPR_FunctionInstanceGetUserInterface(IUNICHAR* nameSpaceName, IUNICHAR* functionName, INFA_EXPR_FUNCTION_INSTANCE_METHODS* functions); #endif