Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cSQLBase.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cSQLBase_H
7 #define _INC_cSQLBase_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cSQLConfig.h"
17 
18 namespace GrayLib
19 {
20  typedef INT16 SQL_RETURN_t;
21  static const SQL_RETURN_t k_SQL_SUCCESS = 0;
22 
23  typedef int SQL_COLUMN_t;
24  static const SQL_COLUMN_t k_SQL_COL_FIRST = 1;
25 
28 
30  {
33 
34  public:
35  static const FILECHAR_t* k_DataSource;
36 
37  public:
39  {
40  }
41  cSQLConnectionString(const FILECHAR_t* pszConnectionString)
42  {
43  SetParse(pszConnectionString);
44  }
45  void SetParse(const FILECHAR_t* pszConnectionString)
46  {
47  InitArgsF(pszConnectionString, _FN(";"));
48  }
49 
50  // Parse and build connection string from cIniMap ?
51  // static cIniMap GRAYCALL ParseConnectionString(const FILECHAR_t* pszConenctionString);
52  // static cString GRAYCALL BuildConnectionString(const cIniMap& map);
53  };
54 
56  {
60  typedef cExceptionHResult SUPER_t;
61 
62  public:
66 
69 
70  public:
71  cSQLException(cStringA sCommand = "", cStringA sDescription = "", const cDebugSourceLine& src = cDebugSourceLine());
72  virtual ~cSQLException() throw();
73 
74  virtual BOOL GetErrorMessage(GChar_t* lpszError, UINT nLenMax, UINT* pnHelpContext = nullptr);
75  };
76 
77  class GRAYLIB_LINK cSQLBase : public CObject, protected cNonCopyable
78  {
83 
84  public:
86 #ifdef _CPPUNWIND
87  bool m_bThrowOnError;
88 #endif
89 
90  protected:
92 
93  private:
94  ITERATE_t m_iChildISQLCount;
95 
96  protected:
97  bool AttachISQL( ISQLBase* pSQL);
98  void FreeISQL();
99  bool FreeISQLTested();
100 
101  protected: // only used as a base class. abstract.
102  cSQLBase();
103 
104  public:
105  virtual ~cSQLBase();
106 
107  static const FILECHAR_t* GRAYCALL RemoveDriverIdentification(const FILECHAR_t* pszError);
108 
109  // If some error has occurred.
110  HRESULT FillException(cExceptionHolder& exh, cStringA sCommand, const cDebugSourceLine& src) const;
111  HRESULT ReturnError1(cExceptionHolder& exh) const;
112  HRESULT ReturnError2(cStringA sCommand, const cDebugSourceLine& src) const;
113 
115  bool isISQLValid() const;
116 
118  virtual cSQLDriver* get_SQLDriver() const = 0;
119 
120  virtual cSQLBase* get_SQLParent() const = 0;
121 
123  {
125  return m_iChildISQLCount;
126  }
127  };
128 }
129 #endif // _INC_cSQLBase_H
#define _FN(x)
like _T(x) macro for static text file names.
Definition: FileName.h:23
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cSQLBase.h:78
bool m_bLogOnError
I want to log message if error.
Definition: cSQLBase.h:85
virtual cSQLBase * get_SQLParent() const =0
virtual cSQLDriver * get_SQLDriver() const =0
What driver ultimately owns this?
ITERATE_t get_ChildHandleCount() const noexcept
Definition: cSQLBase.h:122
cIUnkPtr< ISQLBase > m_pISQL
ISQLBase to some SQL implementation object -> a Driver/environment, connection or recordset/statement...
Definition: cSQLBase.h:91
Definition: cSQLBase.h:30
cSQLConnectionString(const FILECHAR_t *pszConnectionString)
Definition: cSQLBase.h:41
static const FILECHAR_t * k_DataSource
"Data Source="
Definition: cSQLBase.h:35
void SetParse(const FILECHAR_t *pszConnectionString)
Definition: cSQLBase.h:45
cSQLConnectionString() noexcept
Definition: cSQLBase.h:38
Definition: cSQLMgr.h:25
Definition: cSQLBase.h:56
cStringA m_sCommand
The command i used to get here.
Definition: cSQLBase.h:63
cStringA m_sDescription
m_pszDescription of the error. (Strip the [driver name] header off ?)
Definition: cSQLBase.h:64
cStringA m_strStateNativeOrigin
no idea what this code means. some text related to m_nNativeError?
Definition: cSQLBase.h:68
cDebugSourceLine m_Src
DEBUGSOURCELINE.
Definition: cSQLBase.h:65
SQL_RETURN_t m_nNativeError
SQL native/driver return code. AKA SQLRETURN or RETCODE. e.g. SQL_SUCCESS.
Definition: cSQLBase.h:67
Definition: cObject.h:67
Definition: cAppState.h:42
Definition: cException.h:130
Definition: cException.h:28
Definition: cException.h:83
Definition: cIUnkPtr.h:32
Definition: cNonCopyable.h:17
Definition: ISQLDriver.h:22
Definition: cMesh.h:22
INT16 SQL_RETURN_t
AKA SQLRETURN or RETCODE. Native driver error. e.g. SQL_SUCCESS = 0.
Definition: cSQLBase.h:20
int SQL_COLUMN_t
what field/column/parameter number. 1 based. SQLUSMALLINT
Definition: cSQLBase.h:23
DECLARE_INTERFACE(IScriptableSetter)
int ITERATE_t
like size_t but signed
Definition: Index.h:28
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
Definition: cDebugAssert.h:29