Skip to content

Remove a row of the query result #20

Description

@invisal

This will be a bit challenging to implement as there are many components at play here. But let try to understand on how it works. First there are 2 important components to understand.

How to find which row is selected

We don't have row selection feature. We can either use cell selection as row selection or we can implement row selection (#10).

Decide if row can be deleted

We also need to find a way to decide if the row can be deleted. The row can be deleted if and only if the result contains only one table. Query with INNER JOIN can contains 2 or more tables. It is not possible to remove if there are mixing of more than 1 table. The result must have PRIMARY KEY columns

Record which rows are deleted

QueryResultChangeProvider is just a context that wrap around ResultChangeCollector (https://github.com/invisal/query-master/blob/main/src/libs/ResultChangeCollector.ts). Currently, it only support recording which cell is being changed. We need to add ability to record which rows has been deleted.

Transform changed to plans

When we commit, we will call getSqlPlanFromChange (https://github.com/invisal/query-master/blob/main/src/libs/GenerateSqlFromChanges.ts). This will prepare the plans from changes

Transform plans to SQL

Once we have the plan, we transform the plan into raw SQL using this function. https://github.com/invisal/query-master/blob/main/src/libs/GenerateSqlFromPlan.ts

If everything is correctly implemented, it should work. I believe we need to implement row selection first before we can continue this feature. I will write up how to implement the row selection shortly as well.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions