Version: 1.0.0
mysql_interface.cpp
Go to the documentation of this file.
1 #include "wx/database/wxprec.h"
2 
3 #if wxUSE_DATABASE_MYSQL
4 
6 {
7 #ifdef __WIN32__
8  bool bLoaded = m_MysqlDLL.Load(wxT("libmySQL.dll"), wxDL_VERBATIM);
9 #else
10  bool bLoaded = m_MysqlDLL.Load(wxDynamicLibrary::CanonicalizeName(wxT("mysqlclient")));
11 #endif
12  if (!bLoaded)
13  {
14  return false;
15  }
16 
17  wxString symbol = wxT("mysql_server_end");
18  if (m_MysqlDLL.HasSymbol(symbol))
19  {
20  m_pMysqlServerEnd = (MysqlServerEndType)m_MysqlDLL.GetSymbol(symbol);
21  }
22  else
23  {
24  return false;
25  }
26 
27  symbol = wxT("mysql_init");
28  if (m_MysqlDLL.HasSymbol(symbol))
29  {
30  m_pMysqlInit = (MysqlInitType)m_MysqlDLL.GetSymbol(symbol);
31  }
32  else
33  {
34  return false;
35  }
36 
37  symbol = wxT("mysql_real_connect");
38  if (m_MysqlDLL.HasSymbol(symbol))
39  {
41  }
42  else
43  {
44  return false;
45  }
46 
47  symbol = wxT("mysql_select_db");
48  if (m_MysqlDLL.HasSymbol(symbol))
49  {
51  }
52  else
53  {
54  return false;
55  }
56 
57  symbol = wxT("mysql_real_query");
58  if (m_MysqlDLL.HasSymbol(symbol))
59  {
60  m_pMysqlRealQuery = (MysqlRealQueryType)m_MysqlDLL.GetSymbol(symbol);
61  }
62  else
63  {
64  return false;
65  }
66 
67  symbol = wxT("mysql_error");
68  if (m_MysqlDLL.HasSymbol(symbol))
69  {
70  m_pMysqlError = (MysqlErrorType)m_MysqlDLL.GetSymbol(symbol);
71  }
72  else
73  {
74  return false;
75  }
76 
77  symbol = wxT("mysql_errno");
78  if (m_MysqlDLL.HasSymbol(symbol))
79  {
80  m_pMysqlErrno = (MysqlErrnoType)m_MysqlDLL.GetSymbol(symbol);
81  }
82  else
83  {
84  return false;
85  }
86 
87  symbol = wxT("mysql_close");
88  if (m_MysqlDLL.HasSymbol(symbol))
89  {
90  m_pMysqlClose = (MysqlCloseType)m_MysqlDLL.GetSymbol(symbol);
91  }
92  else
93  {
94  return false;
95  }
96 
97  symbol = wxT("mysql_autocommit");
98  if (m_MysqlDLL.HasSymbol(symbol))
99  {
101  }
102  else
103  {
104  return false;
105  }
106 
107  symbol = wxT("mysql_commit");
108  if (m_MysqlDLL.HasSymbol(symbol))
109  {
110  m_pMysqlCommit = (MysqlCommitType)m_MysqlDLL.GetSymbol(symbol);
111  }
112  else
113  {
114  return false;
115  }
116 
117  symbol = wxT("mysql_rollback");
118  if (m_MysqlDLL.HasSymbol(symbol))
119  {
120  m_pMysqlRollback = (MysqlRollbackType)m_MysqlDLL.GetSymbol(symbol);
121  }
122  else
123  {
124  return false;
125  }
126 
127  symbol = wxT("mysql_query");
128  if (m_MysqlDLL.HasSymbol(symbol))
129  {
130  m_pMysqlQuery = (MysqlQueryType)m_MysqlDLL.GetSymbol(symbol);
131  }
132  else
133  {
134  return false;
135  }
136 
137  symbol = wxT("mysql_stmt_affected_rows");
138  if (m_MysqlDLL.HasSymbol(symbol))
139  {
141  }
142  else
143  {
144  return false;
145  }
146 
147  symbol = wxT("mysql_affected_rows");
148  if (m_MysqlDLL.HasSymbol(symbol))
149  {
151  }
152  else
153  {
154  return false;
155  }
156 
157  symbol = wxT("mysql_stmt_init");
158  if (m_MysqlDLL.HasSymbol(symbol))
159  {
160  m_pMysqlStmtInit = (MysqlStmtInitType)m_MysqlDLL.GetSymbol(symbol);
161  }
162  else
163  {
164  return false;
165  }
166 
167  symbol = wxT("mysql_stmt_prepare");
168  if (m_MysqlDLL.HasSymbol(symbol))
169  {
171  }
172  else
173  {
174  return false;
175  }
176 
177  symbol = wxT("mysql_stmt_execute");
178  if (m_MysqlDLL.HasSymbol(symbol))
179  {
181  }
182  else
183  {
184  return false;
185  }
186 
187  symbol = wxT("mysql_stmt_error");
188  if (m_MysqlDLL.HasSymbol(symbol))
189  {
190  m_pMysqlStmtError = (MysqlStmtErrorType)m_MysqlDLL.GetSymbol(symbol);
191  }
192  else
193  {
194  return false;
195  }
196 
197  symbol = wxT("mysql_stmt_errno");
198  if (m_MysqlDLL.HasSymbol(symbol))
199  {
200  m_pMysqlStmtErrno = (MysqlStmtErrnoType)m_MysqlDLL.GetSymbol(symbol);
201  }
202  else
203  {
204  return false;
205  }
206 
207  symbol = wxT("mysql_stmt_free_result");
208  if (m_MysqlDLL.HasSymbol(symbol))
209  {
211  }
212  else
213  {
214  return false;
215  }
216 
217  symbol = wxT("mysql_stmt_close");
218  if (m_MysqlDLL.HasSymbol(symbol))
219  {
220  m_pMysqlStmtClose = (MysqlStmtCloseType)m_MysqlDLL.GetSymbol(symbol);
221  }
222  else
223  {
224  return false;
225  }
226 
227  symbol = wxT("mysql_list_tables");
228  if (m_MysqlDLL.HasSymbol(symbol))
229  {
231  }
232  else
233  {
234  return false;
235  }
236 
237  symbol = wxT("mysql_fetch_row");
238  if (m_MysqlDLL.HasSymbol(symbol))
239  {
240  m_pMysqlFetchRow = (MysqlFetchRowType)m_MysqlDLL.GetSymbol(symbol);
241  }
242  else
243  {
244  return false;
245  }
246 
247  symbol = wxT("mysql_fetch_field");
248  if (m_MysqlDLL.HasSymbol(symbol))
249  {
251  }
252  else
253  {
254  return false;
255  }
256 
257  symbol = wxT("mysql_free_result");
258  if (m_MysqlDLL.HasSymbol(symbol))
259  {
261  }
262  else
263  {
264  return false;
265  }
266 
267  symbol = wxT("mysql_get_server_version");
268  if (m_MysqlDLL.HasSymbol(symbol))
269  {
271  }
272  else
273  {
274  return false;
275  }
276 
277  symbol = wxT("mysql_stmt_result_metadata");
278  if (m_MysqlDLL.HasSymbol(symbol))
279  {
281  }
282  else
283  {
284  return false;
285  }
286 
287  symbol = wxT("mysql_num_fields");
288  if (m_MysqlDLL.HasSymbol(symbol))
289  {
290  m_pMysqlNumFields = (MysqlNumFieldsType)m_MysqlDLL.GetSymbol(symbol);
291  }
292  else
293  {
294  return false;
295  }
296 
297  symbol = wxT("mysql_stmt_param_count");
298  if (m_MysqlDLL.HasSymbol(symbol))
299  {
301  }
302  else
303  {
304  return false;
305  }
306 
307  symbol = wxT("mysql_stmt_bind_param");
308  if (m_MysqlDLL.HasSymbol(symbol))
309  {
311  }
312  else
313  {
314  return false;
315  }
316 
317  symbol = wxT("mysql_stmt_fetch");
318  if (m_MysqlDLL.HasSymbol(symbol))
319  {
320  m_pMysqlStmtFetch = (MysqlStmtFetchType)m_MysqlDLL.GetSymbol(symbol);
321  }
322  else
323  {
324  return false;
325  }
326 
327  symbol = wxT("mysql_stmt_bind_result");
328  if (m_MysqlDLL.HasSymbol(symbol))
329  {
331  }
332  else
333  {
334  return false;
335  }
336 
337  return true;
338 }
339 
340 #endif//wxUSE_DATABASE_MYSQL
MysqlStmtBindParamType m_pMysqlStmtBindParam
int(STDCALL * MysqlStmtAffectedRows)(MYSQL_STMT *)
int(STDCALL * MysqlStmtExecuteType)(MYSQL_STMT *)
int(STDCALL * MysqlQueryType)(MYSQL *, const char *)
MYSQL_FIELD *(STDCALL * MysqlFetchFieldType)(MYSQL_RES *)
MysqlStmtResultMetadataType m_pMysqlStmtResultMetadata
my_bool(STDCALL * MysqlRollbackType)(MYSQL *)
my_bool(STDCALL * MysqlStmtCloseType)(MYSQL_STMT *)
wxDynamicLibrary m_MysqlDLL
MYSQL_ROW(STDCALL * MysqlFetchRowType)(MYSQL_RES *)
MysqlRealConnectType m_pMysqlRealConnect
MysqlServerEndType m_pMysqlServerEnd
MysqlStmtFreeResultType m_pMysqlStmtFreeResult
MysqlSelectDatabaseType m_pMysqlSelectDatabase
void(STDCALL * MysqlCloseType)(MYSQL *)
MYSQL_STMT *(STDCALL * MysqlStmtInitType)(MYSQL *)
const char *(STDCALL * MysqlStmtErrorType)(MYSQL_STMT *)
MysqlStmtExecuteType m_pMysqlStmtExecute
unsigned int(STDCALL * MysqlStmtErrnoType)(MYSQL_STMT *)
void(STDCALL * MysqlFreeResultType)(MYSQL_RES *)
MysqlStmtBindResultType m_pMysqlStmtBindResult
const char *(STDCALL * MysqlErrorType)(MYSQL *)
my_bool(STDCALL * MysqlStmtFreeResultType)(MYSQL_STMT *)
MysqlRealQueryType m_pMysqlRealQuery
MysqlErrnoType m_pMysqlErrno
MysqlAutoCommitType m_pMysqlAutoCommit
MysqlFetchRowType m_pMysqlFetchRow
MysqlStmtErrnoType m_pMysqlStmtErrno
MysqlStmtAffectedRows m_pMysqlStmtAffectedRows
MysqlStmtParamCountType m_pMysqlStmtParamCount
MysqlQueryType m_pMysqlQuery
unsigned long(STDCALL * MysqlGetServerVersionType)(MYSQL *)
MysqlCloseType m_pMysqlClose
MysqlFetchFieldType m_pMysqlFetchField
MysqlNumFieldsType m_pMysqlNumFields
MysqlStmtFetchType m_pMysqlStmtFetch
MysqlStmtErrorType m_pMysqlStmtError
my_bool(STDCALL * MysqlCommitType)(MYSQL *)
MysqlFreeResultType m_pMysqlFreeResult
MysqlListTablesType m_pMysqlListTables
MYSQL_RES *(STDCALL * MysqlListTablesType)(MYSQL *, const char *)
MYSQL_RES *(STDCALL * MysqlStmtResultMetadataType)(MYSQL_STMT *)
MysqlErrorType m_pMysqlError
MysqlCommitType m_pMysqlCommit
unsigned int(STDCALL * MysqlErrnoType)(MYSQL *)
my_bool(STDCALL * MysqlStmtBindResultType)(MYSQL_STMT *, MYSQL_BIND *)
my_bool(STDCALL * MysqlStmtBindParamType)(MYSQL_STMT *, MYSQL_BIND *)
void(STDCALL * MysqlServerEndType)(void)
MysqlGetServerVersionType m_pMysqlGetServerVersion
MYSQL *(STDCALL * MysqlInitType)(MYSQL *)
unsigned long(STDCALL * MysqlStmtParamCountType)(MYSQL_STMT *)
MysqlRollbackType m_pMysqlRollback
MysqlStmtCloseType m_pMysqlStmtClose
unsigned int(STDCALL * MysqlNumFieldsType)(MYSQL_RES *)
int(STDCALL * MysqlStmtFetchType)(MYSQL_STMT *)
int(STDCALL * MysqlSelectDatabaseType)(MYSQL *mysql, const char *db)
my_ulonglong(STDCALL * MysqlAffectedRowsType)(MYSQL *)
MysqlAffectedRowsType m_pMysqlAffectedRows
MysqlInitType m_pMysqlInit
MysqlStmtPrepareType m_pMysqlStmtPrepare
MysqlStmtInitType m_pMysqlStmtInit
my_bool(STDCALL * MysqlAutoCommitType)(MYSQL *, my_bool)
MYSQL *(STDCALL * MysqlRealConnectType)(MYSQL *, const char *, const char *, const char *, const char *, unsigned int, const char *, unsigned long)
int(STDCALL * MysqlStmtPrepareType)(MYSQL_STMT *, const char *, unsigned long)
int(STDCALL * MysqlRealQueryType)(MYSQL *, const char *, unsigned long)