schema-related information (like schema version, DB syntax, etc.) moved from "config...
[public/netxms.git] / src / server / tools / nxdbmgr / nxdbmgr.h
CommitLineData
5039dede
AK
1/*
2** nxdbmgr - NetXMS database manager
1e558daf 3** Copyright (C) 2004-2009 Victor Kirhenshtein
5039dede
AK
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**
1e558daf 19** File: nxdbmgr.h
5039dede
AK
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
5039dede
AK
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
1e558daf 45void CheckDatabase();
5039dede 46void InitDatabase(const TCHAR *pszInitFile);
1e558daf 47void ReindexDatabase();
890a0930 48BOOL ClearDatabase();
4f23eecc 49void ExportDatabase(const char *file);
890a0930 50void ImportDatabase(const char *file);
1e558daf
VK
51void UpgradeDatabase();
52void UnlockDatabase();
5039dede 53DB_RESULT SQLSelect(const TCHAR *pszQuery);
4c4c9b03 54DB_ASYNC_RESULT SQLAsyncSelect(const TCHAR *pszQuery);
5039dede
AK
55BOOL SQLQuery(const TCHAR *pszQuery);
56BOOL SQLBatch(const TCHAR *pszBatch);
1e558daf 57BOOL GetYesNo();
5039dede
AK
58void ShowQuery(const TCHAR *pszQuery);
59BOOL ExecSQLBatch(const TCHAR *pszFile);
1e558daf 60BOOL ValidateDatabase();
5039dede
AK
61
62BOOL ConfigReadStr(const TCHAR *pszVar, TCHAR *pszBuffer, int iBufSize, const TCHAR *pszDefault);
63int ConfigReadInt(const TCHAR *pszVar, int iDefault);
64DWORD ConfigReadULong(const TCHAR *pszVar, DWORD dwDefault);
65
66
67//
68// Global variables
69//
70
71extern DB_HANDLE g_hCoreDB;
72extern BOOL g_bIgnoreErrors;
73extern BOOL g_bTrace;
74extern int g_iSyntax;
75extern const TCHAR *g_pszTableSuffix;
76extern const TCHAR *g_pszSqlType[][2];
77
78
79#endif