DMDbF.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //---------------------------------------------------------------------------
  2. #ifndef DMDbFH
  3. #define DMDbFH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Controls.hpp>
  7. #include <StdCtrls.hpp>
  8. #include <Forms.hpp>
  9. #include <ADODB.hpp>
  10. #include <DB.hpp>
  11. //---------------------------------------------------------------------------
  12. #define ERRMSG(v,w,x,y) ITSLog->LogDbError(v,w,x,y,__FILE__, String(__FUNC__), __LINE__,true)
  13. #define ERRLOG(v,w,x,y) ITSLog->LogDbError(v,w,x,y,__FILE__, String(__FUNC__), __LINE__,false)
  14. //---------------------------------------------------------------------------
  15. class TDMDb : public TDataModule
  16. {
  17. __published: // IDE-managed Components
  18. void __fastcall DataModuleCreate(TObject *Sender);
  19. void __fastcall DataModuleDestroy(TObject *Sender);
  20. private: // User declarations
  21. TADOConnection *FDbConn;
  22. String FErrorString;
  23. String FConnString;
  24. bool FException;
  25. public: // User declarations
  26. __fastcall TDMDb(TComponent* Owner);
  27. void __fastcall SetException(bool AException=true) { FException = AException; }
  28. TADOConnection *GetConnection() { return FDbConn; }
  29. void __fastcall SetConnectString(String AProvider, String AServerName, String AUserName, String APassword, String ACatalog="");
  30. bool __fastcall Connect(String AConnStr="");
  31. bool __fastcall Close();
  32. bool __fastcall SQLClose(TADOQuery *adoQry);
  33. bool __fastcall SQLClear(TADOQuery *adoQry);
  34. int __fastcall SQLText(TADOQuery *adoQry, String sQry);
  35. bool __fastcall SQLBind(TADOQuery *adoQry, String param, String var);
  36. bool __fastcall SQLBindStream(TADOQuery *adoQry, String param, TStream * pStream);
  37. int __fastcall SQLOpen(TADOQuery *adoQry);
  38. int __fastcall SQLExec(TADOQuery *adoQry);
  39. bool __fastcall LocateItem(TADOQuery *adoQry, String sFldNm, String sFldVal);
  40. void __fastcall SetErrorString(String AErrorString);
  41. __property String ErrorString = {read=FErrorString, write=SetErrorString};
  42. __property String ConnString = {read=FConnString, write=FConnString};
  43. };
  44. //---------------------------------------------------------------------------
  45. extern PACKAGE TDMDb *DMDb;
  46. //---------------------------------------------------------------------------
  47. #endif