You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
213 lines
11 KiB
C++
213 lines
11 KiB
C++
#if !defined(AFX_PACKAGEINFOTABLE_H__09D87BD2_2746_41E1_A805_F6563D923174__INCLUDED_)
|
|
#define AFX_PACKAGEINFOTABLE_H__09D87BD2_2746_41E1_A805_F6563D923174__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
#if _MSC_VER < 1400 // To prevent STL warning for pre VC++ 2005
|
|
#pragma warning(disable:4786)
|
|
#endif
|
|
|
|
#include "afxdao.h"
|
|
#include <set>
|
|
#include <map>
|
|
|
|
#ifdef BUILD_GUIDLL
|
|
#define DLLCLASS __declspec(dllexport)
|
|
#else
|
|
#define DLLCLASS __declspec(dllimport)
|
|
#endif
|
|
|
|
// PackageInfoTable.h : header file
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CPackageInfoTable DAO recordset
|
|
|
|
class DLLCLASS CPackageInfoTableField
|
|
{
|
|
public:
|
|
long m_PackageTableIndex;
|
|
CString m_PackageTableName;
|
|
|
|
// Need to overload < opertor bcos std::set requires this for less than comparison
|
|
virtual bool operator <(const CPackageInfoTableField& rhs) const
|
|
{ // apply operator< to operands
|
|
return m_PackageTableIndex < rhs.m_PackageTableIndex;
|
|
}
|
|
};
|
|
|
|
class DLLCLASS CPackageInfoTable : public CDaoRecordset
|
|
{
|
|
public:
|
|
CPackageInfoTable(CDaoDatabase* pDatabase = NULL);
|
|
DECLARE_DYNAMIC(CPackageInfoTable)
|
|
|
|
// Field/Param Data
|
|
// {{AFX_FIELD(CPackageInfoTable, CDaoRecordset)
|
|
long m_PackageTableIndex;
|
|
CString m_PackageTableName;
|
|
// }}AFX_FIELD
|
|
|
|
// Overrides
|
|
// ClassWizard generated virtual function overrides
|
|
// {{AFX_VIRTUAL(CPackageInfoTable)
|
|
public:
|
|
virtual CString GetDefaultDBName(); // Default database name
|
|
virtual CString GetDefaultSQL(); // Default SQL for Recordset
|
|
virtual void DoFieldExchange(CDaoFieldExchange* pFX); // RFX support
|
|
// }}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
#ifdef _DEBUG
|
|
virtual void AssertValid() const;
|
|
virtual void Dump(CDumpContext& dc) const;
|
|
#endif
|
|
|
|
/// Get all records of Package Table Index and Package Table Name. Return true if successful
|
|
static bool GetPackageInfoTable(std::set<CPackageInfoTableField> &setPkgInfoTableField);
|
|
|
|
/// Get all records of Package Table Index and Package Table Name. Return true if successful
|
|
static bool GetPackageInfoTable(std::set<CPackageInfoTableField> &setPkgInfoTableField, CDaoDatabase &db);
|
|
|
|
/// Get all records of Package Table Index and Package Table Name. Return true if successful
|
|
static bool GetPackageInfoTable(std::set<CString> &setPkgInfoTableString);
|
|
|
|
/// Get all records of Package Table Index and Package Table Name. Return true if successful
|
|
static bool GetPackageInfoTable(std::set<CString> &setPkgInfoTableString, CDaoDatabase &db);
|
|
|
|
/// Get all records of Package Table Index and Package Table Name. Return true if successful
|
|
static bool GetPackageInfoTable(std::map<int, CString> &mapPkgInfoTableField);
|
|
|
|
/// Get all records of Package Table Index and Package Table Name. Return true if successful
|
|
static bool GetPackageInfoTable(std::map<int, CString> &mapPkgInfoTableField, CDaoDatabase &db);
|
|
|
|
/// Get num of records in PackageInfoTable
|
|
static long GetPackageInfoTableCnt();
|
|
|
|
/// Get num of records in PackageInfoTable
|
|
static long GetPackageInfoTableCnt(CDaoDatabase &db);
|
|
|
|
/// create CPackageInfoTableField array. lArraySize defines the array size
|
|
static CPackageInfoTableField* CreatePackageInfoTableFieldStructure(long &lArraySize);
|
|
|
|
/// create CPackageInfoTableField array. lArraySize defines the array size
|
|
static CPackageInfoTableField* CreatePackageInfoTableFieldStructure(CDaoDatabase &db, long &lArraySize);
|
|
|
|
/// Get all records of Package Table Index and Package Table Name. The amount of records is limited by lArraySize
|
|
static CPackageInfoTableField* GetPackageInfoTable(long &lArraySize);
|
|
|
|
/// Get all records of Package Table Index and Package Table Name. The amount of records is limited by lArraySize
|
|
static CPackageInfoTableField* GetPackageInfoTable(CDaoDatabase &db, long &lArraySize);
|
|
|
|
/// return true if PackageInfoTable is present in database
|
|
static bool IsPackageInfoTablePresent();
|
|
|
|
/// return true if PackageInfoTable is present in database
|
|
static bool IsPackageInfoTablePresent(CDaoDatabase &db);
|
|
|
|
/// Return true if use mutiple PackageInfo Table
|
|
static bool IsUseMutiplePackageInfoTable();
|
|
|
|
/// Return true if use mutiple PackageInfo Table
|
|
static bool IsUseMutiplePackageInfoTable(CString &csFirstTable);
|
|
|
|
/// Return true if use mutiple PackageInfo Table
|
|
static bool IsUseMutiplePackageInfoTable(std::set<CString>::iterator &iter, std::set<CString> &setPkgInfoTableString);
|
|
|
|
/// return true if PackageInfoTable is present in database
|
|
static bool IsUseMutiplePackageInfoTable(CDaoDatabase &db);
|
|
|
|
/// return true if PackageInfoTable is present in database. The first table name will be stored in csFirstTable.
|
|
static bool IsUseMutiplePackageInfoTable(CDaoDatabase &db, CString &csFirstTable);
|
|
|
|
/* return true if PackageInfoTable is present in database.
|
|
Store the PackageInfoTable iterator in iter.
|
|
Store the list of table in PackageInfoTable to setPkgInfoTableString */
|
|
static bool IsUseMutiplePackageInfoTable(CDaoDatabase &db, std::set<CString>::iterator &iter, std::set<CString> &setPkgInfoTableString);
|
|
|
|
/// return true if PackageInfoTable is present in database
|
|
static bool CanUseMutiplePackageInfoTable();
|
|
|
|
/// return true if PackageInfoTable is present in database
|
|
static bool CanUseMutiplePackageInfoTable(CDaoDatabase &db);
|
|
|
|
/* Create New table and Copy Field Info from source database to destination database.
|
|
Set csDestinationDbFile to empty if same database file else set csDestinationTable to the path of the database file.
|
|
Set bPromptError = false to disable prompt database error
|
|
Set bGoldenData = true for golden package */
|
|
static bool CreateNewTableAndCopyFieldInfo(CDaoDatabase &sourceDb, CDaoDatabase &destDb, CString csDestinationDbFileName, bool bPromptError = true,
|
|
bool bGoldenData = false);
|
|
|
|
/* Copy Table field data from source database to destination database.
|
|
Set csDestinationDbFile to empty if same database file else set csDestinationTable to the path of the database file.
|
|
Set the field name as key and field value as value in fieldAndCriteria. Set fieldAndCriteria to NULL if no Criteria
|
|
Set bPromptError = false to disable prompt database error
|
|
Set bGoldenData = true for golden package */
|
|
static bool CopyTableFieldData(CDaoDatabase &sourceDb, CString csSourceTable, CString csDestinationTable,
|
|
std::map<CString, CString>* fieldAndCriteria = NULL, CString csDestinationDbFileName = "", bool bPromptError = true, bool bGoldenData = false);
|
|
|
|
/* Copy csPackageName data from Golden package to package. If cannot find table name in PackageInfoTable Table,
|
|
by default copy table from csSourceTable to csDestinationTable. Return true if copy successful. */
|
|
static bool CopyFromGoldenPackageData(CDaoDatabase &db, CString csSourceTable, CString csDestinationTable, CString csPackageName);
|
|
|
|
/* Create New Package in package info table. Return true if successful.
|
|
Set PackageName in csPackageName
|
|
Set bGoldenData = true to create new package in golden packageinfo table
|
|
Set bPromptError = false to disable prompt database error */
|
|
static bool CreateNewPackageInfo(CDaoDatabase &db, CString csPackageName, bool bGoldenData = false, bool bPromptError = true);
|
|
|
|
/* Return true if all packageinfo field in db1 and db2 fields are the same.
|
|
Set bPromptError = false to disable prompt database error */
|
|
static bool ComparePackageInfoField(CDaoDatabase &db1, CDaoDatabase &db2, bool bPromptError = true);
|
|
|
|
/* Return true if the packageinfo field in csTableName in db1 and db2 fields are the same.
|
|
Set bPromptError = false to disable prompt database error */
|
|
static bool IsSamePackageInfoField(CDaoDatabase &db1, CDaoDatabase &db2, CString csTableName, bool bPromptError = true);
|
|
|
|
/* Delete package in package info table. Return true if successful.
|
|
Set bPromptError = false to disable prompt database error.
|
|
Set bGoldenData = true to delete package in golden packageinfo table. */
|
|
static bool DeletePackageInfo(CDaoDatabase &db, CString csPackageName, bool bGoldenData = false, bool bPromptError = true);
|
|
|
|
/* Create Golden Package info table and copy the data from PackageInfo table. Return true if successful
|
|
Set csDestinationDbFile to empty if same database file else set csDestinationTable to the path of the database file. */
|
|
static bool CreateGoldenPackageDataTable(CDaoDatabase &db, CString csDestinationDbFileName = "");
|
|
|
|
/* copy Package info data from existing package to new package. Return true if successful.
|
|
Set bUseGoldenPackageMethod = true to copy golden package data
|
|
Set bPromptError = false to disable prompt database error. */
|
|
static bool CopyToNewPackageInfo(CDaoDatabase &db, CString csNewPackage, CString csExistingPackage, bool bUseGoldenPackageMethod, bool bPromptError = true);
|
|
|
|
/// Return true if Rename Package name successful. Set bGoldenData = true if rename golden package name
|
|
static bool RenamePackage(CDaoDatabase &db, CString cOrignalPkgName, CString csNewName, bool bGoldenData = false);
|
|
|
|
/// Return true if package info table have default package. Set bGoldenData = true if check golden package table have default package
|
|
static bool CheckHaveDefaultPackageInfo(CDaoDatabase &db, bool bUseGoldenPackageMethod = false);
|
|
|
|
/// Return the total field count of single or multiple packageinfo table
|
|
static int GetAllPkgTblFieldCount(CDaoDatabase &db, CString csPackageInfo = "PackageInfo");
|
|
|
|
/* Return the first element number of a particular packageinfo table.
|
|
iWhichTable is 0 based index. First packageinfo table denotes as number 0 element */
|
|
static int GetPkgTblStartNum(CDaoDatabase &db, int iWhichTable);
|
|
|
|
/* Return the first element number of a particular packageinfo table.
|
|
Set csPackageInfo to the name of table to get the first element number */
|
|
static int GetPkgTblStartNum(CDaoDatabase &db, CString csPackageInfo = "PackageInfo");
|
|
|
|
/* Return the last element number of a particular packageinfo table.
|
|
iWhichTable is 0 based index. First packageinfo table denotes as number 0 element */
|
|
static int GetPkgTblEndNum(CDaoDatabase &db, int iWhichTable);
|
|
|
|
/* Return the last element number of a particular packageinfo table.
|
|
Set csPackageInfo to the name of table to get the first element number */
|
|
static int GetPkgTblEndNum(CDaoDatabase &db, CString csPackageInfo = "PackageInfo");
|
|
};
|
|
|
|
// {{AFX_INSERT_LOCATION}}
|
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
|
|
#endif // !defined(AFX_PACKAGEINFOTABLE_H__09D87BD2_2746_41E1_A805_F6563D923174__INCLUDED_)
|