Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with NaN #43

Merged
merged 26 commits into from
May 26, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4b174b4
Commit inicial da alteração para NaN
Bigous Mar 5, 2015
79a8685
Commit inicial da alteração para NaN
Bigous Mar 5, 2015
6ecdca7
Removidos os erros de comipalção NaN, faltam 2 erros do sdk 7.0
Bigous Mar 5, 2015
22d8b3c
Removidos os erros de comipalção NaN, faltam 2 erros do sdk 7.0
Bigous Mar 5, 2015
a144ca8
Revert "Removidos os erros de comipalção NaN, faltam 2 erros do sdk 7.0"
Bigous Mar 5, 2015
63e7817
Revert "Removidos os erros de comipalção NaN, faltam 2 erros do sdk 7.0"
Bigous Mar 5, 2015
56613f6
Nan compile errors stripped.
Bigous Mar 5, 2015
537e74b
Nan compile errors stripped.
Bigous Mar 5, 2015
47646ec
Change configuration to compile without errors on windows.
Bigous Mar 9, 2015
bf2f046
Change configuration to compile without errors on windows.
Bigous Mar 9, 2015
9c3a488
BugFix - Escapable scope was not defined in GetValue
Bigous Mar 10, 2015
45eb8de
BugFix - Escapable scope was not defined in GetValue
Bigous Mar 10, 2015
1217432
Merge with upstream from oracle.
Bigous Mar 10, 2015
627516d
Merge with upstream from oracle.
Bigous Mar 10, 2015
ac0a3bf
Removed the use of deprecated sys package from webapp example
Bigous Mar 10, 2015
f15f846
Removed the use of deprecated sys package from webapp example
Bigous Mar 10, 2015
97fd0d7
Merge with the latest version of oracledb
Bigous Mar 16, 2015
e9bf062
Merge with the latest version of oracledb
Bigous Mar 16, 2015
43a306c
Bump to signoff
Bigous Mar 23, 2015
e08a200
Merge with the latest version of oracledb [SIGN-OFF]
Bigous Mar 16, 2015
7af0588
Merge with the latest version of oracledb [SIGN-OFF]
Bigous Mar 16, 2015
d8b200f
Bump to signoff
Bigous Mar 23, 2015
a148f7d
Merge with latest commit from upstream.
Bigous Mar 31, 2015
e68332f
Merge with latest commit from upstream.
Bigous Mar 31, 2015
3c36d55
Merge with tag 0.5
Bigous May 11, 2015
b3eec33
Avoiding using ?: operator with NanNull
Bigous May 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge with tag 0.5
Signed-off-by: Richard Natal <bigous@gmail.com>
  • Loading branch information
Bigous committed May 11, 2015
commit 3c36d55204da5c616d6047b3570a50c43c99552d
4 changes: 2 additions & 2 deletions examples/webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ oracledb.createPool (
});

hs.listen(portid, "localhost");

console.log("Server running at http://localhost:" + portid);
});

Expand All @@ -135,7 +135,7 @@ oracledb.createPool (
function handleError(response, text, err)
{
if (err) {
text += err.message
text += err.message;
}
console.error(text);
response.write("<p>Error: " + text + "</p>");
Expand Down
86 changes: 56 additions & 30 deletions src/njs/src/njsConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,14 @@ void Connection::Async_AfterExecute(uv_work_t *req)
default :
result->Set(NanNew<v8::String>("rowsAffected"),
NanNew<v8::Integer>((unsigned int) executeBaton->rowsAffected));//, v8::ReadOnly);
result->Set(NanNew<v8::String>("outBinds"),NanUndefined());
if( executeBaton->numOutBinds )
{
result->Set(NanNew<v8::String>("outBinds"), Connection::GetOutBinds(executeBaton));//, v8::ReadOnly);
}
else
{
result->Set(NanNew<v8::String>("outBinds"),NanUndefined());
}
result->Set(NanNew<v8::String>("rows"), NanUndefined());
result->Set(NanNew<v8::String>("metaData"), NanUndefined());
break;
Expand Down Expand Up @@ -1177,8 +1184,9 @@ v8::Handle<v8::Value> Connection::GetRows (eBaton* executeBaton)
RETURNS:
Handle
*/
v8::Handle<v8::Value> Connection::GetValue ( short ind, unsigned short type, void* val,
DPI_BUFLEN_TYPE len )
v8::Handle<v8::Value> Connection::GetValue ( short ind, unsigned short type,
void* val, DPI_BUFLEN_TYPE len,
DPI_SZ_TYPE maxSize)
{
NanEscapableScope();
Handle<Value> value;
Expand Down Expand Up @@ -1226,56 +1234,54 @@ v8::Handle<v8::Value> Connection::GetValue ( short ind, unsigned short type, voi
Returns
v8::Value - this will be an array (even for 1 row, array or 1).
*/
Handle<Value> Connection::GetArrayValue ( Bind *binds, unsigned long count )
v8::Handle<v8::Value> Connection::GetArrayValue ( Bind *binds, unsigned long count )
{
HandleScope scope;
NanEscapableScope();
Local<Date> date;
Local<Array> arrVal;
unsigned long index = 0;
Handle<Value> val;

/* To return a value of array type, create one of specified size */
arrVal = v8::Array::New ( count ) ;
arrVal = NanNew<v8::Array>( count ) ;

for ( index = 0 ; index < count ; index ++ )
{
switch ( binds->type )
{
case dpi::DpiVarChar:
arrVal->Set ( index,
( binds->ind[index] == -1 ) ? Null () :
String::New ((char *)binds->value +
( binds->ind[index] == -1 ) ? NanNull() :
NanNew<v8::String> ((char *)binds->value +
(index * binds->maxSize ),
binds->len2[index]));
break;
case dpi::DpiInteger:
arrVal->Set ( index,
(binds->ind[index] == -1 ) ? Null () :
Integer::New ( *((int *)binds->value + index )));
(binds->ind[index] == -1 ) ? NanNull() :
NanNew<v8::Integer> ( *((int *)binds->value + index )));
break;
case dpi::DpiDouble:
arrVal->Set ( index,
(binds->ind[index] == -1 ) ? Null () :
Number::New ( *((double *)binds->value + index )));
(binds->ind[index] == -1 ) ? NanNull() :
NanNew<v8::Number> ( *((double *)binds->value + index )));
break;
case dpi::DpiTimestampLTZ:
if ( binds->ind[index] != -1 )
{
date = Date::Cast (*Date::New (*((long double *)binds->value +
index )));
val = date;
arrVal->Set ( index, val );
arrVal->Set ( index,
NanNew<v8::Date> (*((long double *)binds->value + index )) );
}
else
{
arrVal->Set ( index, Null () );
arrVal->Set ( index, NanNull () );
}
break;
default:
break;
}
}
return scope.Close ( arrVal ) ;
return NanEscapeScope( arrVal ) ;
}


Expand All @@ -1293,23 +1299,23 @@ Handle<Value> Connection::GetArrayValue ( Bind *binds, unsigned long count )
v8::Handle<v8::Value> Connection::GetOutBinds (eBaton* executeBaton)
{
NanEscapableScope();

if(!executeBaton->binds.empty())
{
if( executeBaton->binds[0]->key.empty() )
{
// Binds as JS array
unsigned int outCount = 0;
for(unsigned int index = 0; index < executeBaton->binds.size(); index++)
{
if(executeBaton->binds[index]->isOut)
outCount++;
}
return NanEscapeScope(GetOutBindArray( executeBaton->binds, outCount ));
return NanEscapeScope(GetOutBindArray( executeBaton->binds,
executeBaton->numOutBinds,
executeBaton->stmtIsReturning,
executeBaton->rowsAffected ));
}
else
{
// Binds as JS object
return NanEscapeScope(GetOutBindObject( executeBaton->binds ));
return NanEscapeScope(GetOutBindObject( executeBaton->binds,
executeBaton->stmtIsReturning,
executeBaton->rowsAffected ));
}
}
return NanUndefined();
Expand All @@ -1326,8 +1332,10 @@ v8::Handle<v8::Value> Connection::GetOutBinds (eBaton* executeBaton)
RETURNS:
Outbinds array
*/
v8::Handle<v8::Value> Connection::GetOutBindArray ( std::vector<Bind*> binds,
unsigned int outCount )
v8::Handle<v8::Value> Connection::GetOutBindArray ( std::vector<Bind*> &binds,
unsigned int outCount,
bool isDMLReturning,
unsigned long rowcount )
{
NanEscapableScope();

Expand Down Expand Up @@ -1371,7 +1379,9 @@ v8::Handle<v8::Value> Connection::GetOutBindArray ( std::vector<Bind*> binds,
RETURNS:
Outbinds object
*/
v8::Handle<v8::Value> Connection::GetOutBindObject ( std::vector<Bind*> binds )
v8::Handle<v8::Value> Connection::GetOutBindObject ( std::vector<Bind*> &binds,
bool isDMLReturning,
unsigned long rowcount )
{
NanEscapableScope();
Local<Object> objectBinds = NanNew<v8::Object>();
Expand All @@ -1382,8 +1392,24 @@ v8::Handle<v8::Value> Connection::GetOutBindObject ( std::vector<Bind*> binds )
Handle<Value> val;

binds[index]->key.erase(binds[index]->key.begin());

if ( !isDMLReturning )
{
val = Connection::GetValue (
binds[index]->ind[0],
binds[index]->type,
(binds[index]->type == DpiTimestampLTZ ) ?
binds[index]->extvalue : binds[index]->value,
binds[index]->len[0],
binds[index]->maxSize );
}
else
{
val = Connection::GetArrayValue ( binds[index], rowcount ) ;
}

objectBinds->Set( NanNew<v8::String> ( binds[index]->key.c_str(),
(int) binds[index]->key.length() ),
(int) binds[index]->key.length() ),
val );
}
}
Expand Down
15 changes: 11 additions & 4 deletions src/njs/src/njsConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,20 @@ class Connection: public ObjectWrap
static void GetOutBindParams (unsigned short dataType, Bind* bind,
eBaton* executeBaton);
static v8::Handle<v8::Value> GetOutBinds (eBaton* executeBaton);
static v8::Handle<v8::Value> GetOutBindArray ( std::vector<Bind*> binds, unsigned int outCount);
static v8::Handle<v8::Value> GetOutBindObject (std::vector<Bind*> binds);
static v8::Handle<v8::Value> GetOutBindArray ( std::vector<Bind*> &binds,
unsigned int outCount,
bool bDMLReturn = false,
unsigned long rowcount = 1);
static v8::Handle<v8::Value> GetOutBindObject (std::vector<Bind*> &binds,
bool bDMLReturn = false,
unsigned long rowcount = 1);
static v8::Handle<v8::Value> GetRows (eBaton* executeBaton);
static v8::Handle<v8::Value> GetMetaData (std::string* columnNames,
unsigned int numCols);
unsigned int numCols);
static v8::Handle<v8::Value> GetArrayValue (Bind *bind, unsigned long count);
static v8::Handle<v8::Value> GetValue (short ind, unsigned short type, void* val,
DPI_BUFLEN_TYPE len);
DPI_BUFLEN_TYPE len,
DPI_SZ_TYPE maxSize = -1);
static void UpdateDateValue ( eBaton *executeBaton );
static void v8Date2OraDate ( v8::Handle<v8::Value>, Bind *bind);

Expand Down
28 changes: 14 additions & 14 deletions src/njs/src/njsOracle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ void Oracledb::Init(Handle<Object> target)
Oracledb::GetStmtCacheSize,
Oracledb::SetStmtCacheSize );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("isAutoCommit"),
Oracledb::GetIsAutoCommit,
Oracledb::SetIsAutoCommit );
NanNew<v8::String>("autoCommit"),
Oracledb::GetAutoCommit,
Oracledb::SetAutoCommit );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("maxRows"),
Oracledb::GetMaxRows,
Expand All @@ -132,9 +132,9 @@ void Oracledb::Init(Handle<Object> target)
Oracledb::GetConnectionClass,
Oracledb::SetConnectionClass );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("isExternalAuth"),
Oracledb::GetIsExternalAuth,
Oracledb::SetIsExternalAuth );
NanNew<v8::String>("externalAuth"),
Oracledb::GetExternalAuth,
Oracledb::SetExternalAuth );

NanAssignPersistent( oracledbTemplate_s, temp);
target->Set(NanNew<v8::String>("Oracledb"),temp->GetFunction());
Expand Down Expand Up @@ -336,11 +336,11 @@ NAN_SETTER(Oracledb::SetStmtCacheSize)
DESCRIPTION
Get Accessor of autoCommit property
*/
NAN_PROPERTY_GETTER(Oracledb::GetIsAutoCommit)
NAN_PROPERTY_GETTER(Oracledb::GetAutoCommit)
{
NanScope();
Oracledb* oracledb = ObjectWrap::Unwrap<Oracledb>(args.Holder());
Handle<Boolean> value = NanNew<v8::Boolean>(oracledb->isAutoCommit_);
Handle<Boolean> value = NanNew<v8::Boolean>(oracledb->autoCommit_);
NanReturnValue(value);
}

Expand All @@ -349,11 +349,11 @@ NAN_PROPERTY_GETTER(Oracledb::GetIsAutoCommit)
DESCRIPTION
Set Accessor of autoCommit property
*/
NAN_SETTER(Oracledb::SetIsAutoCommit)
NAN_SETTER(Oracledb::SetAutoCommit)
{
NanScope();
Oracledb* oracledb = ObjectWrap::Unwrap<Oracledb>(args.Holder());
oracledb->isAutoCommit_ = value->ToBoolean()->Value();
oracledb->autoCommit_ = value->ToBoolean()->Value();
}

/*****************************************************************************/
Expand Down Expand Up @@ -420,12 +420,12 @@ NAN_SETTER(Oracledb::SetConnectionClass)
DESCRIPTION
Get Accessor of externalAuth property
*/
NAN_PROPERTY_GETTER(Oracledb::GetIsExternalAuth)
NAN_PROPERTY_GETTER(Oracledb::GetExternalAuth)
{
NanScope();

Oracledb* oracledb = ObjectWrap::Unwrap<Oracledb>(args.Holder());
Handle<Boolean> value = NanNew<v8::Boolean>(oracledb->isExternalAuth_);
Handle<Boolean> value = NanNew<v8::Boolean>(oracledb->externalAuth_);

NanReturnValue(value);
}
Expand All @@ -436,11 +436,11 @@ NAN_PROPERTY_GETTER(Oracledb::GetIsExternalAuth)
DESCRIPTION
Set Accessor of externalAuth property
*/
NAN_SETTER(Oracledb::SetIsExternalAuth)
NAN_SETTER(Oracledb::SetExternalAuth)
{
NanScope();
Oracledb* oracledb = ObjectWrap::Unwrap<Oracledb>(args.Holder());
oracledb->isExternalAuth_ = value->ToBoolean()->Value();
oracledb->externalAuth_ = value->ToBoolean()->Value();
}


Expand Down
8 changes: 4 additions & 4 deletions src/njs/src/njsOracle.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,25 @@ class Oracledb: public ObjectWrap
static NAN_PROPERTY_GETTER(GetPoolIncrement);
static NAN_PROPERTY_GETTER(GetPoolTimeout);
static NAN_PROPERTY_GETTER(GetStmtCacheSize);
static NAN_PROPERTY_GETTER(GetIsAutoCommit);
static NAN_PROPERTY_GETTER(GetAutoCommit);
static NAN_PROPERTY_GETTER(GetMaxRows);
static NAN_PROPERTY_GETTER(GetOutFormat);
static NAN_PROPERTY_GETTER(GetVersion);
static NAN_PROPERTY_GETTER(GetConnectionClass);
static NAN_PROPERTY_GETTER(GetIsExternalAuth);
static NAN_PROPERTY_GETTER(GetExternalAuth);

// Define Setter Accessors to Properties
static NAN_SETTER(SetPoolMin);
static NAN_SETTER(SetPoolMax);
static NAN_SETTER(SetPoolIncrement);
static NAN_SETTER(SetPoolTimeout);
static NAN_SETTER(SetStmtCacheSize);
static NAN_SETTER(SetIsAutoCommit);
static NAN_SETTER(SetAutoCommit);
static NAN_SETTER(SetMaxRows);
static NAN_SETTER(SetOutFormat);
static NAN_SETTER(SetVersion);
static NAN_SETTER(SetConnectionClass);
static NAN_SETTER(SetIsExternalAuth);
static NAN_SETTER(SetExternalAuth);

Oracledb();
~Oracledb();
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.