ffbdb9a49cbb98dc0ec6c85a43006f77bb88cb03
[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_TEXT4K varchar(4000)
14 #define SQL_INT64 bigint
15 #define SQL_INT64_TEXT 'bigint'
16 #define TABLE_TYPE
17 #define CRLF char(13)+char(10)
18 #define CONCAT +
19
20 #elif defined(DB_POSTGRESQL)
21
22 #define DB_SYNTAX 'PGSQL'
23 #define SQL_TEXT text
24 #define SQL_TEXT4K varchar(4000)
25 #define SQL_INT64 bigint
26 #define SQL_INT64_TEXT 'bigint'
27 #define TABLE_TYPE
28 #define CRLF '\015\012'
29 #define CONCAT ||
30
31 #elif defined(DB_ORACLE)
32
33 #define DB_SYNTAX 'ORACLE'
34 #define SQL_TEXT clob
35 #define SQL_TEXT4K varchar(4000)
36 #define SQL_INT64 number(20)
37 #define SQL_INT64_TEXT 'number(20)'
38 #define TABLE_TYPE
39 #define CRLF chr(13)||chr(10)
40 #define CONCAT ||
41
42 #elif defined(DB_SQLITE)
43
44 #define DB_SYNTAX 'SQLITE'
45 #define SQL_TEXT varchar
46 #define SQL_TEXT4K varchar(4000)
47 #define SQL_INT64 number(20)
48 #define SQL_INT64_TEXT 'number(20)'
49 #define TABLE_TYPE
50 #define CRLF char(13,10)
51 #define CONCAT ||
52
53 #elif defined(DB_MYSQL)
54
55 #define DB_SYNTAX 'MYSQL'
56 #define SQL_TEXT text
57 #define SQL_TEXT4K text
58 #define SQL_INT64 bigint
59 #define SQL_INT64_TEXT 'bigint'
60 #define TABLE_TYPE
61 #define CRLF '\r\n'
62 #define CONCAT
63
64 #elif defined(DB_DB2)
65
66 #define DB_SYNTAX 'DB2'
67 #define SQL_TEXT LONG VARCHAR
68 #define SQL_TEXT4K varchar(4000)
69 #define SQL_INT64 BIGINT
70 #define SQL_INT64_TEXT 'BIGINT'
71 #define TABLE_TYPE
72 #define CRLF chr(13)||chr(10)
73 #define CONCAT ||
74
75 #else
76
77 #error Database type should be defined
78
79 #endif
80
81 #if defined(DB_POSTGRESQL) || defined(DB_ORACLE)
82 # define COMMENT_TABLE(name, text) COMMENT ON TABLE name IS text;
83 # define COMMENT_COLUMN(name, text) COMMENT ON COLUMN name IS text;
84 #else
85 # define COMMENT_TABLE(name, text)
86 # define COMMENT_COLUMN(name, text)
87 #endif
88
89 #ifdef DB_POSTGRESQL
90 # define COMMENT_INDEX(name, text) COMMENT ON INDEX name IS text;
91 #else
92 # define COMMENT_INDEX(name, text)
93 #endif