InterBase Development Studio enables you to noticeably speed
up your coding. This article will show you a couple of features available
in stored procedures and triggers editor.
Code templates and
bookmarks
Code templates are very handy for inserting widely used block
of code. One of the predefined template is "ins" which will be expanded
to
INSERT INTO |() VALUES ()
where "|" means cursor position right after template expansion.
Templates may also include bookmarks. Bookmark is a point where you
can quickly move cursor. In the editor window they appear as a
small triangles. Press Alt+Up to move to the previous bookmark
and Alt+Down to move to the next one. The full definition of the above
example looks like:
INSERT INTO | (#) VALUES (#)
where # means bookmark. So just after typing "ins" and <space>
you may start typing table name. After that you may press Alt+Down and
type column names, Alt+Down again and type column values. Code completion
will move this algorithm to the next
level.
Intellectual code completion
We call our code completion "intellectual" because it does not simply
show full list of keywords and table names. The drow-down list contains
only essential items. For example, you just typed INSERT and press
Ctrl+Space to invoke code completion. You will see only "INTO"
suggession because no other syntax is valid here. The great feature
of the code completion in InterBase/Firebird Development Studio
is the ability to generate list of table columns and corresponding
variables. Check out the following example that uses code
template "ins" and code completion:
Automatic variable
creation
But the code templates and completion are not only things
that could speed up your developent. Please take a closer look at
the final page of the example:
As you can see, all variables are marked by red color. These variables
are undefined in the procedure/trigger. Now you have to manually create
all variables typing their names and defining their data type.
Interbase Development Studio offers much better way. Right-click on
any of the highlighted variable and check context menu:
The last item says "Autocreate undefined variables". Yes, it will check
the procedure code, collect undefined variables, determine their data
types and create them. In this example data type for each variable
can be easily detected by corresponding table columns.
The example above contains only 4 columns. But what if your table
contains 20? Imagine how much time you can save with all these
features. |