Baby Language Lab Scripts
A collection of data processing tools.
 All Classes Namespaces Files Functions Variables Pages
data_structs.base_objects.DBObject Class Reference

Represents an object that can be stored in the database. More...

Inheritance diagram for data_structs.base_objects.DBObject:

Public Member Functions

def __init__
 Constructor. More...
 
def db_insert
 Performs operations needed to insert this object into the database. More...
 
def db_delete
 Performs operations needed to delete this object from the database. More...
 
- Public Member Functions inherited from data_structs.base_objects.BLLObject
def __str__
 Builds a nicely formatted string containing all attributes of this object (except those in omit_attr_names), for debugging purposes. More...
 

Static Public Member Functions

def db_select
 Selects objects of this type from the database. More...
 

Public Attributes

 db_id
 

Static Private Member Functions

def _build_where_cond_from_ids
 Convenience method for subclasses. More...
 

Detailed Description

Represents an object that can be stored in the database.

Definition at line 58 of file base_objects.py.

Constructor & Destructor Documentation

def data_structs.base_objects.DBObject.__init__ (   self)

Constructor.

Parameters
self

Definition at line 61 of file base_objects.py.

Member Function Documentation

def data_structs.base_objects.DBObject._build_where_cond_from_ids (   ids)
staticprivate

Convenience method for subclasses.

Constructs a SQL where condition clause from the specified ids.

Parameters
ids(list) list of integer primary keys
Returns
(string) clause like "WHERE id IN (0, 1, 2, 3, 4)" - assumes primary key column is named 'id'. Returns None if ids is empty.

Definition at line 88 of file base_objects.py.

def data_structs.base_objects.DBObject.db_delete (   self,
  db 
)

Performs operations needed to delete this object from the database.

Subclasses must override this method.

Parameters
self
db(BLLDatabase) database object to use for the deletion operation.

Definition at line 73 of file base_objects.py.

def data_structs.base_objects.DBObject.db_insert (   self,
  db 
)

Performs operations needed to insert this object into the database.

Subclasses must override this method.

Parameters
self
db(BLLDatabase) database object to use for the insertion operation.

Definition at line 67 of file base_objects.py.

def data_structs.base_objects.DBObject.db_select (   db,
  ids = [] 
)
static

Selects objects of this type from the database.

Subclasses must override this method.

Parameters
db(BLLDatabase) database object to use for the selection operation.
ids(list=[]) list of ids (primary key integers) from the corresponding DB table for this object that are to be selected. If empty, all objects from the corresponding table are selected.
Returns
(list) list of objects of this type, constructed from a SELECT query on the corresponding DB table.

Definition at line 81 of file base_objects.py.

Member Data Documentation

data_structs.base_objects.DBObject.db_id

Definition at line 62 of file base_objects.py.


The documentation for this class was generated from the following file: