From 139f9b7260fd73f016c3cce30d1779d66805a425 Mon Sep 17 00:00:00 2001 From: konrad Date: Sat, 11 Dec 2010 20:45:44 +0000 Subject: [PATCH] update DB docu git-svn-id: https://silmor.de/svn/softmagic/pack/trunk@658 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- doc/wolf-db.html | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/doc/wolf-db.html b/doc/wolf-db.html index 613ad11..b57e84b 100644 --- a/doc/wolf-db.html +++ b/doc/wolf-db.html @@ -28,6 +28,17 @@ For each database table woc needs a description of that table: <Value name="MaskUsable" value="0x300"/> <!--dec: 768--> </Column> <Column name="orderid" type="int32" foreignkey="order:orderid" notnull="yes"/> + <AuditColumn name="auditrabbit" type="string:32" null="yes"> + <Call lang="php" method="MyRabbit::getRandomRabbitString()"/> + </AuditColumn> + <Preset> + <V col="ticketid" val="1"/> + <V col="eventid" val="10"/> + <V col="price" code="rand()"/> + <V col="status" val="0x4"/> + <V col="orderid" val="1"/> + </Preset> + <Foreign method="getRabbit" via="rabbit:rabbitid=eventid"/> </Table> @@ -37,11 +48,12 @@ Table attributes: namethe name of the table, the generated class will be Wttablename backupbool, contains whether the table is in the backup routine (default: false) baseoptional, contains the class that this tables class is derived from, the base class must be derived from WobTable (default is to derive from WobTable directly) +auditoptional, contains boolean value whether this table has an audit shadow table, default is false

The Table tag can have Doc subtags to embed documentation.

-Column attributes: +Column and AuditColumn attributes: @@ -50,6 +62,7 @@ Column attributes: +
AttributeDescription
namethe name of the column in the database
foreignkeydeclares a reference to a foreign key column, the syntax is "foreigntablename:column" - the table that is referenced must be declared before the current one
uniquebool, declares the column UNIQUE
primarykeybool, tells woc that this column is part of the primary key (multiple columns may be part of the primary key)
indexbool, tells woc that this column should have an index to speed up read operations, the database driver should select an appropriate one
defaultdeclares a default value for the column (currently defaults for enums must be given as integer)

@@ -71,6 +84,21 @@ The Value tags for enum types function similar to enums in C++. If a value attri Columns can be documented by adding the description directly to the Column tag or by embedding it with a Doc tag inside the Column tag. Enum values can be documented by embedding the description between <Value> and </Value>.

+AuditColumns define columns that are only present in the corresponding audit shadow table. See below for details.

+ +Call defines a kind of default - whenever a new row is created the column is preset with the result of the call.

+ +Call attributes: + + + + +
AttributeDescription
langthe language in which the call is formulated (eg. "php" or "php/server")
methodthe expression that is assigned to the column

+ +Presets are rows created when the database is populated. Each row has a "Preset" elements, each column has a "V" element. You can chose between giving the value directly with the "val" attribute or as a call with the "code" attribute - the code must not assume that any tables exist yet or that presets are created in a specific order.

+ +Foreign defines getters that are not automatic (foreign keys in the same table are automatic, foreign keys in a different table are not) - the "method" attribute defines tha name of the method for that getter, while the "via" attribute defines the target table, and the comparison to make. The format of "via" is always "targetTable:targetColumn=hereColumn".

+

Auditing Shadow Tables

The PACK toolkit allows for automatic auditing of tables. A table that is marked for auditing will automatically generate and keep copies of all data that is written to the table. On each insert, delete and update a copy of the new data is inserted into a new row of the auditing shadow table. The shadow table will have the same name as the base table plus the suffix _audit and it will also have a corresponding table class in the generated bindings, so that it can be queried.

-- 1.7.2.5