DMDbF.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. void __fastcall SetConnectString(String AConnStr);
  31. bool __fastcall Connect(String AConnStr="");
  32. bool __fastcall Close();
  33. bool __fastcall SQLClose(TADOQuery *adoQry);
  34. bool __fastcall SQLClear(TADOQuery *adoQry);
  35. int __fastcall SQLText(TADOQuery *adoQry, String sQry);
  36. bool __fastcall SQLBind(TADOQuery *adoQry, String param, String var);
  37. bool __fastcall SQLBindStream(TADOQuery *adoQry, String param, TStream * pStream);
  38. int __fastcall SQLOpen(TADOQuery *adoQry);
  39. int __fastcall SQLExec(TADOQuery *adoQry);
  40. bool __fastcall LocateItem(TADOQuery *adoQry, String sFldNm, String sFldVal);
  41. void __fastcall SetErrorString(String AErrorString);
  42. __property String ErrorString = {read=FErrorString, write=SetErrorString};
  43. __property String ConnString = {read=FConnString, write=FConnString};
  44. };
  45. //---------------------------------------------------------------------------
  46. extern PACKAGE TDMDb *DMDb;
  47. //---------------------------------------------------------------------------
  48. #endif