1 // SCHEMA
2 
3 #define VAR(type, x)                                        schema.Var(SCHEMA_##type, Upp::SqlResolveId__(#x));
4 #define COLUMN(type, ctype, name, width, prec)              schema.Column(type, Upp::SqlResolveId__(#name));
5 #define COLUMN_ARRAY(type, ctype, name, width, prec, items) schema.ColumnArray(type, Upp::SqlResolveId__(#name), items);
6 #define INLINE_ATTRIBUTE(x)                                 schema.InlineAttribute(x);
7 #define ATTRIBUTE(x, d)                                     schema.Attribute(x, d);
8 #define TABLE_SUFFIX(s)                                     schema.TableSuffix(s);
9 
10 #ifdef __GNUC__
11 
12 #define TYPE(x)\
13 static void SCHEMA_##x(Upp::SqlSchema& schema) __attribute__((unused)); \
14 static void SCHEMA_##x(Upp::SqlSchema& schema) {
15 
16 #else
17 
18 #define TYPE(x)\
19 static void SCHEMA_##x(Upp::SqlSchema& schema) {
20 
21 #endif
22 
23 #define TYPE_I(x, b1)\
24 static void SCHEMA_##x(Upp::SqlSchema& schema) { SCHEMA_##b1(schema);
25 
26 #define TYPE_II(x, b1, b2)\
27 TYPE_I(x, b1) SCHEMA_##b2(schema);
28 
29 #define TYPE_III(x, b1, b2, b3)\
30 TYPE_II(x, b1, b2) SCHEMA_##b3(schema);
31 
32 #define END_TYPE }
33 
34 #include SCHEMADIALECT
35 
36 // TABLE
37 
38 #define TABLE(x)\
39 void TABLE_##x(SqlSchema& schema) { schema.Table(SqlResolveId__(#x)); SCHEMA_##x(schema); schema.EndTable(); }
40 
41 #define TABLE_I(x, b)             TABLE(x)
42 #define TABLE_II(x, b1, b2)       TABLE(x)
43 #define TABLE_III(x, b1, b2, b3)  TABLE(x)
44 
45 #include SCHEMADIALECT
46 
47 // All_Tables
48 
49 #define TABLE(x)                  TABLE_##x(schema);
50 #define TABLE_I(x, b)             TABLE(x)
51 #define TABLE_II(x, b1, b2)       TABLE(x)
52 #define TABLE_III(x, b1, b2, b3)  TABLE(x)
53 
54 #define SCHEMA(x, d)                                        schema.Object(x, d);
55 #define CONFIG(x, d)                                        schema.Config(x, d);
56 #define UPGRADE(x)                                          schema.Upgrade(x);
57 
58 #ifdef __GNUC__
59 static void All_Tables(SqlSchema& schema) __attribute__((unused));
60 #endif
61 
All_Tables(SqlSchema & schema)62 static void All_Tables(SqlSchema& schema) {
63 
64 #include SCHEMADIALECT
65 
66 
67 }
68