minor changes
[public/netxms.git] / src / db / dbdrv / mysql / mysqldrv.h
CommitLineData
5039dede
AK
1/*
2** MySQL Database Driver
3** Copyright (C) 2003 Victor Kirhenshtein
4**
5** This program is free software; you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation; either version 2 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program; if not, write to the Free Software
17** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18**
f7e4c50e 19** File: mysqldrv.h
5039dede
AK
20**
21**/
22
23#ifndef _mysqldrv_h_
24#define _mysqldrv_h_
25
26#ifdef _WIN32
f7e4c50e
VK
27
28#ifndef _WIN32_WINNT
29#define _WIN32_WINNT 0x0502
30#endif
31
5039dede
AK
32#include <winsock2.h>
33#include <windows.h>
34#define EXPORT __declspec(dllexport)
35#else
36#include <string.h>
37#define EXPORT
38#endif /* _WIN32 */
39
40#include <dbdrv.h>
41#include <nms_util.h>
42
43#undef GROUP_FLAG
44#include <mysql.h>
45#include <errmsg.h>
46
54aa9c6f
VK
47/**
48 * Structure of DB connection handle
49 */
5039dede
AK
50typedef struct
51{
52 MYSQL *pMySQL;
53 MUTEX mutexQueryLock;
54} MYSQL_CONN;
55
54aa9c6f
VK
56/**
57 * Structure of prepared statement
58 */
c94bb5aa
VK
59typedef struct
60{
fa88627b 61 MYSQL_CONN *connection;
c94bb5aa
VK
62 MYSQL_STMT *statement;
63 MYSQL_BIND *bindings;
140b8ada 64 unsigned long *lengthFields;
c94bb5aa
VK
65 Array *buffers;
66 int paramCount;
67} MYSQL_STATEMENT;
68
54aa9c6f
VK
69/**
70 * Structure of synchronous SELECT result
71 */
c94bb5aa
VK
72typedef struct
73{
74 MYSQL_RES *resultSet;
75 bool isPreparedStatement;
fa88627b
VK
76 MYSQL_STMT *statement;
77 int numColumns;
78 int numRows;
79 int currentRow;
80 MYSQL_BIND *bindings;
81 unsigned long *lengthFields;
c94bb5aa
VK
82} MYSQL_RESULT;
83
54aa9c6f
VK
84/**
85 * Structure of asynchronous SELECT result
86 */
5039dede
AK
87typedef struct
88{
89 MYSQL_CONN *pConn;
90 MYSQL_RES *pHandle;
91 MYSQL_ROW pCurrRow;
92 BOOL bNoMoreRows;
93 int iNumCols;
94 unsigned long *pulColLengths;
95} MYSQL_ASYNC_RESULT;
96
97#endif /* _mysqldrv_h_ */