implemented new tdata format
[public/netxms.git] / sql / database.in
CommitLineData
ce99c536
VK
1/*
2** DB-specific settings for database initialization script.
3**
4** ex: syntax=c
5*/
6
7// Define common macros for uncommon data types
8// and database syntax type
9#if defined(DB_MSSQL)
10
bd3a1373
VK
11#define DB_SYNTAX 'MSSQL'
12#define SQL_TEXT text
89e5f052 13#define SQL_TEXT_TEXT 'text'
bd3a1373
VK
14#define SQL_TEXT4K varchar(4000)
15#define SQL_INT64 bigint
22aaa779 16#define SQL_INT64_TEXT 'bigint'
ce99c536 17#define TABLE_TYPE
6c70a0a1 18#define CRLF char(13)+char(10)
bd3a1373 19#define CONCAT +
ce99c536
VK
20
21#elif defined(DB_POSTGRESQL)
22
bd3a1373
VK
23#define DB_SYNTAX 'PGSQL'
24#define SQL_TEXT text
89e5f052 25#define SQL_TEXT_TEXT 'text'
bd3a1373
VK
26#define SQL_TEXT4K varchar(4000)
27#define SQL_INT64 bigint
22aaa779 28#define SQL_INT64_TEXT 'bigint'
ce99c536 29#define TABLE_TYPE
bd3a1373
VK
30#define CRLF '\015\012'
31#define CONCAT ||
ce99c536
VK
32
33#elif defined(DB_ORACLE)
34
bd3a1373
VK
35#define DB_SYNTAX 'ORACLE'
36#define SQL_TEXT clob
89e5f052 37#define SQL_TEXT_TEXT 'clob'
bd3a1373
VK
38#define SQL_TEXT4K varchar(4000)
39#define SQL_INT64 number(20)
22aaa779 40#define SQL_INT64_TEXT 'number(20)'
ce99c536 41#define TABLE_TYPE
bd3a1373
VK
42#define CRLF chr(13)||chr(10)
43#define CONCAT ||
ce99c536
VK
44
45#elif defined(DB_SQLITE)
46
bd3a1373
VK
47#define DB_SYNTAX 'SQLITE'
48#define SQL_TEXT varchar
89e5f052 49#define SQL_TEXT_TEXT 'varchar'
bd3a1373
VK
50#define SQL_TEXT4K varchar(4000)
51#define SQL_INT64 number(20)
22aaa779 52#define SQL_INT64_TEXT 'number(20)'
ce99c536 53#define TABLE_TYPE
9113e749 54#define CRLF char(13,10)
bd3a1373 55#define CONCAT ||
ce99c536
VK
56
57#elif defined(DB_MYSQL)
58
bd3a1373
VK
59#define DB_SYNTAX 'MYSQL'
60#define SQL_TEXT text
89e5f052 61#define SQL_TEXT_TEXT 'text'
bd3a1373
VK
62#define SQL_TEXT4K text
63#define SQL_INT64 bigint
22aaa779 64#define SQL_INT64_TEXT 'bigint'
ce99c536 65#define TABLE_TYPE
bd3a1373
VK
66#define CRLF '\r\n'
67#define CONCAT
ce99c536 68
7b61f11f
AK
69#elif defined(DB_DB2)
70
bd3a1373
VK
71#define DB_SYNTAX 'DB2'
72#define SQL_TEXT LONG VARCHAR
89e5f052 73#define SQL_TEXT_TEXT 'LONG VARCHAR'
bd3a1373
VK
74#define SQL_TEXT4K varchar(4000)
75#define SQL_INT64 BIGINT
22aaa779 76#define SQL_INT64_TEXT 'BIGINT'
7b61f11f 77#define TABLE_TYPE
bd3a1373
VK
78#define CRLF chr(13)||chr(10)
79#define CONCAT ||
7b61f11f 80
ce99c536
VK
81#else
82
83#error Database type should be defined
84
85#endif
938a6733
AK
86
87#if defined(DB_POSTGRESQL) || defined(DB_ORACLE)
88# define COMMENT_TABLE(name, text) COMMENT ON TABLE name IS text;
89# define COMMENT_COLUMN(name, text) COMMENT ON COLUMN name IS text;
90#else
91# define COMMENT_TABLE(name, text)
92# define COMMENT_COLUMN(name, text)
93#endif
94
95#ifdef DB_POSTGRESQL
96# define COMMENT_INDEX(name, text) COMMENT ON INDEX name IS text;
97#else
98# define COMMENT_INDEX(name, text)
99#endif