Module dado.object

Database Object. Permits the association of the object with a database table. There are some special attributes: db_fields = table (record) that indicates which attributes should be loaded from the database table_name = string with the name of the database table key_name = string with the name of the key attribute/field

Release: $Id: object.lua,v 1.4 2008/04/09 03:16:15 tomas Exp $

Functions

class (self, c) Creates a new class.
insert (self) Inserts a new record in the database.
new (class, dado, o) Creates a new object.
save (self) Saves the object data.
update (self) Updates the data of the object in the corresponding database record.


Functions

class (self, c)
Creates a new class.

Parameters

  • self:
  • c: Table with the mandatory fields.

Return value:

Table representing the class.
insert (self)
Inserts a new record in the database.

Parameters

  • self:

Return value:

Boolean indicating the success of the operation.
new (class, dado, o)
Creates a new object.

Parameters

  • class: Table representing the class of the object.
  • dado: Dado connection.
  • o: Table representing the object (optional).

Return value:

Table representing the object.
save (self)
Saves the object data. This function decides when to perform an update or an insert according to the value of the loaded attribute which indicates if the data was already loaded from the database.

Parameters

  • self:
update (self)
Updates the data of the object in the corresponding database record.

Parameters

  • self:

Return value:

Boolean indicating the success of the operation.

Valid XHTML 1.0!