- Initial work on maps
[public/netxms.git] / sql / dbinit.in
CommitLineData
6c9e7d36
VK
1/*
2** Input file for database initialization script.
3** This file should be processed by C preprocessor to produce
4** real initialization script.
b51c8c91
AK
5**
6** ex: syntax=c
6c9e7d36
VK
7*/
8
e641b7d0 9// Common constants
3c468b80
VK
10#include <nxevent.h>
11#include <nms_locks.h>
e641b7d0 12#include <nximage.h>
e42108f0 13#include <netxmsdb.h>
5e918a37 14#include <nxnt.h>
b7a391d7 15#include <nxtools.h>
3c468b80 16
6c9e7d36 17// Define common macros for uncommon data types
70573ffe
VK
18// and database syntax type
19#if defined(DB_MSSQL)
20
21#define DB_SYNTAX 'MSSQL'
0c6014e4
VK
22#define SQL_TEXT text
23#define SQL_INT64 bigint
cb7ec554 24#define TABLE_TYPE
70573ffe
VK
25
26#elif defined(DB_POSTGRESQL)
27
28#define DB_SYNTAX 'PGSQL'
0c6014e4
VK
29#define SQL_TEXT varchar // change it to oid?
30#define SQL_INT64 bigint
cb7ec554 31#define TABLE_TYPE
70573ffe 32
063876b3
VK
33#elif defined(DB_ORACLE)
34
35#define DB_SYNTAX 'ORACLE'
36#define SQL_TEXT clob
37#define SQL_INT64 number(20)
38#define TABLE_TYPE
39
7dbb6862
VK
40#elif defined(DB_SQLITE)
41
42#define DB_SYNTAX 'SQLITE'
43#define SQL_TEXT varchar
44#define SQL_INT64 number(20)
45#define TABLE_TYPE
46
47#elif defined(DB_MYSQL)
70573ffe
VK
48
49#define DB_SYNTAX 'MYSQL'
0c6014e4
VK
50#define SQL_TEXT blob
51#define SQL_INT64 bigint
cb7ec554 52#define TABLE_TYPE TYPE=InnoDB
70573ffe 53
7dbb6862
VK
54#else
55
56#error Database type should be defined
57
6c9e7d36
VK
58#endif
59
77f69c9d 60// String concatenation for multi-line texts
063876b3 61#if defined(DB_MSSQL)
77f69c9d 62#define CONCAT +
7dbb6862 63#elif defined(DB_ORACLE) || defined(DB_SQLITE)
063876b3 64#define CONCAT ||
77f69c9d
VK
65#else
66#define CONCAT
67#endif
68
7dbb6862
VK
69// Start transaction
70
71#if defined(DB_POSTGRESQL) || defined(DB_SQLITE)
72BEGIN TRANSACTION;
73#endif
74
6c9e7d36
VK
75// Actual SQL queries
76#include "schema.in"
77#include "setup.in"
78#include "events.in"
e641b7d0 79#include "images.in"
6eec168c 80#include "policy.in"
6ed0d23d 81#include "traps.in"
038b6f22 82#include "objtools.in"
5c6b881b 83#include "scripts.in"
5d8a7f11 84#include "maps.in"
7dbb6862
VK
85
86// End transaction
87#if defined(DB_POSTGRESQL) || defined(DB_SQLITE)
88COMMIT TRANSACTION;
89#endif