schema-related information (like schema version, DB syntax, etc.) moved from "config...
[public/netxms.git] / src / server / tools / nxdbmgr / nxdbmgr.h
1 /*
2 ** nxdbmgr - NetXMS database manager
3 ** Copyright (C) 2004-2009 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 **
19 ** File: nxdbmgr.h
20 **
21 **/
22
23 #ifndef _nxdbmgr_h_
24 #define _nxdbmgr_h_
25
26 #include <nms_common.h>
27 #include <nms_util.h>
28 #include <uuid.h>
29 #include <nxsrvapi.h>
30 #include <netxmsdb.h>
31
32
33 //
34 // Non-standard data type codes
35 //
36
37 #define SQL_TYPE_TEXT 0
38 #define SQL_TYPE_INT64 1
39
40
41 //
42 // Functions
43 //
44
45 void CheckDatabase();
46 void InitDatabase(const TCHAR *pszInitFile);
47 void ReindexDatabase();
48 BOOL ClearDatabase();
49 void ExportDatabase(const char *file);
50 void ImportDatabase(const char *file);
51 void UpgradeDatabase();
52 void UnlockDatabase();
53 DB_RESULT SQLSelect(const TCHAR *pszQuery);
54 DB_ASYNC_RESULT SQLAsyncSelect(const TCHAR *pszQuery);
55 BOOL SQLQuery(const TCHAR *pszQuery);
56 BOOL SQLBatch(const TCHAR *pszBatch);
57 BOOL GetYesNo();
58 void ShowQuery(const TCHAR *pszQuery);
59 BOOL ExecSQLBatch(const TCHAR *pszFile);
60 BOOL ValidateDatabase();
61
62 BOOL ConfigReadStr(const TCHAR *pszVar, TCHAR *pszBuffer, int iBufSize, const TCHAR *pszDefault);
63 int ConfigReadInt(const TCHAR *pszVar, int iDefault);
64 DWORD ConfigReadULong(const TCHAR *pszVar, DWORD dwDefault);
65
66
67 //
68 // Global variables
69 //
70
71 extern DB_HANDLE g_hCoreDB;
72 extern BOOL g_bIgnoreErrors;
73 extern BOOL g_bTrace;
74 extern int g_iSyntax;
75 extern const TCHAR *g_pszTableSuffix;
76 extern const TCHAR *g_pszSqlType[][2];
77
78
79 #endif