ultimatepp/uppsrc/Sql/sch_schema.h
mdelfede d2b54f7989 changed svn layout
git-svn-id: svn://ultimatepp.org/upp/trunk@281 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-06-07 22:31:27 +00:00

53 lines
1.6 KiB
C

// SCHEMA
#define VAR(type, x) schema.Var(SCHEMA_##type, #x);
#define COLUMN(type, ctype, name, width, prec) schema.Column(type, #name);
#define COLUMN_ARRAY(type, ctype, name, width, prec, items) schema.ColumnArray(type, #name, items);
#define INLINE_ATTRIBUTE(x) schema.InlineAttribute(x);
#define ATTRIBUTE(x, d) schema.Attribute(x, d);
#define TABLE_SUFFIX(s) schema.TableSuffix(s);
#define TYPE(x)\
static void SCHEMA_##x(SqlSchema& schema) {
#define TYPE_I(x, b1)\
static void SCHEMA_##x(SqlSchema& schema) { SCHEMA_##b1(schema);
#define TYPE_II(x, b1, b2)\
TYPE_I(x, b1) SCHEMA_##b2(schema);
#define TYPE_III(x, b1, b2, b3)\
TYPE_II(x, b1, b2) SCHEMA_##b3(schema);
#define END_TYPE }
#include SCHEMADIALECT
// TABLE
#define TABLE(x)\
void TABLE_##x(SqlSchema& schema) { schema.Table(#x); SCHEMA_##x(schema); schema.EndTable(); }
#define TABLE_I(x, b) TABLE(x)
#define TABLE_II(x, b1, b2) TABLE(x)
#define TABLE_III(x, b1, b2, b3) TABLE(x)
#include SCHEMADIALECT
// All_Tables
#define TABLE(x) TABLE_##x(schema);
#define TABLE_I(x, b) TABLE(x)
#define TABLE_II(x, b1, b2) TABLE(x)
#define TABLE_III(x, b1, b2, b3) TABLE(x)
#define SCHEMA(x, d) schema.Object(x, d);
#define CONFIG(x, d) schema.Config(x, d);
#define UPGRADE(x) schema.Upgrade(x);
static void All_Tables(SqlSchema& schema) {
#include SCHEMADIALECT
}