-
Notifications
You must be signed in to change notification settings - Fork 672
Developer Guide: Data Access Objects (DAO's)
CVi edited this page Sep 13, 2010
·
18 revisions
All of ThinkTank’s database interactions are encapsulated in DAO’s (Data Access Objects), contained in the model (the common directory).
Let’s draft what common DAO methods should return.
Multiple SELECT formats exist:
- “SELECT Single row” is for methods that expect only/exactly one result.
- “SELECT Multiple rows” is for methods expecting any number of results.
Method return format draft as of now is as follows:
- INSERT: last inserted ID (where there is an AUTO_INCREMENT primary key)
- UPDATE/DELETE: number of affected rows
- SELECT Multiple rows: array with objects, or arrays if no appropriate class exist, empty array on no rows returned.
- SELECT Single row: object, array if no appropriate class exist, null on no rows returned.
- IF: True if the data exist, otherwise false.