Model » History » Version 1
Version 1/28
-
Next » -
Current version
Elmer de Looff, 2011-09-16 18:03
Database abstraction model¶
Goal of this component¶
The µWeb framework provides amodel
module with the intention of simplifying database access. The design goal is to provide a rich abstraction that
- takes away the tedious work of retrieving, creating and deleting records
- can load its parent objects automatically if so required
- does not get in the way of the developer
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.
Record class
¶
Creation and initialization¶
init¶
FromKey classmethod
¶
List classmethod
¶
Equality checks¶
Integer conversion (int)¶
_LoadForeignRelations¶
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.
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.