OracleDbSupport

Revision as of 21:51, 5 February 2015 by Ppisl (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)

OracleDb is a Node.js module, which provides functionality to work with Oracle DB.

NetBeans doesn't have a special support for OracleDb module, but NetBeans should offer to write the code quickly. There are a few screenshot, what is possible now.

image:OracleDbCC_01.png

The code completion for OracleDb object with documentation. This code completion is based on a signature file that will be probably distributed with NB. The code completion offers properties and methods of OracleDb class.

image:OracleDb_connAttrs_CC_01.png image:OracleDb_connAttrs_CC_02.png

The two pictures above show the code completion for property names of object, which is an argument of a function call.

In this case NetBeans knows (it can be based on a signature file or file with JS Doc documentation) that OracleDb.getConnection() method has two parameters. One of the parameter can be an anonymous object literal, which is defined in a signature file through JS Doc @typedef annotation. So if NetBeans find out, that the code completion is called inside an object literal, which is used as an argument of a function call, and NetBeans knows the right types, then the IDE offers the names of appropriate properties.

Also NetBeans knows that that the OracleDb.getConnection() method has second parameter, which is a callback. So when you invoke code completion on the argument place, NetBeans offers a template, which corresponds to the known callback function. See picture below.

image:OracleDb_connectionCallBack_CC_01.png

As is displayed on the picture, the template is offered as an item of code completion. This item is displayed only at position after '(' or ',' chars and if the function call contains known callback. Again the callback can be defined in the source file through @callback tag in Js Documentation.

When is callback template code completion item applied, the result looks like on the picture below.

image:OracleDb_connectionCallBack_CC_result.png

The template adds JsDoc defining types of the callback parameters. This is a way how the IDE can recognize what should be offered for the parameters.

File:OracleDb connection CC result.png

In this case Connection object (parameter of the callback) has method release, which has another callback as parameter.

image:OracleDb_releaseCallBack_CC_result.png

And after applying this template the result looks in this way:

image: OracleDb_releaseCallBack_result.png


There is example of part of the OracleDb signature file. In the case of OracleDb.getConnection() method JsDoc it can look like this: image:OracleDb_SignatureFile_Example.png

As you can see on the picture above there are defined both types of parameters for OracleDb.getConnection() method. The first attribute has defined type OracleDb~connectionAttrs through @typedef annotation in JsDoc. The callback function is defined as OracleDb~getConnectionCallback type that is defined in JsDoc through the @callback annotation.

On the picture above, you can also notice that NetBeans marks occurrences of the getConnectionCallback. In NetBeans the type OracleDb~getConnectionCallback is internally in NetBeans translated as OracleDb.getConnectionCallback so user can easily rename the OracleDb object or getConnectionCallback for example.

Also on the picture there is navigator, which shows the getConnectionCallback and connectionAttrs as property of OracleDb. The callback getConnectionCallback has special icon. The same icon has code completion item offering the callback item.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo