// DatabaseUtility.h: interface for the CDatabaseUtility class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_DATABASEUTILITY_H__02069DB9_2872_407E_9CFD_50FAD481ADD7__INCLUDED_) #define AFX_DATABASEUTILITY_H__02069DB9_2872_407E_9CFD_50FAD481ADD7__INCLUDED_ #include #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifdef BUILD_UTILITYDLL #define UTILITYDLL __declspec(dllexport) #else #define UTILITYDLL __declspec(dllimport) #endif class UTILITYDLL CDatabaseUtility { public: static bool DeleteRecord(CString csDatabaseName, CString csTableName, CString csPackageName); static bool DeleteAllRecipesAndPackages(CString csDatabaseName); static bool DeleteRecipeAndPackage(CString csDatabaseName, CString csPackageName); static bool DeleteAllRecords(CString csDatabaseName, CString csTableName); static bool GetAllLanguageTables(CDaoDatabase* pDatabase, CStringArray *csaTableArray); static bool DeleteField(CString csPath, CString csTableName, CString csFieldName); static bool SetFieldValueToAllRecords(CString csPath, CString csTableName, CString csFieldName, short nFieldType, CString csDefaultValue); static bool CreateNewField(CString csPath, CString csTableName, CString strName, short nType, long lSize, long lAttributes,CString csDefaultValue ); static bool IsFieldPresent(CString csPath, CString csTableName, CString csFieldName); CDatabaseUtility(); virtual ~CDatabaseUtility(); static bool CreateNewField(CString csPath, CString csTableName, CDaoFieldInfo *pFieldInfo, CString csDefaultValue); static bool InsertField(CString csPath, CString csTableName,CString csNewFieldName,short nNewFieldPosition,short nType, long lSize, long lAttributes,CString csDefaultValue); static bool InsertBooleanField(CString csPath, CString csTableName, CString csNewFieldName, short nNewFieldPosition, bool bDefaultValue = false); static bool InsertStringField(CString csPath, CString csTableName, CString csNewFieldName, short nNewFieldPosition, CString csDefaultValue = "", long lSize = 50, long lAttributes = dbVariableField); static bool InsertLongField(CString csPath, CString csTableName, CString csNewFieldName, short nNewFieldPosition, long lDefaultValue = 0); static bool InsertDoubleField(CString csPath, CString csTableName, CString csNewFieldName, short nNewFieldPosition, double dDefaultValue = 0); static short GetFieldCount(CDaoDatabase* pDatabase,CString csTableName); static int GetRecordCount(CDaoDatabase* pDatabase,CString csTableName); static bool GetFieldData(CDaoDatabase *pDatabase,CString csTableName,short fieldType,CString fieldName,CString* m_pFieldData); static bool GetAllFieldInfo(CDaoDatabase* pDatabase,CString csTableName,CDaoFieldInfo* m_pFieldInfo); static bool IsTablePresent(CDaoDatabase *pDatabase, CString strTableName); static bool SetFieldValueToAllRecords(CDaoDatabase* pDataBase,CString csTableName,CDaoFieldInfo& fieldInfo,CString* csFieldData,bool bAddNewRecord = false,int iRecordCount = 0); private: static bool CreateTempTable(CDaoDatabase *pDatabase,CString csTempTableName,CString csTempFieldName,int nRecordCount); }; #endif // !defined(AFX_DATABASEUTILITY_H__02069DB9_2872_407E_9CFD_50FAD481ADD7__INCLUDED_)