11 Commits

Author SHA1 Message Date
Ghostkeeper
034f62ea2c
Match table name with container type
The table name is used as the container type in the resulting metadata, so we need to use the container type string as table name correctly, or none of the profiles can be found.

Contributes to issue CURA-6096.
2021-09-08 16:40:22 +02:00
Ghostkeeper
057ba8cdeb
Fix setting container type of subclasses
This mistake caused all of the container types to end up as either None or the actual instance itself, which was causing crashes.

Contributes to issue CURA-6096.
2021-09-08 15:46:25 +02:00
Ghostkeeper
adac0af1ec
Revert "Use SQLQueryFactory for container DB"
This reverts commit 571a051041b7c126ca942055961c7714312a967f.
2021-09-08 15:10:32 +02:00
jelle Spijker
571a051041
Use SQLQueryFactory for container DB
Needed to add a Filter possibility to facilitate that
Created a Simple UserString class which can be used as:

```py
        sql_filter = SQLFilter(f"SELECT {{}} FROM table_name WHERE id = ?")
        cursor.execute(sql_filter)  # Will execute: SELECT * FROM table_name WHERE id = ?
        cursor.execute(sql_filter["id", "name"])  # Will execute: SELECT id, name FROM table_name WHERE id = ?

```

Contributes to CURA-6096
2021-09-02 16:55:24 +02:00
jelle Spijker
4067d9d607
Fixed typing
Contributes to CURA-6096
2021-09-02 10:17:40 +02:00
jelle Spijker
f80e1ec279
Updated documentation
Contributes to CURA-6096
2021-09-01 18:58:03 +02:00
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
Jaime van Kessel
3191baf5a0 Add delete to handlers
CURA-6096
2021-08-27 14:36:04 +02:00
Jaime van Kessel
55d6ff0e61 Clean up formating of the insert queries
CURA-6096
2021-08-25 13:58:11 +02:00
Jaime van Kessel
132b863e13 Add update queries for variant, intent & qualit DB handlers
CURA-6096
2021-08-25 13:48:25 +02:00
Jaime van Kessel
e0e8223c5d Move DB handling into specialised classes
This keeps CuraContainerRegistry a lot cleaner, especially when more container types are
added

Cura-6096
2021-08-20 15:40:50 +02:00