From ebe0585a40a6ca88d2fae0f97b8308b69eeeec52 Mon Sep 17 00:00:00 2001 From: Gregoo Date: Mon, 20 Jan 2025 19:39:12 +0100 Subject: [PATCH] Quote SQL identifiers as best practice and to avoid any problem in the future --- bricktracker/sql/migrations/0001.sql | 106 +++++++++--------- bricktracker/sql/migrations/0002.sql | 6 +- bricktracker/sql/minifigure/base/select.sql | 20 ++-- .../sql/minifigure/delete/all_from_set.sql | 4 +- bricktracker/sql/minifigure/insert.sql | 14 +-- bricktracker/sql/minifigure/list/all.sql | 26 ++--- bricktracker/sql/minifigure/list/from_set.sql | 4 +- bricktracker/sql/minifigure/list/last.sql | 12 +- .../sql/minifigure/list/missing_part.sql | 24 ++-- .../sql/minifigure/list/using_part.sql | 18 +-- .../sql/minifigure/select/generic.sql | 28 ++--- .../sql/minifigure/select/specific.sql | 6 +- .../sql/missing/delete/all_from_set.sql | 4 +- bricktracker/sql/missing/delete/from_set.sql | 8 +- bricktracker/sql/missing/insert.sql | 18 +-- bricktracker/sql/missing/update/from_set.sql | 10 +- bricktracker/sql/part/base/select.sql | 36 +++--- bricktracker/sql/part/delete/all_from_set.sql | 4 +- bricktracker/sql/part/insert.sql | 24 ++-- bricktracker/sql/part/list/all.sql | 40 +++---- .../sql/part/list/from_minifigure.sql | 26 ++--- bricktracker/sql/part/list/from_set.sql | 20 ++-- bricktracker/sql/part/list/missing.sql | 36 +++--- bricktracker/sql/part/select/generic.sql | 38 +++---- bricktracker/sql/part/select/specific.sql | 26 ++--- bricktracker/sql/schema/count.sql | 4 +- bricktracker/sql/schema/drop.sql | 10 +- bricktracker/sql/set/base/select.sql | 56 ++++----- bricktracker/sql/set/delete/set.sql | 4 +- bricktracker/sql/set/insert.sql | 24 ++-- bricktracker/sql/set/list/generic.sql | 18 +-- .../sql/set/list/missing_minifigure.sql | 10 +- bricktracker/sql/set/list/missing_part.sql | 14 +-- .../sql/set/list/using_minifigure.sql | 10 +- bricktracker/sql/set/list/using_part.sql | 14 +-- bricktracker/sql/set/select.sql | 6 +- bricktracker/sql/set/update_checked.sql | 6 +- bricktracker/sql/wish/base/select.sql | 18 +-- bricktracker/sql/wish/delete/wish.sql | 4 +- bricktracker/sql/wish/insert.sql | 18 +-- bricktracker/sql/wish/select.sql | 2 +- 41 files changed, 388 insertions(+), 388 deletions(-) diff --git a/bricktracker/sql/migrations/0001.sql b/bricktracker/sql/migrations/0001.sql index 846eddc..fc10f82 100644 --- a/bricktracker/sql/migrations/0001.sql +++ b/bricktracker/sql/migrations/0001.sql @@ -1,62 +1,62 @@ --- description: Database initialization --- FROM sqlite3 app.db .schema > init.sql with extra IF NOT EXISTS and transaction +-- description: Original database initialization +-- FROM sqlite3 app.db .schema > init.sql with extra IF NOT EXISTS, transaction and quotes BEGIN transaction; -CREATE TABLE IF NOT EXISTS wishlist ( - set_num TEXT, - name TEXT, - year INTEGER, - theme_id INTEGER, - num_parts INTEGER, - set_img_url TEXT, - set_url TEXT, - last_modified_dt TEXT +CREATE TABLE IF NOT EXISTS "wishlist" ( + "set_num" TEXT, + "name" TEXT, + "year" INTEGER, + "theme_id" INTEGER, + "num_parts" INTEGER, + "set_img_url" TEXT, + "set_url" TEXT, + "last_modified_dt" TEXT ); -CREATE TABLE IF NOT EXISTS sets ( - set_num TEXT, - name TEXT, - year INTEGER, - theme_id INTEGER, - num_parts INTEGER, - set_img_url TEXT, - set_url TEXT, - last_modified_dt TEXT, - mini_col BOOLEAN, - set_check BOOLEAN, - set_col BOOLEAN, - u_id TEXT +CREATE TABLE IF NOT EXISTS "sets" ( + "set_num" TEXT, + "name" TEXT, + "year" INTEGER, + "theme_id" INTEGER, + "num_parts" INTEGER, + "set_img_url" TEXT, + "set_url" TEXT, + "last_modified_dt" TEXT, + "mini_col" BOOLEAN, + "set_check" BOOLEAN, + "set_col" BOOLEAN, + "u_id" TEXT ); -CREATE TABLE IF NOT EXISTS inventory ( - set_num TEXT, - id INTEGER, - part_num TEXT, - name TEXT, - part_img_url TEXT, - part_img_url_id TEXT, - color_id INTEGER, - color_name TEXT, - quantity INTEGER, - is_spare BOOLEAN, - element_id INTEGER, - u_id TEXT +CREATE TABLE IF NOT EXISTS "inventory" ( + "set_num" TEXT, + "id" INTEGER, + "part_num" TEXT, + "name" TEXT, + "part_img_url" TEXT, + "part_img_url_id" TEXT, + "color_id" INTEGER, + "color_name" TEXT, + "quantity" INTEGER, + "is_spare" BOOLEAN, + "element_id" INTEGER, + "u_id" TEXT ); -CREATE TABLE IF NOT EXISTS minifigures ( - fig_num TEXT, - set_num TEXT, - name TEXT, - quantity INTEGER, - set_img_url TEXT, - u_id TEXT +CREATE TABLE IF NOT EXISTS "minifigures" ( + "fig_num" TEXT, + "set_num" TEXT, + "name" TEXT, + "quantity" INTEGER, + "set_img_url" TEXT, + "u_id" TEXT ); -CREATE TABLE IF NOT EXISTS missing ( - set_num TEXT, - id INTEGER, - part_num TEXT, - part_img_url_id TEXT, - color_id INTEGER, - quantity INTEGER, - element_id INTEGER, - u_id TEXT +CREATE TABLE IF NOT EXISTS "missing" ( + "set_num" TEXT, + "id" INTEGER, + "part_num" TEXT, + "part_img_url_id" TEXT, + "color_id" INTEGER, + "quantity" INTEGER, + "element_id" INTEGER, + "u_id" TEXT ); COMMIT; \ No newline at end of file diff --git a/bricktracker/sql/migrations/0002.sql b/bricktracker/sql/migrations/0002.sql index 5dc9ed4..d719d4e 100644 --- a/bricktracker/sql/migrations/0002.sql +++ b/bricktracker/sql/migrations/0002.sql @@ -6,8 +6,8 @@ PRAGMA journal_mode = WAL; BEGIN transaction; -- Fix a bug where 'None' was inserted in missing instead of NULL -UPDATE missing -SET element_id = NULL -WHERE element_id = 'None'; +UPDATE "missing" +SET "element_id" = NULL +WHERE "missing"."element_id" = 'None'; COMMIT; \ No newline at end of file diff --git a/bricktracker/sql/minifigure/base/select.sql b/bricktracker/sql/minifigure/base/select.sql index 365019f..8182998 100644 --- a/bricktracker/sql/minifigure/base/select.sql +++ b/bricktracker/sql/minifigure/base/select.sql @@ -1,20 +1,20 @@ SELECT - minifigures.fig_num, - minifigures.set_num, - minifigures.name, - minifigures.quantity, - minifigures.set_img_url, - minifigures.u_id, + "minifigures"."fig_num", + "minifigures"."set_num", + "minifigures"."name", + "minifigures"."quantity", + "minifigures"."set_img_url", + "minifigures"."u_id", {% block total_missing %} - NULL AS total_missing, -- dummy for order: total_missing + NULL AS "total_missing", -- dummy for order: total_missing {% endblock %} {% block total_quantity %} - NULL AS total_quantity, -- dummy for order: total_quantity + NULL AS "total_quantity", -- dummy for order: total_quantity {% endblock %} {% block total_sets %} - NULL AS total_sets -- dummy for order: total_sets + NULL AS "total_sets" -- dummy for order: total_sets {% endblock %} -FROM minifigures +FROM "minifigures" {% block join %}{% endblock %} diff --git a/bricktracker/sql/minifigure/delete/all_from_set.sql b/bricktracker/sql/minifigure/delete/all_from_set.sql index b04b2b5..e0b8446 100644 --- a/bricktracker/sql/minifigure/delete/all_from_set.sql +++ b/bricktracker/sql/minifigure/delete/all_from_set.sql @@ -1,2 +1,2 @@ -DELETE FROM minifigures -WHERE u_id IS NOT DISTINCT FROM :u_id \ No newline at end of file +DELETE FROM "minifigures" +WHERE "minifigures"."u_id" IS NOT DISTINCT FROM :u_id \ No newline at end of file diff --git a/bricktracker/sql/minifigure/insert.sql b/bricktracker/sql/minifigure/insert.sql index b957645..d72a2a3 100644 --- a/bricktracker/sql/minifigure/insert.sql +++ b/bricktracker/sql/minifigure/insert.sql @@ -1,10 +1,10 @@ -INSERT INTO minifigures ( - fig_num, - set_num, - name, - quantity, - set_img_url, - u_id +INSERT INTO "minifigures" ( + "fig_num", + "set_num", + "name", + "quantity", + "set_img_url", + "u_id" ) VALUES ( :fig_num, :set_num, diff --git a/bricktracker/sql/minifigure/list/all.sql b/bricktracker/sql/minifigure/list/all.sql index 804387a..480eb67 100644 --- a/bricktracker/sql/minifigure/list/all.sql +++ b/bricktracker/sql/minifigure/list/all.sql @@ -1,34 +1,34 @@ {% extends 'minifigure/base/select.sql' %} {% block total_missing %} -SUM(IFNULL(missing_join.total, 0)) AS total_missing, +SUM(IFNULL("missing_join"."total", 0)) AS "total_missing", {% endblock %} -{% block total_quantity %} -SUM(IFNULL(minifigures.quantity, 0)) AS total_quantity, +{% block "total_quantity" %} +SUM(IFNULL("minifigures"."quantity", 0)) AS "total_quantity", {% endblock %} {% block total_sets %} -COUNT(minifigures.set_num) AS total_sets +COUNT("minifigures"."set_num") AS "total_sets" {% endblock %} {% block join %} -- LEFT JOIN + SELECT to avoid messing the total LEFT JOIN ( SELECT - set_num, - u_id, - SUM(quantity) AS total - FROM missing + "missing"."set_num", + "missing"."u_id", + SUM("missing"."quantity") AS total + FROM "missing" GROUP BY - set_num, - u_id + "missing"."set_num", + "missing"."u_id" ) missing_join -ON minifigures.u_id IS NOT DISTINCT FROM missing_join.u_id -AND minifigures.fig_num IS NOT DISTINCT FROM missing_join.set_num +ON "minifigures"."u_id" IS NOT DISTINCT FROM "missing_join"."u_id" +AND "minifigures"."fig_num" IS NOT DISTINCT FROM "missing_join"."set_num" {% endblock %} {% block group %} GROUP BY - minifigures.fig_num + "minifigures"."fig_num" {% endblock %} diff --git a/bricktracker/sql/minifigure/list/from_set.sql b/bricktracker/sql/minifigure/list/from_set.sql index 60c79f3..ea2dcbe 100644 --- a/bricktracker/sql/minifigure/list/from_set.sql +++ b/bricktracker/sql/minifigure/list/from_set.sql @@ -1,6 +1,6 @@ {% extends 'minifigure/base/select.sql' %} {% block where %} -WHERE u_id IS NOT DISTINCT FROM :u_id -AND set_num IS NOT DISTINCT FROM :set_num +WHERE "minifigures"."u_id" IS NOT DISTINCT FROM :u_id +AND "minifigures"."set_num" IS NOT DISTINCT FROM :set_num {% endblock %} diff --git a/bricktracker/sql/minifigure/list/last.sql b/bricktracker/sql/minifigure/list/last.sql index 2660af9..faf3f40 100644 --- a/bricktracker/sql/minifigure/list/last.sql +++ b/bricktracker/sql/minifigure/list/last.sql @@ -1,17 +1,17 @@ {% extends 'minifigure/base/select.sql' %} {% block total_missing %} -SUM(IFNULL(missing.quantity, 0)) AS total_missing, +SUM(IFNULL("missing"."quantity", 0)) AS "total_missing", {% endblock %} {% block join %} -LEFT JOIN missing -ON minifigures.fig_num IS NOT DISTINCT FROM missing.set_num -AND minifigures.u_id IS NOT DISTINCT FROM missing.u_id +LEFT JOIN "missing" +ON "minifigures"."fig_num" IS NOT DISTINCT FROM "missing"."set_num" +AND "minifigures"."u_id" IS NOT DISTINCT FROM "missing"."u_id" {% endblock %} {% block group %} GROUP BY - minifigures.fig_num, - minifigures.u_id + "minifigures"."fig_num", + "minifigures"."u_id" {% endblock %} diff --git a/bricktracker/sql/minifigure/list/missing_part.sql b/bricktracker/sql/minifigure/list/missing_part.sql index 99eee8f..e0bc54d 100644 --- a/bricktracker/sql/minifigure/list/missing_part.sql +++ b/bricktracker/sql/minifigure/list/missing_part.sql @@ -1,30 +1,30 @@ {% extends 'minifigure/base/select.sql' %} {% block total_missing %} -SUM(IFNULL(missing.quantity, 0)) AS total_missing, +SUM(IFNULL("missing"."quantity", 0)) AS "total_missing", {% endblock %} {% block join %} -LEFT JOIN missing -ON minifigures.fig_num IS NOT DISTINCT FROM missing.set_num -AND minifigures.u_id IS NOT DISTINCT FROM missing.u_id +LEFT JOIN "missing" +ON "minifigures"."fig_num" IS NOT DISTINCT FROM "missing"."set_num" +AND "minifigures"."u_id" IS NOT DISTINCT FROM "missing"."u_id" {% endblock %} {% block where %} -WHERE minifigures.fig_num IN ( +WHERE "minifigures"."fig_num" IN ( SELECT - missing.set_num - FROM missing + "missing"."set_num" + FROM "missing" - WHERE missing.color_id IS NOT DISTINCT FROM :color_id - AND missing.element_id IS NOT DISTINCT FROM :element_id - AND missing.part_num IS NOT DISTINCT FROM :part_num + WHERE "missing"."color_id" IS NOT DISTINCT FROM :color_id + AND "missing"."element_id" IS NOT DISTINCT FROM :element_id + AND "missing"."part_num" IS NOT DISTINCT FROM :part_num - GROUP BY missing.set_num + GROUP BY "missing"."set_num" ) {% endblock %} {% block group %} GROUP BY - minifigures.fig_num + "minifigures"."fig_num" {% endblock %} diff --git a/bricktracker/sql/minifigure/list/using_part.sql b/bricktracker/sql/minifigure/list/using_part.sql index 9b6b82c..c40d379 100644 --- a/bricktracker/sql/minifigure/list/using_part.sql +++ b/bricktracker/sql/minifigure/list/using_part.sql @@ -1,24 +1,24 @@ {% extends 'minifigure/base/select.sql' %} {% block total_quantity %} -SUM(minifigures.quantity) AS total_quantity, +SUM("minifigures"."quantity") AS "total_quantity", {% endblock %} {% block where %} -WHERE minifigures.fig_num IN ( +WHERE "minifigures"."fig_num" IN ( SELECT - inventory.set_num - FROM inventory + "inventory"."set_num" + FROM "inventory" - WHERE inventory.color_id IS NOT DISTINCT FROM :color_id - AND inventory.element_id IS NOT DISTINCT FROM :element_id - AND inventory.part_num IS NOT DISTINCT FROM :part_num + WHERE "inventory"."color_id" IS NOT DISTINCT FROM :color_id + AND "inventory"."element_id" IS NOT DISTINCT FROM :element_id + AND "inventory"."part_num" IS NOT DISTINCT FROM :part_num - GROUP BY inventory.set_num + GROUP BY "inventory"."set_num" ) {% endblock %} {% block group %} GROUP BY - minifigures.fig_num + "minifigures"."fig_num" {% endblock %} diff --git a/bricktracker/sql/minifigure/select/generic.sql b/bricktracker/sql/minifigure/select/generic.sql index 704ca5c..114810d 100644 --- a/bricktracker/sql/minifigure/select/generic.sql +++ b/bricktracker/sql/minifigure/select/generic.sql @@ -1,38 +1,38 @@ {% extends 'minifigure/base/select.sql' %} {% block total_missing %} -SUM(IFNULL(missing_join.total, 0)) AS total_missing, +SUM(IFNULL("missing_join"."total", 0)) AS "total_missing", {% endblock %} {% block total_quantity %} -SUM(IFNULL(minifigures.quantity, 0)) AS total_quantity, +SUM(IFNULL("minifigures"."quantity", 0)) AS "total_quantity", {% endblock %} {% block total_sets %} -COUNT(minifigures.set_num) AS total_sets +COUNT("minifigures"."set_num") AS "total_sets" {% endblock %} {% block join %} -- LEFT JOIN + SELECT to avoid messing the total LEFT JOIN ( SELECT - set_num, - u_id, - SUM(quantity) AS total - FROM missing + "missing"."set_num", + "missing"."u_id", + SUM("missing"."quantity") AS "total" + FROM "missing" GROUP BY - set_num, - u_id -) missing_join -ON minifigures.u_id IS NOT DISTINCT FROM missing_join.u_id -AND minifigures.fig_num IS NOT DISTINCT FROM missing_join.set_num + "missing"."set_num", + "missing"."u_id" +) "missing_join" +ON "minifigures"."u_id" IS NOT DISTINCT FROM "missing_join"."u_id" +AND "minifigures"."fig_num" IS NOT DISTINCT FROM "missing_join"."set_num" {% endblock %} {% block where %} -WHERE fig_num IS NOT DISTINCT FROM :fig_num +WHERE "minifigures"."fig_num" IS NOT DISTINCT FROM :fig_num {% endblock %} {% block group %} GROUP BY - minifigures.fig_num + "minifigures"."fig_num" {% endblock %} diff --git a/bricktracker/sql/minifigure/select/specific.sql b/bricktracker/sql/minifigure/select/specific.sql index 02100b8..34a8b3d 100644 --- a/bricktracker/sql/minifigure/select/specific.sql +++ b/bricktracker/sql/minifigure/select/specific.sql @@ -1,7 +1,7 @@ {% extends 'minifigure/base/select.sql' %} {% block where %} -WHERE fig_num IS NOT DISTINCT FROM :fig_num -AND u_id IS NOT DISTINCT FROM :u_id -AND set_num IS NOT DISTINCT FROM :set_num +WHERE "minifigures"."fig_num" IS NOT DISTINCT FROM :fig_num +AND "minifigures"."u_id" IS NOT DISTINCT FROM :u_id +AND "minifigures"."set_num" IS NOT DISTINCT FROM :set_num {% endblock %} diff --git a/bricktracker/sql/missing/delete/all_from_set.sql b/bricktracker/sql/missing/delete/all_from_set.sql index 6ec5f55..612b102 100644 --- a/bricktracker/sql/missing/delete/all_from_set.sql +++ b/bricktracker/sql/missing/delete/all_from_set.sql @@ -1,2 +1,2 @@ -DELETE FROM missing -WHERE u_id IS NOT DISTINCT FROM :u_id \ No newline at end of file +DELETE FROM "missing" +WHERE "missing"."u_id" IS NOT DISTINCT FROM :u_id \ No newline at end of file diff --git a/bricktracker/sql/missing/delete/from_set.sql b/bricktracker/sql/missing/delete/from_set.sql index 66819d2..ceedc78 100644 --- a/bricktracker/sql/missing/delete/from_set.sql +++ b/bricktracker/sql/missing/delete/from_set.sql @@ -1,4 +1,4 @@ -DELETE FROM missing -WHERE set_num IS NOT DISTINCT FROM :set_num -AND id IS NOT DISTINCT FROM :id -AND u_id IS NOT DISTINCT FROM :u_id +DELETE FROM "missing" +WHERE "missing"."set_num" IS NOT DISTINCT FROM :set_num +AND "missing"."id" IS NOT DISTINCT FROM :id +AND "missing"."u_id" IS NOT DISTINCT FROM :u_id diff --git a/bricktracker/sql/missing/insert.sql b/bricktracker/sql/missing/insert.sql index a883f50..c645028 100644 --- a/bricktracker/sql/missing/insert.sql +++ b/bricktracker/sql/missing/insert.sql @@ -1,12 +1,12 @@ -INSERT INTO missing ( - set_num, - id, - part_num, - part_img_url_id, - color_id, - quantity, - element_id, - u_id +INSERT INTO "missing" ( + "set_num", + "id", + "part_num", + "part_img_url_id", + "color_id", + "quantity", + "element_id", + "u_id" ) VALUES( :set_num, diff --git a/bricktracker/sql/missing/update/from_set.sql b/bricktracker/sql/missing/update/from_set.sql index 26ef04d..335dd06 100644 --- a/bricktracker/sql/missing/update/from_set.sql +++ b/bricktracker/sql/missing/update/from_set.sql @@ -1,5 +1,5 @@ -UPDATE missing -SET quantity = :quantity -WHERE set_num IS NOT DISTINCT FROM :set_num -AND id IS NOT DISTINCT FROM :id -AND u_id IS NOT DISTINCT FROM :u_id +UPDATE "missing" +SET "quantity" = :quantity +WHERE "missing"."set_num" IS NOT DISTINCT FROM :set_num +AND "missing"."id" IS NOT DISTINCT FROM :id +AND "missing"."u_id" IS NOT DISTINCT FROM :u_id diff --git a/bricktracker/sql/part/base/select.sql b/bricktracker/sql/part/base/select.sql index 648cfad..3966a75 100644 --- a/bricktracker/sql/part/base/select.sql +++ b/bricktracker/sql/part/base/select.sql @@ -1,32 +1,32 @@ SELECT - inventory.set_num, - inventory.id, - inventory.part_num, - inventory.name, - inventory.part_img_url, - inventory.part_img_url_id, - inventory.color_id, - inventory.color_name, - inventory.quantity, - inventory.is_spare, - inventory.element_id, - inventory.u_id, + "inventory"."set_num", + "inventory"."id", + "inventory"."part_num", + "inventory"."name", + "inventory"."part_img_url", + "inventory"."part_img_url_id", + "inventory"."color_id", + "inventory"."color_name", + "inventory"."quantity", + "inventory"."is_spare", + "inventory"."element_id", + "inventory"."u_id", {% block total_missing %} - NULL AS total_missing, -- dummy for order: total_missing + NULL AS "total_missing", -- dummy for order: total_missing {% endblock %} {% block total_quantity %} - NULL AS total_quantity, -- dummy for order: total_quantity + NULL AS "total_quantity", -- dummy for order: total_quantity {% endblock %} {% block total_spare %} - NULL AS total_spare, -- dummy for order: total_spare + NULL AS "total_spare", -- dummy for order: total_spare {% endblock %} {% block total_sets %} - NULL AS total_sets, -- dummy for order: total_sets + NULL AS "total_sets", -- dummy for order: total_sets {% endblock %} {% block total_minifigures %} - NULL AS total_minifigures -- dummy for order: total_minifigures + NULL AS "total_minifigures" -- dummy for order: total_minifigures {% endblock %} -FROM inventory +FROM "inventory" {% block join %}{% endblock %} diff --git a/bricktracker/sql/part/delete/all_from_set.sql b/bricktracker/sql/part/delete/all_from_set.sql index 99c576a..59d44c3 100644 --- a/bricktracker/sql/part/delete/all_from_set.sql +++ b/bricktracker/sql/part/delete/all_from_set.sql @@ -1,2 +1,2 @@ -DELETE FROM inventory -WHERE u_id IS NOT DISTINCT FROM :u_id \ No newline at end of file +DELETE FROM "inventory" +WHERE "inventory"."u_id" IS NOT DISTINCT FROM :u_id \ No newline at end of file diff --git a/bricktracker/sql/part/insert.sql b/bricktracker/sql/part/insert.sql index 6e47df1..39b2d14 100644 --- a/bricktracker/sql/part/insert.sql +++ b/bricktracker/sql/part/insert.sql @@ -1,16 +1,16 @@ INSERT INTO inventory ( - set_num, - id, - part_num, - name, - part_img_url, - part_img_url_id, - color_id, - color_name, - quantity, - is_spare, - element_id, - u_id + "set_num", + "id", + "part_num", + "name", + "part_img_url", + "part_img_url_id", + "color_id", + "color_name", + "quantity", + "is_spare", + "element_id", + "u_id" ) VALUES ( :set_num, :id, diff --git a/bricktracker/sql/part/list/all.sql b/bricktracker/sql/part/list/all.sql index 5c48393..ded1297 100644 --- a/bricktracker/sql/part/list/all.sql +++ b/bricktracker/sql/part/list/all.sql @@ -1,43 +1,43 @@ {% extends 'part/base/select.sql' %} {% block total_missing %} -SUM(IFNULL(missing.quantity, 0)) AS total_missing, +SUM(IFNULL("missing"."quantity", 0)) AS "total_missing", {% endblock %} {% block total_quantity %} -SUM(inventory.quantity * IFNULL(minifigures.quantity, 1)) AS total_quantity, +SUM("inventory"."quantity" * IFNULL("minifigures"."quantity", 1)) AS "total_quantity", {% endblock %} {% block total_sets %} -COUNT(DISTINCT sets.u_id) AS total_sets, +COUNT(DISTINCT "sets"."u_id") AS "total_sets", {% endblock %} {% block total_minifigures %} -SUM(IFNULL(minifigures.quantity, 0)) AS total_minifigures +SUM(IFNULL("minifigures"."quantity", 0)) AS "total_minifigures" {% endblock %} {% block join %} -LEFT JOIN missing -ON inventory.set_num IS NOT DISTINCT FROM missing.set_num -AND inventory.id IS NOT DISTINCT FROM missing.id -AND inventory.part_num IS NOT DISTINCT FROM missing.part_num -AND inventory.color_id IS NOT DISTINCT FROM missing.color_id -AND inventory.element_id IS NOT DISTINCT FROM missing.element_id -AND inventory.u_id IS NOT DISTINCT FROM missing.u_id +LEFT JOIN "missing" +ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num" +AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id" +AND "inventory"."part_num" IS NOT DISTINCT FROM "missing"."part_num" +AND "inventory"."color_id" IS NOT DISTINCT FROM "missing"."color_id" +AND "inventory"."element_id" IS NOT DISTINCT FROM "missing"."element_id" +AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id" -LEFT JOIN minifigures -ON inventory.set_num IS NOT DISTINCT FROM minifigures.fig_num -AND inventory.u_id IS NOT DISTINCT FROM minifigures.u_id +LEFT JOIN "minifigures" +ON "inventory"."set_num" IS NOT DISTINCT FROM "minifigures"."fig_num" +AND "inventory"."u_id" IS NOT DISTINCT FROM "minifigures"."u_id" LEFT JOIN sets -ON inventory.u_id IS NOT DISTINCT FROM sets.u_id +ON "inventory"."u_id" IS NOT DISTINCT FROM "sets"."u_id" {% endblock %} {% block group %} GROUP BY - inventory.part_num, - inventory.name, - inventory.color_id, - inventory.is_spare, - inventory.element_id + "inventory"."part_num", + "inventory"."name", + "inventory"."color_id", + "inventory"."is_spare", + "inventory"."element_id" {% endblock %} diff --git a/bricktracker/sql/part/list/from_minifigure.sql b/bricktracker/sql/part/list/from_minifigure.sql index 9c2128b..cf4135f 100644 --- a/bricktracker/sql/part/list/from_minifigure.sql +++ b/bricktracker/sql/part/list/from_minifigure.sql @@ -2,27 +2,27 @@ {% extends 'part/base/select.sql' %} {% block total_missing %} -SUM(IFNULL(missing.quantity, 0)) AS total_missing, +SUM(IFNULL("missing"."quantity", 0)) AS "total_missing", {% endblock %} {% block join %} -LEFT JOIN missing -ON missing.set_num IS NOT DISTINCT FROM inventory.set_num -AND missing.id IS NOT DISTINCT FROM inventory.id -AND missing.part_num IS NOT DISTINCT FROM inventory.part_num -AND missing.color_id IS NOT DISTINCT FROM inventory.color_id -AND missing.element_id IS NOT DISTINCT FROM inventory.element_id +LEFT JOIN "missing" +ON "missing"."set_num" IS NOT DISTINCT FROM "inventory"."set_num" +AND "missing"."id" IS NOT DISTINCT FROM "inventory"."id" +AND "missing"."part_num" IS NOT DISTINCT FROM "inventory"."part_num" +AND "missing"."color_id" IS NOT DISTINCT FROM "inventory"."color_id" +AND "missing"."element_id" IS NOT DISTINCT FROM "inventory"."element_id" {% endblock %} {% block where %} -WHERE inventory.set_num IS NOT DISTINCT FROM :set_num +WHERE "inventory"."set_num" IS NOT DISTINCT FROM :set_num {% endblock %} {% block group %} GROUP BY - inventory.part_num, - inventory.name, - inventory.color_id, - inventory.is_spare, - inventory.element_id + "inventory"."part_num", + "inventory"."name", + "inventory"."color_id", + "inventory"."is_spare", + "inventory"."element_id" {% endblock %} diff --git a/bricktracker/sql/part/list/from_set.sql b/bricktracker/sql/part/list/from_set.sql index 1e9d411..2646eeb 100644 --- a/bricktracker/sql/part/list/from_set.sql +++ b/bricktracker/sql/part/list/from_set.sql @@ -2,20 +2,20 @@ {% extends 'part/base/select.sql' %} {% block total_missing %} -IFNULL(missing.quantity, 0) AS total_missing, +IFNULL("missing"."quantity", 0) AS "total_missing", {% endblock %} {% block join %} -LEFT JOIN missing -ON inventory.set_num IS NOT DISTINCT FROM missing.set_num -AND inventory.id IS NOT DISTINCT FROM missing.id -AND inventory.part_num IS NOT DISTINCT FROM missing.part_num -AND inventory.color_id IS NOT DISTINCT FROM missing.color_id -AND inventory.element_id IS NOT DISTINCT FROM missing.element_id -AND inventory.u_id IS NOT DISTINCT FROM missing.u_id +LEFT JOIN "missing" +ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num" +AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id" +AND "inventory"."part_num" IS NOT DISTINCT FROM "missing"."part_num" +AND "inventory"."color_id" IS NOT DISTINCT FROM "missing"."color_id" +AND "inventory"."element_id" IS NOT DISTINCT FROM "missing"."element_id" +AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id" {% endblock %} {% block where %} -WHERE inventory.u_id IS NOT DISTINCT FROM :u_id -AND inventory.set_num IS NOT DISTINCT FROM :set_num +WHERE "inventory"."u_id" IS NOT DISTINCT FROM :u_id +AND "inventory"."set_num" IS NOT DISTINCT FROM :set_num {% endblock %} diff --git a/bricktracker/sql/part/list/missing.sql b/bricktracker/sql/part/list/missing.sql index e85bbd4..555916f 100644 --- a/bricktracker/sql/part/list/missing.sql +++ b/bricktracker/sql/part/list/missing.sql @@ -1,36 +1,36 @@ {% extends 'part/base/select.sql' %} {% block total_missing %} -SUM(IFNULL(missing.quantity, 0)) AS total_missing, +SUM(IFNULL("missing"."quantity", 0)) AS "total_missing", {% endblock %} {% block total_sets %} -COUNT(inventory.u_id) - COUNT(minifigures.u_id) AS total_sets, +COUNT("inventory"."u_id") - COUNT("minifigures"."u_id") AS "total_sets", {% endblock %} {% block total_minifigures %} -SUM(IFNULL(minifigures.quantity, 0)) AS total_minifigures +SUM(IFNULL("minifigures"."quantity", 0)) AS "total_minifigures" {% endblock %} {% block join %} -INNER JOIN missing -ON missing.set_num IS NOT DISTINCT FROM inventory.set_num -AND missing.id IS NOT DISTINCT FROM inventory.id -AND missing.part_num IS NOT DISTINCT FROM inventory.part_num -AND missing.color_id IS NOT DISTINCT FROM inventory.color_id -AND missing.element_id IS NOT DISTINCT FROM inventory.element_id -AND missing.u_id IS NOT DISTINCT FROM inventory.u_id +INNER JOIN "missing" +ON "missing"."set_num" IS NOT DISTINCT FROM "inventory"."set_num" +AND "missing"."id" IS NOT DISTINCT FROM "inventory"."id" +AND "missing"."part_num" IS NOT DISTINCT FROM "inventory"."part_num" +AND "missing"."color_id" IS NOT DISTINCT FROM "inventory"."color_id" +AND "missing"."element_id" IS NOT DISTINCT FROM "inventory"."element_id" +AND "missing"."u_id" IS NOT DISTINCT FROM "inventory"."u_id" -LEFT JOIN minifigures -ON missing.set_num IS NOT DISTINCT FROM minifigures.fig_num -AND missing.u_id IS NOT DISTINCT FROM minifigures.u_id +LEFT JOIN "minifigures" +ON "missing"."set_num" IS NOT DISTINCT FROM "minifigures"."fig_num" +AND "missing"."u_id" IS NOT DISTINCT FROM "minifigures"."u_id" {% endblock %} {% block group %} GROUP BY - inventory.part_num, - inventory.name, - inventory.color_id, - inventory.is_spare, - inventory.element_id + "inventory"."part_num", + "inventory"."name", + "inventory"."color_id", + "inventory"."is_spare", + "inventory"."element_id" {% endblock %} diff --git a/bricktracker/sql/part/select/generic.sql b/bricktracker/sql/part/select/generic.sql index fbc84e8..4a75b4c 100644 --- a/bricktracker/sql/part/select/generic.sql +++ b/bricktracker/sql/part/select/generic.sql @@ -1,40 +1,40 @@ {% extends 'part/base/select.sql' %} {% block total_missing %} -SUM(IFNULL(missing.quantity, 0)) AS total_missing, +SUM(IFNULL("missing"."quantity", 0)) AS "total_missing", {% endblock %} {% block total_quantity %} -SUM((NOT inventory.is_spare) * inventory.quantity * IFNULL(minifigures.quantity, 1)) AS total_quantity, +SUM((NOT "inventory"."is_spare") * "inventory"."quantity" * IFNULL("minifigures"."quantity", 1)) AS "total_quantity", {% endblock %} {% block total_spare %} -SUM(inventory.is_spare * inventory.quantity * IFNULL(minifigures.quantity, 1)) AS total_spare, +SUM("inventory"."is_spare" * "inventory"."quantity" * IFNULL("minifigures"."quantity", 1)) AS "total_spare", {% endblock %} {% block join %} -LEFT JOIN missing -ON inventory.set_num IS NOT DISTINCT FROM missing.set_num -AND inventory.id IS NOT DISTINCT FROM missing.id -AND inventory.part_num IS NOT DISTINCT FROM missing.part_num -AND inventory.color_id IS NOT DISTINCT FROM missing.color_id -AND inventory.element_id IS NOT DISTINCT FROM missing.element_id -AND inventory.u_id IS NOT DISTINCT FROM missing.u_id +LEFT JOIN "missing" +ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num" +AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id" +AND "inventory"."part_num" IS NOT DISTINCT FROM "missing"."part_num" +AND "inventory"."color_id" IS NOT DISTINCT FROM "missing"."color_id" +AND "inventory"."element_id" IS NOT DISTINCT FROM "missing"."element_id" +AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id" -LEFT JOIN minifigures -ON inventory.set_num IS NOT DISTINCT FROM minifigures.fig_num -AND inventory.u_id IS NOT DISTINCT FROM minifigures.u_id +LEFT JOIN "minifigures" +ON "inventory"."set_num" IS NOT DISTINCT FROM "minifigures"."fig_num" +AND "inventory"."u_id" IS NOT DISTINCT FROM "minifigures"."u_id" {% endblock %} {% block where %} -WHERE inventory.part_num IS NOT DISTINCT FROM :part_num -AND inventory.color_id IS NOT DISTINCT FROM :color_id -AND inventory.element_id IS NOT DISTINCT FROM :element_id +WHERE "inventory"."part_num" IS NOT DISTINCT FROM :part_num +AND "inventory"."color_id" IS NOT DISTINCT FROM :color_id +AND "inventory"."element_id" IS NOT DISTINCT FROM :element_id {% endblock %} {% block group %} GROUP BY - inventory.part_num, - inventory.color_id, - inventory.element_id + "inventory"."part_num", + "inventory"."color_id", + "inventory"."element_id" {% endblock %} diff --git a/bricktracker/sql/part/select/specific.sql b/bricktracker/sql/part/select/specific.sql index 1918b3f..ebdd5f5 100644 --- a/bricktracker/sql/part/select/specific.sql +++ b/bricktracker/sql/part/select/specific.sql @@ -1,24 +1,24 @@ {% extends 'part/base/select.sql' %} {% block join %} -LEFT JOIN missing -ON inventory.set_num IS NOT DISTINCT FROM missing.set_num -AND inventory.id IS NOT DISTINCT FROM missing.id -AND inventory.u_id IS NOT DISTINCT FROM missing.u_id +LEFT JOIN "missing" +ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num" +AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id" +AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id" {% endblock %} {% block where %} -WHERE inventory.u_id IS NOT DISTINCT FROM :u_id -AND inventory.set_num IS NOT DISTINCT FROM :set_num -AND inventory.id IS NOT DISTINCT FROM :id +WHERE "inventory"."u_id" IS NOT DISTINCT FROM :u_id +AND "inventory"."set_num" IS NOT DISTINCT FROM :set_num +AND "inventory"."id" IS NOT DISTINCT FROM :id {% endblock %} {% block group %} GROUP BY - inventory.set_num, - inventory.id, - inventory.part_num, - inventory.color_id, - inventory.element_id, - inventory.u_id + "inventory"."set_num", + "inventory"."id", + "inventory"."part_num", + "inventory"."color_id", + "inventory"."element_id", + "inventory"."u_id" {% endblock %} diff --git a/bricktracker/sql/schema/count.sql b/bricktracker/sql/schema/count.sql index 6f2d241..5df9cda 100644 --- a/bricktracker/sql/schema/count.sql +++ b/bricktracker/sql/schema/count.sql @@ -1,2 +1,2 @@ -SELECT COUNT(*) AS count -FROM {{ table }} \ No newline at end of file +SELECT COUNT(*) AS "count" +FROM "{{ table }}" \ No newline at end of file diff --git a/bricktracker/sql/schema/drop.sql b/bricktracker/sql/schema/drop.sql index 450bc3d..353ce03 100644 --- a/bricktracker/sql/schema/drop.sql +++ b/bricktracker/sql/schema/drop.sql @@ -1,9 +1,9 @@ BEGIN transaction; -DROP TABLE IF EXISTS wishlist; -DROP TABLE IF EXISTS sets; -DROP TABLE IF EXISTS inventory; -DROP TABLE IF EXISTS minifigures; -DROP TABLE IF EXISTS missing; +DROP TABLE IF EXISTS "wishlist"; +DROP TABLE IF EXISTS "sets"; +DROP TABLE IF EXISTS "inventory"; +DROP TABLE IF EXISTS "minifigures"; +DROP TABLE IF EXISTS "missing"; COMMIT; \ No newline at end of file diff --git a/bricktracker/sql/set/base/select.sql b/bricktracker/sql/set/base/select.sql index 4162375..4450b61 100644 --- a/bricktracker/sql/set/base/select.sql +++ b/bricktracker/sql/set/base/select.sql @@ -1,45 +1,45 @@ SELECT - sets.set_num, - sets.name, - sets.year, - sets.theme_id, - sets.num_parts, - sets.set_img_url, - sets.set_url, - sets.last_modified_dt, - sets.mini_col, - sets.set_check, - sets.set_col, - sets.u_id, + "sets"."set_num", + "sets"."name", + "sets"."year", + "sets"."theme_id", + "sets"."num_parts", + "sets"."set_img_url", + "sets"."set_url", + "sets"."last_modified_dt", + "sets"."mini_col", + "sets"."set_check", + "sets"."set_col", + "sets"."u_id", {% block number %} - CAST(SUBSTR(sets.set_num, 1, INSTR(sets.set_num, '-') - 1) AS INTEGER) AS set_number, - CAST(SUBSTR(sets.set_num, 1, INSTR(sets.set_num, '-') + 1) AS INTEGER) AS set_version, + CAST(SUBSTR("sets"."set_num", 1, INSTR("sets"."set_num", '-') - 1) AS INTEGER) AS "set_number", + CAST(SUBSTR("sets"."set_num", 1, INSTR("sets"."set_num", '-') + 1) AS INTEGER) AS "set_version", {% endblock %} - IFNULL(missing_join.total, 0) AS total_missing, - IFNULL(minifigures_join.total, 0) AS total_minifigures + IFNULL("missing_join"."total", 0) AS "total_missing", + IFNULL("minifigures_join"."total", 0) AS "total_minifigures" FROM sets -- LEFT JOIN + SELECT to avoid messing the total LEFT JOIN ( SELECT - u_id, - SUM(quantity) AS total - FROM missing + "missing"."u_id", + SUM("missing"."quantity") AS "total" + FROM "missing" {% block where_missing %}{% endblock %} - GROUP BY u_id -) missing_join -ON sets.u_id IS NOT DISTINCT FROM missing_join.u_id + GROUP BY "u_id" +) "missing_join" +ON "sets"."u_id" IS NOT DISTINCT FROM "missing_join"."u_id" -- LEFT JOIN + SELECT to avoid messing the total LEFT JOIN ( SELECT - u_id, - SUM(quantity) AS total - FROM minifigures + "minifigures"."u_id", + SUM("minifigures"."quantity") AS "total" + FROM "minifigures" {% block where_minifigures %}{% endblock %} - GROUP BY u_id -) minifigures_join -ON sets.u_id IS NOT DISTINCT FROM minifigures_join.u_id + GROUP BY "u_id" +) "minifigures_join" +ON "sets"."u_id" IS NOT DISTINCT FROM "minifigures_join"."u_id" {% block where %}{% endblock %} diff --git a/bricktracker/sql/set/delete/set.sql b/bricktracker/sql/set/delete/set.sql index c4f3ebf..0bf32b9 100644 --- a/bricktracker/sql/set/delete/set.sql +++ b/bricktracker/sql/set/delete/set.sql @@ -1,2 +1,2 @@ -DELETE FROM sets -WHERE u_id IS NOT DISTINCT FROM :u_id \ No newline at end of file +DELETE FROM "sets" +WHERE "sets"."u_id" IS NOT DISTINCT FROM :u_id \ No newline at end of file diff --git a/bricktracker/sql/set/insert.sql b/bricktracker/sql/set/insert.sql index 5858039..eb19329 100644 --- a/bricktracker/sql/set/insert.sql +++ b/bricktracker/sql/set/insert.sql @@ -1,16 +1,16 @@ INSERT INTO sets ( - set_num, - name, - year, - theme_id, - num_parts, - set_img_url, - set_url, - last_modified_dt, - mini_col, - set_check, - set_col, - u_id + "set_num", + "name", + "year", + "theme_id", + "num_parts", + "set_img_url", + "set_url", + "last_modified_dt", + "mini_col", + "set_check", + "set_col", + "u_id" ) VALUES ( :set_num, :name, diff --git a/bricktracker/sql/set/list/generic.sql b/bricktracker/sql/set/list/generic.sql index f4cfc12..84ea5c1 100644 --- a/bricktracker/sql/set/list/generic.sql +++ b/bricktracker/sql/set/list/generic.sql @@ -1,12 +1,12 @@ SELECT - sets.set_num, - sets.name, - sets.year, - sets.theme_id, - sets.num_parts, - sets.set_img_url, - sets.set_url -FROM sets + "sets"."set_num", + "sets"."name", + "sets"."year", + "sets"."theme_id", + "sets"."num_parts", + "sets"."set_img_url", + "sets"."set_url" +FROM "sets" GROUP BY - sets.set_num + "sets"."set_num" diff --git a/bricktracker/sql/set/list/missing_minifigure.sql b/bricktracker/sql/set/list/missing_minifigure.sql index 6a5fd28..7dda72b 100644 --- a/bricktracker/sql/set/list/missing_minifigure.sql +++ b/bricktracker/sql/set/list/missing_minifigure.sql @@ -1,13 +1,13 @@ {% extends 'set/base/select.sql' %} {% block where %} -WHERE sets.u_id IN ( +WHERE "sets"."u_id" IN ( SELECT - missing.u_id - FROM missing + "missing"."u_id" + FROM "missing" - WHERE missing.set_num IS NOT DISTINCT FROM :fig_num + WHERE "missing"."set_num" IS NOT DISTINCT FROM :fig_num - GROUP BY missing.u_id + GROUP BY "missing"."u_id" ) {% endblock %} diff --git a/bricktracker/sql/set/list/missing_part.sql b/bricktracker/sql/set/list/missing_part.sql index 1d14daf..2b52e22 100644 --- a/bricktracker/sql/set/list/missing_part.sql +++ b/bricktracker/sql/set/list/missing_part.sql @@ -1,15 +1,15 @@ {% extends 'set/base/select.sql' %} {% block where %} -WHERE sets.u_id IN ( +WHERE "sets"."u_id" IN ( SELECT - missing.u_id - FROM missing + "missing"."u_id" + FROM "missing" - WHERE missing.color_id IS NOT DISTINCT FROM :color_id - AND missing.element_id IS NOT DISTINCT FROM :element_id - AND missing.part_num IS NOT DISTINCT FROM :part_num + WHERE "missing"."color_id" IS NOT DISTINCT FROM :color_id + AND "missing"."element_id" IS NOT DISTINCT FROM :element_id + AND "missing"."part_num" IS NOT DISTINCT FROM :part_num - GROUP BY missing.u_id + GROUP BY "missing"."u_id" ) {% endblock %} diff --git a/bricktracker/sql/set/list/using_minifigure.sql b/bricktracker/sql/set/list/using_minifigure.sql index de98221..0c97794 100644 --- a/bricktracker/sql/set/list/using_minifigure.sql +++ b/bricktracker/sql/set/list/using_minifigure.sql @@ -1,13 +1,13 @@ {% extends 'set/base/select.sql' %} {% block where %} -WHERE sets.u_id IN ( +WHERE "sets"."u_id" IN ( SELECT - inventory.u_id - FROM inventory + "inventory"."u_id" + FROM "inventory" - WHERE inventory.set_num IS NOT DISTINCT FROM :fig_num + WHERE "inventory"."set_num" IS NOT DISTINCT FROM :fig_num - GROUP BY inventory.u_id + GROUP BY "inventory"."u_id" ) {% endblock %} diff --git a/bricktracker/sql/set/list/using_part.sql b/bricktracker/sql/set/list/using_part.sql index afa788d..cd8a1db 100644 --- a/bricktracker/sql/set/list/using_part.sql +++ b/bricktracker/sql/set/list/using_part.sql @@ -1,15 +1,15 @@ {% extends 'set/base/select.sql' %} {% block where %} -WHERE sets.u_id IN ( +WHERE "sets"."u_id" IN ( SELECT - inventory.u_id - FROM inventory + "inventory"."u_id" + FROM "inventory" - WHERE inventory.color_id IS NOT DISTINCT FROM :color_id - AND inventory.element_id IS NOT DISTINCT FROM :element_id - AND inventory.part_num IS NOT DISTINCT FROM :part_num + WHERE "inventory"."color_id" IS NOT DISTINCT FROM :color_id + AND "inventory"."element_id" IS NOT DISTINCT FROM :element_id + AND "inventory"."part_num" IS NOT DISTINCT FROM :part_num - GROUP BY inventory.u_id + GROUP BY "inventory"."u_id" ) {% endblock %} diff --git a/bricktracker/sql/set/select.sql b/bricktracker/sql/set/select.sql index d9c10aa..485a733 100644 --- a/bricktracker/sql/set/select.sql +++ b/bricktracker/sql/set/select.sql @@ -1,13 +1,13 @@ {% extends 'set/base/select.sql' %} {% block where_missing %} -WHERE u_id IS NOT DISTINCT FROM :u_id +WHERE "missing"."u_id" IS NOT DISTINCT FROM :u_id {% endblock %} {% block where_minifigures %} -WHERE u_id IS NOT DISTINCT FROM :u_id +WHERE "minifigures"."u_id" IS NOT DISTINCT FROM :u_id {% endblock %} {% block where %} -WHERE sets.u_id IS NOT DISTINCT FROM :u_id +WHERE "sets"."u_id" IS NOT DISTINCT FROM :u_id {% endblock %} diff --git a/bricktracker/sql/set/update_checked.sql b/bricktracker/sql/set/update_checked.sql index 77a5cca..2fe6852 100644 --- a/bricktracker/sql/set/update_checked.sql +++ b/bricktracker/sql/set/update_checked.sql @@ -1,3 +1,3 @@ -UPDATE sets -SET {{name}} = :status -WHERE u_id IS NOT DISTINCT FROM :u_id +UPDATE "sets" +SET "{{name}}" = :status +WHERE "sets"."u_id" IS NOT DISTINCT FROM :u_id diff --git a/bricktracker/sql/wish/base/select.sql b/bricktracker/sql/wish/base/select.sql index 0d516c2..5ce91af 100644 --- a/bricktracker/sql/wish/base/select.sql +++ b/bricktracker/sql/wish/base/select.sql @@ -1,13 +1,13 @@ SELECT - wishlist.set_num, - wishlist.name, - wishlist.year, - wishlist.theme_id, - wishlist.num_parts, - wishlist.set_img_url, - wishlist.set_url, - wishlist.last_modified_dt -FROM wishlist + "wishlist"."set_num", + "wishlist"."name", + "wishlist"."year", + "wishlist"."theme_id", + "wishlist"."num_parts", + "wishlist"."set_img_url", + "wishlist"."set_url", + "wishlist"."last_modified_dt" +FROM "wishlist" {% block where %}{% endblock %} diff --git a/bricktracker/sql/wish/delete/wish.sql b/bricktracker/sql/wish/delete/wish.sql index 387ffd7..2f33e9c 100644 --- a/bricktracker/sql/wish/delete/wish.sql +++ b/bricktracker/sql/wish/delete/wish.sql @@ -1,2 +1,2 @@ -DELETE FROM wishlist -WHERE set_num IS NOT DISTINCT FROM :set_num \ No newline at end of file +DELETE FROM "wishlist" +WHERE "wishlist"."set_num" IS NOT DISTINCT FROM :set_num \ No newline at end of file diff --git a/bricktracker/sql/wish/insert.sql b/bricktracker/sql/wish/insert.sql index 9ace503..e002ab8 100644 --- a/bricktracker/sql/wish/insert.sql +++ b/bricktracker/sql/wish/insert.sql @@ -1,12 +1,12 @@ -INSERT INTO wishlist ( - set_num, - name, - year, - theme_id, - num_parts, - set_img_url, - set_url, - last_modified_dt +INSERT INTO "wishlist" ( + "set_num", + "name", + "year", + "theme_id", + "num_parts", + "set_img_url", + "set_url", + "last_modified_dt" ) VALUES ( :set_num, :name, diff --git a/bricktracker/sql/wish/select.sql b/bricktracker/sql/wish/select.sql index 2559843..326e507 100644 --- a/bricktracker/sql/wish/select.sql +++ b/bricktracker/sql/wish/select.sql @@ -1,5 +1,5 @@ {% extends 'wish/base/select.sql' %} {% block where %} -WHERE wishlist.set_num IS NOT DISTINCT FROM :set_num +WHERE "wishlist"."set_num" IS NOT DISTINCT FROM :set_num {% endblock %}