Coder Social home page Coder Social logo

odb-task's Introduction

Oracle Database Tasks for VSC

Overview

The goal of this extension is to simplify the ability to run scripts against your database connections. It works around the concept of having a config file in the root of your project with a list of all your connection details.

Install

Search the marketplace for odb-task and click the install button. Depends on having SQL*Plus or SQLcl available on your system (I recommend going to the effort of installing SQL*Plus).

image

Set up

  1. Open your project
  2. Create a file in your project root named .build-oracle.json
  3. Update the contents per the below example
  4. Reload Code just to make sure everything is detected

Key bindings

The best way to create a shortcut for build is to define it in keyboard shortcuts.

  1. Ensure you have run a compile task - the command doesn't appear in the keyboard shortcuts settings until you have successfully run the task
  2. Navigate to Keyboard Shortcuts: File -> Preferences -> Keyboard Shortcuts
  3. Search odb-task and set your desired keyboard binding

Alternatively, you can just add to your keybindings.json file directly:

{
    "key": "ctrl+shift+b",
    "command": "odb-task.compileSqlPlus"
}

The command property can be either: odb-task.compileSqlPlus or odb-task.compileSqcl.

Example config

[
    {
        "targetName": "DEV",
        "connectionString": "user/password@XE"
    }
]

Usage

Open the command palette and type Compile with. You will see two entries:

  1. Compile with SQL*Plus
  2. Compile with SQLcl

note: This extension doesn't ship with these binaries, so it assumes if you are running one or the other, the command is available on your system.

Choose the interpreter you wish to compile with.

You will prompted for which connection to compile against. Choose the connection name.

image

image

Configuration

As mentioned, this extension depends on the binaries for SQL*Plus or SQLcl being available on your system. These default to sqlplus and sql respectively. If these are not within your Path, or have been renamed to something else, you can set an alternative path/name within settings.

image

Author

Trent Schafer

LICENSE

MIT

odb-task's People

Contributors

tschf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

odb-task's Issues

Compile script not included in package

compile.sql is located at src/lib/compile.sql. But src is not deployed in the vsix package. Need to store out side of src so it's deployed with the package

command 'odb-task.compileSqlPlus' not found

i have different Windows hosts all with Windows 10 Prof. Edition. My VSC Version is 1.33.1 and my Extension Version of odb-task is 0.0.2.

on two of three Windows hosts i get the following error:
command 'odb-task.compileSqlPlus' not found.

My settings in settings.json are:
image.
My .build-oracle.json file is in one of the upper folders.

Do you know why i get the this kind of error:
image

Multi folder workspace only picks up build file in the first folder

If I have multiple project folders, currently it only observed the build file from the first folder.

Notes: On first activation, go over all workspace folders to set up build targets:

vcode.workspace.workspaceFolders

Then, when compiling a specific file, get the workspace of the active file to select a target from relevant workspace:

vscode.workspace.getWorkspaceFolder(uri)

See: https://code.visualstudio.com/docs/extensionAPI/vscode-api#_workspace

SP2-0310: Unable to open file: "&1.sql"

Getting the following error when compiling package spec.

`Compiling script: &1

Error starting at line : 19 File @ /Users/vitoc/.vscode/extensions/tschf.odb-task-0.0.2/dist/compile.sql
In command -
@"&1"
Error report -
SP2-0310: Unable to open file: "&1.sql"
No errors.`

Add Colors to compile

See http://orasql.org/2013/05/22/sqlplus-tips-6-colorizing-output/

Example of how I used it:

set define off
--
<compile file>
--
set define on
@$SQL_FILE_COLOR
prompt &_C_RED
show errors
prompt &_C_RESET
exit;

Not sure if when running compile.sql you could reference colors.sql or if the path would come into play. Note colors.sql has some hidden characters so its important to include it as is (see blog post for file contents)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.