|
1 | 1 | #pragma once |
2 | 2 | #include "../acl_cpp_define.hpp" |
| 3 | +#include <string> |
3 | 4 |
|
4 | 5 | #if !defined(ACL_CLIENT_ONLY) && !defined(ACL_DB_DISABLE) |
5 | 6 |
|
@@ -80,73 +81,69 @@ class ACL_CPP_API mysql_conf { |
80 | 81 | */ |
81 | 82 | mysql_conf& set_charset(const char* charset); |
82 | 83 |
|
83 | | - const char* get_dbaddr() const |
84 | | - { |
85 | | - return dbaddr_; |
| 84 | + const char* get_dbaddr() const { |
| 85 | + return dbaddr.c_str(); |
86 | 86 | } |
87 | 87 |
|
88 | | - const char* get_dbname() const |
89 | | - { |
90 | | - return dbname_; |
| 88 | + const char* get_dbname() const { |
| 89 | + return dbname.c_str(); |
91 | 90 | } |
92 | 91 |
|
93 | | - const char* get_dbkey() const |
94 | | - { |
95 | | - return dbkey_; |
| 92 | + const char* get_dbkey() const { |
| 93 | + return dbkey.c_str(); |
96 | 94 | } |
97 | 95 |
|
98 | | - const char* get_dbuser() const |
99 | | - { |
100 | | - return dbuser_; |
| 96 | + const char* get_dbuser() const { |
| 97 | + return dbuser.c_str(); |
101 | 98 | } |
102 | 99 |
|
103 | | - const char* get_dbpass() const |
104 | | - { |
105 | | - return dbpass_; |
| 100 | + const char* get_dbpass() const { |
| 101 | + return dbpass.c_str(); |
106 | 102 | } |
107 | 103 |
|
108 | | - size_t get_dblimit() const |
109 | | - { |
110 | | - return dblimit_; |
| 104 | + size_t get_dblimit() const { |
| 105 | + return dblimit; |
111 | 106 | } |
112 | 107 |
|
113 | | - unsigned long get_dbflags() const |
114 | | - { |
115 | | - return dbflags_; |
| 108 | + unsigned long get_dbflags() const { |
| 109 | + return dbflags; |
116 | 110 | } |
117 | 111 |
|
118 | | - bool get_auto_commit() const |
119 | | - { |
120 | | - return auto_commit_; |
| 112 | + bool get_auto_commit() const { |
| 113 | + return auto_commit; |
121 | 114 | } |
122 | 115 |
|
123 | | - int get_conn_timeout() const |
124 | | - { |
125 | | - return conn_timeout_; |
| 116 | + int get_conn_timeout() const { |
| 117 | + return conn_timeout; |
126 | 118 | } |
127 | 119 |
|
128 | | - int get_rw_timeout() const |
129 | | - { |
130 | | - return rw_timeout_; |
| 120 | + int get_rw_timeout() const { |
| 121 | + return rw_timeout; |
131 | 122 | } |
132 | 123 |
|
133 | | - const char* get_charset() const |
134 | | - { |
135 | | - return charset_; |
| 124 | + const char* get_charset() const { |
| 125 | + return charset.c_str(); |
136 | 126 | } |
137 | 127 |
|
138 | | -private: |
139 | | - char* dbaddr_; // 数据库监听地址 |
140 | | - char* dbname_; // 数据库名 |
141 | | - char* dbkey_; // dbname@dbaddr |
142 | | - char* dbuser_; // 数据库账号 |
143 | | - char* dbpass_; // 数据库账号密码 |
144 | | - char* charset_; // 连接数据库时的字符集 |
145 | | - size_t dblimit_; // 数据库连接池连接数上限 |
146 | | - unsigned long dbflags_; // 打开数据库时的标志位 |
147 | | - bool auto_commit_; // 是否自动提交修改后的数据 |
148 | | - int conn_timeout_; // 连接数据库的超时时间 |
149 | | - int rw_timeout_; // 与数据库通信的超时时间 |
| 128 | + ////////////////////////////////////////////////////////////////////// |
| 129 | + |
| 130 | + std::string dbaddr; // 数据库监听地址 |
| 131 | + std::string dbname; // 数据库名 |
| 132 | + std::string dbkey; // dbname@dbaddr |
| 133 | + std::string dbuser; // 数据库账号 |
| 134 | + std::string dbpass; // 数据库账号密码 |
| 135 | + std::string charset; // 连接数据库时的字符集 |
| 136 | + size_t dblimit; // 数据库连接池连接数上限 |
| 137 | + unsigned long dbflags; // 打开数据库时的标志位 |
| 138 | + bool auto_commit; // 是否自动提交修改后的数据 |
| 139 | + int conn_timeout; // 连接数据库的超时时间 |
| 140 | + int rw_timeout; // 与数据库通信的超时时间 |
| 141 | + |
| 142 | + std::string sslcrt; |
| 143 | + std::string sslkey; |
| 144 | + std::string sslca; |
| 145 | + std::string sslcapath; |
| 146 | + std::string sslcipher; |
150 | 147 | }; |
151 | 148 |
|
152 | 149 | } // namespace acl |
|
0 commit comments