From 77e1998e746a8d35fe326806758243bffeb8e655 Mon Sep 17 00:00:00 2001 From: Nikhil Nandagopal Date: Mon, 19 Oct 2020 15:10:21 +0530 Subject: [PATCH] updated query template to have an explanatory comment (#1260) --- .../mysqlPlugin/src/main/resources/templates/CREATE.sql | 2 +- .../mysqlPlugin/src/main/resources/templates/DELETE.sql | 2 +- .../mysqlPlugin/src/main/resources/templates/SELECT.sql | 2 +- .../mysqlPlugin/src/main/resources/templates/UPDATE.sql | 2 +- .../postgresPlugin/src/main/resources/templates/CREATE.sql | 2 +- .../postgresPlugin/src/main/resources/templates/DELETE.sql | 2 +- .../postgresPlugin/src/main/resources/templates/SELECT.sql | 2 +- .../postgresPlugin/src/main/resources/templates/UPDATE.sql | 3 ++- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql index bcdd4dbd5a..0b775700cf 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql @@ -5,4 +5,4 @@ VALUES '{{ nameInput.text }}', '{{ genderDropdown.selectedOptionValue }}', '{{ nameInput.text }}' - ); \ No newline at end of file + ); -- nameInput and genderDropdown are example widgets, replace them with your widget names. Read more at http://bit.ly/postgres-widget-docs \ No newline at end of file diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql index aad8425f9b..9e871189b6 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = '{{ usersTable.selectedRow.id }}'; +DELETE FROM users WHERE id = -1; -- Use widget data in a query by replacing static values with {{ widgetName.property }}. Read more at http://bit.ly/postgres-widget-docs diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/SELECT.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/SELECT.sql index 80ef4f2134..ca2169fdf5 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/SELECT.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/SELECT.sql @@ -1 +1 @@ -SELECT * FROM users where role = '{{ roleDropdown.selectedOptionValue }}' ORDER BY id LIMIT 10; \ No newline at end of file +SELECT * FROM users where role = 'Admin' ORDER BY id LIMIT 10 -- Use widget data in a query using {{ widgetName.property }}. Read more at http://bit.ly/postgres-widget-docs diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql index 4c1b31b32b..13be7e5f15 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,3 @@ UPDATE users SET status = 'APPROVED' - WHERE id = '{{ usersTable.selectedRow.id }}'; + WHERE id = '{{ usersTable.selectedRow.id }}'; -- usersTable is an example table widget from where the id is being read. Replace it with your own Table widget or a static value. Read more at http://bit.ly/postgres-widget-docs diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql index 60948f8b63..5a7c082ce9 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql @@ -5,4 +5,4 @@ VALUES '{{ nameInput.text }}', '{{ genderDropdown.selectedOptionValue }}', '{{ nameInput.text }}' - ); + ); -- nameInput and genderDropdown are example widgets, replace them with your widget names. Read more at http://bit.ly/postgres-widget-docs diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql index aad8425f9b..9e871189b6 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = '{{ usersTable.selectedRow.id }}'; +DELETE FROM users WHERE id = -1; -- Use widget data in a query by replacing static values with {{ widgetName.property }}. Read more at http://bit.ly/postgres-widget-docs diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql index 80ef4f2134..4f38a30a09 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql @@ -1 +1 @@ -SELECT * FROM users where role = '{{ roleDropdown.selectedOptionValue }}' ORDER BY id LIMIT 10; \ No newline at end of file +SELECT * FROM users where role = 'Admin' ORDER BY id LIMIT 10; -- Use widget data in a query using {{ widgetName.property }}. Read more at http://bit.ly/postgres-widget-docs \ No newline at end of file diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql index 4c1b31b32b..fdba4616e1 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,4 @@ UPDATE users SET status = 'APPROVED' - WHERE id = '{{ usersTable.selectedRow.id }}'; + WHERE id = '{{ usersTable.selectedRow.id }}'; -- usersTable is an example table widget from where the id is being read. Replace it with your own Table widget or a static value. Read more at http://bit.ly/postgres-widget-docs +