Skip to content

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).

DAO Method Interfaces

Let’s draft what common DAO methods should return.

  • 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.
Clone this wiki locally