8      SQL Query Editor

Database Master Query editor is a powerful SQL editor and provides SQL code highlighting, IntelliSense (Code Completion), code regions, snippets and find features. It also displays the current executed query status with a progress bar and gives information about the total executed query status on the toolbar.

 

Database Master provides powerful tools which allow you to edit query text directly with syntax highlighting and code completion.

 

image

SQL Query Editor

8.1      Executing a script

Pressing F5, CTRL+E or using the tool menu would execute any highlighted text in the query window. If no text is highlighted, all the text will be sent for execution.

8.2      Output Window

Many database servers such as Microsoft SQL Server are able to handle batch statements. This means they are able to execute many SQL statements at once, returning many data tables* (in case of select statements). If you are executing a script containing five select statements, the result would be five data tables presented in the output window.

Some other database servers, such as Oracle and MySQL, require each statement to end with a semicolon “;” and do not support batch statements. If you would type five statements (ended with “;”) in one script and execute it, Database Master would split the script into five statements and execute each one separate from the others.
Using the “GO” word in MS SQL Server would give the same result.

 

When you execute a script that returns a result, the result of the script will be presented in the output window. The output window contains a Log output tab and tabs for each select query result. If there is more than one SQL select query all the results will be displayed here.

 

The Log window contains the following information about the SQL query:

·         Type: Result type.

·         Description: SQL command and database engine message.

·         Time: Execution time of the SQL command in milliseconds.

·         Line/Column: Line and column position of the statement code

 

8.3      IntelliSense

By pressing any key IntelliSense will provide an array of options that make language references easily accessible. When coding, you do not need to leave the editor window to perform searches on database elements.

 

You can keep your context, find the information you need, insert elements directly, and even have IntelliSense complete your typing. IntelliSense comprises database objects, reserved words, local variables, columns and even joining options.

 

8.4      Code Scripts

Database Master’s IntelliSense snippets enable developers to easily manage and distribute their own customized SQL code libraries. Inserting these commonly used pieces of code is an effective way to enhance your productivity. You can save time because you no longer need to search countless sources of code examples just to find a similar piece of code to copy and paste into your solution code.

 

To add a snippet, simply highlight its text, right-click and select Snippets->Add to snippets. To delete a snippet, use the Snippet Manager on the toolbar.

 

8.5      Extensions

SQL and JSON Query Editor provides.Net C# based query extensions methods to execute like query statements.  An extension method has simplified calling syntax. It represents methods as instance methods. The extensions are some predefined class methods which can be call like a c# class and method:  ext.Math.Round(6.25)

 

8.5.1        Method Extensions

The .Net Math class and method can be called: ext.Math.Round(6.25) to round numbers or  ext.DataTable.WriteToXml(“D:\mydata.xml”) to export result to xml file.

 

This statement will run .Net Math class and Sin method and returns the result to output window.

 

To get all supported  extensions please execute: print help command. This command will print all currently available extensions and their methods.

 

8.5.2        Variables

You can define also variables like a C# variable using varkeyword. It can be a string or and int value. The scripting engine will execute it  as a .Net type.

The variable member must be defined with a  _  character:

var _myVaraible = 10;

var _mystr  = “Hello World”;

var  _myquery = “select * from orders”;

 

You can pass the variables into the method calls or sql queries.

 

 

 

 

 

 


powered by Nucleon Software