Feature request: Promote to variable, introduce variable and
Jimmy
Posts: 2
A few common features from software refactor tools:
Usage scenario 1 - promote value to variable
Let's take a query:
SELECT * FROM MyTable WHERE ID = 123
User does right click on "123" and select "Promote to variable". After refactor code looks as follows:
DECLARE @ID int
SET @ID = 123
SELECT * FROM MyTable WHERE ID = @ID
Usage scenario 2 - declaring variable
User types a query (or paste it)
SELECT * FROM MyTable WHERE ID = @myParam
Note, that @myParam is not yet declared
User does rightclick on "@myParam" and select "Devlare variable". After refactor code looks as follos:
DECLARE @ID myParam
SELECT * FROM MyTable WHERE ID = @myParam
Usage scenario 3 - variable setter
User does rightclick on declared variable and SET statement is created in the next line.
This feature could be especially useful in connection with the clipboard. When addin detects that text in the clipboard is a variable name allows to create SET statement based on clipboard variable.
Final note
There is a lot more features in software refactor tools that can be adapted to the tool. Please contact me if you will need any assist.
--
Jimmy
Friend of Red Gate Software Member
Usage scenario 1 - promote value to variable
Let's take a query:
SELECT * FROM MyTable WHERE ID = 123
User does right click on "123" and select "Promote to variable". After refactor code looks as follows:
DECLARE @ID int
SET @ID = 123
SELECT * FROM MyTable WHERE ID = @ID
Usage scenario 2 - declaring variable
User types a query (or paste it)
SELECT * FROM MyTable WHERE ID = @myParam
Note, that @myParam is not yet declared
User does rightclick on "@myParam" and select "Devlare variable". After refactor code looks as follos:
DECLARE @ID myParam
SELECT * FROM MyTable WHERE ID = @myParam
Usage scenario 3 - variable setter
User does rightclick on declared variable and SET statement is created in the next line.
This feature could be especially useful in connection with the clipboard. When addin detects that text in the clipboard is a variable name allows to create SET statement based on clipboard variable.
Final note
There is a lot more features in software refactor tools that can be adapted to the tool. Please contact me if you will need any assist.
--
Jimmy
Friend of Red Gate Software Member
Jimmy
Comments
Thanks for your suggestions. We will look at these for a future version.