DCL 3.7.4
Loading...
Searching...
No Matches
MyConnection.h
Go to the documentation of this file.
1#ifndef __DCL_MY_CONNECTION_H__
2#define __DCL_MY_CONNECTION_H__ 20031025_20250414
3
4__DCL_BEGIN_NAMESPACE
5
6class MyQuery;
7
9{
11protected:
12 MYSQL* __mysql;
13 bool __storeResult;
14 ByteString __lastErrorMessage;
15
16public:
17 MYSQL* connHandle() const;
18 bool storeResult() const;
19
20 void setErrorHandle(
21 SQL::Error _error,
22 const wchar_t* _filename, int _line
23 );
24
25 void setErrorMessage(
26 const ByteString& _message,
27 const wchar_t* _filename, int _line
28 );
29
30public:
31 // interface implementation
32 MyConnection(const wchar_t* _serverTitle);
33
34 virtual void destroy();
35 virtual ~MyConnection();
36 virtual bool __open(const char* _conns, size_t _connslen);
37 virtual bool __close();
38 virtual bool __execute(const char* _sql, size_t _sqllen);
39 virtual bool __startTrans();
40 virtual bool __commitTrans();
41 virtual bool __rollbackTrans();
42 virtual bool __createQueryInstance(SQL::Query** _queryHandleOut);
43 virtual bool __getErrorMessage(char* _buf, size_t* _buflen);
44 virtual bool __getServerInfo(char* _buf, size_t* _buflen);
45};
46
47inline MYSQL* MyConnection::connHandle() const
48{
49 return __mysql;
50}
51
52inline bool MyConnection::storeResult() const
53{
54 return __storeResult;
55}
56
58 SQL::Error _error,
59 const wchar_t* _filename,
60 int _line
61 )
62{
63 Connection::setErrorStatus(_error, _filename, _line);
64
65 if (_error == SQL::eServerError)
66 __lastErrorMessage = mysql_error(connHandle());
67 else
68 __lastErrorMessage.clear();
69}
70
72 const ByteString& _message,
73 const wchar_t* _filename,
74 int _line
75 )
76{
77 Connection::setErrorStatus(SQL::eServerError, _filename, _line);
78
79 __lastErrorMessage = _message;
80}
81
82__DCL_END_NAMESPACE
83
84#endif // __DCL_MY_CONNECTION_H__
#define DECLARE_CLASSINFO(class_name)
Definition Object.h:227
virtual bool __createQueryInstance(SQL::Query **_queryHandleOut)
virtual bool __execute(const char *_sql, size_t _sqllen)
virtual bool __startTrans()
virtual bool __getErrorMessage(char *_buf, size_t *_buflen)
bool storeResult() const
virtual bool __rollbackTrans()
virtual void destroy()
MyConnection(const wchar_t *_serverTitle)
virtual bool __close()
virtual bool __commitTrans()
void setErrorMessage(const ByteString &_message, const wchar_t *_filename, int _line)
MYSQL * connHandle() const
virtual bool __getServerInfo(char *_buf, size_t *_buflen)
virtual bool __open(const char *_conns, size_t _connslen)
void setErrorHandle(SQL::Error _error, const wchar_t *_filename, int _line)
virtual ~MyConnection()
_PROTECTED const wchar_t * _filename
Definition SQLCore.h:439
_PROTECTED const wchar_t int _line
Definition SQLCore.h:441
Error
Definition SQLCore.h:19
@ eServerError
Definition SQLCore.h:21