implemented new tdata format
[public/netxms.git] / sql / database.in
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
11 #define DB_SYNTAX 'MSSQL'
12 #define SQL_TEXT text
13 #define SQL_TEXT_TEXT 'text'
14 #define SQL_TEXT4K varchar(4000)
15 #define SQL_INT64 bigint
16 #define SQL_INT64_TEXT 'bigint'
17 #define TABLE_TYPE
18 #define CRLF char(13)+char(10)
19 #define CONCAT +
20
21 #elif defined(DB_POSTGRESQL)
22
23 #define DB_SYNTAX 'PGSQL'
24 #define SQL_TEXT text
25 #define SQL_TEXT_TEXT 'text'
26 #define SQL_TEXT4K varchar(4000)
27 #define SQL_INT64 bigint
28 #define SQL_INT64_TEXT 'bigint'
29 #define TABLE_TYPE
30 #define CRLF '\015\012'
31 #define CONCAT ||
32
33 #elif defined(DB_ORACLE)
34
35 #define DB_SYNTAX 'ORACLE'
36 #define SQL_TEXT clob
37 #define SQL_TEXT_TEXT 'clob'
38 #define SQL_TEXT4K varchar(4000)
39 #define SQL_INT64 number(20)
40 #define SQL_INT64_TEXT 'number(20)'
41 #define TABLE_TYPE
42 #define CRLF chr(13)||chr(10)
43 #define CONCAT ||
44
45 #elif defined(DB_SQLITE)
46
47 #define DB_SYNTAX 'SQLITE'
48 #define SQL_TEXT varchar
49 #define SQL_TEXT_TEXT 'varchar'
50 #define SQL_TEXT4K varchar(4000)
51 #define SQL_INT64 number(20)
52 #define SQL_INT64_TEXT 'number(20)'
53 #define TABLE_TYPE
54 #define CRLF char(13,10)
55 #define CONCAT ||
56
57 #elif defined(DB_MYSQL)
58
59 #define DB_SYNTAX 'MYSQL'
60 #define SQL_TEXT text
61 #define SQL_TEXT_TEXT 'text'
62 #define SQL_TEXT4K text
63 #define SQL_INT64 bigint
64 #define SQL_INT64_TEXT 'bigint'
65 #define TABLE_TYPE
66 #define CRLF '\r\n'
67 #define CONCAT
68
69 #elif defined(DB_DB2)
70
71 #define DB_SYNTAX 'DB2'
72 #define SQL_TEXT LONG VARCHAR
73 #define SQL_TEXT_TEXT 'LONG VARCHAR'
74 #define SQL_TEXT4K varchar(4000)
75 #define SQL_INT64 BIGINT
76 #define SQL_INT64_TEXT 'BIGINT'
77 #define TABLE_TYPE
78 #define CRLF chr(13)||chr(10)
79 #define CONCAT ||
80
81 #else
82
83 #error Database type should be defined
84
85 #endif
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