Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController Class Reference

Public Member Functions

 __init__ (self, SQLQueryFactory queries)
 
None setupTable (self, Cursor cursor)
 
None insert (self, metadata_type metadata)
 
None update (self, metadata_type metadata)
 
None delete (self, str container_id)
 
Generator keys (self)
 
Generator values (self, str container_id)
 
Generator items (self, str container_id)
 
metadata_type getMetadata (self, str container_id)
 
metadata_type groomMetadata (self, metadata_type metadata)
 

Public Attributes

Optional[Cursor] cursor = None
 

Protected Member Functions

Cursor _execute (self, *args)
 

Protected Attributes

 _queries = queries
 
Optional[InstanceContainer_container_type = None
 
list _insert_batch = []
 

Detailed Description

This is an interface for storing and retrieving container metadata from a database. Since each type of container
has it's own metadata (and thus should probably insert / get / update it differently) it's likely that each type
needs it's own controller.

Member Function Documentation

◆ delete()

None UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.delete ( self,
str container_id )
Removes a container from the DB.

◆ getMetadata()

metadata_type UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.getMetadata ( self,
str container_id )
Return the metadata needed to create a container

param container_id: The container_id to query
:return The container metadata

◆ groomMetadata()

metadata_type UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.groomMetadata ( self,
metadata_type metadata )
Ensures that the metadata is in the order of the field keys and has the right size.
if the metadata doesn't contains a key which is stored in the DB it will add it as
an empty string. Key, value pairs that are not stored in the DB are dropped.

:param metadata: The container metadata

◆ insert()

None UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.insert ( self,
metadata_type metadata )
Insert a container in the DB.

param container_id: The container_id to insert

◆ items()

Generator UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.items ( self,
str container_id )
Yields all values and keys obtained from the DB row including the `container_type` and `type`
param container_id: The container_id to query

◆ keys()

Generator UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.keys ( self)
Yields all the metadata keys. These consist of the DB fields and `container_type` and `type`

◆ setupTable()

None UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.setupTable ( self,
Cursor cursor )
Creates the table in the DB.

param cursor: the DB cursor

◆ update()

None UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.update ( self,
metadata_type metadata )
Updates a container in the DB.

param container_id: The container_id to update

◆ values()

Generator UM.Settings.DatabaseContainerMetadataController.DatabaseMetadataContainerController.values ( self,
str container_id )
Yields all value obtained from the DB row and the 'container_type' and `type`

param container_id: The container_id to query

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