cdbexpstoreproc.cpp
来自「本人买的<<VC++项目开发实例>>源代码配套光盘.」· C++ 代码 · 共 187 行
CPP
187 行
// Copyright (C) 1991 - 1999 Rational Software Corporation
#include "stdafx.h"
#include "CDBExpStoreProc.h"
#include "resource.h"
#include "..\OBSCRIPT\FetchScript.h"
#include "CDBExpDatabase.h"
#include "DLLFuncs.h"
#include "..\DLLs\StoreProcFunc\spparamdef.h"
//##ModelId=3C5B9B9F0397
CDBExpStoreProc::CDBExpStoreProc(const CString& strName)
{
m_strStoreProcName = strName;
}
//##ModelId=3C5B9B9F03AB
CDBExpStoreProc::~CDBExpStoreProc()
{
}
//##ModelId=3C5B9B9F03AC
BOOL CDBExpStoreProc::ExpandItem(HTREEITEM hItem, UINT state)
{
return TRUE;
}
//##ModelId=3C5B9B9F03C9
const char * CDBExpStoreProc::GetTreeNodeCaption()
{
return (const char *)m_strStoreProcName;
}
//##ModelId=3C5CCD0301FB
BOOL CDBExpStoreProc::OpenRelatedView(LPARAM lParam)
{
// ToDo: Add your specialized code here
// AfxMessageBox("Not");
return static_cast<BOOL>(0);
}
//##ModelId=3C62871800DF
void CDBExpStoreProc::BuildTVITEM(HTREEITEM hParentItem)
{
// ToDo: Add your specialized code here or after the call to base class
CDBTreeNode::BuildTVITEM(hParentItem);
this->m_tvInsertStruct.item.cChildren = 0;
this->m_tvInsertStruct.item.iImage =
this->m_tvInsertStruct.item.iSelectedImage = 6;
}
//##ModelId=3C6287BA02D7
BOOL CDBExpStoreProc::PopupContextMenu(DBTREE_NODE_CONTEXT& context)
{
// ToDo: Add your specialized code here or after the call to base class
return CDBTreeNode::PopupContextMenu(context);
}
//##ModelId=3C6287BA013C
void CDBExpStoreProc::OnMenuItemClick(UINT nCmd)
{
// ToDo: Add your specialized code here or after the call to base class
CDBExpDatabase *pDatabase = this->GetDatabase();
PARAM_STORED_PROCEDURE paramSP;
memset(¶mSP, 0, sizeof(paramSP));
strcpy(paramSP.szStoredProcedureName, (const char *)this->GetTreeNodeCaption());
strcpy(paramSP.szConnectionString, (const char *)this->GetDatabase()->m_strCnn);
LPARAM lParam = (LPARAM)¶mSP;
HWND hWnd = AfxGetMainWnd()->m_hWnd;
CString strSQL = "";
CFetchScript fs(pDatabase->m_ptrConnection);
fs.SetServerType(pDatabase->GetDatabaseType());
switch(nCmd)
{
case ID_MENU_EXP_SCRIPT:
fs.SetObjectName(this->m_strStoreProcName);
strSQL = fs.GetScript();
strcpy(paramSP.szSQLInString, (const char *)strSQL);
this->SP_GenerateScript(lParam);
break;
case ID_MENU_PROP:
this->SP_Property(lParam);
break;
case ID_MENU_SP_DEF:
fs.SetObjectName(this->m_strStoreProcName);
strSQL = fs.GetScript();
strcpy(paramSP.szSQLInString, (const char *)strSQL);
this->SP_Definition(lParam);
break;
case ID_MENU_SP_OPEN:
this->SP_Execute(lParam);
break;
default:
CDBTreeNode::OnMenuItemClick(nCmd);
break;
}
if(ID_MENU_EXP_SCRIPT == nCmd)
{
CFetchScript fs(pDatabase->m_ptrConnection);
fs.SetObjectName(this->m_strStoreProcName);
fs.SetServerType(pDatabase->GetDatabaseType());
CString strSQL = fs.GetScript();
/*szSQLInString*/
}
//CDBTreeNode::OnMenuItemClick(nCmd);
}
//##ModelId=3CA0A1F3034B
void CDBExpStoreProc::BuildContextMenu(DBTREE_NODE_CONTEXT &context)
{
// TODO: Add your specialized code here.
//加载存储过程树的弹出式菜单!!
/*CMenu object can automatically detach the hMenu before attaching
to a new menu resource !!
Victor Lee , Mar 14, 2002
*/
m_pContextMenu->LoadMenu(IDR_MENU_SP);
}
//##ModelId=3CD94FFB0294
int CDBExpStoreProc::SP_Execute(LPARAM lParam)
{
int ret = CDLLFuncs::SP_Execute(AfxGetMainWnd()->m_hWnd, lParam);
if(FALSE == ret )
return FALSE;
return 1;
}
//##ModelId=3CD94FFB0276
int CDBExpStoreProc::SP_Definition(LPARAM lParam)
{
int ret = CDLLFuncs::SP_Definition(AfxGetMainWnd()->m_hWnd, lParam);
if(FALSE == ret )
return FALSE;
return 1;
}
//##ModelId=3CD94FFB0258
int CDBExpStoreProc::SP_GenerateScript(LPARAM lParam)
{
int ret = CDLLFuncs::SP_GenerateScript(AfxGetMainWnd()->m_hWnd, lParam);
if(FALSE == ret )
return FALSE;
return 1;
}
//##ModelId=3CD94FFB023A
int CDBExpStoreProc::SP_Property(LPARAM lParam)
{
int ret = CDLLFuncs::SP_Property(AfxGetMainWnd()->m_hWnd, lParam);
if(FALSE == ret )
return FALSE;
return 1;
}
//##ModelId=3CD958C30264
void CDBExpStoreProc::BuildLVITEM(int& nIndex)
{
// ToDo: Add your specialized code here or after the call to base class
CDBTreeNode::BuildLVITEM(nIndex);
m_lvInsertStruct.iImage = 3;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?