libUTL++
DBconnection.h
1 #pragma once
2 
4 
5 #include <libutl/DBresult.h>
6 
8 
9 UTL_NS_BEGIN;
10 
12 
24 
26 class DBconnection : public Object
27 {
31 
32 public:
34  virtual void connect(const String& connectStr) = 0;
35 
37  virtual void disconnect() = 0;
38 
40  bool
41  isConnected() const
42  {
43  return _connected;
44  }
45 
47  void
49  {
50  _result.clear();
51  }
52 
54  virtual const DBresult* exec(const String& cmd) = 0;
55 
56 protected:
57  void
58  setConnected(bool connected)
59  {
60  _connected = connected;
61  }
62 
63 protected:
64  DBresult _result;
65 
66 private:
67  void init();
68  void deInit();
69 
70 private:
71  bool _connected;
72 };
73 
75 
76 UTL_NS_END;
void clearResult()
Clear result.
Definition: DBconnection.h:48
void deInit()
De-initialize UTL++.
Database command result.
Definition: DBresult.h:40
Character string.
Definition: String.h:31
#define UTL_CLASS_DECL_ABC(DC, BC)
Declaration of standard UTL++ functionality for an abstract base class (ABC).
Definition: macros.h:650
Database connection.
Definition: DBconnection.h:26
#define UTL_CLASS_NO_SERIALIZE
Declare that a class cannot do serialize().
Definition: macros.h:384
#define UTL_CLASS_NO_COPY
Declare that a class cannot do copy().
Definition: macros.h:358
bool isConnected() const
Connected?
Definition: DBconnection.h:41
Root of UTL++ class hierarchy.
Definition: Object.h:52
void init()
Initialize UTL++.