minor changes
[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
33//
34// Database syntax codes
35//
36
37#define DB_SYNTAX_MYSQL 0
38#define DB_SYNTAX_PGSQL 1
39#define DB_SYNTAX_MSSQL 2
40#define DB_SYNTAX_ORACLE 3
41#define DB_SYNTAX_SQLITE 4
42
43
44//
45// Non-standard data type codes
46//
47
48#define SQL_TYPE_TEXT 0
49#define SQL_TYPE_INT64 1
50
51
52//
53// Functions
54//
55
1e558daf 56void CheckDatabase();
5039dede 57void InitDatabase(const TCHAR *pszInitFile);
1e558daf 58void ReindexDatabase();
890a0930 59BOOL ClearDatabase();
4f23eecc 60void ExportDatabase(const char *file);
890a0930 61void ImportDatabase(const char *file);
1e558daf
VK
62void UpgradeDatabase();
63void UnlockDatabase();
5039dede 64DB_RESULT SQLSelect(const TCHAR *pszQuery);
4c4c9b03 65DB_ASYNC_RESULT SQLAsyncSelect(const TCHAR *pszQuery);
5039dede
AK
66BOOL SQLQuery(const TCHAR *pszQuery);
67BOOL SQLBatch(const TCHAR *pszBatch);
1e558daf 68BOOL GetYesNo();
5039dede
AK
69void ShowQuery(const TCHAR *pszQuery);
70BOOL ExecSQLBatch(const TCHAR *pszFile);
1e558daf 71BOOL ValidateDatabase();
5039dede
AK
72
73BOOL ConfigReadStr(const TCHAR *pszVar, TCHAR *pszBuffer, int iBufSize, const TCHAR *pszDefault);
74int ConfigReadInt(const TCHAR *pszVar, int iDefault);
75DWORD ConfigReadULong(const TCHAR *pszVar, DWORD dwDefault);
76
77
78//
79// Global variables
80//
81
82extern DB_HANDLE g_hCoreDB;
83extern BOOL g_bIgnoreErrors;
84extern BOOL g_bTrace;
85extern int g_iSyntax;
86extern const TCHAR *g_pszTableSuffix;
87extern const TCHAR *g_pszSqlType[][2];
88
89
90#endif