Click here to Skip to main content
15,884,177 members
Articles / Desktop Programming / WTL

Shrinking SQL Server Transaction Logs with SQL-DMO

Rate me:
Please Sign up or sign in to vote.
4.99/5 (49 votes)
21 Apr 2004CPOL9 min read 204.1K   4.7K   70  
Using SQL-DMO to shrink SQL Server transaction logs.
/////////////////////////////////////////////////////////////////////////////
#ifndef __DMOSINK_H__
#define __DMOSINK_H__

#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 )
	#pragma once
#endif

/////////////////////////////////////////////////////////////////////////////

_COM_SMARTPTR_TYPEDEF( IConnectionPointContainer, __uuidof( IConnectionPointContainer ) );
_COM_SMARTPTR_TYPEDEF( IConnectionPoint, __uuidof( IConnectionPoint ) );

/////////////////////////////////////////////////////////////////////////////

class IBackupSink : public ISQLDMOBackupSink
{
public:
	IBackupSink( IN HWND hWndNotify );

public: // IUnknown implementation

	STDMETHOD( QueryInterface )( IN REFIID riid, IN OUT LPVOID* ppvObj );
	STDMETHOD_( ULONG, AddRef )( void );
	STDMETHOD_( ULONG, Release )( void );

public: // ISQLDMOBackupSink implementation

	STDMETHOD( PercentComplete )( IN SQLDMO_LPCSTR bstrMessage, IN LONG lPercent );
	STDMETHOD( NextMedia )( IN SQLDMO_LPCSTR bstrMessage );
	STDMETHOD( Complete )( IN SQLDMO_LPCSTR bstrMessage );

public:
	DECLARE_WNDMSG( SQLDMO_BACKUPPERCCOMPLETE );
	DECLARE_WNDMSG( SQLDMO_BACKUPCOMPLETE     );
	DECLARE_WNDMSG( SQLDMO_BACKUPNEXTMEDIA    );

protected:
	ULONG	m_ulRef;	
	HWND	m_hWndNotify;
};

/////////////////////////////////////////////////////////////////////////////
#endif // __DMOSINK_H__
/////////////////////////////////////////////////////////////////////////////

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) SafeNet Inc
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions