Avoiding using ?: operator with NanNull

Signed-off-by: Richard Natal <bigous@gmail.com>
This commit is contained in:
Richard Natal 2015-05-18 10:54:25 -03:00
parent 3c36d55204
commit b3eec33d7e
2 changed files with 67 additions and 44 deletions

View File

@ -1,31 +1,50 @@
{
"name" : "oracledb",
"version" : "0.5.0",
"description" : "Oracle Database driver by Oracle Corp.",
"license" : "Apache 2.0",
"homepage": "http://www.oracle.com/technetwork/database/database-technologies/node_js/index.html",
"keywords" : [
"oracledb", "dboracle", "Node.js", "SQL", "PL/SQL", "connection", "connectivity", "OCI", "client", "plugin", "library", "driver", "extension", "binding", "interface", "adapter", "module", "DB", "official", "Database", "Oracle"
],
"repository" : {
"type" : "git",
"url" : "git://github.com/oracle/node-oracledb.git"
},
"dependencies" : {
"nan": "^1.7.0"
},
"engines" : {
"node" : ">=0.10.28"
},
"engineStrict": true,
"maintainers" : [
{
"name" : "Oracle Corp."
}
],
"bugs" : {
"url" : "https://github.com/oracle/node-oracledb/issues"
},
"main" : "./index.js"
"name": "oracledb",
"version": "0.5.0",
"description": "Oracle Database driver by Oracle Corp.",
"license": "Apache 2.0",
"homepage": "http://www.oracle.com/technetwork/database/database-technologies/node_js/index.html",
"keywords": [
"oracledb",
"dboracle",
"Node.js",
"SQL",
"PL/SQL",
"connection",
"connectivity",
"OCI",
"client",
"plugin",
"library",
"driver",
"extension",
"binding",
"interface",
"adapter",
"module",
"DB",
"official",
"Database",
"Oracle"
],
"repository": {
"type": "git",
"url": "git://github.com/oracle/node-oracledb.git"
},
"dependencies": {
"nan": "^1.8.4"
},
"engines": {
"node": ">=0.10.28"
},
"engineStrict": true,
"maintainers": [
{
"name": "Oracle Corp."
}
],
"bugs": {
"url": "https://github.com/oracle/node-oracledb/issues"
},
"main": "./index.js"
}

View File

@ -1247,35 +1247,39 @@ v8::Handle<v8::Value> Connection::GetArrayValue ( Bind *binds, unsigned long cou
for ( index = 0 ; index < count ; index ++ )
{
if(
binds->ind[index] == -1 &&
(
(binds->type == dpi::DpiVarChar) ||
(binds->type == dpi::DpiInteger) ||
(binds->type == dpi::DpiDouble) ||
(binds->type == dpi::DpiTimestampLTZ)
)
)
{
arrVal->Set( index, NanNull() );
continue;
}
switch ( binds->type )
{
case dpi::DpiVarChar:
arrVal->Set ( index,
( binds->ind[index] == -1 ) ? NanNull() :
NanNew<v8::String> ((char *)binds->value +
(index * binds->maxSize ),
binds->len2[index]));
NanNew<v8::String> ((char *)binds->value +
(index * binds->maxSize ),
binds->len2[index]));
break;
case dpi::DpiInteger:
arrVal->Set ( index,
(binds->ind[index] == -1 ) ? NanNull() :
NanNew<v8::Integer> ( *((int *)binds->value + index )));
NanNew<v8::Integer> ( *((int *)binds->value + index )));
break;
case dpi::DpiDouble:
arrVal->Set ( index,
(binds->ind[index] == -1 ) ? NanNull() :
NanNew<v8::Number> ( *((double *)binds->value + index )));
NanNew<v8::Number> ( *((double *)binds->value + index )));
break;
case dpi::DpiTimestampLTZ:
if ( binds->ind[index] != -1 )
{
arrVal->Set ( index,
NanNew<v8::Date> (*((long double *)binds->value + index )) );
}
else
{
arrVal->Set ( index, NanNull () );
}
break;
default:
break;