Model » History » Version 1
Elmer de Looff, 2011-09-16 18:03
1 | 1 | Elmer de Looff | h1. Database abstraction model |
---|---|---|---|
2 | 1 | Elmer de Looff | |
3 | 1 | Elmer de Looff | h2. Goal of this component |
4 | 1 | Elmer de Looff | |
5 | 1 | Elmer de Looff | The µWeb framework provides a @model@ module with the intention of simplifying database access. The design goal is to provide a rich abstraction that |
6 | 1 | Elmer de Looff | * takes away the tedious work of retrieving, creating and deleting records |
7 | 1 | Elmer de Looff | * can load its parent objects automatically if so required |
8 | 1 | Elmer de Looff | * _does *not* get in the way of the developer_ |
9 | 1 | Elmer de Looff | |
10 | 1 | Elmer de Looff | Making database interaction easier without restricting the abilities of the developer is our main goal. Some default mechanisms make assumptions on the way the database is organised, but these are well-documented, and it's entirely possible to change the behavior of these mechanisms. |
11 | 1 | Elmer de Looff | |
12 | 1 | Elmer de Looff | h2. Record @class@ |
13 | 1 | Elmer de Looff | |
14 | 1 | Elmer de Looff | h3. Creation and initialization |
15 | 1 | Elmer de Looff | |
16 | 1 | Elmer de Looff | h4. __init__ |
17 | 1 | Elmer de Looff | |
18 | 1 | Elmer de Looff | h4. FromKey @classmethod@ |
19 | 1 | Elmer de Looff | |
20 | 1 | Elmer de Looff | h4. List @classmethod@ |
21 | 1 | Elmer de Looff | |
22 | 1 | Elmer de Looff | h3. Equality checks |
23 | 1 | Elmer de Looff | |
24 | 1 | Elmer de Looff | h3. Integer conversion (__int__) |
25 | 1 | Elmer de Looff | |
26 | 1 | Elmer de Looff | h3. _LoadForeignRelations |
27 | 1 | Elmer de Looff | |
28 | 1 | Elmer de Looff | *N.B.* In the default implementation, fields that refer to a record in another table (@n to 1@ or @1 to 1@ relationships) *MUST have the name of that table.* |
29 | 1 | Elmer de Looff | For example: Given two tables `child` and `parent`. Entries in `child` that refer to their parent, must do so using a field called `parent` (not parentID or some such). If the table names are plural, the fields that refer to the relation should also have a pluralized name. |
30 | 1 | Elmer de Looff | |
31 | 1 | Elmer de Looff | h3. Save |
32 | 1 | Elmer de Looff | |
33 | 1 | Elmer de Looff | h4. _RecordInsert |
34 | 1 | Elmer de Looff | |
35 | 1 | Elmer de Looff | h4. _RecordUpdate |
36 | 1 | Elmer de Looff | |
37 | 1 | Elmer de Looff | |
38 | 1 | Elmer de Looff | |
39 | 1 | Elmer de Looff | h2. Getting started |