Cura/cura/Settings/DatabaseHandlers/VariantDatabaseHandler.py
jelle Spijker 7aa08d4acd
Use a class to build to sql queries
This greatly reduced the amount of duplicate code in the DataBaseHandlers
Not sure how secure this is SQL injections. Need to check that and maybe
put in some guards. Using double underscores for now and only provide a
getter. But then again why bother with an SQL injection as
you can just as easily modify the Python code, and we still have the old
Containers to fallback to if the Database gets corrupted.

Contributes to CURA-6096
2021-09-01 16:58:48 +02:00

19 lines
958 B
Python

from UM.Settings.SQLQueryFactory import SQLQueryFactory
from UM.Settings.DatabaseContainerMetadataController import DatabaseMetadataContainerController
from UM.Settings.InstanceContainer import InstanceContainer
class VariantDatabaseHandler(DatabaseMetadataContainerController):
"""The Database handler for Variant containers"""
def __init__(self):
super().__init__(SQLQueryFactory(table = "variants",
fields = {
"id": "text",
"name": "text",
"hardware_type": "text",
"definition": "text",
"version": "text",
"setting_version": "text"
}))
self.container_type = InstanceContainer