Added support for new attributes "versionString" and "versionSuffix"
This commit is contained in:
parent
b713c76bc8
commit
4869896d51
30
doc/api.md
30
doc/api.md
|
@ -54,6 +54,8 @@ limitations under the License.
|
|||
- 3.2.20 [`queueTimeout`](#propdbqueuetimeout)
|
||||
- 3.2.21 [`stmtCacheSize`](#propdbstmtcachesize)
|
||||
- 3.2.22 [`version`](#propdbversion)
|
||||
- 3.2.23 [`versionString`](#propdbversionstring)
|
||||
- 3.2.24 [`versionSuffix`](#propdbversionsuffix)
|
||||
- 3.3 [Oracledb Methods](#oracledbmethods)
|
||||
- 3.3.1 [`createPool()`](#createpool)
|
||||
- 3.3.2 [`getConnection()`](#getconnectiondb)
|
||||
|
@ -1092,6 +1094,34 @@ var oracledb = require('oracledb');
|
|||
console.log("Driver version number is " + oracledb.version);
|
||||
```
|
||||
|
||||
#### <a name="propdbversionstring"></a> 3.2.23 `oracledb.versionString`
|
||||
```
|
||||
readonly String versionString
|
||||
```
|
||||
|
||||
This readonly property gives a string representation of the node-oracledb version, including the version suffix if one is present.
|
||||
|
||||
##### Example
|
||||
|
||||
```javascript
|
||||
var oracledb = require('oracledb');
|
||||
console.log("Driver version is " + oracledb.versionString);
|
||||
```
|
||||
|
||||
#### <a name="propdbversionsuffix"></a> 3.2.24 `oracledb.versionSuffix`
|
||||
```
|
||||
readonly String versionSuffix
|
||||
```
|
||||
|
||||
This readonly property gives a string representing the version suffix (e.g. "-dev" or "-beta") or the value undefined if no version suffix is present.
|
||||
|
||||
##### Example
|
||||
|
||||
```javascript
|
||||
var oracledb = require('oracledb');
|
||||
console.log("Driver version suffix is " + oracledb.versionSuffix);
|
||||
```
|
||||
|
||||
### <a name="oracledbmethods"></a> 3.3 Oracledb Methods
|
||||
|
||||
#### <a name="createpool"></a> 3.3.1 `oracledb.createPool()`
|
||||
|
|
|
@ -32,12 +32,9 @@ var major, minor, update, port, portUpdate;
|
|||
console.log("Run at: " + new Date());
|
||||
console.log("Node.js version: " + process.version + " (" + process.platform, process.arch + ")");
|
||||
|
||||
addonVer = oracledb.version;
|
||||
major = Math.floor(addonVer / 10000);
|
||||
minor = Math.floor(addonVer / 100) % 100;
|
||||
update = addonVer % 100;
|
||||
//console.log("Node-oracledb version: " + addonVer);
|
||||
console.log("Node-oracledb text format: " + major + "." + minor + "." + update);
|
||||
// console.log("Node-oracledb version:", oracledb.version); // numeric version format
|
||||
// console.log("Node-oracledb version suffix:", oracledb.versionSuffix); // e.g. "-beta.1". May be undefined
|
||||
console.log("Node-oracledb text format:", oracledb.versionString);
|
||||
|
||||
clientVer = oracledb.oracleClientVersion;
|
||||
major = Math.floor (clientVer / 100000000);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "oracledb",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.0-dev",
|
||||
"description": "Oracle Database driver by Oracle Corp.",
|
||||
"license": "Apache-2.0",
|
||||
"homepage": "http://www.oracle.com/technetwork/database/database-technologies/scripting-languages/node_js/",
|
||||
|
|
|
@ -19,7 +19,6 @@ CD=cd
|
|||
ECHO=echo
|
||||
DATE=date -u
|
||||
SED=sed
|
||||
GREP=grep
|
||||
RMDIR=rm -rf
|
||||
RMALL=rm -f
|
||||
GIT=git
|
||||
|
@ -36,10 +35,7 @@ BINARY_PATH_LOCAL=../build/Release/oracledb.node
|
|||
LICENSE_PATH_LOCAL=../LICENSE.md
|
||||
|
||||
# Find the node-oracledb version number
|
||||
MAJ=$(shell $(GREP) '\#define \+NJS_NODE_ORACLEDB_MAJOR' ../src/njsOracle.h | $(SED) -e 's/[^0-9]*//')
|
||||
MIN=$(shell $(GREP) '\#define \+NJS_NODE_ORACLEDB_MINOR' ../src/njsOracle.h | $(SED) -e 's/[^0-9]*//')
|
||||
PAT=$(shell $(GREP) '\#define \+NJS_NODE_ORACLEDB_PATCH' ../src/njsOracle.h | $(SED) -e 's/[^0-9]*//')
|
||||
VER=$(MAJ).$(MIN).$(PAT)
|
||||
VER=$(shell $(NODE) getversion.js)
|
||||
|
||||
# The staging-oracledb-X.Y.Z.tgz package will try to download binaries from
|
||||
# https://$NODE_ORACLEDB_PACKAGE_HOSTNAME/$NODE_ORACLEDB_PACKAGE_URL_PATH/vX.Y.Z/
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* You may not use the identified files except in compliance with the Apache
|
||||
* License, Version 2.0 (the "License.")
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* NAME
|
||||
* getversion.js
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Extracts the version from the package.json file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
'use strict';
|
||||
|
||||
let packageJSON;
|
||||
|
||||
try {
|
||||
packageJSON = require('../package.json');
|
||||
} catch (err) {
|
||||
throw new Error('package.json is required to extract the node-oracledb version number');
|
||||
}
|
||||
|
||||
console.log(packageJSON.version);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "oracledb",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.0-dev",
|
||||
"description": "Oracle Database driver by Oracle Corp.",
|
||||
"license": "Apache-2.0",
|
||||
"homepage": "http://www.oracle.com/technetwork/database/database-technologies/scripting-languages/node_js/",
|
||||
|
|
|
@ -163,6 +163,12 @@ void njsOracledb::Init(Handle<Object> target)
|
|||
Nan::SetAccessor(temp->InstanceTemplate(),
|
||||
Nan::New<v8::String>("version").ToLocalChecked(),
|
||||
njsOracledb::GetVersion, njsOracledb::SetVersion);
|
||||
Nan::SetAccessor(temp->InstanceTemplate(),
|
||||
Nan::New<v8::String>("versionString").ToLocalChecked(),
|
||||
njsOracledb::GetVersionString, njsOracledb::SetVersionString);
|
||||
Nan::SetAccessor(temp->InstanceTemplate(),
|
||||
Nan::New<v8::String>("versionSuffix").ToLocalChecked(),
|
||||
njsOracledb::GetVersionSuffix, njsOracledb::SetVersionSuffix);
|
||||
Nan::SetAccessor(temp->InstanceTemplate(),
|
||||
Nan::New<v8::String>("connectionClass").ToLocalChecked(),
|
||||
njsOracledb::GetConnectionClass, njsOracledb::SetConnectionClass);
|
||||
|
@ -508,6 +514,54 @@ NAN_SETTER(njsOracledb::SetVersion)
|
|||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// njsOracledb::GetVersionString()
|
||||
// Get accessor of "versionString" property.
|
||||
//-----------------------------------------------------------------------------
|
||||
NAN_GETTER(njsOracledb::GetVersionString)
|
||||
{
|
||||
Local<String> value =
|
||||
Nan::New<v8::String>(NJS_VERSION_STRING).ToLocalChecked();
|
||||
info.GetReturnValue().Set(value);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// njsOracledb::SetVersionString()
|
||||
// Set accessor of "versionString" property.
|
||||
//-----------------------------------------------------------------------------
|
||||
NAN_SETTER(njsOracledb::SetVersionString)
|
||||
{
|
||||
PropertyIsReadOnly("versionString");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// njsOracledb::GetVersionSuffix()
|
||||
// Get accessor of "versionSuffix" property.
|
||||
//-----------------------------------------------------------------------------
|
||||
NAN_GETTER(njsOracledb::GetVersionSuffix)
|
||||
{
|
||||
Local<String> value =
|
||||
#ifdef NJS_NODE_ORACLEDB_SUFFIX
|
||||
Nan::New<v8::String>(NJS_NODE_ORACLEDB_SUFFIX).ToLocalChecked();
|
||||
#else
|
||||
Nan::Undefined();
|
||||
#endif
|
||||
info.GetReturnValue().Set(value);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// njsOracledb::SetVersionSuffix()
|
||||
// Set accessor of "versionSuffix" property.
|
||||
//-----------------------------------------------------------------------------
|
||||
NAN_SETTER(njsOracledb::SetVersionSuffix)
|
||||
{
|
||||
PropertyIsReadOnly("versionSuffix");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// njsOracledb::GetConnectionClass()
|
||||
// Get accessor of "connectionClass" property.
|
||||
|
|
|
@ -67,9 +67,11 @@ using namespace v8;
|
|||
|
||||
|
||||
// Keep the version in sync with package.json
|
||||
// suffix should be something like "-dev" or "-beta.1"
|
||||
#define NJS_NODE_ORACLEDB_MAJOR 2
|
||||
#define NJS_NODE_ORACLEDB_MINOR 1
|
||||
#define NJS_NODE_ORACLEDB_PATCH 0
|
||||
#define NJS_NODE_ORACLEDB_SUFFIX "-dev"
|
||||
|
||||
// define stringified version and driver name
|
||||
#define NJS_STR_HELPER(x) #x
|
||||
|
@ -77,7 +79,8 @@ using namespace v8;
|
|||
#define NJS_VERSION_STRING \
|
||||
NJS_STR(NJS_NODE_ORACLEDB_MAJOR) "." \
|
||||
NJS_STR(NJS_NODE_ORACLEDB_MINOR) "." \
|
||||
NJS_STR(NJS_NODE_ORACLEDB_PATCH)
|
||||
NJS_STR(NJS_NODE_ORACLEDB_PATCH) \
|
||||
NJS_NODE_ORACLEDB_SUFFIX
|
||||
#define NJS_DRIVER_NAME "node-oracledb : " NJS_VERSION_STRING
|
||||
|
||||
// Used for Oracledb.version
|
||||
|
@ -149,6 +152,8 @@ private:
|
|||
static NAN_GETTER(GetMaxRows);
|
||||
static NAN_GETTER(GetOutFormat);
|
||||
static NAN_GETTER(GetVersion);
|
||||
static NAN_GETTER(GetVersionString);
|
||||
static NAN_GETTER(GetVersionSuffix);
|
||||
static NAN_GETTER(GetConnectionClass);
|
||||
static NAN_GETTER(GetExternalAuth);
|
||||
static NAN_GETTER(GetFetchArraySize);
|
||||
|
@ -169,6 +174,8 @@ private:
|
|||
static NAN_SETTER(SetMaxRows);
|
||||
static NAN_SETTER(SetOutFormat);
|
||||
static NAN_SETTER(SetVersion);
|
||||
static NAN_SETTER(SetVersionString);
|
||||
static NAN_SETTER(SetVersionSuffix);
|
||||
static NAN_SETTER(SetConnectionClass);
|
||||
static NAN_SETTER(SetExternalAuth);
|
||||
static NAN_SETTER(SetFetchArraySize);
|
||||
|
|
Loading…
Reference in New Issue