?? ccdb.cpp
字號(hào):
DLLSynFuntInterfaceBug(pstrReqParam->nBusID,SYS_ACTION_DEL,(char*)pstrReqParam->pBuf,sizeof(int));
}
#endif
return ERR_BUS_SUCCESS;
}
else
return ERR_BUS_SQLEXE;
}
break;
case BUSINESS_SCENE: // 場(chǎng)景表
{
WCHAR SqlIst[8][150];
//刪除日程:先刪除定時(shí)器
swprintf(SqlIst[0],L"delete from timertable where timerid in(select StartTimerID from scheduletable where objectId=%d and type=%d)",
*((int *)pstrReqParam->pBuf),SCHEDULE_DEV_SCENE);
swprintf(SqlIst[1],L"delete from scheduletable where ObjectId =%d and type=%d ",
*((int *)pstrReqParam->pBuf),SCHEDULE_DEV_SCENE);
swprintf(SqlIst[2],L"delete from SceneDevtable where SceneId =%d ",
*((int *)pstrReqParam->pBuf));
swprintf(SqlIst[3],L"Delete from SceneTable where SceneID=%d",
*((int *)pstrReqParam->pBuf));
if(!g_DataBase.OpenData())
{
return ERR_PROG_NOTOPEN;
}
NodeSql *pFirst,*pNode=NULL,*pNext=NULL;
for(int i=0;i<4;i++)
{
pNext=new NodeSql;
memset(pNext,0,sizeof(NodeSql));
pNext->pSql = SqlIst[i];
if(pNode==NULL)
{
pNode=pNext;
pFirst=pNext;
}else
{
pNode->pNext=pNext;
pNode=pNext;
}
}
BOOL bDel=g_DataBase.ExecuteSql(pFirst);
//刪除
while(pFirst)
{
pNode=pFirst;
pFirst=pFirst->pNext;
delete pNode;
}
g_DataBase.CloseData();
if(bDel)
{
//發(fā)送同步消息
/* num=sizeof(BusToCmdList)/sizeof(BusToCmdList[0]);
for(int i=0;i<num;i++)
{
if(BusToCmdList[i].nBus== pstrReqParam->nBusID)
break;
}
*/
#ifndef _USEBYLHL
// if(i <num && bSyn)
if( bSyn)
{//??默認(rèn)都是第一個(gè)為主鍵ID
DLLSynFuntInterfaceBug(pstrReqParam->nBusID,SYS_ACTION_DEL,(char*)pstrReqParam->pBuf,sizeof(int));
}
#endif
return ERR_BUS_SUCCESS;
}
else
return ERR_BUS_SQLEXE;
}
break;
case BUSINESS_HOUSE:
{//刪除房間
WCHAR SqlIst[8][300];
//刪除該房間下場(chǎng)景的日程的定時(shí)器
// swprintf(SqlIst[0],L"delete from timertable where timerid in(select StartTimerID from scheduletable where type=%d and objectId \
// in(select SceneID from scenetable where houseid=%d ))",
swprintf(SqlIst[0],L"delete from timertable where timerid in(select StartTimerID from scheduletable,scenetable where scheduletable.type=%d and objectId =SceneID\
and houseid=%d )",
SCHEDULE_DEV_SCENE,*((int *)pstrReqParam->pBuf));
//刪除該房間下場(chǎng)景的日程
swprintf(SqlIst[1],L"delete from scheduletable where type=%d and ObjectId in(select sceneID from scenetable where houseid=%d )",
SCHEDULE_DEV_SCENE,*((int *)pstrReqParam->pBuf));
//刪除該房間下的場(chǎng)景設(shè)備
swprintf(SqlIst[2],L"delete from SceneDevtable where SceneId in(select sceneID from scenetable where houseid=%d ) ",
*((int *)pstrReqParam->pBuf));
//刪除該房間下的場(chǎng)景
swprintf(SqlIst[3],L"Delete from SceneTable where houseid=%d ",
*((int *)pstrReqParam->pBuf));
//刪除該房間
swprintf(SqlIst[4],L"Delete from HouseTable where houseid=%d ",
*((int *)pstrReqParam->pBuf));
if(!g_DataBase.OpenData())
{
return ERR_PROG_NOTOPEN;
}
NodeSql *pFirst,*pNode=NULL,*pNext=NULL;
for(int i=0;i<5;i++)
{
pNext=new NodeSql;
memset(pNext,0,sizeof(NodeSql));
pNext->pSql = SqlIst[i];
if(pNode==NULL)
{
pNode=pNext;
pFirst=pNext;
}else
{
pNode->pNext=pNext;
pNode=pNext;
}
}
writebuginfo("file:%s,line:%dbefor exesql\n",__FILE__,__LINE__);
BOOL bDel=g_DataBase.ExecuteSql(pFirst);
writebuginfo("file:%s,line:%dexesql=%d\n",__FILE__,__LINE__,bDel);
//刪除
while(pFirst)
{
pNode=pFirst;
pFirst=pFirst->pNext;
delete pNode;
}
g_DataBase.CloseData();
if(bDel)
{
//發(fā)送同步消息
/* num=sizeof(BusToCmdList)/sizeof(BusToCmdList[0]);
for(int i=0;i<num;i++)
{
if(BusToCmdList[i].nBus== pstrReqParam->nBusID)
break;
}
*/
#ifndef _USEBYLHL
// if(i <num && bSyn)
if( bSyn)
{//??默認(rèn)都是第一個(gè)為主鍵ID
writebuginfo("file:%s,line:%dEnter Syn\n",__FILE__,__LINE__);
DLLSynFuntInterfaceBug(pstrReqParam->nBusID,SYS_ACTION_DEL,(char*)pstrReqParam->pBuf,sizeof(int));
writebuginfo("file:%s,line:%dexit Syn\n",__FILE__,__LINE__);
}
#endif
return ERR_BUS_SUCCESS;
}
else
return ERR_BUS_SQLEXE;
}break;
case BUSINESS_SCHEDULE: // 日程表
{
WCHAR SqlIst[3][150];
//刪除日程:先刪除定時(shí)器
swprintf(SqlIst[0],L"delete from timertable where timerid in(select StartTimerID from scheduletable where Id=%d)",
*((int *)pstrReqParam->pBuf));
swprintf(SqlIst[1],L"delete from timertable where timerid in(select EndTimerID from scheduletable where Id=%d)",
*((int *)pstrReqParam->pBuf));
swprintf(SqlIst[2],L"delete from scheduletable where Id =%d ",
*((int *)pstrReqParam->pBuf));
if(!g_DataBase.OpenData())
{
return ERR_PROG_NOTOPEN;
}
NodeSql *pFirst,*pNode=NULL,*pNext=NULL;
for(int i=0;i<3;i++)
{
pNext=new NodeSql;
memset(pNext,0,sizeof(NodeSql));
pNext->pSql = SqlIst[i];
if(pNode==NULL)
{
pNode=pNext;
pFirst=pNext;
}else
{
pNode->pNext=pNext;
pNode=pNext;
}
}
BOOL bDel=g_DataBase.ExecuteSql(pFirst);
//刪除
while(pFirst)
{
pNode=pFirst;
pFirst=pFirst->pNext;
delete pNode;
}
g_DataBase.CloseData();
if(bDel)
{
//發(fā)送同步消息
/* num=sizeof(BusToCmdList)/sizeof(BusToCmdList[0]);
for(int i=0;i<num;i++)
{
if(BusToCmdList[i].nBus== pstrReqParam->nBusID)
break;
}
*/
#ifndef _USEBYLHL
// if(i <num && bSyn)
if(bSyn)
{//??默認(rèn)都是第一個(gè)為主鍵ID
DLLSynFuntInterfaceBug(pstrReqParam->nBusID,SYS_ACTION_DEL,(char*)pstrReqParam->pBuf,sizeof(int));
}
#endif
return ERR_BUS_SUCCESS;
}
else
return ERR_BUS_SQLEXE;
}
break;
case BUSINESS_CLOCK: // 鬧鐘表
{
WCHAR SqlIst[2][150];
//先刪除定時(shí)器
swprintf(SqlIst[0],L"Delete from timertable where BusType=%d and busId=%d ",TIMER_BUSTYPE_CLOCK,
*((int *)pstrReqParam->pBuf));
swprintf(SqlIst[1],L"delete from clocktable where clockId =%d ",
*((int *)pstrReqParam->pBuf));
if(!g_DataBase.OpenData())
{
return ERR_PROG_NOTOPEN;
}
NodeSql *pFirst,*pNode=NULL,*pNext=NULL;
for(int i=0;i<2;i++)
{
pNext=new NodeSql;
memset(pNext,0,sizeof(NodeSql));
pNext->pSql = SqlIst[i];
if(pNode==NULL)
{
pNode=pNext;
pFirst=pNext;
}else
{
pNode->pNext=pNext;
pNode=pNext;
}
}
BOOL bDel=g_DataBase.ExecuteSql(pFirst);
//刪除
while(pFirst)
{
pNode=pFirst;
pFirst=pFirst->pNext;
delete pNode;
}
g_DataBase.CloseData();
if(bDel)
{
//發(fā)送同步消息
/* num=sizeof(BusToCmdList)/sizeof(BusToCmdList[0]);
for(int i=0;i<num;i++)
{
if(BusToCmdList[i].nBus== pstrReqParam->nBusID)
break;
}
*/
#ifndef _USEBYLHL
// if(i <num && bSyn)
if(bSyn)
{//??默認(rèn)都是第一個(gè)為主鍵ID
DLLSynFuntInterfaceBug(pstrReqParam->nBusID,SYS_ACTION_DEL,(char*)pstrReqParam->pBuf,sizeof(int));
}
#endif
return ERR_BUS_SUCCESS;
}
else
return ERR_BUS_SQLEXE;
}break;
case BUSINESS_TICKLER: // 備忘錄表
{
WCHAR SqlIst[2][150];
//先刪除定時(shí)器
swprintf(SqlIst[0],L"Delete from Timertable where TimerID in (select TimerID from TicklerTable where Idx=%d )",
*((int *)pstrReqParam->pBuf));
swprintf(SqlIst[1],L"delete from Ticklertable where Idx =%d ",
*((int *)pstrReqParam->pBuf));
if(!g_DataBase.OpenData())
{
return ERR_PROG_NOTOPEN;
}
NodeSql *pFirst,*pNode=NULL,*pNext=NULL;
for(int i=0;i<2;i++)
{
pNext=new NodeSql;
memset(pNext,0,sizeof(NodeSql));
pNext->pSql = SqlIst[i];
if(pNode==NULL)
{
pNode=pNext;
pFirst=pNext;
}else
{
pNode->pNext=pNext;
pNode=pNext;
}
}
BOOL bDel=g_DataBase.ExecuteSql(pFirst);
//刪除
while(pFirst)
{
pNode=pFirst;
pFirst=pFirst->pNext;
delete pNode;
}
g_DataBase.CloseData();
if(bDel)
{
//發(fā)送同步消息
/* num=sizeof(BusToCmdList)/sizeof(BusToCmdList[0]);
for(int i=0;i<num;i++)
{
if(BusToCmdList[i].nBus== pstrReqParam->nBusID)
break;
}
*/
#ifndef _USEBYLHL
// if(i <num && bSyn)
if(bSyn)
{//??默認(rèn)都是第一個(gè)為主鍵ID
DLLSynFuntInterfaceBug(pstrReqParam->nBusID,SYS_ACTION_DEL,(char*)pstrReqParam->pBuf,sizeof(int));
}
#endif
return ERR_BUS_SUCCESS;
}
else
return ERR_BUS_SQLEXE;
}break;
case BUSINESS_CARD: // 卡號(hào)(用戶(hù)
{
WCHAR SqlIst[2][150];
//如果是臨時(shí)卡,刪除時(shí)間
swprintf(SqlIst[0],L"Delete from CardTimer where CardId=%d",
*((int *)pstrReqParam->pBuf));
swprintf(SqlIst[1],L"delete from Cardtable where CardId =%d ",
*((int *)pstrReqParam->pBuf));
if(!g_DataBase.OpenData())
{
return ERR_PROG_NOTOPEN;
}
NodeSql *pFirst,*pNode=NULL,*pNext=NULL;
for(int i=0;i<2;i++)
{
pNext=new NodeSql;
memset(pNext,0,sizeof(NodeSql));
pNext->pSql = SqlIst[i];
if(pNode==NULL)
{
pNode=pNext;
pFirst=pNext;
}else
{
pNode->pNext=pNext;
pNode=pNext;
}
}
BOOL bDel=g_DataBase.ExecuteSql(pFirst);
//刪除
while(pFirst)
{
pNode=pFirst;
pFirst=pFirst->pNext;
delete pNode;
}
g_DataBase.CloseData();
if(bDel)
{
//發(fā)送同步消息
/* num=sizeof(BusToCmdList)/sizeof(BusToCmdList[0]);
for(int i=0;i<num;i++)
{
if(BusToCmdList[i].nBus== pstrReqParam->nBusID)
break;
}
*/
#ifndef _USEBYLHL
// if(i <num && bSyn)
if(bSyn)
{//??默認(rèn)都是第一個(gè)為主鍵ID
DLLSynFuntInterfaceBug(pstrReqParam->nBusID,SYS_ACTION_DEL,(char*)pstrReqParam->pBuf,sizeof(int));
}
#endif
return ERR_BUS_SUCCESS;
}
else
return ERR_BUS_SQLEXE;
}break;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -