Package biana :: Package BianaDB :: Module database :: Class FieldDB
[hide private]
[frames] | no frames]

Class FieldDB

source code


Class to represent a field in a database

Instance Methods [hide private]
 
__init__(self, field_name, data_type, default_value=None, null=True, foreign_key=None, user_friendly_name=None, optimize_space=None, compress=None)
"field_name": field name in the database "data_type": data type of this field "default_value" "null": By default, it is accecpted a null value.
source code
 
is_compressed(self) source code
 
get_optimized_field_name(self) source code
 
get_optimized_space(self)
Returns the number of bytes for the optimized form of the field, if it has.
source code
 
get_user_friendly_name(self) source code
 
get_field_name(self) source code
 
get_data_type(self) source code
 
get_optimized_data_type(self) source code
 
get_mysql_query(self) source code
 
get_not_optimized_query(self) source code
 
set_foreign_key(self, foreign_key) source code
 
get_optimized_table(self)
Get the optimized table
source code
 
get_foreign_key_mysql_query(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, field_name, data_type, default_value=None, null=True, foreign_key=None, user_friendly_name=None, optimize_space=None, compress=None)
(Constructor)

source code 

"field_name": field name in the database
"data_type": data type of this field
"default_value"
"null": By default, it is accecpted a null value. If not, it is necessary to specify it
"foreign_key": it is a tuples with the table and the Field of its correspondent key
                (TableObject, FieldObject)
                They should be of the same data_type!!!
"user_friendly_name": This is used to refer to this field in a user friendly manner (for different fields in different tables that have the same meaning...)
"optimize_space": This is used to apply the space optimization for this field. It consists on saving the unique values of this field in a separated table, and an integer cross-reference is saved in the original table. It can be None, or the number of bytes reserved to index it

Overrides: object.__init__

get_optimized_space(self)

source code 

Returns the number of bytes for the optimized form of the field, if it has. Otherwise, return None