Compile Source Code- dbFlux (5/9)published on
Hi, this is the fifth article in the series about dbFlux, the VSCode extension that helps you as an Oracle application developer to develop your applications quickly and efficiently. Last time it was about modifying tables.
Today we will talk about the core component of dbFlux. The thing you do most often in your daily work as a developer is probably compiling source code. In our case we are mostly talking about business logic, which we store as stored procedures or packages inside the database.
As soon as you have created a package with dbFlux, the easiest way is to use the command
dbFLux: Create Object or the ShortCut
Ctrl+Alt+C, you are able to compile it with dbFlux. Of course dbFlux does not compile here, but the database. dbFlux just takes the file and calls SQLPlus or SQLcl in the background with it.
I recommend you to use SQLPlus for this. Because of the fact that SQLcl is a java program and has to load its Java VM, the startup speed is much faster when using SQLPlus. To use SQLPlus just go to the settings of dbFLux and select it.
As soon as you call the command
dbFlux: Create Object or
Ctrl+Alt+C using the ShortCut, the current file is called with SQLPlus depending on its location in the directory tree. Of course it doesn't matter if you compile a package or create a view.
Since dbFLux is based on the directory definition of smartFS, see the first article in this series, the database connection that matches the directory is taken. That means files in the
db/_setup folder will be called with the configured admin user, files in the
db/<schema> folders will be called with exactly this user in SingleMode and in Multi- or FlexMode the ProxyUser (_depl) will connect to this schema. If you call SQL files outside these folders, you will be asked by dbFlux with which connection you want to execute this file.
As soon as you compile a file, the internal terminal opens within VSCode, which you have to configure with bash as default terminal in any case. If there were no errors, this is of course confirmed with "green".
If you have made an error and the package cannot be compiled for example, dbFLux will show the related errors on the console and also in the problem panel. In both cases you can click on the error or the appropriate file and you will get the focus directly to the correct file set at the correct line. Furthermore, the file will also be highlighted in color (red) in the explorer, as well as the corresponding location in the code.
dbFlux has also the possibility to show warning. This must be activated in the settings. Additionally you have the possibility to exclude warnings.
Another hilghlight of dbFlux is the possibility to compile a certain or all defined schemas. Especially if you have made changes in a schema and this may lead to errors in dependent methods or views etc..
With the command
dbFLux: Compile Selected Schemas or the ShortCut
Shift+Alt+B dbFLux shows the list of available schemas and here you can select one or all. Then you can choose if you want to compile all or only invalid objects.
Any files that fail to compile in the database will now be marked in red accordingly and the errors will be displayed in the terminal and also within the problem panel.
That's it for today. Next time it's about the direct support for editing the static files.
List of the single articles of this series:
1. Initialize Workspace
2. Create Database Objects
3. Configure Custom Trigger Runs
4. Modify Table
5. Compile Source Code