📄 dbinterface.c
字号:
# line 44 "dbInterface.cpp"
CS_UNUSED, NULL);
# line 44 "dbInterface.cpp"
}
# line 44 "dbInterface.cpp"
# line 44 "dbInterface.cpp"
_sql->retcode = _sqlepilog(_sql);
# line 44 "dbInterface.cpp"
}
# line 44 "dbInterface.cpp"
# line 44 "dbInterface.cpp"
}
# line 44 "dbInterface.cpp"
# line 44 "dbInterface.cpp"
}
# line 44 "dbInterface.cpp"
# line 44 "dbInterface.cpp"
}
# line 44 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 44 "dbInterface.cpp"
if(sqlca.sqlcode < 0)
return sqlca.sqlcode;
else return id;
}
int disconnectDb(int id)
{
if(0 == id)
{
/*
** SQL STATEMENT: 4
** exec sql disconnect all;
*/
# line 54 "dbInterface.cpp"
# line 54 "dbInterface.cpp"
{
# line 54 "dbInterface.cpp"
_SQL_CT_HANDLES * _sql;
# line 54 "dbInterface.cpp"
_sqlinitctx(&_sql, CS_VERSION_150, CS_TRUE, &sqlca, (long
# line 54 "dbInterface.cpp"
*)NULL, (CS_CHAR *)NULL);
# line 54 "dbInterface.cpp"
if (_sql != (_SQL_CT_HANDLES *) NULL)
# line 54 "dbInterface.cpp"
{
# line 54 "dbInterface.cpp"
_sql->stmtData.persistent = CS_FALSE;
# line 54 "dbInterface.cpp"
_sql->stmttype = SQL_DISCONNECT_ALL;
# line 54 "dbInterface.cpp"
_sql->connName.lnlen = CS_UNUSED;
# line 54 "dbInterface.cpp"
if ((_sql->retcode = _sqlprolog(_sql)) == CS_SUCCEED)
# line 54 "dbInterface.cpp"
{
# line 54 "dbInterface.cpp"
_sql->retcode = _sqlepilog(_sql);
# line 54 "dbInterface.cpp"
}
# line 54 "dbInterface.cpp"
# line 54 "dbInterface.cpp"
}
# line 54 "dbInterface.cpp"
# line 54 "dbInterface.cpp"
}
# line 54 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 54 "dbInterface.cpp"
}
else
{
/*
** SQL STATEMENT: 4
** exec sql begin declare section;
*/
# line 58 "dbInterface.cpp"
char cntname[32];
/*
** SQL STATEMENT: 5
** exec sql end declare section;
*/
# line 60 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 60 "dbInterface.cpp"
sprintf(cntname, "joyit@zyj%d", id);
/*
** SQL STATEMENT: 6
** exec sql disconnect :cntname;
*/
# line 63 "dbInterface.cpp"
# line 63 "dbInterface.cpp"
{
# line 63 "dbInterface.cpp"
_SQL_CT_HANDLES * _sql;
# line 63 "dbInterface.cpp"
_sqlinitctx(&_sql, CS_VERSION_150, CS_TRUE, &sqlca, (long
# line 63 "dbInterface.cpp"
*)NULL, (CS_CHAR *)NULL);
# line 63 "dbInterface.cpp"
if (_sql != (_SQL_CT_HANDLES *) NULL)
# line 63 "dbInterface.cpp"
{
# line 63 "dbInterface.cpp"
_sql->stmtData.persistent = CS_FALSE;
# line 63 "dbInterface.cpp"
_sql->stmttype = SQL_DISCONNECT;
# line 63 "dbInterface.cpp"
_sql->connName.lnlen = CS_NULLTERM;
# line 63 "dbInterface.cpp"
strcpy(_sql->connName.last_name, cntname);
# line 63 "dbInterface.cpp"
if ((_sql->retcode = _sqlprolog(_sql)) == CS_SUCCEED)
# line 63 "dbInterface.cpp"
{
# line 63 "dbInterface.cpp"
_sql->retcode = _sqlepilog(_sql);
# line 63 "dbInterface.cpp"
}
# line 63 "dbInterface.cpp"
# line 63 "dbInterface.cpp"
}
# line 63 "dbInterface.cpp"
# line 63 "dbInterface.cpp"
}
# line 63 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 63 "dbInterface.cpp"
}
return sqlca.sqlcode;
}
char* getLastError()
{
static char error[512];
memset(error, 0, 512);
snprintf(error, 512, sqlca.sqlerrm.sqlerrmc);
return error;
}
int WriteRealtimeStatus(RealTimeStatus * pTimeStatus)
{
/*
** SQL STATEMENT: 6
** exec sql begin declare section;
*/
# line 77 "dbInterface.cpp"
struct _RealTimeStatus
{
CS_CHAR UpdateTime[32];
CS_CHAR NEname[64];
CS_INT NEid;
CS_INT NEavailability;
CS_FLOAT NEcpu;
CS_FLOAT NEram;
CS_FLOAT NEhd;
}TimeStatus;
/*
** SQL STATEMENT: 7
** exec sql end declare section;
*/
# line 88 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 88 "dbInterface.cpp"
memcpy(&TimeStatus,pTimeStatus,sizeof(TimeStatus));
TimeStatus.NEcpu=pTimeStatus->NEcpu;
TimeStatus.NEhd=pTimeStatus->NEhd;
TimeStatus.NEram=pTimeStatus->NEram;
/*
** SQL STATEMENT: 8
** exec sql insert into SapDB.dbo.TBL_RealtimeStatus(UpdateTime,NEname
** ,NEid,NEavailability,NEcpu,NEram,NEhd) values(:TimeStatus.UpdateT
** ime,:TimeStatus.NEname,:TimeStatus.NEid,:TimeStatus.NEavailabilit
** y,:TimeStatus.NEcpu,:TimeStatus.NEram,:TimeStatus.NEhd);
*/
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_SQL_CT_HANDLES * _sql;
# line 94 "dbInterface.cpp"
_sqlinitctx(&_sql, CS_VERSION_150, CS_TRUE, &sqlca, (long
# line 94 "dbInterface.cpp"
*)NULL, (CS_CHAR *)NULL);
# line 94 "dbInterface.cpp"
if (_sql != (_SQL_CT_HANDLES *) NULL)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->stmtIdlen = CS_UNUSED;
# line 94 "dbInterface.cpp"
_sql->stmtData.persistent = CS_FALSE;
# line 94 "dbInterface.cpp"
_sql->stmttype = SQL_INSERT_STMT;
# line 94 "dbInterface.cpp"
_sql->connName.lnlen = CS_UNUSED;
# line 94 "dbInterface.cpp"
if ((_sql->retcode = _sqlprolog(_sql)) == CS_SUCCEED)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->retcode = ct_command(_sql->conn.command,
# line 94 "dbInterface.cpp"
CS_LANG_CMD, "insert into SapDB.dbo.TBL_RealtimeStat"
"us(UpdateTime,NEname,NEid,NEavailability,NEcpu,NEram,NEhd) values(@sql0_Update"
"Time ,@sql1_NEname ,@sql2_NEid ,@sql3_NEavailability ,@sql4_NEcpu ,@sql5_NEram"
" ,@sql6_NEhd )", 208, CS_UNUSED);
# line 94 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.count = 0;
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.maxlength =
# line 94 "dbInterface.cpp"
_sql_MIN(16384,32);
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.format = CS_FMT_NULLTERM;
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.status = CS_INPUTVALUE;
# line 94 "dbInterface.cpp"
_sql->retcode = ct_param(_sql->conn.command,
# line 94 "dbInterface.cpp"
&_sql->dfmtNULLCHAR,
# line 94 "dbInterface.cpp"
SQLNULLSTR(TimeStatus.UpdateTime), (CS_INT)
# line 94 "dbInterface.cpp"
CS_NULLTERM, (CS_SMALLINT) 0);
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.status = 0;
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.count = 0;
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.maxlength =
# line 94 "dbInterface.cpp"
_sql_MIN(16384,64);
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.format = CS_FMT_NULLTERM;
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.status = CS_INPUTVALUE;
# line 94 "dbInterface.cpp"
_sql->retcode = ct_param(_sql->conn.command,
# line 94 "dbInterface.cpp"
&_sql->dfmtNULLCHAR,
# line 94 "dbInterface.cpp"
SQLNULLSTR(TimeStatus.NEname), (CS_INT) CS_NULLTERM,
# line 94 "dbInterface.cpp"
(CS_SMALLINT) 0);
# line 94 "dbInterface.cpp"
_sql->dfmtNULLCHAR.status = 0;
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->dfmtCS_INT_TYPE.count = 0;
# line 94 "dbInterface.cpp"
_sql->dfmtCS_INT_TYPE.status = CS_INPUTVALUE;
# line 94 "dbInterface.cpp"
_sql->retcode = ct_param(_sql->conn.command,
# line 94 "dbInterface.cpp"
&_sql->dfmtCS_INT_TYPE, &TimeStatus.NEid,
# line 94 "dbInterface.cpp"
(CS_INT) CS_UNUSED, (CS_SMALLINT) 0);
# line 94 "dbInterface.cpp"
_sql->dfmtCS_INT_TYPE.status = 0;
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->dfmtCS_INT_TYPE.count = 0;
# line 94 "dbInterface.cpp"
_sql->dfmtCS_INT_TYPE.status = CS_INPUTVALUE;
# line 94 "dbInterface.cpp"
_sql->retcode = ct_param(_sql->conn.command,
# line 94 "dbInterface.cpp"
&_sql->dfmtCS_INT_TYPE,
# line 94 "dbInterface.cpp"
&TimeStatus.NEavailability, (CS_INT) CS_UNUSED,
# line 94 "dbInterface.cpp"
(CS_SMALLINT) 0);
# line 94 "dbInterface.cpp"
_sql->dfmtCS_INT_TYPE.status = 0;
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.count = 0;
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.status = CS_INPUTVALUE;
# line 94 "dbInterface.cpp"
_sql->retcode = ct_param(_sql->conn.command,
# line 94 "dbInterface.cpp"
&_sql->dfmtCS_FLOAT_TYPE, &TimeStatus.NEcpu,
# line 94 "dbInterface.cpp"
(CS_INT) CS_UNUSED, (CS_SMALLINT) 0);
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.status = 0;
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.count = 0;
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.status = CS_INPUTVALUE;
# line 94 "dbInterface.cpp"
_sql->retcode = ct_param(_sql->conn.command,
# line 94 "dbInterface.cpp"
&_sql->dfmtCS_FLOAT_TYPE, &TimeStatus.NEram,
# line 94 "dbInterface.cpp"
(CS_INT) CS_UNUSED, (CS_SMALLINT) 0);
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.status = 0;
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 94 "dbInterface.cpp"
{
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.count = 0;
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.status = CS_INPUTVALUE;
# line 94 "dbInterface.cpp"
_sql->retcode = ct_param(_sql->conn.command,
# line 94 "dbInterface.cpp"
&_sql->dfmtCS_FLOAT_TYPE, &TimeStatus.NEhd,
# line 94 "dbInterface.cpp"
(CS_INT) CS_UNUSED, (CS_SMALLINT) 0);
# line 94 "dbInterface.cpp"
_sql->dfmtCS_FLOAT_TYPE.status = 0;
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
_sql->retcode = ct_send(_sql->conn.command);
# line 94 "dbInterface.cpp"
_sql->hastate = (_sql->retcode == CS_RET_HAFAILOVER);
# line 94 "dbInterface.cpp"
_sql->retcode = _sqlResults(_sql);
# line 94 "dbInterface.cpp"
_sql->retcode = _sqlepilog(_sql);
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
}
# line 94 "dbInterface.cpp"
# line 94 "dbInterface.cpp"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -