additions for compiling for Win via samba
@ -1,4 +1,5 @@
|
|||||||
Mail by sasha, should be rewritten as a HOWTO sometimes
|
Mail by sasha, should be rewritten as a HOWTO sometimes
|
||||||
|
vva added point C) for Windows-project
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
I have set up a repository with BitKeeper on work. There are still some things
|
I have set up a repository with BitKeeper on work. There are still some things
|
||||||
@ -29,6 +30,12 @@ you will need just to set up a slave repository on your machine:
|
|||||||
Now you have the entire source tree in the current directory. Let's compile it:
|
Now you have the entire source tree in the current directory. Let's compile it:
|
||||||
|
|
||||||
BUILD/compile-pentium-debug
|
BUILD/compile-pentium-debug
|
||||||
|
|
||||||
|
C) Windows project.
|
||||||
|
- Compile Linux-project (see points above)
|
||||||
|
- run VC++Files/prepare
|
||||||
|
- make repository accessible for Windows (using samba)
|
||||||
|
- open VC++Files/mysql.dsw in Microsoft Visual Stidio (5.0 or above)
|
||||||
|
|
||||||
After you edit a file, you need to check it in using bk citool or bk ci
|
After you edit a file, you need to check it in using bk citool or bk ci
|
||||||
filename. Note that ci is different than commit - you ci a file, but you commit
|
filename. Note that ci is different than commit - you ci a file, but you commit
|
||||||
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
|||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../sql" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
|
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../client" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
@ -67,7 +67,7 @@ LINK32=link.exe
|
|||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../sql" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
|
# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../client" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
@ -88,7 +88,7 @@ LINK32=link.exe
|
|||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\client\mysqlbinlog.cpp
|
SOURCE=.\mysqlbinlog.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "Header Files"
|
# Begin Group "Header Files"
|
||||||
|
65
VC++Files/mysqlmanager/CHILDFRM.CPP
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// ChildFrm.cpp : implementation of the CChildFrame class
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MySqlManager.h"
|
||||||
|
|
||||||
|
#include "ChildFrm.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChildFrame
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
|
||||||
|
//{{AFX_MSG_MAP(CChildFrame)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChildFrame construction/destruction
|
||||||
|
|
||||||
|
CChildFrame::CChildFrame()
|
||||||
|
{
|
||||||
|
// TODO: add member initialization code here
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CChildFrame::~CChildFrame()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||||
|
{
|
||||||
|
// TODO: Modify the Window class or styles here by modifying
|
||||||
|
// the CREATESTRUCT cs
|
||||||
|
|
||||||
|
return CMDIChildWnd::PreCreateWindow(cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChildFrame diagnostics
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CChildFrame::AssertValid() const
|
||||||
|
{
|
||||||
|
CMDIChildWnd::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChildFrame::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CMDIChildWnd::Dump(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChildFrame message handlers
|
52
VC++Files/mysqlmanager/CHILDFRM.H
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// ChildFrm.h : interface of the CChildFrame class
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if !defined(AFX_CHILDFRM_H__826CB2F0_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_CHILDFRM_H__826CB2F0_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
class CChildFrame : public CMDIChildWnd
|
||||||
|
{
|
||||||
|
DECLARE_DYNCREATE(CChildFrame)
|
||||||
|
public:
|
||||||
|
CChildFrame();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CChildFrame)
|
||||||
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CChildFrame();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CChildFrame)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code!
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHILDFRM_H__826CB2F0_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
137
VC++Files/mysqlmanager/MAINFRM.CPP
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
// MainFrm.cpp : implementation of the CMainFrame class
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MySqlManager.h"
|
||||||
|
#include "MainFrm.h"
|
||||||
|
|
||||||
|
CMainFrame* CMainFrame::g_pMainFrame = NULL;
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrame
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
|
||||||
|
//{{AFX_MSG_MAP(CMainFrame)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
ON_WM_CREATE()
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
static UINT indicators[] =
|
||||||
|
{
|
||||||
|
ID_SEPARATOR, // status line indicator
|
||||||
|
ID_INDICATOR_CAPS,
|
||||||
|
ID_INDICATOR_NUM,
|
||||||
|
ID_INDICATOR_SCRL,
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrame construction/destruction
|
||||||
|
|
||||||
|
CMainFrame::CMainFrame()
|
||||||
|
{
|
||||||
|
// TODO: add member initialization code here
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMainFrame::~CMainFrame()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||||
|
{
|
||||||
|
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!m_wndToolBar.Create(this) ||
|
||||||
|
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create toolbar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_wndStatusBar.Create(this) ||
|
||||||
|
!m_wndStatusBar.SetIndicators(indicators,
|
||||||
|
sizeof(indicators)/sizeof(UINT)))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create status bar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
|
||||||
|
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
|
||||||
|
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
|
||||||
|
|
||||||
|
// TODO: Delete these three lines if you don't want the toolbar to
|
||||||
|
// be dockable
|
||||||
|
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
||||||
|
EnableDocking(CBRS_ALIGN_ANY);
|
||||||
|
DockControlBar(&m_wndToolBar);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||||
|
{
|
||||||
|
// TODO: Modify the Window class or styles here by modifying
|
||||||
|
// the CREATESTRUCT cs
|
||||||
|
|
||||||
|
return CMDIFrameWnd::PreCreateWindow(cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrame diagnostics
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CMainFrame::AssertValid() const
|
||||||
|
{
|
||||||
|
CMDIFrameWnd::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CMDIFrameWnd::Dump(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrame message handlers
|
||||||
|
|
||||||
|
int CMainFrame::StatusMsg ( LPCSTR fmt, ... )
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
char buf [2048];
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
int ret = vsprintf(buf, fmt, args);
|
||||||
|
|
||||||
|
if ( this != NULL )
|
||||||
|
{
|
||||||
|
static char g_StatusMsg_Buffer_TT [ 2048 ];
|
||||||
|
memcpy ( g_StatusMsg_Buffer_TT, buf, sizeof(g_StatusMsg_Buffer_TT) );
|
||||||
|
m_wndStatusBar.SetPaneText ( 0, buf );
|
||||||
|
m_wndStatusBar.UpdateWindow ();
|
||||||
|
}
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
|
return ( ret );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
|
||||||
|
{
|
||||||
|
g_pMainFrame = this;
|
||||||
|
return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
|
||||||
|
}
|
69
VC++Files/mysqlmanager/MAINFRM.H
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// MainFrm.h : interface of the CMainFrame class
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if !defined(AFX_MAINFRM_H__826CB2EE_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_MAINFRM_H__826CB2EE_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
class CMainFrame : public CMDIFrameWnd
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC(CMainFrame)
|
||||||
|
public:
|
||||||
|
CMainFrame();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMainFrame)
|
||||||
|
public:
|
||||||
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||||
|
protected:
|
||||||
|
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CMainFrame();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int StatusMsg ( LPCSTR fmt, ... );
|
||||||
|
|
||||||
|
protected: // control bar embedded members
|
||||||
|
CStatusBar m_wndStatusBar;
|
||||||
|
CToolBar m_wndToolBar;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CMainFrame)
|
||||||
|
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code!
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
static CMainFrame* g_pMainFrame;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MainFrame ( CMainFrame::g_pMainFrame ? CMainFrame::g_pMainFrame : (CMainFrame*) AfxGetMainWnd() -> GetTopLevelFrame() )
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MAINFRM_H__826CB2EE_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
327
VC++Files/mysqlmanager/MySqlManager.mak
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
# Microsoft Developer Studio Generated NMAKE File, Based on MySqlManager.dsp
|
||||||
|
!IF "$(CFG)" == ""
|
||||||
|
CFG=MySqlManager - Win32 Debug
|
||||||
|
!MESSAGE No configuration specified. Defaulting to MySqlManager - Win32 Debug.
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(CFG)" != "MySqlManager - Win32 Release" && "$(CFG)" != "MySqlManager - Win32 Debug"
|
||||||
|
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "MySqlManager.mak" CFG="MySqlManager - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "MySqlManager - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "MySqlManager - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
!ERROR An invalid configuration is specified.
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(OS)" == "Windows_NT"
|
||||||
|
NULL=
|
||||||
|
!ELSE
|
||||||
|
NULL=nul
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "MySqlManager - Win32 Release"
|
||||||
|
|
||||||
|
OUTDIR=.\release
|
||||||
|
INTDIR=.\release
|
||||||
|
# Begin Custom Macros
|
||||||
|
OutDir=.\release
|
||||||
|
# End Custom Macros
|
||||||
|
|
||||||
|
!IF "$(RECURSE)" == "0"
|
||||||
|
|
||||||
|
ALL : "..\client_release\MySqlManager.exe" "$(OUTDIR)\MySqlManager.pch"
|
||||||
|
|
||||||
|
!ELSE
|
||||||
|
|
||||||
|
ALL : "mysqlclient - Win32 Release" "..\client_release\MySqlManager.exe" "$(OUTDIR)\MySqlManager.pch"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(RECURSE)" == "1"
|
||||||
|
CLEAN :"mysqlclient - Win32 ReleaseCLEAN"
|
||||||
|
!ELSE
|
||||||
|
CLEAN :
|
||||||
|
!ENDIF
|
||||||
|
-@erase "$(INTDIR)\ChildFrm.obj"
|
||||||
|
-@erase "$(INTDIR)\MainFrm.obj"
|
||||||
|
-@erase "$(INTDIR)\MySqlManager.obj"
|
||||||
|
-@erase "$(INTDIR)\MySqlManager.pch"
|
||||||
|
-@erase "$(INTDIR)\MySqlManager.res"
|
||||||
|
-@erase "$(INTDIR)\MySqlManagerDoc.obj"
|
||||||
|
-@erase "$(INTDIR)\MySqlManagerView.obj"
|
||||||
|
-@erase "$(INTDIR)\RegisterServer.obj"
|
||||||
|
-@erase "$(INTDIR)\StdAfx.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolSql.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolSqlQuery.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolSqlResults.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolSqlStatus.obj"
|
||||||
|
-@erase "$(INTDIR)\vc60.idb"
|
||||||
|
-@erase "..\client_release\MySqlManager.exe"
|
||||||
|
|
||||||
|
"$(OUTDIR)" :
|
||||||
|
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||||
|
|
||||||
|
CPP_PROJ=/nologo /G6 /MT /W3 /GX /O1 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||||
|
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\MySqlManager.res" /d "NDEBUG" /d "_AFXDLL"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MySqlManager.bsc"
|
||||||
|
BSC32_SBRS= \
|
||||||
|
|
||||||
|
LINK32=link.exe
|
||||||
|
LINK32_FLAGS=/nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\MySqlManager.pdb" /machine:I386 /out:"../client_release/MySqlManager.exe"
|
||||||
|
LINK32_OBJS= \
|
||||||
|
"$(INTDIR)\ChildFrm.obj" \
|
||||||
|
"$(INTDIR)\MainFrm.obj" \
|
||||||
|
"$(INTDIR)\MySqlManager.obj" \
|
||||||
|
"$(INTDIR)\MySqlManagerDoc.obj" \
|
||||||
|
"$(INTDIR)\MySqlManagerView.obj" \
|
||||||
|
"$(INTDIR)\RegisterServer.obj" \
|
||||||
|
"$(INTDIR)\StdAfx.obj" \
|
||||||
|
"$(INTDIR)\ToolSql.obj" \
|
||||||
|
"$(INTDIR)\ToolSqlQuery.obj" \
|
||||||
|
"$(INTDIR)\ToolSqlResults.obj" \
|
||||||
|
"$(INTDIR)\ToolSqlStatus.obj" \
|
||||||
|
"$(INTDIR)\MySqlManager.res" \
|
||||||
|
"..\lib_release\mysqlclient.lib"
|
||||||
|
|
||||||
|
"..\client_release\MySqlManager.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||||
|
$(LINK32) @<<
|
||||||
|
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "MySqlManager - Win32 Debug"
|
||||||
|
|
||||||
|
OUTDIR=.\debug
|
||||||
|
INTDIR=.\debug
|
||||||
|
# Begin Custom Macros
|
||||||
|
OutDir=.\debug
|
||||||
|
# End Custom Macros
|
||||||
|
|
||||||
|
!IF "$(RECURSE)" == "0"
|
||||||
|
|
||||||
|
ALL : "..\client_debug\MySqlManager.exe" "$(OUTDIR)\MySqlManager.pch"
|
||||||
|
|
||||||
|
!ELSE
|
||||||
|
|
||||||
|
ALL : "mysqlclient - Win32 Debug" "..\client_debug\MySqlManager.exe" "$(OUTDIR)\MySqlManager.pch"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(RECURSE)" == "1"
|
||||||
|
CLEAN :"mysqlclient - Win32 DebugCLEAN"
|
||||||
|
!ELSE
|
||||||
|
CLEAN :
|
||||||
|
!ENDIF
|
||||||
|
-@erase "$(INTDIR)\ChildFrm.obj"
|
||||||
|
-@erase "$(INTDIR)\MainFrm.obj"
|
||||||
|
-@erase "$(INTDIR)\MySqlManager.obj"
|
||||||
|
-@erase "$(INTDIR)\MySqlManager.pch"
|
||||||
|
-@erase "$(INTDIR)\MySqlManager.res"
|
||||||
|
-@erase "$(INTDIR)\MySqlManagerDoc.obj"
|
||||||
|
-@erase "$(INTDIR)\MySqlManagerView.obj"
|
||||||
|
-@erase "$(INTDIR)\RegisterServer.obj"
|
||||||
|
-@erase "$(INTDIR)\StdAfx.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolSql.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolSqlQuery.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolSqlResults.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolSqlStatus.obj"
|
||||||
|
-@erase "$(INTDIR)\vc60.idb"
|
||||||
|
-@erase "$(INTDIR)\vc60.pdb"
|
||||||
|
-@erase "$(OUTDIR)\MySqlManager.pdb"
|
||||||
|
-@erase "..\client_debug\MySqlManager.exe"
|
||||||
|
|
||||||
|
"$(OUTDIR)" :
|
||||||
|
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||||
|
|
||||||
|
CPP_PROJ=/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||||
|
MTL_PROJ=/nologo /D "_DEBUG" /o "NUL" /win32
|
||||||
|
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\MySqlManager.res" /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MySqlManager.bsc"
|
||||||
|
BSC32_SBRS= \
|
||||||
|
|
||||||
|
LINK32=link.exe
|
||||||
|
LINK32_FLAGS=wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\MySqlManager.pdb" /debug /machine:I386 /out:"../client_debug/MySqlManager.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
|
||||||
|
LINK32_OBJS= \
|
||||||
|
"$(INTDIR)\ChildFrm.obj" \
|
||||||
|
"$(INTDIR)\MainFrm.obj" \
|
||||||
|
"$(INTDIR)\MySqlManager.obj" \
|
||||||
|
"$(INTDIR)\MySqlManagerDoc.obj" \
|
||||||
|
"$(INTDIR)\MySqlManagerView.obj" \
|
||||||
|
"$(INTDIR)\RegisterServer.obj" \
|
||||||
|
"$(INTDIR)\StdAfx.obj" \
|
||||||
|
"$(INTDIR)\ToolSql.obj" \
|
||||||
|
"$(INTDIR)\ToolSqlQuery.obj" \
|
||||||
|
"$(INTDIR)\ToolSqlResults.obj" \
|
||||||
|
"$(INTDIR)\ToolSqlStatus.obj" \
|
||||||
|
"$(INTDIR)\MySqlManager.res" \
|
||||||
|
"..\lib_debug\mysqlclient.lib"
|
||||||
|
|
||||||
|
"..\client_debug\MySqlManager.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||||
|
$(LINK32) @<<
|
||||||
|
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
.c{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cpp{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cxx{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.c{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cpp{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cxx{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||||
|
!IF EXISTS("MySqlManager.dep")
|
||||||
|
!INCLUDE "MySqlManager.dep"
|
||||||
|
!ELSE
|
||||||
|
!MESSAGE Warning: cannot find "MySqlManager.dep"
|
||||||
|
!ENDIF
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "MySqlManager - Win32 Release" || "$(CFG)" == "MySqlManager - Win32 Debug"
|
||||||
|
SOURCE=.\ChildFrm.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ChildFrm.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\MainFrm.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\MainFrm.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\MySqlManager.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\MySqlManager.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\MySqlManager.rc
|
||||||
|
|
||||||
|
"$(INTDIR)\MySqlManager.res" : $(SOURCE) "$(INTDIR)"
|
||||||
|
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\MySqlManagerDoc.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\MySqlManagerDoc.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\MySqlManagerView.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\MySqlManagerView.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\RegisterServer.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\RegisterServer.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\StdAfx.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "MySqlManager - Win32 Release"
|
||||||
|
|
||||||
|
CPP_SWITCHES=/nologo /G6 /MT /W3 /GX /O1 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fp"$(INTDIR)\MySqlManager.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||||
|
|
||||||
|
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\MySqlManager.pch" : $(SOURCE) "$(INTDIR)"
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_SWITCHES) $(SOURCE)
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "MySqlManager - Win32 Debug"
|
||||||
|
|
||||||
|
CPP_SWITCHES=/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\MySqlManager.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||||
|
|
||||||
|
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\MySqlManager.pch" : $(SOURCE) "$(INTDIR)"
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_SWITCHES) $(SOURCE)
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
SOURCE=.\ToolSql.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ToolSql.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ToolSqlQuery.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ToolSqlQuery.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ToolSqlResults.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ToolSqlResults.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ToolSqlStatus.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ToolSqlStatus.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "MySqlManager - Win32 Release"
|
||||||
|
|
||||||
|
"mysqlclient - Win32 Release" :
|
||||||
|
cd "\MYSQL-3.23\client"
|
||||||
|
$(MAKE) /$(MAKEFLAGS) /F ".\mysqlclient.mak" CFG="mysqlclient - Win32 Release"
|
||||||
|
cd "..\mysqlmanager"
|
||||||
|
|
||||||
|
"mysqlclient - Win32 ReleaseCLEAN" :
|
||||||
|
cd "\MYSQL-3.23\client"
|
||||||
|
$(MAKE) /$(MAKEFLAGS) /F ".\mysqlclient.mak" CFG="mysqlclient - Win32 Release" RECURSE=1 CLEAN
|
||||||
|
cd "..\mysqlmanager"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "MySqlManager - Win32 Debug"
|
||||||
|
|
||||||
|
"mysqlclient - Win32 Debug" :
|
||||||
|
cd "\MYSQL-3.23\client"
|
||||||
|
$(MAKE) /$(MAKEFLAGS) /F ".\mysqlclient.mak" CFG="mysqlclient - Win32 Debug"
|
||||||
|
cd "..\mysqlmanager"
|
||||||
|
|
||||||
|
"mysqlclient - Win32 DebugCLEAN" :
|
||||||
|
cd "\MYSQL-3.23\client"
|
||||||
|
$(MAKE) /$(MAKEFLAGS) /F ".\mysqlclient.mak" CFG="mysqlclient - Win32 Debug" RECURSE=1 CLEAN
|
||||||
|
cd "..\mysqlmanager"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
102
VC++Files/mysqlmanager/README.TXT
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
========================================================================
|
||||||
|
MICROSOFT FOUNDATION CLASS LIBRARY : MySqlManager
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
|
||||||
|
AppWizard has created this MySqlManager application for you. This application
|
||||||
|
not only demonstrates the basics of using the Microsoft Foundation classes
|
||||||
|
but is also a starting point for writing your application.
|
||||||
|
|
||||||
|
This file contains a summary of what you will find in each of the files that
|
||||||
|
make up your MySqlManager application.
|
||||||
|
|
||||||
|
MySqlManager.h
|
||||||
|
This is the main header file for the application. It includes other
|
||||||
|
project specific headers (including Resource.h) and declares the
|
||||||
|
CMySqlManagerApp application class.
|
||||||
|
|
||||||
|
MySqlManager.cpp
|
||||||
|
This is the main application source file that contains the application
|
||||||
|
class CMySqlManagerApp.
|
||||||
|
|
||||||
|
MySqlManager.rc
|
||||||
|
This is a listing of all of the Microsoft Windows resources that the
|
||||||
|
program uses. It includes the icons, bitmaps, and cursors that are stored
|
||||||
|
in the RES subdirectory. This file can be directly edited in Microsoft
|
||||||
|
Developer Studio.
|
||||||
|
|
||||||
|
res\MySqlManager.ico
|
||||||
|
This is an icon file, which is used as the application's icon. This
|
||||||
|
icon is included by the main resource file MySqlManager.rc.
|
||||||
|
|
||||||
|
res\MySqlManager.rc2
|
||||||
|
This file contains resources that are not edited by Microsoft
|
||||||
|
Developer Studio. You should place all resources not
|
||||||
|
editable by the resource editor in this file.
|
||||||
|
|
||||||
|
MySqlManager.clw
|
||||||
|
This file contains information used by ClassWizard to edit existing
|
||||||
|
classes or add new classes. ClassWizard also uses this file to store
|
||||||
|
information needed to create and edit message maps and dialog data
|
||||||
|
maps and to create prototype member functions.
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
For the main frame window:
|
||||||
|
|
||||||
|
MainFrm.h, MainFrm.cpp
|
||||||
|
These files contain the frame class CMainFrame, which is derived from
|
||||||
|
CMDIFrameWnd and controls all MDI frame features.
|
||||||
|
|
||||||
|
res\Toolbar.bmp
|
||||||
|
This bitmap file is used to create tiled images for the toolbar.
|
||||||
|
The initial toolbar and status bar are constructed in the
|
||||||
|
CMainFrame class. Edit this toolbar bitmap along with the
|
||||||
|
array in MainFrm.cpp to add more toolbar buttons.
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
AppWizard creates one document type and one view:
|
||||||
|
|
||||||
|
MySqlManagerDoc.h, MySqlManagerDoc.cpp - the document
|
||||||
|
These files contain your CMySqlManagerDoc class. Edit these files to
|
||||||
|
add your special document data and to implement file saving and loading
|
||||||
|
(via CMySqlManagerDoc::Serialize).
|
||||||
|
|
||||||
|
MySqlManagerView.h, MySqlManagerView.cpp - the view of the document
|
||||||
|
These files contain your CMySqlManagerView class.
|
||||||
|
CMySqlManagerView objects are used to view CMySqlManagerDoc objects.
|
||||||
|
|
||||||
|
res\MySqlManagerDoc.ico
|
||||||
|
This is an icon file, which is used as the icon for MDI child windows
|
||||||
|
for the CMySqlManagerDoc class. This icon is included by the main
|
||||||
|
resource file MySqlManager.rc.
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
Other standard files:
|
||||||
|
|
||||||
|
StdAfx.h, StdAfx.cpp
|
||||||
|
These files are used to build a precompiled header (PCH) file
|
||||||
|
named MySqlManager.pch and a precompiled types file named StdAfx.obj.
|
||||||
|
|
||||||
|
Resource.h
|
||||||
|
This is the standard header file, which defines new resource IDs.
|
||||||
|
Microsoft Developer Studio reads and updates this file.
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
Other notes:
|
||||||
|
|
||||||
|
AppWizard uses "TODO:" to indicate parts of the source code you
|
||||||
|
should add to or customize.
|
||||||
|
|
||||||
|
If your application uses MFC in a shared DLL, and your application is
|
||||||
|
in a language other than the operating system's current language, you
|
||||||
|
will need to copy the corresponding localized resources MFC40XXX.DLL
|
||||||
|
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
|
||||||
|
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
|
||||||
|
For example, MFC40DEU.DLL contains resources translated to German.) If you
|
||||||
|
don't do this, some of the UI elements of your application will remain in the
|
||||||
|
language of the operating system.
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
BIN
VC++Files/mysqlmanager/RES/BITMAP1.BMP
Normal file
After Width: | Height: | Size: 630 B |
BIN
VC++Files/mysqlmanager/RES/BITMAP3.BMP
Normal file
After Width: | Height: | Size: 630 B |
BIN
VC++Files/mysqlmanager/RES/BMP00001.BMP
Normal file
After Width: | Height: | Size: 246 B |
BIN
VC++Files/mysqlmanager/RES/BMP00002.BMP
Normal file
After Width: | Height: | Size: 238 B |
BIN
VC++Files/mysqlmanager/RES/DATABASE.BMP
Normal file
After Width: | Height: | Size: 238 B |
BIN
VC++Files/mysqlmanager/RES/FONTD.BMP
Normal file
After Width: | Height: | Size: 246 B |
BIN
VC++Files/mysqlmanager/RES/FONTU.BMP
Normal file
After Width: | Height: | Size: 246 B |
BIN
VC++Files/mysqlmanager/RES/QUERY_EX.BMP
Normal file
After Width: | Height: | Size: 246 B |
BIN
VC++Files/mysqlmanager/RES/TOOLBAR.BMP
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
VC++Files/mysqlmanager/RES/mysqlmanager.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
13
VC++Files/mysqlmanager/RES/mysqlmanager.rc2
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// MYSQLMANAGER.RC2 - resources Microsoft Visual C++ does not edit directly
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#error this file is not editable by Microsoft Visual C++
|
||||||
|
#endif //APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Add manually edited resources here...
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
BIN
VC++Files/mysqlmanager/RES/mysqlmanagerdoc.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
55
VC++Files/mysqlmanager/RESOURCE.H
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Developer Studio generated include file.
|
||||||
|
// Used by MySqlManager.rc
|
||||||
|
//
|
||||||
|
#define IDC_START_PB 3
|
||||||
|
#define IDC_STOP_PB 4
|
||||||
|
#define ID_SERVERS_PB 7
|
||||||
|
#define IDD_ABOUTBOX 100
|
||||||
|
#define IDM_QUERY_EXEC 101
|
||||||
|
#define IDM_QUERY_DATABASES 102
|
||||||
|
#define IDM_REFRESH 103
|
||||||
|
#define IDD_REGISTER_SERVER 114
|
||||||
|
#define IDR_MAINFRAME 128
|
||||||
|
#define IDR_MYSQLMTYPE 129
|
||||||
|
#define IDD_TOOL_SQL 132
|
||||||
|
#define IDB_BITMAP1 133
|
||||||
|
#define IDD_TOOL_SQL_QUERY 134
|
||||||
|
#define IDD_TOOL_SQL_RESULTS 135
|
||||||
|
#define IDD_TOOL_SQL_STATUS 136
|
||||||
|
#define IDC_TAB1 1000
|
||||||
|
#define IDC_EDIT 1001
|
||||||
|
#define IDC_QUERY_PB 1002
|
||||||
|
#define IDC_FONT_PB 1003
|
||||||
|
#define IDS_QUERY_EXEC 1003
|
||||||
|
#define ID_SERVER_CB 1003
|
||||||
|
#define ID_USER 1004
|
||||||
|
#define IDC_SERVER_CB 1004
|
||||||
|
#define IDC_DATABASES_PB 1005
|
||||||
|
#define ID_PASSWORD 1005
|
||||||
|
#define ID_HOST_CB 1006
|
||||||
|
#define IDC_TIMER_SECS 1006
|
||||||
|
#define ID_PORT_CB 1007
|
||||||
|
#define IDC_CLEAR 1007
|
||||||
|
#define ID_GROUPS_PB 1012
|
||||||
|
#define ID_REMOVE_PB 1017
|
||||||
|
#define ID_DISPLAY_SERVER_STATUS_CK 1057
|
||||||
|
#define ID_USE_STANDARD_CK 1058
|
||||||
|
#define ID_USE_TRUSTED_CK 1059
|
||||||
|
#define IDM_SQL_TOOL_QUERY 32771
|
||||||
|
#define IDM_TOOLS_REGISTER_SERVER 32772
|
||||||
|
#define IDM_TOOLS_SERVER_PROPERTIES 32773
|
||||||
|
#define IDS_QUERY_DATABASES 57346
|
||||||
|
#define IDS_REFRESH 57347
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_3D_CONTROLS 1
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 136
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 32775
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1008
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 104
|
||||||
|
#endif
|
||||||
|
#endif
|
5
VC++Files/mysqlmanager/STDAFX.CPP
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// stdafx.cpp : source file that includes just the standard includes
|
||||||
|
// MySqlManager.pch will be the pre-compiled header
|
||||||
|
// stdafx.obj will contain the pre-compiled type information
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
28
VC++Files/mysqlmanager/STDAFX.H
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// stdafx.h : include file for standard system include files,
|
||||||
|
// or project specific include files that are used frequently, but
|
||||||
|
// are changed infrequently
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_STDAFX_H__826CB2EC_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_STDAFX_H__826CB2EC_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
|
||||||
|
#include <afxwin.h> // MFC core and standard components
|
||||||
|
#include <afxext.h> // MFC extensions
|
||||||
|
#include <afxdisp.h> // MFC OLE automation classes
|
||||||
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||||
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
|
||||||
|
#include <afxsock.h>
|
||||||
|
#include "mysql.h"
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_STDAFX_H__826CB2EC_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
687
VC++Files/mysqlmanager/TOOLSQL.CPP
Normal file
@ -0,0 +1,687 @@
|
|||||||
|
// ToolSql.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MySqlManager.h"
|
||||||
|
#include "ToolSql.h"
|
||||||
|
|
||||||
|
#define WINDOW_COORDS 0
|
||||||
|
#define CLIENT_COORDS 1
|
||||||
|
|
||||||
|
#define MY_TIMER_ID 0x1234
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CToolSql::CToolSql(CWnd* pParent,CResource* pServer,CResource* pResource)
|
||||||
|
: CDialog(CToolSql::IDD, pParent)
|
||||||
|
, m_pQuery(0)
|
||||||
|
, m_pResults(0)
|
||||||
|
, m_pStatus(0)
|
||||||
|
, m_pServer(pServer)
|
||||||
|
, m_pResource(pResource)
|
||||||
|
, m_ui_timer(0)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CToolSql)
|
||||||
|
m_nIntervalTimerSeconds = 10;
|
||||||
|
m_bClear = FALSE;
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
memset ( & m_lf, 0,sizeof(m_lf) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CToolSql::~CToolSql()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (m_ui_timer)
|
||||||
|
{
|
||||||
|
KillTimer(MY_TIMER_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pdb)
|
||||||
|
{
|
||||||
|
mysql_close(m_pdb);
|
||||||
|
}
|
||||||
|
if (m_pQuery)
|
||||||
|
{
|
||||||
|
m_pQuery->DestroyWindow();
|
||||||
|
delete m_pQuery;
|
||||||
|
}
|
||||||
|
if (m_pResults)
|
||||||
|
{
|
||||||
|
m_pResults->DestroyWindow();
|
||||||
|
delete m_pResults;
|
||||||
|
}
|
||||||
|
if (m_pStatus)
|
||||||
|
{
|
||||||
|
m_pStatus->DestroyWindow();
|
||||||
|
delete m_pStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CToolSql)
|
||||||
|
DDX_Control(pDX, IDC_STOP_PB, m_ctl_Stop);
|
||||||
|
DDX_Control(pDX, IDC_START_PB, m_ctl_Start);
|
||||||
|
DDX_Control(pDX, IDC_SERVER_CB, m_ctl_Server);
|
||||||
|
DDX_Control(pDX, IDC_TAB1, m_tabs);
|
||||||
|
DDX_Text(pDX, IDC_TIMER_SECS, m_nIntervalTimerSeconds);
|
||||||
|
DDV_MinMaxInt(pDX, m_nIntervalTimerSeconds, 1, 120);
|
||||||
|
DDX_Check(pDX, IDC_CLEAR, m_bClear);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CToolSql, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CToolSql)
|
||||||
|
ON_BN_CLICKED(IDC_QUERY_PB, OnQueryPb)
|
||||||
|
ON_BN_CLICKED(IDC_DATABASES_PB, OnQueryDatabases)
|
||||||
|
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
|
||||||
|
ON_BN_CLICKED(IDC_FONT_PB, OnFontPb)
|
||||||
|
ON_WM_SIZE()
|
||||||
|
ON_BN_CLICKED(IDC_START_PB, OnStartPb)
|
||||||
|
ON_BN_CLICKED(IDC_STOP_PB, OnStopPb)
|
||||||
|
ON_WM_TIMER()
|
||||||
|
ON_WM_DESTROY()
|
||||||
|
ON_BN_CLICKED(IDC_CLEAR, OnClear)
|
||||||
|
ON_COMMAND(IDM_QUERY_EXEC, OnQueryPb)
|
||||||
|
ON_COMMAND(IDM_QUERY_DATABASES, OnQueryDatabases)
|
||||||
|
ON_EN_CHANGE(IDC_TIMER_SECS, OnChangeTimerSecs)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL CToolSql::OnInitDialog()
|
||||||
|
{
|
||||||
|
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
m_ctl_Start . EnableWindow(TRUE);
|
||||||
|
m_ctl_Stop . EnableWindow(FALSE);
|
||||||
|
|
||||||
|
CString strTitle;
|
||||||
|
|
||||||
|
strTitle.Format ("mySql Query to %s on %s",m_pServer->GetDisplayName(),m_pServer->GetHostName());
|
||||||
|
|
||||||
|
m_ctl_Server.AddString ( m_pServer->GetDisplayName() );
|
||||||
|
m_ctl_Server.SetCurSel (0);
|
||||||
|
|
||||||
|
SetWindowText(strTitle);
|
||||||
|
|
||||||
|
CWaitCursor x;
|
||||||
|
|
||||||
|
m_btn_QueryExec.AutoLoad ( IDC_QUERY_PB, this );
|
||||||
|
m_btn_QueryDatabases.AutoLoad ( IDC_DATABASES_PB, this );
|
||||||
|
m_btn_Font.AutoLoad ( IDC_FONT_PB, this );
|
||||||
|
|
||||||
|
m_tabs.GetWindowRect ( m_rectTab[WINDOW_COORDS] );
|
||||||
|
GetWindowRect ( m_rectDlg[WINDOW_COORDS] );
|
||||||
|
|
||||||
|
m_tabs.GetClientRect ( m_rectTab[CLIENT_COORDS] );
|
||||||
|
GetClientRect ( m_rectDlg[CLIENT_COORDS] );
|
||||||
|
|
||||||
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||||||
|
if (pSysMenu != NULL)
|
||||||
|
{
|
||||||
|
CString strText;
|
||||||
|
strText.LoadString(IDS_QUERY_EXEC);
|
||||||
|
if (!strText.IsEmpty())
|
||||||
|
{
|
||||||
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
||||||
|
pSysMenu->AppendMenu(MF_STRING, IDM_QUERY_EXEC, strText);
|
||||||
|
}
|
||||||
|
strText.LoadString(IDS_QUERY_DATABASES);
|
||||||
|
if (!strText.IsEmpty())
|
||||||
|
{
|
||||||
|
pSysMenu->AppendMenu(MF_STRING, IDM_QUERY_DATABASES, strText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
m_pdb = new MYSQL;
|
||||||
|
|
||||||
|
CString strQuery ( "Query" );
|
||||||
|
CString strResults ( "Results" );
|
||||||
|
CString strStatus ( "Status" );
|
||||||
|
|
||||||
|
TC_ITEM tc1 = { TCIF_TEXT, 0,0, (LPSTR)(LPCTSTR)strQuery, strQuery.GetLength(), 0,0};
|
||||||
|
TC_ITEM tc2 = { TCIF_TEXT, 0,0, (LPSTR)(LPCTSTR)strResults, strResults.GetLength(), 0,0};
|
||||||
|
TC_ITEM tc3 = { TCIF_TEXT, 0,0, (LPSTR)(LPCTSTR)strStatus, strStatus.GetLength(), 0,0};
|
||||||
|
|
||||||
|
m_tabs.InsertItem ( 0,&tc1 );
|
||||||
|
m_tabs.InsertItem ( 1,&tc2 );
|
||||||
|
m_tabs.InsertItem ( 2,&tc3 );
|
||||||
|
|
||||||
|
m_pQuery = new CToolSqlQuery ( NULL );
|
||||||
|
m_pResults = new CToolSqlResults ( NULL );
|
||||||
|
m_pStatus = new CToolSqlStatus ( NULL );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
// OpenDatabase();
|
||||||
|
//
|
||||||
|
// m_pSelection->SetDatabase ( & m_db );
|
||||||
|
// m_pScript->SetDatabase ( & m_db );
|
||||||
|
// m_pLog->SetDatabase ( & m_db );
|
||||||
|
|
||||||
|
m_pQuery -> Create ( (LPCTSTR)IDD_TOOL_SQL_QUERY, &m_tabs );
|
||||||
|
m_pResults -> Create ( (LPCTSTR)IDD_TOOL_SQL_RESULTS, &m_tabs );
|
||||||
|
m_pStatus -> Create ( (LPCTSTR)IDD_TOOL_SQL_STATUS, &m_tabs );
|
||||||
|
|
||||||
|
ActivateTab ( 0 );
|
||||||
|
|
||||||
|
m_pQuery -> SetWindowPos(NULL,20,24,0,0,SWP_NOZORDER|SWP_NOSIZE);
|
||||||
|
m_pResults -> SetWindowPos(NULL,20,24,0,0,SWP_NOZORDER|SWP_NOSIZE);
|
||||||
|
m_pStatus -> SetWindowPos(NULL,20,24,0,0,SWP_NOZORDER|SWP_NOSIZE);
|
||||||
|
|
||||||
|
DoOnSize( SIZE_RESTORED, m_rectDlg[CLIENT_COORDS].Width(), m_rectDlg[CLIENT_COORDS].Height() );
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
mysql_init(m_pdb);
|
||||||
|
if (!mysql_real_connect(m_pdb,m_pServer->GetHostName(), m_pServer->GetUserName(),m_pServer->GetPassword(),0,m_pServer->GetPortNumber(), NullS,0))
|
||||||
|
{
|
||||||
|
// my_printf_error(0,"connect to server at '%s' failed; error: '%s'",
|
||||||
|
// MYF(ME_BELL), pResource->GetHostName(), mysql_error(&mysql));
|
||||||
|
CString strText;
|
||||||
|
strText.Format ( "connect to server at '%s' failed; error: '%s'", m_pServer->GetHostName(), mysql_error(m_pdb));
|
||||||
|
AfxMessageBox(strText);
|
||||||
|
EndDialog(IDCANCEL);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_pResource && m_pResource->GetType() == CResource::eDatabase )
|
||||||
|
{
|
||||||
|
CString strDB = m_pResource->GetDisplayName();
|
||||||
|
strDB.TrimRight();
|
||||||
|
if (mysql_select_db(m_pdb,strDB))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::ActivateTab ( int tab )
|
||||||
|
|
||||||
|
{
|
||||||
|
switch (tab)
|
||||||
|
{
|
||||||
|
case 0: ;
|
||||||
|
m_pResults-> ShowWindow(SW_HIDE);
|
||||||
|
m_pStatus-> ShowWindow(SW_HIDE);
|
||||||
|
m_pQuery-> ShowWindow(SW_SHOW);
|
||||||
|
m_pQuery->m_ctl_edit.SetFocus();
|
||||||
|
break;
|
||||||
|
case 1: ;
|
||||||
|
m_pQuery-> ShowWindow(SW_HIDE);
|
||||||
|
m_pStatus-> ShowWindow(SW_HIDE);
|
||||||
|
m_pResults-> ShowWindow(SW_SHOW);
|
||||||
|
m_pResults->m_ctl_edit.SetFocus();
|
||||||
|
break;
|
||||||
|
case 2: ;
|
||||||
|
m_pResults-> ShowWindow(SW_HIDE);
|
||||||
|
m_pQuery-> ShowWindow(SW_HIDE);
|
||||||
|
m_pStatus-> ShowWindow(SW_SHOW);
|
||||||
|
m_pStatus->m_ctl_edit.SetFocus();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CalculateFontSize ( CEdit& ed, CSize& sizeRet )
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
CDC* pdc = ed.GetDC();
|
||||||
|
|
||||||
|
int nAveWidth , nAveHeight;
|
||||||
|
int i ;
|
||||||
|
|
||||||
|
CSize size ;
|
||||||
|
|
||||||
|
static BOOL bFirstTime = TRUE;
|
||||||
|
static char rgchAlphabet [54] ;
|
||||||
|
|
||||||
|
if ( bFirstTime )
|
||||||
|
{
|
||||||
|
bFirstTime = false;
|
||||||
|
for ( i = 0 ; i <= 25 ; i++)
|
||||||
|
{
|
||||||
|
rgchAlphabet[i] = (char)(i+(int)'a') ;
|
||||||
|
rgchAlphabet[i+26] = (char)(i+(int)'A') ;
|
||||||
|
}
|
||||||
|
rgchAlphabet[52] = 0x20;
|
||||||
|
rgchAlphabet[53] = 0x20;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFont* pf = ed.GetFont();
|
||||||
|
LOGFONT lf;
|
||||||
|
pf->GetLogFont(&lf);
|
||||||
|
pdc->SelectObject (pf);
|
||||||
|
GetTextExtentPoint32 ( pdc->m_hDC, (LPSTR) rgchAlphabet, 54, & size ) ;
|
||||||
|
|
||||||
|
nAveWidth = size.cx / 54 ;
|
||||||
|
|
||||||
|
if ( size.cx % 54 )
|
||||||
|
{
|
||||||
|
nAveWidth++;
|
||||||
|
}
|
||||||
|
|
||||||
|
nAveHeight = size.cy; //6 * size.cy / 4;
|
||||||
|
|
||||||
|
sizeRet.cx = nAveWidth;
|
||||||
|
sizeRet.cy = nAveHeight; // tm.tmHeight;
|
||||||
|
|
||||||
|
ed.ReleaseDC(pdc);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
int ProcessYieldMessage ()
|
||||||
|
{
|
||||||
|
|
||||||
|
CWinApp* pApp = AfxGetApp();
|
||||||
|
|
||||||
|
if ( pApp )
|
||||||
|
{
|
||||||
|
MSG msgx;
|
||||||
|
while (::PeekMessage(&msgx, NULL, NULL, NULL, PM_NOREMOVE))
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!pApp->PumpMessage())
|
||||||
|
{
|
||||||
|
// ExitProcess(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void print_table_data(MYSQL_RES *result,CString& str,CEdit& ed,LOGFONT& lf)
|
||||||
|
{
|
||||||
|
MYSQL_ROW cur;
|
||||||
|
uint length;
|
||||||
|
MYSQL_FIELD* field;
|
||||||
|
bool* num_flag;
|
||||||
|
my_ulonglong nRows = mysql_num_rows(result);
|
||||||
|
uint nFields = mysql_num_fields(result);
|
||||||
|
int* rgi = new int [nFields];
|
||||||
|
memset ( rgi, 0, nFields*sizeof(int) );
|
||||||
|
num_flag=(bool*) my_alloca(sizeof(bool)*nFields);
|
||||||
|
|
||||||
|
ed.SetLimitText(65535*16);
|
||||||
|
|
||||||
|
CSize sizeFont;
|
||||||
|
CalculateFontSize ( ed, sizeFont );
|
||||||
|
uint index = 0;
|
||||||
|
rgi[index++]=0;
|
||||||
|
CString separator("");
|
||||||
|
|
||||||
|
mysql_field_seek(result,0);
|
||||||
|
|
||||||
|
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
|
||||||
|
{
|
||||||
|
uint length= (uint) strlen(field->name);
|
||||||
|
length=max(length,field->max_length);
|
||||||
|
if (length < 4 && !IS_NOT_NULL(field->flags))
|
||||||
|
length=4; // Room for "NULL"
|
||||||
|
field->max_length=length+1;
|
||||||
|
int n=length+2;
|
||||||
|
for (uint i=lstrlen(field->name); i-- > 0 ; ) separator+="-";
|
||||||
|
if ( index!= nFields )
|
||||||
|
{
|
||||||
|
int o = rgi[index-1];
|
||||||
|
rgi[index++]=o+((n+1)*sizeFont.cx)/2;
|
||||||
|
}
|
||||||
|
separator+='\t';
|
||||||
|
str += field->name;
|
||||||
|
str += "\t";
|
||||||
|
num_flag[off]= IS_NUM(field->type);
|
||||||
|
}
|
||||||
|
separator += "\r\n";
|
||||||
|
str += "\r\n";
|
||||||
|
str += separator;
|
||||||
|
ed.SetSel(-1,-1);
|
||||||
|
ed.ReplaceSel(str);
|
||||||
|
|
||||||
|
if ( 1 || nRows > 100 )
|
||||||
|
{
|
||||||
|
while ((cur = mysql_fetch_row(result)))
|
||||||
|
{
|
||||||
|
ProcessYieldMessage ();
|
||||||
|
mysql_field_seek(result,0);
|
||||||
|
str.Empty();
|
||||||
|
ed.SetSel(-1,-1);
|
||||||
|
for (uint off=0 ; off < mysql_num_fields(result); off++)
|
||||||
|
{
|
||||||
|
field = mysql_fetch_field(result);
|
||||||
|
length=field->max_length;
|
||||||
|
CString strText;
|
||||||
|
strText.Format ("%s", cur[off] ? (char*) cur[off] : "NULL");
|
||||||
|
str += strText;
|
||||||
|
str += "\t";
|
||||||
|
}
|
||||||
|
str += "\r\n";
|
||||||
|
ed.SetSel(-1,-1);
|
||||||
|
ed.ReplaceSel(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while ((cur = mysql_fetch_row(result)))
|
||||||
|
{
|
||||||
|
mysql_field_seek(result,0);
|
||||||
|
for (uint off=0 ; off < mysql_num_fields(result); off++)
|
||||||
|
{
|
||||||
|
field = mysql_fetch_field(result);
|
||||||
|
length=field->max_length;
|
||||||
|
CString strText;
|
||||||
|
strText.Format ("%s", cur[off] ? (char*) cur[off] : "NULL");
|
||||||
|
str += strText;
|
||||||
|
str += "\t";
|
||||||
|
}
|
||||||
|
str += "\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my_afree((gptr) num_flag);
|
||||||
|
str += "\r\n";
|
||||||
|
ed.SetTabStops(nFields,rgi);
|
||||||
|
delete [] rgi;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnQueryPb()
|
||||||
|
{
|
||||||
|
|
||||||
|
CWaitCursor x;
|
||||||
|
// mysql_select_db(m_pdb,"mysql");
|
||||||
|
|
||||||
|
if ( m_pResource && m_pResource->GetType() == CResource::eDatabase )
|
||||||
|
{
|
||||||
|
CString strDB = m_pResource->GetDisplayName();
|
||||||
|
strDB.TrimRight();
|
||||||
|
if (mysql_select_db(m_pdb,strDB))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pQuery->UpdateData();
|
||||||
|
m_pResults->m_edit.Empty();
|
||||||
|
CString str = m_pQuery->m_edit;
|
||||||
|
if ( mysql_real_query(m_pdb,str,str.GetLength())==0 )
|
||||||
|
{
|
||||||
|
MYSQL_RES *result;
|
||||||
|
if ((result=mysql_store_result(m_pdb)))
|
||||||
|
{
|
||||||
|
my_ulonglong nRows = mysql_num_rows(result);
|
||||||
|
m_pResults->UpdateData(FALSE);
|
||||||
|
m_tabs.SetCurSel(1);
|
||||||
|
ActivateTab ( 1 );
|
||||||
|
print_table_data(result,m_pResults->m_edit,m_pResults->m_ctl_edit,m_lf);
|
||||||
|
// m_pResults->UpdateData(FALSE);
|
||||||
|
m_pResults->m_ctl_edit.SetSel(-1,-1);
|
||||||
|
CString strText;
|
||||||
|
strText.Format ( "\r\n(%d row(s) affected)\r\n", nRows );
|
||||||
|
m_pResults->m_ctl_edit.ReplaceSel(strText);
|
||||||
|
mysql_free_result(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pResults->m_edit = mysql_error(m_pdb);
|
||||||
|
m_pResults->UpdateData(FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pResults->m_edit = mysql_error(m_pdb);
|
||||||
|
m_pResults->UpdateData(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tabs.SetCurSel(1);
|
||||||
|
ActivateTab ( 1 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnQueryDatabases()
|
||||||
|
{
|
||||||
|
CWaitCursor x;
|
||||||
|
MYSQL_RES *result;
|
||||||
|
m_pResults->m_edit.Empty();
|
||||||
|
if ((result=mysql_list_dbs(m_pdb,0)))
|
||||||
|
{
|
||||||
|
my_ulonglong nRows = mysql_num_rows(result);
|
||||||
|
print_table_data(result,m_pResults->m_edit,m_pResults->m_ctl_edit,m_lf);
|
||||||
|
//m_pResults->UpdateData(FALSE);
|
||||||
|
mysql_free_result(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pResults->m_edit = mysql_error(m_pdb);
|
||||||
|
m_pResults->UpdateData(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tabs.SetCurSel(1);
|
||||||
|
ActivateTab ( 1 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
ActivateTab ( m_tabs.GetCurSel() );
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnFontPb()
|
||||||
|
{
|
||||||
|
|
||||||
|
CFontDialog FontDlg ( & m_lf );
|
||||||
|
|
||||||
|
if ( FontDlg.DoModal ( ) == IDOK )
|
||||||
|
{
|
||||||
|
if (m_font.GetSafeHandle())
|
||||||
|
m_font.DeleteObject();
|
||||||
|
m_lf = *FontDlg.m_cf.lpLogFont;
|
||||||
|
m_font.CreateFontIndirect(FontDlg.m_cf.lpLogFont);
|
||||||
|
m_pQuery->SetFont(&m_font);
|
||||||
|
m_pResults->SetFont(&m_font);
|
||||||
|
m_pStatus->SetFont(&m_font);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::DoOnSize(UINT nType, int cx, int cy)
|
||||||
|
{
|
||||||
|
|
||||||
|
int nx = cx - ( m_rectDlg[CLIENT_COORDS].Width ( ) - m_rectTab[CLIENT_COORDS].Width ( ) );
|
||||||
|
int ny = cy - ( m_rectDlg[CLIENT_COORDS].Height ( ) - m_rectTab[CLIENT_COORDS].Height ( ) );
|
||||||
|
|
||||||
|
if (IsWindow(m_tabs.GetSafeHwnd()))
|
||||||
|
{
|
||||||
|
m_tabs.SetWindowPos ( NULL
|
||||||
|
, 0
|
||||||
|
, 0
|
||||||
|
, nx
|
||||||
|
, ny
|
||||||
|
, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW );
|
||||||
|
|
||||||
|
if (m_pResults&&IsWindow(m_pResults->GetSafeHwnd()))
|
||||||
|
m_pResults -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE );
|
||||||
|
if (m_pQuery&&IsWindow(m_pQuery->GetSafeHwnd()))
|
||||||
|
m_pQuery -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE );
|
||||||
|
if (m_pStatus&&IsWindow(m_pStatus->GetSafeHwnd()))
|
||||||
|
m_pStatus -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE );
|
||||||
|
// switch ( m_tabs.GetCurSel() )
|
||||||
|
// {
|
||||||
|
// case 0:
|
||||||
|
// {
|
||||||
|
// if (m_pResults&&IsWindow(m_pResults->GetSafeHwnd()))
|
||||||
|
// m_pResults -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW );
|
||||||
|
// if (m_pQuery&&IsWindow(m_pQuery->GetSafeHwnd()))
|
||||||
|
// m_pQuery -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW );
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// case 1:
|
||||||
|
// {
|
||||||
|
// if (m_pQuery&&IsWindow(m_pQuery->GetSafeHwnd()))
|
||||||
|
// m_pQuery -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW );
|
||||||
|
// if (m_pResults&&IsWindow(m_pResults->GetSafeHwnd()))
|
||||||
|
// m_pResults -> SetWindowPos(NULL,20,24,nx-40,ny-48,SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW );
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnSize(UINT nType, int cx, int cy)
|
||||||
|
{
|
||||||
|
|
||||||
|
CDialog::OnSize(nType, cx, cy);
|
||||||
|
|
||||||
|
DoOnSize ( nType, cx, cy );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnOK()
|
||||||
|
{
|
||||||
|
CDialog::OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnCancel()
|
||||||
|
{
|
||||||
|
CDialog::OnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL CToolSql::PreTranslateMessage(MSG* pMsg)
|
||||||
|
{
|
||||||
|
return CDialog::PreTranslateMessage(pMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::DoProcessListQuery()
|
||||||
|
{
|
||||||
|
|
||||||
|
MYSQL_RES *result;
|
||||||
|
if (result=mysql_list_processes(m_pdb))
|
||||||
|
{
|
||||||
|
if (m_bClear)
|
||||||
|
{
|
||||||
|
m_pStatus->m_edit.Empty();
|
||||||
|
m_pStatus->UpdateData(FALSE);
|
||||||
|
}
|
||||||
|
print_table_data(result,m_pStatus->m_edit,m_pStatus->m_ctl_edit,m_lf);
|
||||||
|
mysql_free_result(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// my_printf_error(0,"process list failed; error: '%s'",MYF(ME_BELL),mysql_error(mysql));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnStartPb()
|
||||||
|
{
|
||||||
|
UpdateData();
|
||||||
|
if (m_ui_timer) return;
|
||||||
|
if (m_nIntervalTimerSeconds<1) return;
|
||||||
|
ActivateTab ( 2 );
|
||||||
|
m_ui_timer = SetTimer( MY_TIMER_ID, m_nIntervalTimerSeconds*1000, NULL );
|
||||||
|
m_ctl_Start . EnableWindow(FALSE);
|
||||||
|
m_ctl_Stop . EnableWindow(TRUE);
|
||||||
|
DoProcessListQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnStopPb()
|
||||||
|
{
|
||||||
|
UpdateData();
|
||||||
|
if (m_ui_timer)
|
||||||
|
{
|
||||||
|
KillTimer(MY_TIMER_ID);
|
||||||
|
m_ui_timer = 0;
|
||||||
|
}
|
||||||
|
m_ctl_Start . EnableWindow(TRUE);
|
||||||
|
m_ctl_Stop . EnableWindow(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSql::OnTimer(UINT nIDEvent)
|
||||||
|
{
|
||||||
|
DoProcessListQuery();
|
||||||
|
CDialog::OnTimer(nIDEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CToolSql::OnDestroy()
|
||||||
|
{
|
||||||
|
if (m_ui_timer)
|
||||||
|
{
|
||||||
|
KillTimer(MY_TIMER_ID);
|
||||||
|
m_ui_timer = 0;
|
||||||
|
}
|
||||||
|
CDialog::OnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CToolSql::OnClear()
|
||||||
|
{
|
||||||
|
UpdateData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CToolSql::OnChangeTimerSecs()
|
||||||
|
{
|
||||||
|
UpdateData();
|
||||||
|
}
|
102
VC++Files/mysqlmanager/TOOLSQL.H
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#if !defined(AFX_ToolSql_H__826CB2FC_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_ToolSql_H__826CB2FC_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
#include "ToolSqlQuery.h"
|
||||||
|
#include "ToolSqlResults.h"
|
||||||
|
#include "ToolSqlStatus.h"
|
||||||
|
#include "cresource.h"
|
||||||
|
#include <my_global.h>
|
||||||
|
#include "my_sys.h"
|
||||||
|
#include "mysql.h"
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CToolSql dialog
|
||||||
|
|
||||||
|
class CToolSql : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CToolSql(CWnd* pParent = NULL,CResource* pServer=NULL,CResource* pResource=NULL);
|
||||||
|
~CToolSql();
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CToolSql)
|
||||||
|
enum { IDD = IDD_TOOL_SQL };
|
||||||
|
CButton m_ctl_Stop;
|
||||||
|
CButton m_ctl_Start;
|
||||||
|
CComboBox m_ctl_Server;
|
||||||
|
CTabCtrl m_tabs;
|
||||||
|
int m_nIntervalTimerSeconds;
|
||||||
|
BOOL m_bClear;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
CBitmapButton m_btn_QueryExec;
|
||||||
|
CBitmapButton m_btn_Font;
|
||||||
|
CBitmapButton m_btn_QueryDatabases;
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
__int64 m_ui_timer;
|
||||||
|
#else
|
||||||
|
UINT m_ui_timer;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CToolSql)
|
||||||
|
public:
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
|
||||||
|
void ActivateTab ( int tab );
|
||||||
|
void DoProcessListQuery();
|
||||||
|
|
||||||
|
CToolSqlQuery* m_pQuery;
|
||||||
|
CToolSqlResults* m_pResults;
|
||||||
|
CToolSqlStatus* m_pStatus;
|
||||||
|
|
||||||
|
CResource* m_pServer;
|
||||||
|
CResource* m_pResource;
|
||||||
|
MYSQL* m_pdb;
|
||||||
|
CFont m_font;
|
||||||
|
LOGFONT m_lf;
|
||||||
|
CRect m_rectTab[2];
|
||||||
|
CRect m_rectDlg[2];
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CToolSql)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnQueryPb();
|
||||||
|
afx_msg void OnQueryDatabases();
|
||||||
|
afx_msg void OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnFontPb();
|
||||||
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
|
virtual void OnOK();
|
||||||
|
virtual void OnCancel();
|
||||||
|
afx_msg void OnStartPb();
|
||||||
|
afx_msg void OnStopPb();
|
||||||
|
afx_msg void OnTimer(UINT nIDEvent);
|
||||||
|
afx_msg void OnDestroy();
|
||||||
|
afx_msg void OnClear();
|
||||||
|
afx_msg void OnChangeTimerSecs();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
void DoOnSize(UINT nType, int cx, int cy) ;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_ToolSql_H__826CB2FC_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
134
VC++Files/mysqlmanager/cresource.h
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
#ifndef _CRESOURCE_H
|
||||||
|
#define _CRESOURCE_H
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define MYSQL_PORT_AS_STRING "3306" /* Can't use # in preprocessor because of bugs in VC++ 5.0 */
|
||||||
|
|
||||||
|
class CResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum eRESOURCETYPE
|
||||||
|
{
|
||||||
|
eNone
|
||||||
|
, eServer
|
||||||
|
, eDatabase
|
||||||
|
, eTable
|
||||||
|
, eField
|
||||||
|
, eProcesslist
|
||||||
|
, eProcesslistItem
|
||||||
|
};
|
||||||
|
virtual LPCTSTR GetDisplayName() { return ""; }
|
||||||
|
virtual LPCTSTR GetHostName() { return LOCAL_HOST; }
|
||||||
|
virtual LPCTSTR GetUserName() { return "root"; }
|
||||||
|
virtual LPCTSTR GetPassword() { return ""; }
|
||||||
|
virtual LPCTSTR GetPortName() { return MYSQL_PORT_AS_STRING; }
|
||||||
|
virtual int GetPortNumber() { return MYSQL_PORT; }
|
||||||
|
virtual eRESOURCETYPE GetType() { return eNone; }
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CResourceServer : public CResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CResourceServer(LPCTSTR pszName = "",LPCTSTR pszHost = LOCAL_HOST ,LPCTSTR pszUser = "root", LPCTSTR pszPassword = "", LPCTSTR pszPort = MYSQL_PORT_AS_STRING)
|
||||||
|
: m_strName(pszName)
|
||||||
|
, m_strHost(pszHost)
|
||||||
|
, m_strUser(pszUser)
|
||||||
|
, m_strPassword(pszPassword)
|
||||||
|
, m_strPort(pszPort)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual LPCTSTR GetDisplayName() { return m_strName; }
|
||||||
|
virtual LPCTSTR GetHostName() { return m_strHost; }
|
||||||
|
virtual LPCTSTR GetUserName() { return m_strUser; }
|
||||||
|
virtual LPCTSTR GetPassword() { return m_strPassword; }
|
||||||
|
virtual eRESOURCETYPE GetType() { return eServer; }
|
||||||
|
virtual LPCTSTR GetPortName() { return m_strPort; }
|
||||||
|
virtual int GetPortNumber() { return atoi(m_strPort); }
|
||||||
|
CString m_strName;
|
||||||
|
CString m_strHost;
|
||||||
|
CString m_strUser;
|
||||||
|
CString m_strPassword;
|
||||||
|
CString m_strPort;
|
||||||
|
CStringArray m_rgFields;
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CResourceDatabase : public CResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CResourceDatabase(LPCTSTR pszName = "")
|
||||||
|
: m_strName(pszName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual LPCTSTR GetDisplayName() { return m_strName; }
|
||||||
|
virtual eRESOURCETYPE GetType() { return eDatabase; }
|
||||||
|
CString m_strName;
|
||||||
|
CStringArray m_rgFields;
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CResourceTable : public CResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CResourceTable(LPCTSTR pszName = "")
|
||||||
|
: m_strName(pszName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual LPCTSTR GetDisplayName() { return m_strName; }
|
||||||
|
virtual eRESOURCETYPE GetType() { return eTable; }
|
||||||
|
CString m_strName;
|
||||||
|
CStringArray m_rgFields;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CResourceField : public CResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CResourceField(LPCTSTR pszName = "")
|
||||||
|
: m_strName(pszName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual LPCTSTR GetDisplayName() { return m_strName; }
|
||||||
|
virtual eRESOURCETYPE GetType() { return eField; }
|
||||||
|
CString m_strName;
|
||||||
|
CStringArray m_rgFields;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CResourceProcesslist : public CResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CResourceProcesslist(LPCTSTR pszName = "Processlist")
|
||||||
|
: m_strName(pszName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual LPCTSTR GetDisplayName() { return m_strName; }
|
||||||
|
virtual eRESOURCETYPE GetType() { return eProcesslist; }
|
||||||
|
CString m_strName;
|
||||||
|
CStringArray m_rgFields;
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CResourceProcesslistItem : public CResourceProcesslist
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CResourceProcesslistItem(LPCTSTR pszName = "ProcesslistItem")
|
||||||
|
: CResourceProcesslist(pszName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual eRESOURCETYPE GetType() { return eProcesslistItem; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
168
VC++Files/mysqlmanager/mysqlmanager.cpp
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
// MySqlManager.cpp : Defines the class behaviors for the application.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MySqlManager.h"
|
||||||
|
|
||||||
|
#include "MainFrm.h"
|
||||||
|
#include "ChildFrm.h"
|
||||||
|
#include "MySqlManagerDoc.h"
|
||||||
|
#include "MySqlManagerView.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerApp
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMySqlManagerApp, CWinApp)
|
||||||
|
//{{AFX_MSG_MAP(CMySqlManagerApp)
|
||||||
|
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code!
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
// Standard file based document commands
|
||||||
|
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
|
||||||
|
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
|
||||||
|
// Standard print setup command
|
||||||
|
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerApp construction
|
||||||
|
|
||||||
|
CMySqlManagerApp::CMySqlManagerApp()
|
||||||
|
{
|
||||||
|
// TODO: add construction code here,
|
||||||
|
// Place all significant initialization in InitInstance
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// The one and only CMySqlManagerApp object
|
||||||
|
|
||||||
|
CMySqlManagerApp theApp;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerApp initialization
|
||||||
|
|
||||||
|
BOOL CMySqlManagerApp::InitInstance()
|
||||||
|
{
|
||||||
|
|
||||||
|
WSADATA WsaData;
|
||||||
|
|
||||||
|
if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData))
|
||||||
|
{
|
||||||
|
AfxMessageBox("WSAStartup Failed\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
AfxEnableControlContainer();
|
||||||
|
|
||||||
|
// Standard initialization
|
||||||
|
// If you are not using these features and wish to reduce the size
|
||||||
|
// of your final executable, you should remove from the following
|
||||||
|
// the specific initialization routines you do not need.
|
||||||
|
|
||||||
|
#ifdef _AFXDLL
|
||||||
|
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||||
|
#else
|
||||||
|
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Change the registry key under which our settings are stored.
|
||||||
|
// You should modify this string to be something appropriate
|
||||||
|
// such as the name of your company or organization.
|
||||||
|
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||||
|
|
||||||
|
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
|
||||||
|
|
||||||
|
// Register the application's document templates. Document templates
|
||||||
|
// serve as the connection between documents, frame windows and views.
|
||||||
|
|
||||||
|
CMultiDocTemplate* pDocTemplate;
|
||||||
|
pDocTemplate = new CMultiDocTemplate(
|
||||||
|
IDR_MYSQLMTYPE,
|
||||||
|
RUNTIME_CLASS(CMySqlManagerDoc),
|
||||||
|
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
|
||||||
|
RUNTIME_CLASS(CMySqlManagerView));
|
||||||
|
AddDocTemplate(pDocTemplate);
|
||||||
|
|
||||||
|
// create main MDI Frame window
|
||||||
|
CMainFrame* pMainFrame = new CMainFrame;
|
||||||
|
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
|
||||||
|
return FALSE;
|
||||||
|
m_pMainWnd = pMainFrame;
|
||||||
|
|
||||||
|
// Parse command line for standard shell commands, DDE, file open
|
||||||
|
CCommandLineInfo cmdInfo;
|
||||||
|
ParseCommandLine(cmdInfo);
|
||||||
|
|
||||||
|
// Dispatch commands specified on the command line
|
||||||
|
if (!ProcessShellCommand(cmdInfo))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// The main window has been initialized, so show and update it.
|
||||||
|
pMainFrame->ShowWindow(m_nCmdShow);
|
||||||
|
pMainFrame->UpdateWindow();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CAboutDlg dialog used for App About
|
||||||
|
|
||||||
|
class CAboutDlg : public CDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAboutDlg();
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CAboutDlg)
|
||||||
|
enum {IDD = IDD_ABOUTBOX};
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CAboutDlg)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CAboutDlg)
|
||||||
|
// No message handlers
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CAboutDlg)
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CAboutDlg)
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CAboutDlg)
|
||||||
|
// No message handlers
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
// App command to run the dialog
|
||||||
|
void CMySqlManagerApp::OnAppAbout()
|
||||||
|
{
|
||||||
|
CAboutDlg aboutDlg;
|
||||||
|
aboutDlg.DoModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerApp commands
|
50
VC++Files/mysqlmanager/mysqlmanager.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// MySqlManager.h : main header file for the MYSQLMANAGER application
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_MYSQLMANAGER_H__826CB2EA_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_MYSQLMANAGER_H__826CB2EA_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error include 'stdafx.h' before including this file for PCH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // main symbols
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerApp:
|
||||||
|
// See MySqlManager.cpp for the implementation of this class
|
||||||
|
//
|
||||||
|
|
||||||
|
class CMySqlManagerApp : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMySqlManagerApp();
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMySqlManagerApp)
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
|
||||||
|
//{{AFX_MSG(CMySqlManagerApp)
|
||||||
|
afx_msg void OnAppAbout();
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MYSQLMANAGER_H__826CB2EA_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
572
VC++Files/mysqlmanager/mysqlmanager.rc
Normal file
@ -0,0 +1,572 @@
|
|||||||
|
//Microsoft Developer Studio generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||||
|
"\r\n"
|
||||||
|
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
|
||||||
|
"#ifdef _WIN32\r\n"
|
||||||
|
"LANGUAGE 9, 1\r\n"
|
||||||
|
"#pragma code_page(1252)\r\n"
|
||||||
|
"#endif\r\n"
|
||||||
|
"#include ""res\\MySqlManager.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||||
|
"#include ""afxres.rc"" // Standard components\r\n"
|
||||||
|
"#include ""afxprint.rc"" // printing/print preview resources\r\n"
|
||||||
|
"#endif\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
IDR_MAINFRAME ICON DISCARDABLE "res\\MySqlManager.ico"
|
||||||
|
IDR_MYSQLMTYPE ICON DISCARDABLE "res\\MySqlManagerDoc.ico"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Bitmap
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
|
||||||
|
IDB_BITMAP1 BITMAP DISCARDABLE "res\\bitmap3.bmp"
|
||||||
|
IDB_QUERY_EXECU BITMAP FIXED IMPURE "res\\query_ex.bmp"
|
||||||
|
IDB_QUERY_EXECD BITMAP FIXED IMPURE "res\\bmp00001.bmp"
|
||||||
|
IDB_FONTU BITMAP FIXED IMPURE "res\\fontu.bmp"
|
||||||
|
IDB_FONTD BITMAP FIXED IMPURE "res\\fontd.bmp"
|
||||||
|
IDB_DATABASESU BITMAP FIXED IMPURE "res\\database.bmp"
|
||||||
|
IDB_DATABASESD BITMAP FIXED IMPURE "res\\bmp00002.bmp"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Toolbar
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
|
||||||
|
BEGIN
|
||||||
|
BUTTON ID_FILE_NEW
|
||||||
|
BUTTON ID_FILE_OPEN
|
||||||
|
BUTTON ID_FILE_SAVE
|
||||||
|
SEPARATOR
|
||||||
|
BUTTON ID_EDIT_CUT
|
||||||
|
BUTTON ID_EDIT_COPY
|
||||||
|
BUTTON ID_EDIT_PASTE
|
||||||
|
SEPARATOR
|
||||||
|
BUTTON ID_FILE_PRINT
|
||||||
|
BUTTON ID_APP_ABOUT
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Menu
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
POPUP "&File"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
|
||||||
|
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "E&xit", ID_APP_EXIT
|
||||||
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
|
||||||
|
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
|
||||||
|
END
|
||||||
|
POPUP "&Help"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&About MySqlManager...", ID_APP_ABOUT
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
IDR_MYSQLMTYPE MENU PRELOAD DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
POPUP "&File"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
|
||||||
|
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
|
||||||
|
MENUITEM "&Close", ID_FILE_CLOSE
|
||||||
|
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
|
||||||
|
MENUITEM "Save &As...", ID_FILE_SAVE_AS
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT
|
||||||
|
MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW
|
||||||
|
MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "E&xit", ID_APP_EXIT
|
||||||
|
END
|
||||||
|
POPUP "&Edit"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
|
||||||
|
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
|
||||||
|
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
|
||||||
|
END
|
||||||
|
POPUP "&Tools"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "SQL &Query", IDM_SQL_TOOL_QUERY
|
||||||
|
MENUITEM "Register Server", IDM_TOOLS_REGISTER_SERVER
|
||||||
|
MENUITEM "Server Properties", IDM_TOOLS_SERVER_PROPERTIES
|
||||||
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
|
||||||
|
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
|
||||||
|
END
|
||||||
|
POPUP "&Window"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&New Window", ID_WINDOW_NEW
|
||||||
|
MENUITEM "&Cascade", ID_WINDOW_CASCADE
|
||||||
|
MENUITEM "&Tile", ID_WINDOW_TILE_HORZ
|
||||||
|
MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE
|
||||||
|
END
|
||||||
|
POPUP "&Help"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&About MySqlManager...", ID_APP_ABOUT
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Accelerator
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
|
||||||
|
BEGIN
|
||||||
|
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"D", IDM_QUERY_DATABASES, VIRTKEY, ALT, NOINVERT
|
||||||
|
"E", IDM_QUERY_EXEC, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
|
||||||
|
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
|
||||||
|
VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
|
||||||
|
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
|
||||||
|
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
|
||||||
|
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"X", IDM_QUERY_EXEC, VIRTKEY, ALT, NOINVERT
|
||||||
|
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Dialog
|
||||||
|
//
|
||||||
|
|
||||||
|
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 234, 72
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "About MySqlManager"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
|
||||||
|
LTEXT "MySqlManager Version 1.0.2",IDC_STATIC,37,10,119,8,
|
||||||
|
SS_NOPREFIX
|
||||||
|
LTEXT "By James Pereira (jpereira@iafrica.com)",IDC_STATIC,37,
|
||||||
|
49,146,9
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,195,7,32,14,WS_GROUP
|
||||||
|
LTEXT "This file is public domain and comes with NO WARRANTY of any kind",
|
||||||
|
IDC_STATIC,38,25,136,18,SS_SUNKEN
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_TOOL_SQL DIALOGEX 0, 0, 452, 246
|
||||||
|
STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION |
|
||||||
|
WS_SYSMENU | WS_THICKFRAME
|
||||||
|
EXSTYLE WS_EX_CLIENTEDGE
|
||||||
|
CAPTION "mySQL Query Tool"
|
||||||
|
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||||
|
BEGIN
|
||||||
|
PUSHBUTTON "OK",IDOK,369,10,12,14,NOT WS_VISIBLE
|
||||||
|
DEFPUSHBUTTON "Close",IDCANCEL,391,10,50,14
|
||||||
|
CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,11,26,434,213
|
||||||
|
CONTROL "IDB_QUERY_EXEC",IDC_QUERY_PB,"Button",BS_OWNERDRAW |
|
||||||
|
WS_TABSTOP,106,10,12,14
|
||||||
|
CONTROL "IDB_FONT",IDC_FONT_PB,"Button",BS_OWNERDRAW |
|
||||||
|
WS_TABSTOP,123,10,12,14
|
||||||
|
COMBOBOX IDC_SERVER_CB,12,9,85,128,CBS_DROPDOWN | CBS_SORT |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
CONTROL "IDB_DATABASES",IDC_DATABASES_PB,"Button",BS_OWNERDRAW |
|
||||||
|
WS_TABSTOP,142,10,12,14
|
||||||
|
DEFPUSHBUTTON "&Start",IDC_START_PB,315,10,23,14
|
||||||
|
DEFPUSHBUTTON "S&top",IDC_STOP_PB,343,10,23,14
|
||||||
|
EDITTEXT IDC_TIMER_SECS,287,10,22,14,ES_AUTOHSCROLL
|
||||||
|
LTEXT "Interval (s)",IDC_STATIC,249,11,34,8
|
||||||
|
CONTROL "Clear",IDC_CLEAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||||
|
215,11,29,10
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_TOOL_SQL_QUERY DIALOG DISCARDABLE 0, 0, 452, 247
|
||||||
|
STYLE WS_CHILD | WS_BORDER
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
EDITTEXT IDC_EDIT,11,11,434,229,ES_MULTILINE | ES_AUTOVSCROLL |
|
||||||
|
ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_TOOL_SQL_RESULTS DIALOG DISCARDABLE 0, 0, 452, 247
|
||||||
|
STYLE WS_CHILD | WS_BORDER
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
EDITTEXT IDC_EDIT,11,11,434,229,ES_MULTILINE | ES_AUTOVSCROLL |
|
||||||
|
ES_AUTOHSCROLL | WS_VSCROLL
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_REGISTER_SERVER DIALOG FIXED IMPURE 0, 0, 281, 199
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Register Server"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "",-1,5,0,270,195
|
||||||
|
LTEXT "&Server:",-1,12,14,25,8
|
||||||
|
COMBOBOX ID_SERVER_CB,46,12,159,60,CBS_DROPDOWN | CBS_AUTOHSCROLL |
|
||||||
|
CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||||
|
LTEXT "&Host",-1,12,33,25,8
|
||||||
|
COMBOBOX ID_HOST_CB,46,31,159,60,CBS_DROPDOWN | CBS_AUTOHSCROLL |
|
||||||
|
CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||||
|
LTEXT "&Port",-1,12,53,25,8
|
||||||
|
COMBOBOX ID_PORT_CB,46,50,159,60,CBS_DROPDOWN | CBS_AUTOHSCROLL |
|
||||||
|
CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||||
|
GROUPBOX "Login Information",-1,12,82,194,76
|
||||||
|
CONTROL "Use S&tandard Security",ID_USE_STANDARD_CK,"Button",
|
||||||
|
BS_AUTORADIOBUTTON | WS_GROUP,19,107,94,11
|
||||||
|
CONTROL "Use Tr&usted Connection",ID_USE_TRUSTED_CK,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,19,94,99,11
|
||||||
|
LTEXT "&Login ID:",1060,37,124,35,8
|
||||||
|
EDITTEXT ID_USER,77,122,120,12,ES_AUTOHSCROLL | WS_GROUP
|
||||||
|
LTEXT "&Password:",1061,37,140,35,8
|
||||||
|
EDITTEXT ID_PASSWORD,77,138,120,12,ES_PASSWORD | ES_AUTOHSCROLL
|
||||||
|
LTEXT "S&erver Group:",-1,12,164,24,25
|
||||||
|
CONTROL "&Display Server Status in Server Manager",
|
||||||
|
ID_DISPLAY_SERVER_STATUS_CK,"Button",BS_AUTOCHECKBOX |
|
||||||
|
WS_TABSTOP,44,168,152,10
|
||||||
|
DEFPUSHBUTTON "&Register",IDOK,214,11,53,14
|
||||||
|
PUSHBUTTON "Re&move",ID_REMOVE_PB,214,27,53,14
|
||||||
|
PUSHBUTTON "&Close",IDCANCEL,214,43,53,14
|
||||||
|
PUSHBUTTON "&Help",ID_HELP,214,59,53,14
|
||||||
|
PUSHBUTTON "Ser&vers...",ID_SERVERS_PB,214,92,53,14
|
||||||
|
PUSHBUTTON "&Groups...",ID_GROUPS_PB,214,108,53,14
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_TOOL_SQL_STATUS DIALOG DISCARDABLE 0, 0, 452, 247
|
||||||
|
STYLE WS_CHILD | WS_BORDER
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
EDITTEXT IDC_EDIT,11,11,434,229,ES_MULTILINE | ES_AUTOVSCROLL |
|
||||||
|
ES_AUTOHSCROLL | WS_VSCROLL
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _MAC
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 1,0,0,2
|
||||||
|
PRODUCTVERSION 1,0,0,2
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x4L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "\0"
|
||||||
|
VALUE "FileDescription", "MySqlManager MFC Application\0"
|
||||||
|
VALUE "FileVersion", "1, 0, 0, 2\0"
|
||||||
|
VALUE "InternalName", "MySqlManager\0"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 1998\0"
|
||||||
|
VALUE "OriginalFilename", "MySqlManager.EXE\0"
|
||||||
|
VALUE "ProductName", "MySqlManager Application\0"
|
||||||
|
VALUE "ProductVersion", "1, 0, 0, 2\0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // !_MAC
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DESIGNINFO
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
GUIDELINES DESIGNINFO DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDD_ABOUTBOX, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 6
|
||||||
|
RIGHTMARGIN, 227
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 65
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_TOOL_SQL, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 445
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 239
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_TOOL_SQL_QUERY, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 445
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 240
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_TOOL_SQL_RESULTS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 445
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 240
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_TOOL_SQL_STATUS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 445
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 240
|
||||||
|
END
|
||||||
|
END
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// String Table
|
||||||
|
//
|
||||||
|
|
||||||
|
STRINGTABLE PRELOAD DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDR_MAINFRAME "MySqlManager"
|
||||||
|
IDR_MYSQLMTYPE "\nMySqlM\nMySqlM\n\n\nMySqlManager.Document\nMySqlM Document"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE PRELOAD DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
AFX_IDS_APP_TITLE "MySqlManager"
|
||||||
|
AFX_IDS_IDLEMESSAGE "Ready"
|
||||||
|
IDS_QUERY_DATABASES "Query Database(s)"
|
||||||
|
IDS_REFRESH "Refresh"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_INDICATOR_EXT "EXT"
|
||||||
|
ID_INDICATOR_CAPS "CAP"
|
||||||
|
ID_INDICATOR_NUM "NUM"
|
||||||
|
ID_INDICATOR_SCRL "SCRL"
|
||||||
|
ID_INDICATOR_OVR "OVR"
|
||||||
|
ID_INDICATOR_REC "REC"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_FILE_NEW "Create a new document\nNew"
|
||||||
|
ID_FILE_OPEN "Open an existing document\nOpen"
|
||||||
|
ID_FILE_CLOSE "Close the active document\nClose"
|
||||||
|
ID_FILE_SAVE "Save the active document\nSave"
|
||||||
|
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
|
||||||
|
ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup"
|
||||||
|
ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup"
|
||||||
|
ID_FILE_PRINT "Print the active document\nPrint"
|
||||||
|
ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
|
||||||
|
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_FILE_MRU_FILE1 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE2 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE3 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE4 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE5 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE6 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE7 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE8 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE9 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE10 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE11 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE12 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE13 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE14 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE15 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE16 "Open this document"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
|
||||||
|
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_WINDOW_NEW "Open another window for the active document\nNew Window"
|
||||||
|
ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
|
||||||
|
ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
|
||||||
|
ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
|
||||||
|
ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
|
||||||
|
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_EDIT_CLEAR "Erase the selection\nErase"
|
||||||
|
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
|
||||||
|
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
|
||||||
|
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
|
||||||
|
ID_EDIT_FIND "Find the specified text\nFind"
|
||||||
|
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
|
||||||
|
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
|
||||||
|
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
|
||||||
|
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
|
||||||
|
ID_EDIT_UNDO "Undo the last action\nUndo"
|
||||||
|
ID_EDIT_REDO "Redo the previously undone action\nRedo"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
|
||||||
|
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
AFX_IDS_SCSIZE "Change the window size"
|
||||||
|
AFX_IDS_SCMOVE "Change the window position"
|
||||||
|
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
|
||||||
|
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
|
||||||
|
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
|
||||||
|
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
|
||||||
|
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
AFX_IDS_SCRESTORE "Restore the window to normal size"
|
||||||
|
AFX_IDS_SCTASKLIST "Activate Task List"
|
||||||
|
AFX_IDS_MDICHILD "Activate this window"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDC_QUERY_PB "Execute Query"
|
||||||
|
IDS_QUERY_EXEC "Execute Query"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
#define _AFX_NO_SPLITTER_RESOURCES
|
||||||
|
#define _AFX_NO_OLE_RESOURCES
|
||||||
|
#define _AFX_NO_TRACKER_RESOURCES
|
||||||
|
#define _AFX_NO_PROPERTY_RESOURCES
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE 9, 1
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif
|
||||||
|
#include "res\MySqlManager.rc2" // non-Microsoft Visual C++ edited resources
|
||||||
|
#include "afxres.rc" // Standard components
|
||||||
|
#include "afxprint.rc" // printing/print preview resources
|
||||||
|
#endif
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
84
VC++Files/mysqlmanager/mysqlmanagerdoc.cpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// MySqlManagerDoc.cpp : implementation of the CMySqlManagerDoc class
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MySqlManager.h"
|
||||||
|
|
||||||
|
#include "MySqlManagerDoc.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerDoc
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CMySqlManagerDoc, CDocument)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMySqlManagerDoc, CDocument)
|
||||||
|
//{{AFX_MSG_MAP(CMySqlManagerDoc)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code!
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerDoc construction/destruction
|
||||||
|
|
||||||
|
CMySqlManagerDoc::CMySqlManagerDoc()
|
||||||
|
{
|
||||||
|
// TODO: add one-time construction code here
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMySqlManagerDoc::~CMySqlManagerDoc()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMySqlManagerDoc::OnNewDocument()
|
||||||
|
{
|
||||||
|
if (!CDocument::OnNewDocument())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// TODO: add reinitialization code here
|
||||||
|
// (SDI documents will reuse this document)
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerDoc serialization
|
||||||
|
|
||||||
|
void CMySqlManagerDoc::Serialize(CArchive& ar)
|
||||||
|
{
|
||||||
|
if (ar.IsStoring())
|
||||||
|
{
|
||||||
|
// TODO: add storing code here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: add loading code here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerDoc diagnostics
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CMySqlManagerDoc::AssertValid() const
|
||||||
|
{
|
||||||
|
CDocument::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMySqlManagerDoc::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CDocument::Dump(dc);
|
||||||
|
}
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMySqlManagerDoc commands
|
57
VC++Files/mysqlmanager/mysqlmanagerdoc.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// MySqlManagerDoc.h : interface of the CMySqlManagerDoc class
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if !defined(AFX_MYSQLMANAGERDOC_H__826CB2F2_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_MYSQLMANAGERDOC_H__826CB2F2_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
|
||||||
|
class CMySqlManagerDoc : public CDocument
|
||||||
|
{
|
||||||
|
protected: // create from serialization only
|
||||||
|
CMySqlManagerDoc();
|
||||||
|
DECLARE_DYNCREATE(CMySqlManagerDoc)
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMySqlManagerDoc)
|
||||||
|
public:
|
||||||
|
virtual BOOL OnNewDocument();
|
||||||
|
virtual void Serialize(CArchive& ar);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CMySqlManagerDoc();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CMySqlManagerDoc)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MYSQLMANAGERDOC_H__826CB2F2_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
849
VC++Files/mysqlmanager/mysqlmanagerview.cpp
Normal file
@ -0,0 +1,849 @@
|
|||||||
|
// MySqlManagerView.cpp : implementation of the CMySqlManagerView class
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MySqlManager.h"
|
||||||
|
#include "MySqlManagerDoc.h"
|
||||||
|
#include "MySqlManagerView.h"
|
||||||
|
#include "mainfrm.h"
|
||||||
|
#include "ToolSql.h"
|
||||||
|
#include "RegisterServer.h"
|
||||||
|
|
||||||
|
class XStatus
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XStatus ( LPCSTR fmt, ... )
|
||||||
|
{
|
||||||
|
char buf [2048];
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
int ret = vsprintf(buf, fmt, args);
|
||||||
|
MainFrame->StatusMsg ( "%s", buf );
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
~XStatus()
|
||||||
|
{
|
||||||
|
MainFrame->StatusMsg ( " ");
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
XStatus();
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CMySqlManagerView, CTreeView)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMySqlManagerView, CTreeView)
|
||||||
|
//{{AFX_MSG_MAP(CMySqlManagerView)
|
||||||
|
ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
|
||||||
|
ON_COMMAND(IDM_SQL_TOOL_QUERY, OnSqlToolQuery)
|
||||||
|
ON_COMMAND(IDM_REFRESH, OnRefresh)
|
||||||
|
ON_COMMAND(IDM_TOOLS_SERVER_PROPERTIES,OnServerProperties)
|
||||||
|
ON_COMMAND(IDM_TOOLS_REGISTER_SERVER, OnRegisterServer)
|
||||||
|
ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
// Standard printing commands
|
||||||
|
ON_COMMAND(ID_FILE_PRINT, CTreeView::OnFilePrint)
|
||||||
|
ON_COMMAND(ID_FILE_PRINT_DIRECT, CTreeView::OnFilePrint)
|
||||||
|
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CTreeView::OnFilePrintPreview)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CMySqlManagerView::CMySqlManagerView()
|
||||||
|
: m_pTree(0)
|
||||||
|
, m_pImages(0)
|
||||||
|
, m_pbmBmp(0)
|
||||||
|
, m_pTool(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CMySqlManagerView::~CMySqlManagerView()
|
||||||
|
{
|
||||||
|
if ( m_pbmBmp ) delete m_pbmBmp;
|
||||||
|
if ( m_pImages ) delete m_pImages;
|
||||||
|
if ( m_pTool )
|
||||||
|
{
|
||||||
|
m_pTool->DestroyWindow();
|
||||||
|
delete m_pTool;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL CMySqlManagerView::PreCreateWindow(CREATESTRUCT& cs)
|
||||||
|
{
|
||||||
|
return CTreeView::PreCreateWindow(cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnDraw(CDC* pDC)
|
||||||
|
{
|
||||||
|
CMySqlManagerDoc* pDoc = GetDocument();
|
||||||
|
ASSERT_VALID(pDoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL CMySqlManagerView::OnPreparePrinting(CPrintInfo* pInfo)
|
||||||
|
{
|
||||||
|
return DoPreparePrinting(pInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CMySqlManagerView::AssertValid() const
|
||||||
|
{
|
||||||
|
CTreeView::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CTreeView::Dump(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CMySqlManagerDoc* CMySqlManagerView::GetDocument() // non-debug version is inline
|
||||||
|
{
|
||||||
|
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMySqlManagerDoc)));
|
||||||
|
return (CMySqlManagerDoc*)m_pDocument;
|
||||||
|
}
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnInitialUpdate()
|
||||||
|
{
|
||||||
|
|
||||||
|
CTreeView::OnInitialUpdate();
|
||||||
|
|
||||||
|
m_pTree = & GetTreeCtrl();
|
||||||
|
m_pImages = new CImageList;
|
||||||
|
m_pImages->Create( 16, 16, FALSE, 0, 10 );
|
||||||
|
m_pbmBmp = new CBitmap;
|
||||||
|
m_pbmBmp->LoadBitmap( IDB_BITMAP1 );
|
||||||
|
m_pImages->Add( m_pbmBmp, (COLORREF)0 );
|
||||||
|
m_pTree->SetImageList( m_pImages, TVSIL_NORMAL );
|
||||||
|
|
||||||
|
HTREEITEM h = AddResource ( TVI_ROOT, new CResourceServer ( "MySQL", "localhost", "root", "" ) );
|
||||||
|
// AddResource ( h, new CResourceProcesslist () );
|
||||||
|
h = AddResource ( TVI_ROOT, new CResourceServer ( "Test", "localhost", "test", "" ) );
|
||||||
|
// AddResource ( h, new CResourceProcesslist () );
|
||||||
|
|
||||||
|
m_pTree->ModifyStyle(0, TVS_HASLINES|TVS_HASBUTTONS);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HTREEITEM CMySqlManagerView::AddResource ( HTREEITEM hParent, CResource* pRes, HTREEITEM hLastItem )
|
||||||
|
{
|
||||||
|
|
||||||
|
TV_INSERTSTRUCT ItemStruct;
|
||||||
|
memset( &ItemStruct, 0, sizeof(ItemStruct) );
|
||||||
|
ItemStruct.hParent = hParent;
|
||||||
|
ItemStruct.hInsertAfter = hLastItem;
|
||||||
|
ItemStruct.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_IMAGE;
|
||||||
|
ItemStruct.item.hItem = 0;
|
||||||
|
ItemStruct.item.state = 0;
|
||||||
|
ItemStruct.item.stateMask = 0;
|
||||||
|
ItemStruct.item.pszText = (LPSTR) pRes->GetDisplayName();
|
||||||
|
ItemStruct.item.cchTextMax = (int) strlen( ItemStruct.item.pszText );
|
||||||
|
ItemStruct.item.iImage = 2;
|
||||||
|
ItemStruct.item.iSelectedImage = 3;
|
||||||
|
ItemStruct.item.cChildren = 0;
|
||||||
|
ItemStruct.item.lParam = (long) pRes;
|
||||||
|
hLastItem = m_pTree->InsertItem( &ItemStruct );
|
||||||
|
return hLastItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
//int InsertNetResources( LPNETRESOURCE lpNetResource, CTreeCtrl *pTreeCtrl, HTREEITEM hParent, int *pnCount )
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
// DWORD Erc;
|
||||||
|
// NETRESOURCE *pNetRes;
|
||||||
|
// HANDLE hEnum;
|
||||||
|
//
|
||||||
|
// if( !pTreeCtrl ) return -1;
|
||||||
|
// if( pnCount ) *pnCount = 0;
|
||||||
|
// Erc = WNetOpenEnum(
|
||||||
|
// RESOURCE_GLOBALNET,//DWORD dwScope, // scope of enumeration
|
||||||
|
// RESOURCETYPE_ANY,//DWORD dwType, // resource types to list
|
||||||
|
// 0,//DWORD dwUsage, // resource usage to list
|
||||||
|
// lpNetResource,//LPNETRESOURCE lpNetResource, // pointer to resource structure
|
||||||
|
// &hEnum//LPHANDLE lphEnum // pointer to enumeration handle buffer
|
||||||
|
// );
|
||||||
|
// if( Erc )
|
||||||
|
// {
|
||||||
|
// ShowError( Erc );
|
||||||
|
// return Erc;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// DWORD dwBufferSize = 1024;
|
||||||
|
// pNetRes = (NETRESOURCE *)malloc( dwBufferSize );
|
||||||
|
//
|
||||||
|
// while( TRUE )
|
||||||
|
// {
|
||||||
|
// DWORD dwCount = 0xFFFFFFFF;
|
||||||
|
// Erc = WNetEnumResource(
|
||||||
|
// hEnum,//HANDLE hEnum, // handle to enumeration
|
||||||
|
// &dwCount,//LPDWORD lpcCount, // pointer to entries to list
|
||||||
|
// pNetRes,//LPVOID lpBuffer, // pointer to buffer for results
|
||||||
|
// &dwBufferSize//LPDWORD lpBufferSize // pointer to buffer size variable
|
||||||
|
// );
|
||||||
|
// if( Erc == ERROR_NO_MORE_ITEMS ) return 0;
|
||||||
|
// if( Erc )
|
||||||
|
// {
|
||||||
|
// free( pNetRes );
|
||||||
|
// pNetRes = (NETRESOURCE *)malloc( dwBufferSize );
|
||||||
|
// Erc = WNetEnumResource(
|
||||||
|
// hEnum,//HANDLE hEnum, // handle to enumeration
|
||||||
|
// &dwCount,//LPDWORD lpcCount, // pointer to entries to list
|
||||||
|
// pNetRes,//LPVOID lpBuffer, // pointer to buffer for results
|
||||||
|
// &dwBufferSize//LPDWORD lpBufferSize // pointer to buffer size variable
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// if( Erc ){ ShowError( Erc ); return Erc; }
|
||||||
|
//
|
||||||
|
// TV_INSERTSTRUCT ItemStruct;
|
||||||
|
// HTREEITEM hLastItem = TVI_FIRST;
|
||||||
|
// DWORD i;
|
||||||
|
//
|
||||||
|
// if( pnCount ) *pnCount += dwCount;
|
||||||
|
// for( i=0; i<dwCount; i++ )
|
||||||
|
// {
|
||||||
|
// memset( &ItemStruct, 0, sizeof(ItemStruct) );
|
||||||
|
// ItemStruct.hParent = hParent;
|
||||||
|
// ItemStruct.hInsertAfter = hLastItem;
|
||||||
|
// ItemStruct.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_IMAGE;
|
||||||
|
// ItemStruct.item.hItem = 0;
|
||||||
|
// ItemStruct.item.state = 0;
|
||||||
|
// ItemStruct.item.stateMask = 0;
|
||||||
|
// ItemStruct.item.pszText = pNetRes[i].lpRemoteName;
|
||||||
|
// ItemStruct.item.cchTextMax = strlen( ItemStruct.item.pszText );
|
||||||
|
// ItemStruct.item.iImage = 2;
|
||||||
|
// ItemStruct.item.iSelectedImage = 3;
|
||||||
|
// ItemStruct.item.cChildren = 0;
|
||||||
|
// ItemStruct.item.lParam = (long) (new CNetResource( &pNetRes[i] ));
|
||||||
|
//
|
||||||
|
// hLastItem = pTreeCtrl->InsertItem( &ItemStruct );
|
||||||
|
// }
|
||||||
|
// }//end while()
|
||||||
|
//
|
||||||
|
// WNetCloseEnum( hEnum );
|
||||||
|
// free( pNetRes );
|
||||||
|
// return Erc;
|
||||||
|
//}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static void print_top(MYSQL_RES *result)
|
||||||
|
{
|
||||||
|
uint length;
|
||||||
|
MYSQL_FIELD *field;
|
||||||
|
mysql_field_seek(result,0);
|
||||||
|
while ((field = mysql_fetch_field(result)))
|
||||||
|
{
|
||||||
|
if ((length= (uint) strlen(field->name)) > field->max_length)
|
||||||
|
field->max_length=length;
|
||||||
|
else
|
||||||
|
length=field->max_length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static void print_header(MYSQL_RES *result,CStringArray& rg)
|
||||||
|
{
|
||||||
|
MYSQL_FIELD *field;
|
||||||
|
print_top(result);
|
||||||
|
mysql_field_seek(result,0);
|
||||||
|
while ((field = mysql_fetch_field(result)))
|
||||||
|
{
|
||||||
|
// printf(" %-*s|",field->max_length+1,field->name);
|
||||||
|
rg.Add(field->name);
|
||||||
|
}
|
||||||
|
print_top(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static void print_row(MYSQL_RES *result,MYSQL_ROW row,CStringArray& rg)
|
||||||
|
{
|
||||||
|
uint i,length;
|
||||||
|
MYSQL_FIELD *field;
|
||||||
|
mysql_field_seek(result,0);
|
||||||
|
for (i=0 ; i < mysql_num_fields(result); i++)
|
||||||
|
{
|
||||||
|
field = mysql_fetch_field(result);
|
||||||
|
length=field->max_length;
|
||||||
|
rg.Add(row[i] ? (char*) row[i] : "");
|
||||||
|
// printf(" %-*s|",length+1,row[i] ? (char*) row[i] : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::ProcessResultSet ( HTREEITEM hItem, LPVOID r, CResource* pResource )
|
||||||
|
{
|
||||||
|
|
||||||
|
MYSQL_RES* result = (MYSQL_RES *) r;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
switch (pResource->GetType())
|
||||||
|
{
|
||||||
|
case CResource::eProcesslist:
|
||||||
|
{
|
||||||
|
CResourceProcesslist* p = (CResourceProcesslist*) pResource;
|
||||||
|
CResourceProcesslistItem* pi = new CResourceProcesslistItem ();
|
||||||
|
CString strText;
|
||||||
|
print_header(result,p->m_rgFields);
|
||||||
|
for (int i = 0; i<p->m_rgFields.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
strText += p->m_rgFields[i];
|
||||||
|
strText += " ";
|
||||||
|
}
|
||||||
|
pi->m_strName = strText;
|
||||||
|
AddResource ( hItem, pi );
|
||||||
|
for (int index=0;(row=mysql_fetch_row(result));index++)
|
||||||
|
{
|
||||||
|
pi = new CResourceProcesslistItem ();
|
||||||
|
print_row(result,row,pi->m_rgFields);
|
||||||
|
strText.Empty();
|
||||||
|
for (int i = 0; i<pi->m_rgFields.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
strText += pi->m_rgFields[i];
|
||||||
|
strText += " ";
|
||||||
|
}
|
||||||
|
pi->m_strName = strText;
|
||||||
|
AddResource ( hItem, pi );
|
||||||
|
}
|
||||||
|
print_top(result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CResource::eServer:
|
||||||
|
{
|
||||||
|
CResourceServer* p = (CResourceServer*) pResource;
|
||||||
|
CResourceDatabase* pi = new CResourceDatabase ();
|
||||||
|
CString strText;
|
||||||
|
/* print_header(result,p->m_rgFields); */
|
||||||
|
for (int i = 0; i<p->m_rgFields.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
strText += p->m_rgFields[i];
|
||||||
|
strText += " ";
|
||||||
|
}
|
||||||
|
pi->m_strName = strText;
|
||||||
|
/* AddResource ( hItem, pi ); */
|
||||||
|
for (int index=0;(row=mysql_fetch_row(result));index++)
|
||||||
|
{
|
||||||
|
pi = new CResourceDatabase ();
|
||||||
|
print_row(result,row,pi->m_rgFields);
|
||||||
|
strText.Empty();
|
||||||
|
for (int i = 0; i<pi->m_rgFields.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
strText += pi->m_rgFields[i];
|
||||||
|
strText += " ";
|
||||||
|
}
|
||||||
|
pi->m_strName = strText;
|
||||||
|
AddResource ( hItem, pi );
|
||||||
|
}
|
||||||
|
print_top(result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CResource::eDatabase:
|
||||||
|
{
|
||||||
|
CResourceDatabase* p = (CResourceDatabase*) pResource;
|
||||||
|
CResourceTable* pi = new CResourceTable ();
|
||||||
|
CString strText;
|
||||||
|
/* print_header(result,p->m_rgFields); */
|
||||||
|
for (int i = 0; i<p->m_rgFields.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
strText += p->m_rgFields[i];
|
||||||
|
strText += " ";
|
||||||
|
}
|
||||||
|
pi->m_strName = strText;
|
||||||
|
/* AddResource ( hItem, pi ); */
|
||||||
|
for (int index=0;(row=mysql_fetch_row(result));index++)
|
||||||
|
{
|
||||||
|
pi = new CResourceTable ();
|
||||||
|
print_row(result,row,pi->m_rgFields);
|
||||||
|
strText.Empty();
|
||||||
|
for (int i = 0; i<pi->m_rgFields.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
strText += pi->m_rgFields[i];
|
||||||
|
strText += " ";
|
||||||
|
}
|
||||||
|
pi->m_strName = strText;
|
||||||
|
AddResource ( hItem, pi );
|
||||||
|
}
|
||||||
|
print_top(result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CResource::eTable:
|
||||||
|
{
|
||||||
|
CResourceTable* p = (CResourceTable*) pResource;
|
||||||
|
CResourceField* pi = new CResourceField ();
|
||||||
|
CString strText;
|
||||||
|
/* print_header(result,p->m_rgFields); */
|
||||||
|
for (int i = 0; i<p->m_rgFields.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
strText += p->m_rgFields[i];
|
||||||
|
strText += " ";
|
||||||
|
}
|
||||||
|
pi->m_strName = strText;
|
||||||
|
/* AddResource ( hItem, pi ); */
|
||||||
|
for (int index=0;(row=mysql_fetch_row(result));index++)
|
||||||
|
{
|
||||||
|
pi = new CResourceField ();
|
||||||
|
print_row(result,row,pi->m_rgFields);
|
||||||
|
strText.Empty();
|
||||||
|
for (int i = 0; i<pi->m_rgFields.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
strText += pi->m_rgFields[i];
|
||||||
|
strText += " ";
|
||||||
|
}
|
||||||
|
pi->m_strName = strText;
|
||||||
|
AddResource ( hItem, pi );
|
||||||
|
}
|
||||||
|
print_top(result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CResource* CMySqlManagerView::GetSelectedResource(HTREEITEM* phItemRet)
|
||||||
|
{
|
||||||
|
CResource* pResource = NULL;
|
||||||
|
HTREEITEM hItem = m_pTree->GetSelectedItem();
|
||||||
|
if ( hItem )
|
||||||
|
{
|
||||||
|
TV_ITEM item;
|
||||||
|
memset( &item, 0, sizeof(TV_ITEM) );
|
||||||
|
item.hItem = hItem;
|
||||||
|
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
|
||||||
|
m_pTree->GetItem( &item );
|
||||||
|
if ( item.lParam )
|
||||||
|
{
|
||||||
|
pResource = (CResource*) item.lParam;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (phItemRet)
|
||||||
|
{
|
||||||
|
*phItemRet = hItem;
|
||||||
|
}
|
||||||
|
return pResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CResourceServer* CMySqlManagerView::GetServerResource(HTREEITEM hItem)
|
||||||
|
{
|
||||||
|
|
||||||
|
TV_ITEM item;
|
||||||
|
|
||||||
|
memset( &item, 0, sizeof(TV_ITEM) );
|
||||||
|
item.hItem = hItem;
|
||||||
|
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
|
||||||
|
m_pTree->GetItem( &item );
|
||||||
|
if ( !item.lParam ) return NULL;
|
||||||
|
|
||||||
|
CResource* pResource = (CResource*) item.lParam;
|
||||||
|
|
||||||
|
switch (pResource->GetType())
|
||||||
|
{
|
||||||
|
case CResource::eServer:
|
||||||
|
{
|
||||||
|
return (CResourceServer*) pResource;
|
||||||
|
}
|
||||||
|
case CResource::eDatabase:
|
||||||
|
{
|
||||||
|
HTREEITEM hParent = m_pTree->GetParentItem(hItem);
|
||||||
|
memset( &item, 0, sizeof(TV_ITEM) );
|
||||||
|
item.hItem = hParent;
|
||||||
|
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
|
||||||
|
m_pTree->GetItem( &item );
|
||||||
|
if ( !item.lParam ) return NULL;
|
||||||
|
return (CResourceServer*) item.lParam;
|
||||||
|
}
|
||||||
|
case CResource::eTable:
|
||||||
|
{
|
||||||
|
HTREEITEM hParent = m_pTree->GetParentItem(m_pTree->GetParentItem(hItem));
|
||||||
|
memset( &item, 0, sizeof(TV_ITEM) );
|
||||||
|
item.hItem = hParent;
|
||||||
|
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
|
||||||
|
m_pTree->GetItem( &item );
|
||||||
|
if ( !item.lParam ) return NULL;
|
||||||
|
return (CResourceServer*) item.lParam;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
HTREEITEM hItem;
|
||||||
|
hItem = m_pTree->GetSelectedItem();
|
||||||
|
*pResult = 0;
|
||||||
|
if ( !hItem ) return;
|
||||||
|
|
||||||
|
TV_ITEM item;
|
||||||
|
memset( &item, 0, sizeof(TV_ITEM) );
|
||||||
|
item.hItem = hItem;
|
||||||
|
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
|
||||||
|
m_pTree->GetItem( &item );
|
||||||
|
|
||||||
|
if ( ! item.lParam ) return;
|
||||||
|
|
||||||
|
if ( item.cChildren ) return; //if has got children expand only
|
||||||
|
|
||||||
|
CWaitCursor x;
|
||||||
|
|
||||||
|
CResource* pResource = (CResource*) item.lParam;
|
||||||
|
|
||||||
|
MYSQL mysql;
|
||||||
|
MYSQL_RES *result;
|
||||||
|
|
||||||
|
switch (pResource->GetType())
|
||||||
|
{
|
||||||
|
case CResource::eProcesslist:
|
||||||
|
{
|
||||||
|
XStatus x ( "Connecting to server %s on host %s..."
|
||||||
|
, (LPCTSTR) pResource->GetDisplayName()
|
||||||
|
, (LPCTSTR) pResource->GetHostName()
|
||||||
|
);
|
||||||
|
mysql_init(&mysql);
|
||||||
|
if (!mysql_real_connect(&mysql,pResource->GetHostName(), pResource->GetUserName(),pResource->GetPassword(),0,pResource->GetPortNumber(), NullS,0))
|
||||||
|
{
|
||||||
|
PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(result=mysql_list_processes(&mysql)))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProcessResultSet ( hItem, result, pResource );
|
||||||
|
mysql_free_result(result);
|
||||||
|
mysql_close(&mysql);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CResource::eServer:
|
||||||
|
{
|
||||||
|
MainFrame->StatusMsg ( "Connecting to server %s on host %s..."
|
||||||
|
, (LPCTSTR) pResource->GetDisplayName()
|
||||||
|
, (LPCTSTR) pResource->GetHostName()
|
||||||
|
);
|
||||||
|
mysql_init(&mysql);
|
||||||
|
if (!mysql_real_connect(&mysql,pResource->GetHostName(), pResource->GetUserName(),pResource->GetPassword(),0,pResource->GetPortNumber(), NullS,0))
|
||||||
|
{
|
||||||
|
PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES);
|
||||||
|
MainFrame->StatusMsg ( "Error: Connecting to server %s... (%s)"
|
||||||
|
, (LPCTSTR) pResource->GetDisplayName()
|
||||||
|
, mysql_error(&mysql)
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(result=mysql_list_dbs(&mysql,0)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
ProcessResultSet ( hItem, result, pResource );
|
||||||
|
mysql_free_result(result);
|
||||||
|
mysql_close(&mysql);
|
||||||
|
MainFrame->StatusMsg ( " " );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CResource::eDatabase:
|
||||||
|
{
|
||||||
|
CResourceServer* pServer = GetServerResource(hItem);
|
||||||
|
if (!pServer) return;
|
||||||
|
MainFrame->StatusMsg ( "Connecting to server %s on host %s..."
|
||||||
|
, (LPCTSTR) pServer->GetDisplayName()
|
||||||
|
, (LPCTSTR) pServer->GetHostName()
|
||||||
|
);
|
||||||
|
mysql_init(&mysql);
|
||||||
|
if (!mysql_real_connect(&mysql,pServer->GetHostName(), pServer->GetUserName(),pServer->GetPassword(),0,pServer->GetPortNumber(), NullS,0))
|
||||||
|
{
|
||||||
|
PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES);
|
||||||
|
MainFrame->StatusMsg ( "Error: Connecting to server %s... (%s)"
|
||||||
|
, (LPCTSTR) pServer->GetDisplayName()
|
||||||
|
, mysql_error(&mysql)
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CResourceDatabase* pRes = (CResourceDatabase*) pResource;
|
||||||
|
CString strDB = pResource->GetDisplayName();
|
||||||
|
strDB.TrimRight();
|
||||||
|
if (mysql_select_db(&mysql,strDB))
|
||||||
|
{
|
||||||
|
MainFrame->StatusMsg ( "Error: Selecting database %s... (%s)"
|
||||||
|
, (LPCTSTR) strDB
|
||||||
|
, mysql_error(&mysql)
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(result=mysql_list_tables(&mysql,0)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
ProcessResultSet ( hItem, result, pRes );
|
||||||
|
mysql_free_result(result);
|
||||||
|
mysql_close(&mysql);
|
||||||
|
MainFrame->StatusMsg ( " " );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CResource::eTable:
|
||||||
|
{
|
||||||
|
CResourceServer* pServer = GetServerResource(hItem);
|
||||||
|
if (!pServer) return;
|
||||||
|
MainFrame->StatusMsg ( "Connecting to server %s on host %s..."
|
||||||
|
, (LPCTSTR) pServer->GetDisplayName()
|
||||||
|
, (LPCTSTR) pServer->GetHostName()
|
||||||
|
);
|
||||||
|
mysql_init(&mysql);
|
||||||
|
if (!mysql_real_connect(&mysql,pServer->GetHostName(), pServer->GetUserName(),pServer->GetPassword(),0,pServer->GetPortNumber(), NullS,0))
|
||||||
|
{
|
||||||
|
PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES);
|
||||||
|
MainFrame->StatusMsg ( "Error: Connecting to server %s... (%s)"
|
||||||
|
, (LPCTSTR) pServer->GetDisplayName()
|
||||||
|
, mysql_error(&mysql)
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HTREEITEM hParent = m_pTree->GetParentItem(hItem);
|
||||||
|
memset( &item, 0, sizeof(TV_ITEM) );
|
||||||
|
item.hItem = hParent;
|
||||||
|
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
|
||||||
|
m_pTree->GetItem( &item );
|
||||||
|
if ( item.lParam )
|
||||||
|
{
|
||||||
|
CResourceDatabase* pResDatabase = (CResourceDatabase*) item.lParam;
|
||||||
|
CResourceTable* pRes = (CResourceTable*) pResource;
|
||||||
|
CString strDB = pResDatabase->GetDisplayName();
|
||||||
|
CString strTable = pResource->GetDisplayName();
|
||||||
|
strDB.TrimRight();
|
||||||
|
strTable.TrimRight();
|
||||||
|
if (mysql_select_db(&mysql,strDB))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CString str; str.Format("show fields from %s",(LPCTSTR)strTable);
|
||||||
|
if ( mysql_query(&mysql,str)==0 )
|
||||||
|
{
|
||||||
|
MYSQL_RES *result;
|
||||||
|
if ((result=mysql_store_result(&mysql)))
|
||||||
|
{
|
||||||
|
ProcessResultSet ( hItem, result, pRes );
|
||||||
|
mysql_free_result(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mysql_close(&mysql);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// InsertNetResources( (LPNETRESOURCE)pTvItem->lParam,
|
||||||
|
// &m_TreeCtrl,
|
||||||
|
// hItem,
|
||||||
|
// &pTvItem->cChildren );
|
||||||
|
// pTvItem->mask = TVIF_CHILDREN;
|
||||||
|
// m_TreeCtrl.SetItem( pTvItem );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnRefresh()
|
||||||
|
{
|
||||||
|
HTREEITEM hItem = NULL;
|
||||||
|
CResource* pResource = GetSelectedResource(&hItem);
|
||||||
|
if (pResource&&hItem)
|
||||||
|
{
|
||||||
|
switch (pResource->GetType())
|
||||||
|
{
|
||||||
|
case CResource::eTable:
|
||||||
|
{
|
||||||
|
|
||||||
|
TV_ITEM item;
|
||||||
|
MYSQL mysql;
|
||||||
|
// MYSQL_RES *result;
|
||||||
|
|
||||||
|
HTREEITEM hParent = m_pTree->GetParentItem(hItem);
|
||||||
|
|
||||||
|
HTREEITEM hChild = m_pTree->GetChildItem(hItem);
|
||||||
|
while (hChild)
|
||||||
|
{
|
||||||
|
HTREEITEM h = m_pTree->GetNextSiblingItem(hChild);
|
||||||
|
BOOL b = m_pTree->DeleteItem(hChild);
|
||||||
|
hChild = h;
|
||||||
|
}
|
||||||
|
mysql_init(&mysql);
|
||||||
|
if (!mysql_real_connect(&mysql,pResource->GetHostName(), pResource->GetUserName(),pResource->GetPassword(),0,pResource->GetPortNumber(), NullS,0))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset( &item, 0, sizeof(TV_ITEM) );
|
||||||
|
item.hItem = hParent;
|
||||||
|
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
|
||||||
|
m_pTree->GetItem( &item );
|
||||||
|
if ( item.lParam )
|
||||||
|
{
|
||||||
|
CResourceDatabase* pResDatabase = (CResourceDatabase*) item.lParam;
|
||||||
|
CResourceTable* pRes = (CResourceTable*) pResource;
|
||||||
|
CString strDB = pResDatabase->GetDisplayName();
|
||||||
|
CString strTable = pResource->GetDisplayName();
|
||||||
|
strDB.TrimRight();
|
||||||
|
strTable.TrimRight();
|
||||||
|
if (mysql_select_db(&mysql,strDB))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CString str; str.Format("show fields from %s",(LPCTSTR)strTable);
|
||||||
|
if ( mysql_query(&mysql,str)==0 )
|
||||||
|
{
|
||||||
|
MYSQL_RES *result;
|
||||||
|
if ((result=mysql_store_result(&mysql)))
|
||||||
|
{
|
||||||
|
ProcessResultSet ( hItem, result, pRes );
|
||||||
|
mysql_free_result(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mysql_close(&mysql);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnRegisterServer()
|
||||||
|
{
|
||||||
|
CRegisterServer dlg;
|
||||||
|
if (dlg.DoModal()!=IDOK) return;
|
||||||
|
AddResource (
|
||||||
|
TVI_ROOT,
|
||||||
|
new CResourceServer ( dlg.m_strServer, dlg.m_strHost, dlg.m_strUser, dlg.m_strPassword, dlg.m_strPort )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnServerProperties()
|
||||||
|
{
|
||||||
|
HTREEITEM hItem;
|
||||||
|
CResource* pRes = GetSelectedResource(&hItem);
|
||||||
|
if (!pRes) return;
|
||||||
|
if (pRes->GetType()!=CResource::eServer) return;
|
||||||
|
CResourceServer* pResource = (CResourceServer*)pRes;
|
||||||
|
CRegisterServer dlg;
|
||||||
|
dlg.m_strHost = pResource->GetHostName();
|
||||||
|
dlg.m_strUser = pResource->GetUserName();
|
||||||
|
dlg.m_strPassword = pResource->GetPassword();
|
||||||
|
dlg.m_strPort = pResource->GetPortName();
|
||||||
|
if (dlg.DoModal()!=IDOK) return;
|
||||||
|
pResource->m_strHost = dlg.m_strHost ;
|
||||||
|
pResource->m_strUser = dlg.m_strUser ;
|
||||||
|
pResource->m_strPassword = dlg.m_strPassword;
|
||||||
|
pResource->m_strPort = dlg.m_strPort ;
|
||||||
|
TV_ITEM item;
|
||||||
|
memset( &item, 0, sizeof(TV_ITEM) );
|
||||||
|
item.hItem = hItem;
|
||||||
|
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
|
||||||
|
m_pTree->GetItem( &item );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnSqlToolQuery()
|
||||||
|
{
|
||||||
|
|
||||||
|
HTREEITEM hItem;
|
||||||
|
|
||||||
|
CResource* pResource = GetSelectedResource(&hItem);
|
||||||
|
|
||||||
|
if (!pResource) return;
|
||||||
|
|
||||||
|
CResourceServer* pServer = GetServerResource(hItem);
|
||||||
|
if (!pServer) return; /* Avoid bug when selecting field */
|
||||||
|
|
||||||
|
m_pTool = new CToolSql ( AfxGetMainWnd(), pServer, pResource );
|
||||||
|
|
||||||
|
if ( ! m_pTool->Create(IDD_TOOL_SQL,this) )
|
||||||
|
{
|
||||||
|
delete m_pTool;
|
||||||
|
m_pTool = 0;
|
||||||
|
PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pTool->ShowWindow(SW_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL CMySqlManagerView::PreTranslateMessage(MSG* pMsg)
|
||||||
|
{
|
||||||
|
if (m_pTool && m_pTool->PreTranslateMessage(pMsg))
|
||||||
|
return TRUE;
|
||||||
|
return CTreeView::PreTranslateMessage(pMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMySqlManagerView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
|
||||||
|
POINT pt;
|
||||||
|
|
||||||
|
GetCursorPos ( & pt );
|
||||||
|
|
||||||
|
CMenu menu;
|
||||||
|
|
||||||
|
menu.CreatePopupMenu ();
|
||||||
|
|
||||||
|
menu.AppendMenu ( MF_ENABLED , IDM_SQL_TOOL_QUERY, "SQL Query" );
|
||||||
|
menu.AppendMenu ( MF_ENABLED , IDM_REFRESH, "Refresh active item(s)" );
|
||||||
|
menu.AppendMenu ( MF_ENABLED , IDM_TOOLS_REGISTER_SERVER, "Register server" );
|
||||||
|
menu.AppendMenu ( MF_ENABLED , IDM_TOOLS_SERVER_PROPERTIES, "Properties" );
|
||||||
|
|
||||||
|
menu.TrackPopupMenu ( TPM_LEFTALIGN | TPM_RIGHTBUTTON , pt.x, pt.y, CWnd::GetParent(), NULL );
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
|
||||||
|
}
|
89
VC++Files/mysqlmanager/mysqlmanagerview.h
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
// MySqlManagerView.h : interface of the CMySqlManagerView class
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if !defined(AFX_MYSQLMANAGERVIEW_H__826CB2F4_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_MYSQLMANAGERVIEW_H__826CB2F4_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
#include <afxcview.h>
|
||||||
|
#include "cresource.h"
|
||||||
|
|
||||||
|
class CToolSql;
|
||||||
|
|
||||||
|
class CMySqlManagerView : public CTreeView
|
||||||
|
{
|
||||||
|
protected: // create from serialization only
|
||||||
|
CMySqlManagerView();
|
||||||
|
DECLARE_DYNCREATE(CMySqlManagerView)
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
CMySqlManagerDoc* GetDocument();
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMySqlManagerView)
|
||||||
|
public:
|
||||||
|
virtual void OnDraw(CDC* pDC); // overridden to draw this view
|
||||||
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||||
|
virtual void OnInitialUpdate();
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
protected:
|
||||||
|
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
|
||||||
|
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
|
||||||
|
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
|
||||||
|
CResource* GetSelectedResource(HTREEITEM* phItemRet=NULL);
|
||||||
|
CResourceServer* GetServerResource(HTREEITEM hItem);
|
||||||
|
|
||||||
|
HTREEITEM AddResource ( HTREEITEM hParent, CResource* pRes, HTREEITEM hLastItem = TVI_FIRST ) ;
|
||||||
|
void ProcessResultSet ( HTREEITEM hItem, LPVOID result, CResource* pResource );
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~CMySqlManagerView();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
CTreeCtrl* m_pTree;
|
||||||
|
CImageList* m_pImages;
|
||||||
|
CBitmap* m_pbmBmp;
|
||||||
|
CToolSql* m_pTool;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CMySqlManagerView)
|
||||||
|
afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnSqlToolQuery();
|
||||||
|
afx_msg void OnRefresh();
|
||||||
|
afx_msg void OnRegisterServer();
|
||||||
|
afx_msg void OnServerProperties();
|
||||||
|
afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef _DEBUG // debug version in MySqlManagerView.cpp
|
||||||
|
inline CMySqlManagerDoc* CMySqlManagerView::GetDocument()
|
||||||
|
{ return (CMySqlManagerDoc*)m_pDocument; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MYSQLMANAGERVIEW_H__826CB2F4_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
51
VC++Files/mysqlmanager/registerserver.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// RegisterServer.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "mysqlmanager.h"
|
||||||
|
#include "RegisterServer.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CRegisterServer dialog
|
||||||
|
|
||||||
|
|
||||||
|
CRegisterServer::CRegisterServer(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CRegisterServer::IDD, pParent)
|
||||||
|
, m_strServer("servername")
|
||||||
|
, m_strHost("localhost")
|
||||||
|
, m_strUser("root")
|
||||||
|
, m_strPassword("")
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CRegisterServer)
|
||||||
|
m_strPort = _T("3306");
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CRegisterServer::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CRegisterServer)
|
||||||
|
DDX_CBString(pDX, ID_SERVER_CB, m_strServer);
|
||||||
|
DDX_CBString(pDX, ID_HOST_CB, m_strHost);
|
||||||
|
DDX_Text(pDX, ID_USER, m_strUser);
|
||||||
|
DDX_Text(pDX, ID_PASSWORD, m_strPassword);
|
||||||
|
DDX_CBString(pDX, ID_PORT_CB, m_strPort);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CRegisterServer, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CRegisterServer)
|
||||||
|
// NOTE: the ClassWizard will add message map macros here
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CRegisterServer message handlers
|
50
VC++Files/mysqlmanager/registerserver.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#if !defined(AFX_REGISTERSERVER_H__826CB2FF_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_REGISTERSERVER_H__826CB2FF_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
// RegisterServer.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CRegisterServer dialog
|
||||||
|
|
||||||
|
class CRegisterServer : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CRegisterServer(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CRegisterServer)
|
||||||
|
enum { IDD = IDD_REGISTER_SERVER };
|
||||||
|
CString m_strServer;
|
||||||
|
CString m_strHost;
|
||||||
|
CString m_strUser;
|
||||||
|
CString m_strPassword;
|
||||||
|
CString m_strPort;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CRegisterServer)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CRegisterServer)
|
||||||
|
// NOTE: the ClassWizard will add member functions here
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_REGISTERSERVER_H__826CB2FF_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
110
VC++Files/mysqlmanager/toolsqlquery.cpp
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
// ToolSqlQuery.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MySqlManager.h"
|
||||||
|
#include "ToolSqlQuery.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CToolSqlQuery::CToolSqlQuery(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CToolSqlQuery::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CToolSqlQuery)
|
||||||
|
m_edit = _T("");
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlQuery::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CToolSqlQuery)
|
||||||
|
DDX_Control(pDX, IDC_EDIT, m_ctl_edit);
|
||||||
|
DDX_Text(pDX, IDC_EDIT, m_edit);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CToolSqlQuery, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CToolSqlQuery)
|
||||||
|
ON_WM_SIZE()
|
||||||
|
ON_WM_CLOSE()
|
||||||
|
ON_COMMAND(IDM_QUERY_EXEC, OnQueryPb)
|
||||||
|
ON_COMMAND(IDM_QUERY_DATABASES, OnQueryDatabases)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlQuery::SetFont(CFont* pFont, BOOL bRedraw)
|
||||||
|
{
|
||||||
|
m_ctl_edit.SetFont(pFont,bRedraw);
|
||||||
|
m_ctl_edit.Invalidate();
|
||||||
|
m_ctl_edit.UpdateWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlQuery::OnSize(UINT nType, int cx, int cy)
|
||||||
|
{
|
||||||
|
CDialog::OnSize(nType, cx, cy);
|
||||||
|
if (IsWindow(m_ctl_edit.GetSafeHwnd()))
|
||||||
|
m_ctl_edit.SetWindowPos(NULL,20,24,cx-40,cy-48,SWP_NOZORDER | SWP_NOMOVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlQuery::OnCancel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlQuery::OnClose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlQuery::OnQueryPb()
|
||||||
|
{
|
||||||
|
GetParent()->GetParent()->PostMessage(WM_COMMAND,IDM_QUERY_EXEC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlQuery::OnQueryDatabases()
|
||||||
|
{
|
||||||
|
GetParent()->GetParent()->PostMessage(WM_COMMAND,IDM_QUERY_DATABASES);
|
||||||
|
}
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL CToolSqlQuery::PreTranslateMessage(MSG* pMsg)
|
||||||
|
{
|
||||||
|
if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
|
||||||
|
{
|
||||||
|
if (::TranslateAccelerator(m_hWnd, m_hAccel, pMsg))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return CDialog::PreTranslateMessage(pMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL CToolSqlQuery::OnInitDialog()
|
||||||
|
{
|
||||||
|
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
m_hAccel = ::LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE ( IDR_MAINFRAME ));
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
60
VC++Files/mysqlmanager/toolsqlquery.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#if !defined(AFX_TOOLSQLQUERY_H__826CB2FD_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_TOOLSQLQUERY_H__826CB2FD_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
// ToolSqlQuery.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CToolSqlQuery dialog
|
||||||
|
|
||||||
|
class CToolSqlQuery : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CToolSqlQuery(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CToolSqlQuery)
|
||||||
|
enum { IDD = IDD_TOOL_SQL_QUERY };
|
||||||
|
CEdit m_ctl_edit;
|
||||||
|
CString m_edit;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
HACCEL m_hAccel;
|
||||||
|
|
||||||
|
void SetFont(CFont* pFont, BOOL bRedraw = TRUE);
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CToolSqlQuery)
|
||||||
|
public:
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CToolSqlQuery)
|
||||||
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
|
afx_msg void OnCancel();
|
||||||
|
afx_msg void OnClose();
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
afx_msg void OnQueryPb();
|
||||||
|
afx_msg void OnQueryDatabases();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_TOOLSQLQUERY_H__826CB2FD_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
73
VC++Files/mysqlmanager/toolsqlresults.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// ToolSqlResults.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MySqlManager.h"
|
||||||
|
#include "ToolSqlResults.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CToolSqlResults::CToolSqlResults(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CToolSqlResults::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CToolSqlResults)
|
||||||
|
m_edit = _T("");
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlResults::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CToolSqlResults)
|
||||||
|
DDX_Control(pDX, IDC_EDIT, m_ctl_edit);
|
||||||
|
DDX_Text(pDX, IDC_EDIT, m_edit);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CToolSqlResults, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CToolSqlResults)
|
||||||
|
ON_WM_SIZE()
|
||||||
|
ON_WM_CLOSE()
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlResults::SetFont(CFont* pFont, BOOL bRedraw)
|
||||||
|
{
|
||||||
|
m_ctl_edit.SetFont(pFont,bRedraw);
|
||||||
|
m_ctl_edit.Invalidate();
|
||||||
|
m_ctl_edit.UpdateWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlResults::OnSize(UINT nType, int cx, int cy)
|
||||||
|
{
|
||||||
|
CDialog::OnSize(nType, cx, cy);
|
||||||
|
if (IsWindow(m_ctl_edit.GetSafeHwnd()))
|
||||||
|
m_ctl_edit.SetWindowPos(NULL,20,24,cx-40,cy-48,SWP_NOZORDER | SWP_NOMOVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlResults::OnCancel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CToolSqlResults::OnClose()
|
||||||
|
{
|
||||||
|
}
|
53
VC++Files/mysqlmanager/toolsqlresults.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#if !defined(AFX_TOOLSQLRESULTS_H__826CB2FE_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_TOOLSQLRESULTS_H__826CB2FE_8B6D_11D1_AEC1_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
// ToolSqlResults.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CToolSqlResults dialog
|
||||||
|
|
||||||
|
class CToolSqlResults : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CToolSqlResults(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CToolSqlResults)
|
||||||
|
enum { IDD = IDD_TOOL_SQL_RESULTS };
|
||||||
|
CEdit m_ctl_edit;
|
||||||
|
CString m_edit;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
void SetFont(CFont* pFont, BOOL bRedraw = TRUE);
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CToolSqlResults)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CToolSqlResults)
|
||||||
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
|
afx_msg void OnCancel();
|
||||||
|
afx_msg void OnClose();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_TOOLSQLRESULTS_H__826CB2FE_8B6D_11D1_AEC1_00600806E071__INCLUDED_)
|
50
VC++Files/mysqlmanager/toolsqlstatus.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// ToolSqlStatus.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "mysqlmanager.h"
|
||||||
|
#include "ToolSqlStatus.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CToolSqlStatus dialog
|
||||||
|
|
||||||
|
|
||||||
|
CToolSqlStatus::CToolSqlStatus(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CToolSqlStatus::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CToolSqlStatus)
|
||||||
|
m_edit = _T("");
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CToolSqlStatus::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CToolSqlStatus)
|
||||||
|
DDX_Control(pDX, IDC_EDIT, m_ctl_edit);
|
||||||
|
DDX_Text(pDX, IDC_EDIT, m_edit);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CToolSqlStatus, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CToolSqlStatus)
|
||||||
|
ON_WM_DESTROY()
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CToolSqlStatus message handlers
|
||||||
|
|
||||||
|
void CToolSqlStatus::OnDestroy()
|
||||||
|
{
|
||||||
|
CDialog::OnDestroy();
|
||||||
|
|
||||||
|
}
|
47
VC++Files/mysqlmanager/toolsqlstatus.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#if !defined(AFX_TOOLSQLSTATUS_H__40C861B4_9E5A_11D1_AED0_00600806E071__INCLUDED_)
|
||||||
|
#define AFX_TOOLSQLSTATUS_H__40C861B4_9E5A_11D1_AED0_00600806E071__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
// ToolSqlStatus.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CToolSqlStatus dialog
|
||||||
|
|
||||||
|
class CToolSqlStatus : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CToolSqlStatus(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CToolSqlStatus)
|
||||||
|
enum { IDD = IDD_TOOL_SQL_STATUS };
|
||||||
|
CEdit m_ctl_edit;
|
||||||
|
CString m_edit;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CToolSqlStatus)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CToolSqlStatus)
|
||||||
|
afx_msg void OnDestroy();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_TOOLSQLSTATUS_H__40C861B4_9E5A_11D1_AED0_00600806E071__INCLUDED_)
|
BIN
VC++Files/mysqlshutdown/MYSQL.ICO
Normal file
After Width: | Height: | Size: 318 B |
2
VC++Files/mysqlshutdown/mysqlshutdown.rc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
MySql ICON DISCARDABLE "MYSQL.ICO"
|
||||||
|
|
@ -26,7 +26,7 @@ CFG=mysys - Win32 Debug
|
|||||||
# PROP AllowPerConfigDependencies 0
|
# PROP AllowPerConfigDependencies 0
|
||||||
# PROP Scc_ProjName ""
|
# PROP Scc_ProjName ""
|
||||||
# PROP Scc_LocalPath ""
|
# PROP Scc_LocalPath ""
|
||||||
CPP=xicl6.exe
|
CPP=cl.exe
|
||||||
RSC=rc.exe
|
RSC=rc.exe
|
||||||
|
|
||||||
!IF "$(CFG)" == "mysys - Win32 Release"
|
!IF "$(CFG)" == "mysys - Win32 Release"
|
||||||
@ -42,14 +42,14 @@ RSC=rc.exe
|
|||||||
# PROP Intermediate_Dir "release"
|
# PROP Intermediate_Dir "release"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
|
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE RSC /l 0x409
|
# ADD BASE RSC /l 0x409
|
||||||
# ADD RSC /l 0x409
|
# ADD RSC /l 0x409
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LIB32=xilink6.exe -lib
|
LIB32=link.exe -lib
|
||||||
# ADD BASE LIB32 /nologo
|
# ADD BASE LIB32 /nologo
|
||||||
# ADD LIB32 /nologo /out:"..\lib_release\mysys.lib"
|
# ADD LIB32 /nologo /out:"..\lib_release\mysys.lib"
|
||||||
|
|
||||||
@ -66,14 +66,14 @@ LIB32=xilink6.exe -lib
|
|||||||
# PROP Intermediate_Dir "debug"
|
# PROP Intermediate_Dir "debug"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
|
# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
|
||||||
# SUBTRACT CPP /Fr
|
# SUBTRACT CPP /Fr
|
||||||
# ADD BASE RSC /l 0x409
|
# ADD BASE RSC /l 0x409
|
||||||
# ADD RSC /l 0x409
|
# ADD RSC /l 0x409
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LIB32=xilink6.exe -lib
|
LIB32=link.exe -lib
|
||||||
# ADD BASE LIB32 /nologo
|
# ADD BASE LIB32 /nologo
|
||||||
# ADD LIB32 /nologo /out:"..\lib_debug\mysys.lib"
|
# ADD LIB32 /nologo /out:"..\lib_debug\mysys.lib"
|
||||||
|
|
||||||
@ -86,8 +86,8 @@ LIB32=xilink6.exe -lib
|
|||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 0
|
# PROP Use_Debug_Libraries 0
|
||||||
# PROP Output_Dir "max"
|
# PROP Output_Dir "mysys___Win32_Max"
|
||||||
# PROP Intermediate_Dir "max"
|
# PROP Intermediate_Dir "mysys___Win32_Max"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
|
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
|
||||||
# SUBTRACT BASE CPP /YX
|
# SUBTRACT BASE CPP /YX
|
||||||
@ -98,7 +98,7 @@ LIB32=xilink6.exe -lib
|
|||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LIB32=xilink6.exe -lib
|
LIB32=link.exe -lib
|
||||||
# ADD BASE LIB32 /nologo /out:"..\lib_release\mysys.lib"
|
# ADD BASE LIB32 /nologo /out:"..\lib_release\mysys.lib"
|
||||||
# ADD LIB32 /nologo /out:"..\lib_release\mysys-max.lib"
|
# ADD LIB32 /nologo /out:"..\lib_release\mysys-max.lib"
|
||||||
|
|
||||||
@ -283,19 +283,6 @@ SOURCE=.\my_clock.c
|
|||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\my_compress.c
|
SOURCE=.\my_compress.c
|
||||||
|
|
||||||
!IF "$(CFG)" == "mysys - Win32 Release"
|
|
||||||
|
|
||||||
# ADD CPP /I "../zlib"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "mysys - Win32 Debug"
|
|
||||||
|
|
||||||
# ADD CPP /I "../zlib"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "mysys - Win32 Max"
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
104
VC++Files/prepare
Executable file
@ -0,0 +1,104 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -f prepare_done ]
|
||||||
|
then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
SRCDIR=`pwd`
|
||||||
|
|
||||||
|
(
|
||||||
|
find $SRCDIR -name *.dsw -and -not -path \*SCCS\* -print
|
||||||
|
find $SRCDIR -name *.dsp -and -not -path \*SCCS\* -print
|
||||||
|
)|(
|
||||||
|
while read v
|
||||||
|
do
|
||||||
|
sed 's/$'"/`echo -e \\\r`/" $v > $v.tmp
|
||||||
|
rm $v
|
||||||
|
mv $v.tmp $v
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
ln -s $SRCDIR/include $SRCDIR/VC++Files/include
|
||||||
|
|
||||||
|
link_dir_files()
|
||||||
|
{
|
||||||
|
for arg do
|
||||||
|
|
||||||
|
cd $SRCDIR/$arg/
|
||||||
|
(
|
||||||
|
ls -A1|grep \\.[ch]$
|
||||||
|
ls -A1|grep \\.ih$
|
||||||
|
ls -A1|grep \\.asm$
|
||||||
|
)|(
|
||||||
|
while read v
|
||||||
|
do
|
||||||
|
ln -s $SRCDIR/$arg/$v $SRCDIR/VC++Files/$arg/$v
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
cd $SRCDIR/$arg/
|
||||||
|
(ls -A1|grep \\.cc$|sed 's/.cc$//g')|(
|
||||||
|
while read v
|
||||||
|
do
|
||||||
|
ln -s $SRCDIR/$arg/$v.cc $SRCDIR/VC++Files/$arg/$v.cpp
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
link_dir_dirs()
|
||||||
|
{
|
||||||
|
for arg do
|
||||||
|
|
||||||
|
cd $SRCDIR/$arg/
|
||||||
|
(
|
||||||
|
ls -l |grep "^d"|awk '{print($9)}' -
|
||||||
|
)|(
|
||||||
|
while read v
|
||||||
|
do
|
||||||
|
ln -s $SRCDIR/$arg/$v $SRCDIR/VC++Files/$arg/
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
link_dir_files 'heap'
|
||||||
|
link_dir_files 'isam'
|
||||||
|
link_dir_files 'merge'
|
||||||
|
link_dir_files 'mysys'
|
||||||
|
link_dir_files 'zlib'
|
||||||
|
link_dir_files 'regex'
|
||||||
|
link_dir_files 'strings'
|
||||||
|
link_dir_files 'dbug'
|
||||||
|
link_dir_files 'vio'
|
||||||
|
link_dir_files 'client'
|
||||||
|
link_dir_files 'libmysql'
|
||||||
|
link_dir_files 'extra'
|
||||||
|
link_dir_files 'myisam'
|
||||||
|
link_dir_files 'myisammrg'
|
||||||
|
link_dir_files 'innobase'
|
||||||
|
link_dir_files 'bdb'
|
||||||
|
link_dir_files 'sql'
|
||||||
|
link_dir_files 'bdb/build_win32'
|
||||||
|
link_dir_files 'libmysqld'
|
||||||
|
|
||||||
|
link_dir_dirs 'bdb'
|
||||||
|
link_dir_dirs 'innobase'
|
||||||
|
|
||||||
|
ln -s $SRCDIR/myisam/myisampack.c $SRCDIR/VC++Files/myisampack/
|
||||||
|
ln -s $SRCDIR/client/mysqlbinlog.cc $SRCDIR/VC++Files/mysqlbinlog/mysqlbinlog.cpp
|
||||||
|
ln -s $SRCDIR/isam/pack_isam.c $SRCDIR/VC++Files/pack_isam/pack_isam.c
|
||||||
|
|
||||||
|
echo '/* added for win : */' >> $SRCDIR/config.h
|
||||||
|
echo '#undef HAVE_SCHED_H' >> $SRCDIR/config.h
|
||||||
|
echo '#USE_QUERY_CACHE_INTEGRITY_CHECK 1' >> $SRCDIR/config.h
|
||||||
|
|
||||||
|
echo '/* added for win : */' >> $SRCDIR/innobase/ib_config.h
|
||||||
|
echo '#undef HAVE_SCHED_H' >> $SRCDIR/innobase/ib_config.h
|
||||||
|
|
||||||
|
cd $SRCDIR/VC++Files
|
||||||
|
echo '1' > prepare_done
|
255
VC++Files/test1/mysql_thr.c
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
/* Testing of connecting to MySQL from X threads */
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <mysql.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#define TEST_COUNT 20
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
** The following is to emulate the posix thread interface
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
typedef HANDLE pthread_t;
|
||||||
|
typedef struct thread_attr {
|
||||||
|
DWORD dwStackSize ;
|
||||||
|
DWORD dwCreatingFlag ;
|
||||||
|
int priority ;
|
||||||
|
} pthread_attr_t ;
|
||||||
|
|
||||||
|
typedef struct { int dummy; } pthread_condattr_t;
|
||||||
|
typedef unsigned int uint;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint waiting;
|
||||||
|
HANDLE semaphore;
|
||||||
|
} pthread_cond_t;
|
||||||
|
|
||||||
|
typedef CRITICAL_SECTION pthread_mutex_t;
|
||||||
|
|
||||||
|
#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
|
||||||
|
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
|
||||||
|
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
|
||||||
|
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
|
||||||
|
#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B)
|
||||||
|
typedef unsigned (__cdecl *pthread_handler)(void *);
|
||||||
|
#define pthread_self() GetCurrentThread()
|
||||||
|
|
||||||
|
static unsigned int thread_count;
|
||||||
|
static pthread_cond_t COND_thread_count;
|
||||||
|
static pthread_mutex_t LOCK_thread_count;
|
||||||
|
|
||||||
|
pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
|
||||||
|
THR_LOCK_lock,THR_LOCK_isam;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** We have tried to use '_beginthreadex' instead of '_beginthread' here
|
||||||
|
** but in this case the program leaks about 512 characters for each
|
||||||
|
** created thread !
|
||||||
|
*/
|
||||||
|
|
||||||
|
int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
|
||||||
|
pthread_handler func, void *param)
|
||||||
|
{
|
||||||
|
HANDLE hThread;
|
||||||
|
|
||||||
|
hThread=(HANDLE)_beginthread(func,
|
||||||
|
attr->dwStackSize ? attr->dwStackSize :
|
||||||
|
65535,param);
|
||||||
|
if ((long) hThread == -1L)
|
||||||
|
{
|
||||||
|
return(errno ? errno : -1);
|
||||||
|
}
|
||||||
|
*thread_id=hThread;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pthread_exit(unsigned A)
|
||||||
|
{
|
||||||
|
_endthread();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The following simple implementation of conds works as long as
|
||||||
|
** only one thread uses pthread_cond_wait at a time.
|
||||||
|
** This is coded very carefully to work with thr_lock.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
** The following is a simple implementation of posix conditions
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
|
||||||
|
{
|
||||||
|
cond->waiting=0;
|
||||||
|
cond->semaphore=CreateSemaphore(NULL,0,0x7FFFFFFF,(char*) 0);
|
||||||
|
if (!cond->semaphore)
|
||||||
|
return ENOMEM;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_cond_destroy(pthread_cond_t *cond)
|
||||||
|
{
|
||||||
|
return CloseHandle(cond->semaphore) ? 0 : EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&cond->waiting);
|
||||||
|
LeaveCriticalSection(mutex);
|
||||||
|
WaitForSingleObject(cond->semaphore,INFINITE);
|
||||||
|
InterlockedDecrement(&cond->waiting);
|
||||||
|
EnterCriticalSection(mutex);
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_cond_signal(pthread_cond_t *cond)
|
||||||
|
{
|
||||||
|
long prev_count;
|
||||||
|
if (cond->waiting)
|
||||||
|
ReleaseSemaphore(cond->semaphore,1,&prev_count);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_attr_init(pthread_attr_t *connect_att)
|
||||||
|
{
|
||||||
|
connect_att->dwStackSize = 0;
|
||||||
|
connect_att->dwCreatingFlag = 0;
|
||||||
|
connect_att->priority = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
|
||||||
|
{
|
||||||
|
connect_att->dwStackSize=stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
|
||||||
|
{
|
||||||
|
connect_att->priority=priority;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_attr_destroy(pthread_attr_t *connect_att)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* from my_pthread.c */
|
||||||
|
|
||||||
|
#ifndef REMOVE_BUG
|
||||||
|
|
||||||
|
__declspec(thread) int THR_KEY_my_errno;
|
||||||
|
|
||||||
|
int _my_errno(void)
|
||||||
|
{
|
||||||
|
return THR_KEY_my_errno;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
** The test program
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
pthread_handler_decl(test_thread,arg)
|
||||||
|
{
|
||||||
|
MYSQL mysql;
|
||||||
|
MYSQL_RES *res;
|
||||||
|
|
||||||
|
mysql_init(&mysql);
|
||||||
|
if (!mysql_real_connect(&mysql,NULL,0,0,NULL,0,NULL,0))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Couldn't connect to engine!\n%s\n\n",mysql_error(&mysql));
|
||||||
|
perror("");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (mysql_query(&mysql,"select 1") < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Query failed (%s)\n",mysql_error(&mysql));
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (!(res=mysql_store_result(&mysql)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Couldn't get result from query failed\n",
|
||||||
|
mysql_error(&mysql));
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
mysql_free_result(res);
|
||||||
|
|
||||||
|
end:
|
||||||
|
|
||||||
|
Sleep(1000); /* Win32 sleep */
|
||||||
|
mysql_close(&mysql);
|
||||||
|
|
||||||
|
pthread_mutex_lock(&LOCK_thread_count);
|
||||||
|
thread_count--;
|
||||||
|
pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
|
||||||
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
pthread_exit(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc,char **argv)
|
||||||
|
{
|
||||||
|
pthread_t tid;
|
||||||
|
pthread_attr_t thr_attr;
|
||||||
|
int i,error;
|
||||||
|
|
||||||
|
if ((error=pthread_cond_init(&COND_thread_count,NULL)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Got error: %d from pthread_cond_init (errno: %d)",
|
||||||
|
error,errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
pthread_mutex_init(&LOCK_thread_count,NULL);
|
||||||
|
if ((error=pthread_attr_init(&thr_attr)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Got error: %d from pthread_attr_init (errno: %d)",
|
||||||
|
error,errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ((error=pthread_attr_setstacksize(&thr_attr,65536L)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Got error: %d from pthread_attr_setstacksize (errno: %d)",
|
||||||
|
error,errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Init ok. Creating %d threads\n",TEST_COUNT);
|
||||||
|
|
||||||
|
for (i=1 ; i <= TEST_COUNT ; i++)
|
||||||
|
{
|
||||||
|
int *param= &i;
|
||||||
|
if ((error=pthread_mutex_lock(&LOCK_thread_count)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"\nGot error: %d from pthread_mutex_lock (errno: %d)",
|
||||||
|
error,errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ((error=pthread_create(&tid,&thr_attr,test_thread,(void*) param)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"\nGot error: %d from pthread_create (errno: %d)\n",
|
||||||
|
error,errno);
|
||||||
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
thread_count++;
|
||||||
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((error=pthread_mutex_lock(&LOCK_thread_count)))
|
||||||
|
fprintf(stderr,"\nGot error: %d from pthread_mutex_lock\n",error);
|
||||||
|
while (thread_count)
|
||||||
|
{
|
||||||
|
if ((error=pthread_cond_wait(&COND_thread_count,&LOCK_thread_count)))
|
||||||
|
fprintf(stderr,"\nGot error: %d from pthread_cond_wait\n",error);
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
pthread_attr_destroy(&thr_attr);
|
||||||
|
printf("\nend\n");
|
||||||
|
return 0;
|
||||||
|
}
|
250
VC++Files/thr_test/thr_test.c
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
/* Testing of thread creation to find memory allocation bug
|
||||||
|
** This is coded to use as few extern functions as possible!
|
||||||
|
**
|
||||||
|
** The program must be compiled to be multithreaded !
|
||||||
|
**
|
||||||
|
** The problem is that when this program is run it will allocate more and more
|
||||||
|
** memory, so there is a memory leak in the thread handling. The problem is how
|
||||||
|
** to avoid is !
|
||||||
|
**
|
||||||
|
** It looks like the bug is that the std library doesn't free thread
|
||||||
|
** specific variables if one uses a thread variable.
|
||||||
|
** If one compiles this program with -DREMOVE_BUG
|
||||||
|
** there is no memory leaks anymore!
|
||||||
|
**
|
||||||
|
** This program is tested with Microsofts VC++ 5.0, but BC5.2 is also
|
||||||
|
** reported to have this bug.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define TEST_COUNT 100000
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
** The following is to emulate the posix thread interface
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
typedef HANDLE pthread_t;
|
||||||
|
typedef struct thread_attr {
|
||||||
|
DWORD dwStackSize ;
|
||||||
|
DWORD dwCreatingFlag ;
|
||||||
|
int priority ;
|
||||||
|
} pthread_attr_t ;
|
||||||
|
typedef struct { int dummy; } pthread_condattr_t;
|
||||||
|
typedef struct {
|
||||||
|
unsigned int msg;
|
||||||
|
pthread_t thread;
|
||||||
|
DWORD thread_id;
|
||||||
|
} pthread_cond_t;
|
||||||
|
typedef CRITICAL_SECTION pthread_mutex_t;
|
||||||
|
|
||||||
|
#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
|
||||||
|
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
|
||||||
|
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
|
||||||
|
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
|
||||||
|
#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B)
|
||||||
|
typedef unsigned (__cdecl *pthread_handler)(void *);
|
||||||
|
#define pthread_self() GetCurrentThread()
|
||||||
|
|
||||||
|
static unsigned int thread_count;
|
||||||
|
static pthread_cond_t COND_thread_count;
|
||||||
|
static pthread_mutex_t LOCK_thread_count;
|
||||||
|
|
||||||
|
pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
|
||||||
|
THR_LOCK_lock,THR_LOCK_isam;
|
||||||
|
/*
|
||||||
|
** We have tried to use '_beginthreadex' instead of '_beginthread' here
|
||||||
|
** but in this case the program leaks about 512 characters for each
|
||||||
|
** created thread !
|
||||||
|
*/
|
||||||
|
|
||||||
|
int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
|
||||||
|
pthread_handler func, void *param)
|
||||||
|
{
|
||||||
|
HANDLE hThread;
|
||||||
|
|
||||||
|
hThread=(HANDLE)_beginthread(func,
|
||||||
|
attr->dwStackSize ? attr->dwStackSize :
|
||||||
|
65535,param);
|
||||||
|
if ((long) hThread == -1L)
|
||||||
|
{
|
||||||
|
return(errno ? errno : -1);
|
||||||
|
}
|
||||||
|
*thread_id=hThread;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pthread_exit(unsigned A)
|
||||||
|
{
|
||||||
|
_endthread();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The following simple implementation of conds works as long as
|
||||||
|
** only one thread uses pthread_cond_wait at a time.
|
||||||
|
** This is coded very carefully to work with thr_lock.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static unsigned int WIN32_WAIT_SIGNAL= 30000; /* Start message to use */
|
||||||
|
|
||||||
|
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
|
||||||
|
{
|
||||||
|
cond->msg=WIN32_WAIT_SIGNAL++;
|
||||||
|
cond->thread=(pthread_t) pthread_self(); /* For global conds */
|
||||||
|
//IRENA
|
||||||
|
cond->thread_id=GetCurrentThreadId();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
|
||||||
|
{
|
||||||
|
MSG msg ;
|
||||||
|
unsigned int msgCode=cond->msg;
|
||||||
|
|
||||||
|
cond->thread=(pthread_t) pthread_self();
|
||||||
|
//IRENA
|
||||||
|
//??? cond->thread_id=GetCurrentThreadId();
|
||||||
|
//VOID(ReleaseMutex(*mutex));
|
||||||
|
|
||||||
|
LeaveCriticalSection(mutex);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
WaitMessage() ;
|
||||||
|
if (!PeekMessage(&msg, NULL, 1, 65534,PM_REMOVE))
|
||||||
|
{
|
||||||
|
return errno=GetLastError() ;
|
||||||
|
}
|
||||||
|
} while (msg.message != msgCode) ;
|
||||||
|
EnterCriticalSection(mutex);
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pthread_cond_signal(pthread_cond_t *cond)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!PostThreadMessage(cond->thread_id, cond->msg, 0,0))
|
||||||
|
{
|
||||||
|
return errno=GetLastError() ;
|
||||||
|
}
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_attr_init(pthread_attr_t *connect_att)
|
||||||
|
{
|
||||||
|
connect_att->dwStackSize = 0;
|
||||||
|
connect_att->dwCreatingFlag = 0;
|
||||||
|
connect_att->priority = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
|
||||||
|
{
|
||||||
|
connect_att->dwStackSize=stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
|
||||||
|
{
|
||||||
|
connect_att->priority=priority;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_attr_destroy(pthread_attr_t *connect_att)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* from my_pthread.c */
|
||||||
|
|
||||||
|
#ifndef REMOVE_BUG
|
||||||
|
|
||||||
|
__declspec(thread) int THR_KEY_my_errno;
|
||||||
|
|
||||||
|
int _my_errno(void)
|
||||||
|
{
|
||||||
|
return THR_KEY_my_errno;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
** The test program
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
pthread_handler_decl(test_thread,arg)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&LOCK_thread_count);
|
||||||
|
thread_count--;
|
||||||
|
pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
|
||||||
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
pthread_exit(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc,char **argv)
|
||||||
|
{
|
||||||
|
pthread_t tid;
|
||||||
|
pthread_attr_t thr_attr;
|
||||||
|
int i,error;
|
||||||
|
|
||||||
|
if ((error=pthread_cond_init(&COND_thread_count,NULL)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Got error: %d from pthread_cond_init (errno: %d)",
|
||||||
|
error,errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
pthread_mutex_init(&LOCK_thread_count,NULL);
|
||||||
|
if ((error=pthread_attr_init(&thr_attr)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Got error: %d from pthread_attr_init (errno: %d)",
|
||||||
|
error,errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ((error=pthread_attr_setstacksize(&thr_attr,65536L)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Got error: %d from pthread_attr_setstacksize (errno: %d)",
|
||||||
|
error,errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Init ok. Creating %d threads\n",TEST_COUNT);
|
||||||
|
for (i=1 ; i <= TEST_COUNT ; i++)
|
||||||
|
{
|
||||||
|
int *param= &i;
|
||||||
|
if ((i % 100) == 0)
|
||||||
|
{
|
||||||
|
printf("%8d",i);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
if ((error=pthread_mutex_lock(&LOCK_thread_count)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"\nGot error: %d from pthread_mutex_lock (errno: %d)",
|
||||||
|
error,errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ((error=pthread_create(&tid,&thr_attr,test_thread,(void*) param)))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"\nGot error: %d from pthread_create (errno: %d)\n",
|
||||||
|
error,errno);
|
||||||
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
thread_count++;
|
||||||
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
|
||||||
|
if ((error=pthread_mutex_lock(&LOCK_thread_count)))
|
||||||
|
fprintf(stderr,"\nGot error: %d from pthread_mutex_lock\n",error);
|
||||||
|
while (thread_count)
|
||||||
|
{
|
||||||
|
if ((error=pthread_cond_wait(&COND_thread_count,&LOCK_thread_count)))
|
||||||
|
fprintf(stderr,"\nGot error: %d from pthread_cond_wait\n",error);
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
}
|
||||||
|
pthread_attr_destroy(&thr_attr);
|
||||||
|
printf("\nend\n");
|
||||||
|
return 0;
|
||||||
|
}
|