📄 dbinterface.c
字号:
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 85 "dbInterface.cpp"
{
# line 85 "dbInterface.cpp"
_sql->retcode =
# line 85 "dbInterface.cpp"
ct_options(_sql->conn.connection, CS_SET,
# line 85 "dbInterface.cpp"
CS_OPT_TRUNCIGNORE, &_sql->cstrue,
# line 85 "dbInterface.cpp"
CS_UNUSED, NULL);
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 85 "dbInterface.cpp"
{
# line 85 "dbInterface.cpp"
_sql->retcode =
# line 85 "dbInterface.cpp"
ct_options(_sql->conn.connection, CS_SET,
# line 85 "dbInterface.cpp"
CS_OPT_ARITHIGNORE, &_sql->csfalse,
# line 85 "dbInterface.cpp"
CS_UNUSED, NULL);
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 85 "dbInterface.cpp"
{
# line 85 "dbInterface.cpp"
_sql->retcode =
# line 85 "dbInterface.cpp"
ct_options(_sql->conn.connection, CS_SET,
# line 85 "dbInterface.cpp"
CS_OPT_ISOLATION, &_sql->Level3, CS_UNUSED,
# line 85 "dbInterface.cpp"
NULL);
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 85 "dbInterface.cpp"
{
# line 85 "dbInterface.cpp"
_sql->retcode =
# line 85 "dbInterface.cpp"
ct_options(_sql->conn.connection, CS_SET,
# line 85 "dbInterface.cpp"
CS_OPT_CHAINXACTS, &_sql->cstrue, CS_UNUSED,
# line 85 "dbInterface.cpp"
NULL);
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 85 "dbInterface.cpp"
{
# line 85 "dbInterface.cpp"
_sql->retcode =
# line 85 "dbInterface.cpp"
ct_options(_sql->conn.connection, CS_SET,
# line 85 "dbInterface.cpp"
CS_OPT_CURCLOSEONXACT, &_sql->cstrue,
# line 85 "dbInterface.cpp"
CS_UNUSED, NULL);
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
if (_sql->retcode == CS_SUCCEED)
# line 85 "dbInterface.cpp"
{
# line 85 "dbInterface.cpp"
_sql->retcode =
# line 85 "dbInterface.cpp"
ct_options(_sql->conn.connection, CS_SET,
# line 85 "dbInterface.cpp"
CS_OPT_QUOTED_IDENT, &_sql->cstrue,
# line 85 "dbInterface.cpp"
CS_UNUSED, NULL);
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
_sql->retcode = _sqlepilog(_sql);
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
# line 85 "dbInterface.cpp"
}
# line 85 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 85 "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 95 "dbInterface.cpp"
# line 95 "dbInterface.cpp"
{
# line 95 "dbInterface.cpp"
_SQL_CT_HANDLES * _sql;
# line 95 "dbInterface.cpp"
_sqlinitctx(&_sql, CS_VERSION_150, CS_TRUE, &sqlca, (long
# line 95 "dbInterface.cpp"
*)NULL, (CS_CHAR *)NULL);
# line 95 "dbInterface.cpp"
if (_sql != (_SQL_CT_HANDLES *) NULL)
# line 95 "dbInterface.cpp"
{
# line 95 "dbInterface.cpp"
_sql->stmtData.persistent = CS_FALSE;
# line 95 "dbInterface.cpp"
_sql->stmttype = SQL_DISCONNECT_ALL;
# line 95 "dbInterface.cpp"
_sql->connName.lnlen = CS_UNUSED;
# line 95 "dbInterface.cpp"
if ((_sql->retcode = _sqlprolog(_sql)) == CS_SUCCEED)
# line 95 "dbInterface.cpp"
{
# line 95 "dbInterface.cpp"
_sql->retcode = _sqlepilog(_sql);
# line 95 "dbInterface.cpp"
}
# line 95 "dbInterface.cpp"
# line 95 "dbInterface.cpp"
}
# line 95 "dbInterface.cpp"
# line 95 "dbInterface.cpp"
}
# line 95 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 95 "dbInterface.cpp"
}
else
{
/*
** SQL STATEMENT: 4
** exec sql begin declare section;
*/
# line 99 "dbInterface.cpp"
char cntname[32];
/*
** SQL STATEMENT: 5
** exec sql end declare section;
*/
# line 101 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 101 "dbInterface.cpp"
sprintf(cntname, "joyit%d", id);
/*
** SQL STATEMENT: 6
** exec sql disconnect :cntname;
*/
# line 104 "dbInterface.cpp"
# line 104 "dbInterface.cpp"
{
# line 104 "dbInterface.cpp"
_SQL_CT_HANDLES * _sql;
# line 104 "dbInterface.cpp"
_sqlinitctx(&_sql, CS_VERSION_150, CS_TRUE, &sqlca, (long
# line 104 "dbInterface.cpp"
*)NULL, (CS_CHAR *)NULL);
# line 104 "dbInterface.cpp"
if (_sql != (_SQL_CT_HANDLES *) NULL)
# line 104 "dbInterface.cpp"
{
# line 104 "dbInterface.cpp"
_sql->stmtData.persistent = CS_FALSE;
# line 104 "dbInterface.cpp"
_sql->stmttype = SQL_DISCONNECT;
# line 104 "dbInterface.cpp"
_sql->connName.lnlen = CS_NULLTERM;
# line 104 "dbInterface.cpp"
strcpy(_sql->connName.last_name, cntname);
# line 104 "dbInterface.cpp"
if ((_sql->retcode = _sqlprolog(_sql)) == CS_SUCCEED)
# line 104 "dbInterface.cpp"
{
# line 104 "dbInterface.cpp"
_sql->retcode = _sqlepilog(_sql);
# line 104 "dbInterface.cpp"
}
# line 104 "dbInterface.cpp"
# line 104 "dbInterface.cpp"
}
# line 104 "dbInterface.cpp"
# line 104 "dbInterface.cpp"
}
# line 104 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 104 "dbInterface.cpp"
}
return sqlca.sqlcode;
}
char* getLastError()
{
static char error[512];
memset(error, 0, 512);
snprintf(error, 512, sqlca.sqlerrm.sqlerrmc);
return error;
}
/*exec sql declare AlarmsTable1 cursor for select (convert(char(10),Time,102))+' '+(convert(char(9),Time,108)), AlarmCode,Info from SapDB.dbo.TBL_Alarms;*/
/*exec sql declare AlarmsTable1 cursor for select (convert(char(10),Time,102))+' '+(convert(char(9),Time,108)), AlarmCode,Info from SapDB.dbo.TBL_Alarms a where not exists(select 1 from SapDB.dbo.TBL_Alarms where AlarmCode =a.AlarmCode and Time>a.Time);*/
/*
** SQL STATEMENT: 7
** exec sql declare AlarmsTable1 cursor for select (convert(char(10),Time,102))+'
** '+(convert(char(9),Time,108)), AlarmCode,Info from SapLogDB.dbo.TBL_Alarms
** a where not exists(select 1 from SapLogDB.dbo.TBL_Alarms where AlarmCode%16
** =a.AlarmCode%16 and Time>a.Time);
*/
# line 118 "dbInterface.cpp"
int readAlarmsTable(AlarmsTable* pNums,int isFromBegin, int id)
{
/*
** SQL STATEMENT: 7
** exec sql begin declare section;
*/
# line 122 "dbInterface.cpp"
struct _AlarmsTable
{
CS_CHAR Time[32];
CS_INT AlarmCode;
CS_CHAR Info[256];
} TAlarms;
/*
** SQL STATEMENT: 8
** exec sql end declare section;
*/
# line 129 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 129 "dbInterface.cpp"
if(0 != isFromBegin)
{
/*
** SQL STATEMENT: 9
** exec sql close AlarmsTable1;
*/
# line 132 "dbInterface.cpp"
# line 132 "dbInterface.cpp"
{
# line 132 "dbInterface.cpp"
_SQL_CT_HANDLES * _sql;
# line 132 "dbInterface.cpp"
_sqlinitctx(&_sql, CS_VERSION_150, CS_TRUE, &sqlca, (long
# line 132 "dbInterface.cpp"
*)NULL, (CS_CHAR *)NULL);
# line 132 "dbInterface.cpp"
if (_sql != (_SQL_CT_HANDLES *) NULL)
# line 132 "dbInterface.cpp"
{
# line 132 "dbInterface.cpp"
_sql->stmtData.persistent = CS_FALSE;
# line 132 "dbInterface.cpp"
_sql->stmttype = SQL_CLOSE_STMT;
# line 132 "dbInterface.cpp"
_sql->connName.lnlen = CS_UNUSED;
# line 132 "dbInterface.cpp"
_sql->curName.fnlen = 12;
# line 132 "dbInterface.cpp"
strcpy(_sql->curName.first_name, "AlarmsTable1");
# line 132 "dbInterface.cpp"
if ((_sql->retcode = _sqlprolog(_sql)) == CS_SUCCEED)
# line 132 "dbInterface.cpp"
{
# line 132 "dbInterface.cpp"
_sql->retcode = _sqlepilog(_sql);
# line 132 "dbInterface.cpp"
}
# line 132 "dbInterface.cpp"
# line 132 "dbInterface.cpp"
}
# line 132 "dbInterface.cpp"
# line 132 "dbInterface.cpp"
}
# line 132 "dbInterface.cpp"
/*
** Generated code ends here.
*/
# line 132 "dbInterface.cpp"
/*
** SQL STATEMENT: 10
** exec sql open AlarmsTable1;
*/
# line 133 "dbInterface.cpp"
# line 133 "dbInterface.cpp"
{
# line 133 "dbInterface.cpp"
_SQL_CT_HANDLES * _sql;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -