Skip to content

Commit b3eec33

Browse files
committed
Avoiding using ?: operator with NanNull
Signed-off-by: Richard Natal <[email protected]>
1 parent 3c36d55 commit b3eec33

File tree

2 files changed

+67
-44
lines changed

2 files changed

+67
-44
lines changed

package.json

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,50 @@
11
{
2-
3-
"name" : "oracledb",
4-
"version" : "0.5.0",
5-
"description" : "Oracle Database driver by Oracle Corp.",
6-
"license" : "Apache 2.0",
7-
"homepage": "http://www.oracle.com/technetwork/database/database-technologies/node_js/index.html",
8-
"keywords" : [
9-
"oracledb", "dboracle", "Node.js", "SQL", "PL/SQL", "connection", "connectivity", "OCI", "client", "plugin", "library", "driver", "extension", "binding", "interface", "adapter", "module", "DB", "official", "Database", "Oracle"
10-
],
11-
"repository" : {
12-
"type" : "git",
13-
"url" : "git://github.com/oracle/node-oracledb.git"
14-
},
15-
"dependencies" : {
16-
"nan": "^1.7.0"
17-
},
18-
"engines" : {
19-
"node" : ">=0.10.28"
20-
},
21-
"engineStrict": true,
22-
"maintainers" : [
23-
{
24-
"name" : "Oracle Corp."
25-
}
26-
],
27-
"bugs" : {
28-
"url" : "https://github.com/oracle/node-oracledb/issues"
29-
},
30-
"main" : "./index.js"
2+
"name": "oracledb",
3+
"version": "0.5.0",
4+
"description": "Oracle Database driver by Oracle Corp.",
5+
"license": "Apache 2.0",
6+
"homepage": "http://www.oracle.com/technetwork/database/database-technologies/node_js/index.html",
7+
"keywords": [
8+
"oracledb",
9+
"dboracle",
10+
"Node.js",
11+
"SQL",
12+
"PL/SQL",
13+
"connection",
14+
"connectivity",
15+
"OCI",
16+
"client",
17+
"plugin",
18+
"library",
19+
"driver",
20+
"extension",
21+
"binding",
22+
"interface",
23+
"adapter",
24+
"module",
25+
"DB",
26+
"official",
27+
"Database",
28+
"Oracle"
29+
],
30+
"repository": {
31+
"type": "git",
32+
"url": "git://github.com/oracle/node-oracledb.git"
33+
},
34+
"dependencies": {
35+
"nan": "^1.8.4"
36+
},
37+
"engines": {
38+
"node": ">=0.10.28"
39+
},
40+
"engineStrict": true,
41+
"maintainers": [
42+
{
43+
"name": "Oracle Corp."
44+
}
45+
],
46+
"bugs": {
47+
"url": "https://github.com/oracle/node-oracledb/issues"
48+
},
49+
"main": "./index.js"
3150
}

src/njs/src/njsConnection.cpp

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,35 +1247,39 @@ v8::Handle<v8::Value> Connection::GetArrayValue ( Bind *binds, unsigned long cou
12471247

12481248
for ( index = 0 ; index < count ; index ++ )
12491249
{
1250+
if(
1251+
binds->ind[index] == -1 &&
1252+
(
1253+
(binds->type == dpi::DpiVarChar) ||
1254+
(binds->type == dpi::DpiInteger) ||
1255+
(binds->type == dpi::DpiDouble) ||
1256+
(binds->type == dpi::DpiTimestampLTZ)
1257+
)
1258+
)
1259+
{
1260+
arrVal->Set( index, NanNull() );
1261+
continue;
1262+
}
1263+
12501264
switch ( binds->type )
12511265
{
12521266
case dpi::DpiVarChar:
12531267
arrVal->Set ( index,
1254-
( binds->ind[index] == -1 ) ? NanNull() :
1255-
NanNew<v8::String> ((char *)binds->value +
1256-
(index * binds->maxSize ),
1257-
binds->len2[index]));
1268+
NanNew<v8::String> ((char *)binds->value +
1269+
(index * binds->maxSize ),
1270+
binds->len2[index]));
12581271
break;
12591272
case dpi::DpiInteger:
12601273
arrVal->Set ( index,
1261-
(binds->ind[index] == -1 ) ? NanNull() :
1262-
NanNew<v8::Integer> ( *((int *)binds->value + index )));
1274+
NanNew<v8::Integer> ( *((int *)binds->value + index )));
12631275
break;
12641276
case dpi::DpiDouble:
12651277
arrVal->Set ( index,
1266-
(binds->ind[index] == -1 ) ? NanNull() :
1267-
NanNew<v8::Number> ( *((double *)binds->value + index )));
1278+
NanNew<v8::Number> ( *((double *)binds->value + index )));
12681279
break;
12691280
case dpi::DpiTimestampLTZ:
1270-
if ( binds->ind[index] != -1 )
1271-
{
12721281
arrVal->Set ( index,
12731282
NanNew<v8::Date> (*((long double *)binds->value + index )) );
1274-
}
1275-
else
1276-
{
1277-
arrVal->Set ( index, NanNull () );
1278-
}
12791283
break;
12801284
default:
12811285
break;

0 commit comments

Comments
 (0)