enuSpaceSQLite API
enuSpaceSQLite 블럭(block)은 SQLite C++ 멤버의 그래픽적인 인터페이스 기능을 제공합니다. SQLite의 C++ API와 동일한 기능을 수행하거나, 확장된 형태로 제공됩니다.
sqlite overview : https://www.sqlite.org/
SQLite Logic Block
enuSpaceSQLite 블럭에서 제공되는 모듈 리스트입니다.
Plugin interface method
enuSpaceSQLite 플러그인은 함수형 호출 규약에 의하여 정의된 모듈입니다.
함수형 호출 규약을 아래와 같이 정의합니다.
extern "C" __declspec(dllexport) int GetTaskType()
{
return TASK_TYPE_FUNCTION_COMPONENT;
}
TASK_TYPE_FUNCTION_COMPONENT 정의를 수행하면 enuSpace에서는 정의된 규약에 따라서 함수 기반으로 호출을 수행합니다.
enuSpace는 두개의 파일(enuSpaceSQLite.svg+enuSpaceSQLite.dll)로 pair를 이루어 동작을 수행합니다.
svg symbol 앨리먼트에 정의된 pg-function="STATUS=SQLite_CreateTable(DBNAME,QUERY,TRIGER)"에 따라서 dllexport 함수를 호출합니다.
svg에 정의된 입력 pin객체의 이름과 출력 pin객체의 이름을 통하여 함수형 인터페이스를 수행합니다.
SQLite_CreateTable 함수 예시)
extern "C" __declspec(dllexport) void SQLite_CreateTable(wchar_t* id, FuncParam* pParam)
extern "C" __declspec(dllexport) void SQLite_CreateTable(wchar_t* id, FuncParam* pParam)
{
if (pParam)
{
CString strDBName;
CString strQuery;
bool bTrigger = false;
CString strStatus;
/////////////////////////////////////////////////////////////////
// 입력 파라미터 검사
const VariableStruct* pVarDbStruct = pParam->GetParam("DBNAME");
if (pVarDbStruct)
{
if (pVarDbStruct->type == DEF_STRING)
{
strDBName = *(CString*)pVarDbStruct->pValue;
}
}
const VariableStruct* pVarQryStruct = pParam->GetParam("QUERY");
if (pVarQryStruct)
{
if (pVarQryStruct->type == DEF_STRING)
{
strQuery = *(CString*)pVarQryStruct->pValue;
}
}
const VariableStruct* pVarTrigerStruct = pParam->GetParam("TRIGER");
if (pVarTrigerStruct)
{
if (pVarTrigerStruct->type == DEF_BOOL)
{
bTrigger = *(bool*)pVarTrigerStruct->pValue;
}
}
/////////////////////////////////////////////////////////////////
if (bTrigger && strQuery.IsEmpty()==false && strDBName.IsEmpty() == false)
{
std::string strResult;
strResult = Call_CreateTable(CStringToString(strDBName), CStringToString(strQuery));
/////////////////////////////////////////////////////////////////
// 출력 파라미터 값 쓰기
const VariableStruct* pVarDbStruct = pParam->GetOutput("STATUS");
if (pVarDbStruct)
{
if (pVarDbStruct->type == DEF_STRING)
{
*(CString*)pVarDbStruct->pValue = StringToCString(strResult);
*(bool*)pVarTrigerStruct->pValue = false;
}
}
}
}
}
enuSpaceSQLite.svg 샘플 예시)
<?xml version="1.0" encoding="UTF-16"?>
<svg
id="ID_1dY52K"
stroke="rgb(0,119,189)"
stroke-opacity="1.00"
stroke-width="1.00"
transform="translate(0.00,0.00) rotate(0.00) scale(1.0000, 1.0000)"
pg-xcenter="0.00"
pg-ycenter="0.00"
style="stroke:rgb(127,127,127);stroke-opacity:1.00;stroke-width:2.00;stroke-dasharray:1,1,1;"
enuspace-version="3.0.1.9"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="1920"
height="1080"
>
<defs
id="ID_1dY52K1"
>
<symbol
id="SQLite_CreateTable"
type="node"
stroke="rgb(0,119,189)"
stroke-opacity="1.00"
stroke-width="1.00"
transform="translate(0.00,0.00) rotate(0.00) scale(1.0000, 1.0000)"
pg-xcenter="0.00"
pg-ycenter="0.00"
pg-function="STATUS=SQLite_CreateTable(DBNAME,QUERY,TRIGER)"
>
<rect
id="ID_1dY5Dw6"
stroke="rgb(0,174,238)"
stroke-opacity="1.00"
stroke-width="3.00"
transform="translate(-0.76,1.05) rotate(0.00) scale(1.0000, 1.0000)"
pg-xcenter="0.00"
pg-ycenter="0.00"
stroke-linecap="butt"
stroke-linejoin="miter"
x="2.39"
y="0.00"
width="100.00"
height="90.00"
rx="10.00"
ry="10.00"
fill="rgb(0,111,189)"
fill-opacity="1.00"
>
</rect>
<text
id="ID_1dY5Dw7"
stroke="rgb(255,191,40)"
stroke-opacity="1.00"
stroke-width="1.00"
transform="translate(16.50,21.27) rotate(0.00) scale(1.0000, 1.0000)"
pg-xcenter="0.00"
pg-ycenter="0.00"
stroke-linecap="butt"
stroke-linejoin="miter"
x="0.00"
y="0.00"
dx="0.00"
dy="0.00"
font-family="Arial"
font-size="14.0"
font-weight="bold"
font-style="normal"
text-anchor="start"
baseline-shift="0"
baseline-height="-16.098633"
fill="rgb(0,0,0)"
fill-opacity="1.00"
pg-format=""
pg-line-count="2"
pg-oneline-height="16.098633"
text-decoration="none"
>
SQLite
CreateTable
</text>
<pg-pin
id="ID_1dY54m"
name="DBNAME"
desc=""
pin-type="input"
color="rgb(255,255,255)"
var-type="string"
unit=""
default-value=""
>
<circle
id="_1"
stroke="rgb(200,0,0)"
stroke-opacity="1.00"
stroke-width="1.00"
transform="translate(8.92,48.03) rotate(0.00) scale(1.0000, 1.0000)"
pg-xcenter="0.00"
pg-ycenter="0.00"
stroke-dasharray="1,1,1"
cx="0.00"
cy="0.00"
rx="0.00"
ry="0.00"
r="5.00"
fill="rgb(255,191,40)"
fill-opacity="1.00"
>
</circle>
</pg-pin>
<pg-pin
id="ID_1dY54m"
name="QUERY"
desc=""
pin-type="input"
color="rgb(255,255,255)"
var-type="string"
unit=""
default-value="CREATE TABLE TABLE_NAME (COLUMN1 char not null, COLUMN2 char, COLUMN3 char, COLUMN4 char);"
>
<circle
id="ID_1dY54f"
stroke="rgb(200,0,0)"
stroke-opacity="1.00"
stroke-width="1.00"
transform="translate(8.22,12.91) rotate(0.00) scale(1.0000, 1.0000)"
pg-xcenter="0.00"
pg-ycenter="0.00"
stroke-dasharray="1,1,1"
cx="0.00"
cy="0.00"
rx="0.00"
ry="0.00"
r="5.00"
fill="rgb(255,191,40)"
fill-opacity="1.00"
>
</circle>
</pg-pin>
<pg-pin
id="ID_1dY54m"
name="STATUS"
desc=""
pin-type="input"
color="rgb(255,255,255)"
var-type="string"
unit=""
default-value=""
>
<circle
id="_8_2"
stroke="rgb(200,0,0)"
stroke-opacity="1.00"
stroke-width="1.00"
transform="translate(95.47,48.69) rotate(0.00) scale(1.0000, 1.0000)"
pg-xcenter="0.00"
pg-ycenter="0.00"
stroke-dasharray="1,1,1"
cx="0.00"
cy="0.00"
rx="0.00"
ry="0.00"
r="5.00"
fill="rgb(0,175,84)"
fill-opacity="1.00"
>
</circle>
</pg-pin>
<pg-pin
id="ID_1dY54m"
name="TRIGER"
desc=""
pin-type="input"
color="rgb(255,255,255)"
var-type="bool"
unit=""
default-value="false"
>
<circle
id="_1_7"
stroke="rgb(200,0,0)"
stroke-opacity="1.00"
stroke-width="1.00"
transform="translate(8.99,75.63) rotate(0.00) scale(1.0000, 1.0000)"
pg-xcenter="0.00"
pg-ycenter="0.00"
stroke-dasharray="1,1,1"
cx="0.00"
cy="0.00"
rx="0.00"
ry="0.00"
r="5.00"
fill="rgb(255,191,40)"
fill-opacity="1.00"
>
</circle>
</pg-pin>
</symbol>
</defs>
</svg>