//-----------------------------------------------------------------------------
// Microsoft OLE DB TABLECOPY Sample
// Copyright (C) 1996 By Microsoft Corporation.
//
// @doc
//
// @module TABLECOPY.H
//
//-----------------------------------------------------------------------------
#ifndef _TABLECOPY_H_
#define _TABLECOPY_H_
///////////////////////////////////////////////////////////////
// Includes
//
///////////////////////////////////////////////////////////////
#include "oledb.h"
///////////////////////////////////////////////////////////////
// Forward Declarations
//
///////////////////////////////////////////////////////////////
class CTable;
class CWizard;
///////////////////////////////////////////////////////////////
// Defines
//
///////////////////////////////////////////////////////////////
#define MAX_QUERY_LEN4096
#define MAX_NAME_LEN256
#define MAX_COL_SIZE 50000
#define MAX_BLOCK_SIZE 20
// Create param bitmasks describe the parameter required on create table
#define CP_PRECISION0x0001
#define CP_SCALE0x0002
#define CP_LENGTH0x0004
// This macro will determine if the type is numeric, and
// if numeric -> bPrecision, if not numeric -> dwColumnSize
#define COLINFO_SIZE(ColInfo) (IsNumericType(ColInfo.wType) ? ColInfo.bPrecision : ColInfo.ulColumnSize)
// Enum or which Tables to show in the DSN
enum SHOW_TYPES
{
SHOW_NONE= 0x00000000,
SHOW_TABLES= 0x00000001,
SHOW_SYSTABLES= 0x00000002,
SHOW_VIEWS= 0x00000004,
SHOW_SYNONYMS= 0x00000008
};
/////////////////////////////////////////////////////////////////
// CTableCopy
//
/////////////////////////////////////////////////////////////////
class CTableCopy
{
public:
//Constructors
CTableCopy(CWizard* pCWizard);
virtual ~CTableCopy();
//Members
virtual HRESULT CopyTables();
virtual HRESULT MapTypes();
virtual HRESULT CreateTable();
virtual HRESULT CreateIndexes();
virtual HRESULT CopyData(ULONG* pcRows);
//Data
CTable*m_pCFromTable;//Source Table
CTable*m_pCToTable;//Target Table
//Options
DWORDm_dwRowOpt;// Row Options
ULONGm_ulMaxRows;// Maximum rows or ALL_ROWS
DWORDm_dwParamOpt;// Param Options
ULONGm_ulParamSets;// Number of Parameters Sets
DWORDm_dwBlobOpt; // Blob Options
ULONGm_ulBlobSize; // Maximum Size for BLOB Columns
DWORDm_dwShowTypes;// Which Tables in the DSN to show
BOOLm_fShowQuery;// TRUE to display SQL statements
BOOLm_fCopyTables;// TRUE to create the table definition
BOOLm_fCopyIndexes;// TRUE to create indexes on new table
BOOLm_fTranslate;// TRUE to translate object names
CWizard* m_pCWizard;
};
#endif//_TABLECOPY_H_