Updated to follow changes in ODPI-C

This commit is contained in:
Christopher Jones 2017-06-14 08:18:47 +10:00
parent 89434b48ff
commit 7d08ee4ed7
3 changed files with 13 additions and 10 deletions

View File

@ -412,17 +412,16 @@ bool njsConnection::PrepareAndBind(njsBaton *baton)
}
// determine statement information
int isReturning, isQuery, isPLSQL;
if (dpiStmt_GetStatementInfo(baton->dpiStmtHandle, &isQuery, &isPLSQL,
&isReturning) < 0) {
dpiStmtInfo stmtInfo;
if (dpiStmt_GetInfo(baton->dpiStmtHandle, &stmtInfo) < 0) {
baton->GetDPIStmtError(baton->dpiStmtHandle);
return false;
}
baton->isPLSQL = (isPLSQL) ? true : false;
baton->isReturning = (isReturning) ? true : false;
baton->isPLSQL = (stmtInfo.isPLSQL) ? true : false;
baton->isReturning = (stmtInfo.isReturning) ? true : false;
// result sets are incompatible with non-queries
if (!isQuery && baton->getRS) {
if (!stmtInfo.isQuery && baton->getRS) {
baton->error = njsMessages::Get(errInvalidNonQueryExecution);
return false;
}
@ -431,7 +430,7 @@ bool njsConnection::PrepareAndBind(njsBaton *baton)
for (uint32_t i = 0; i < baton->numBindVars; i++) {
int status;
njsVariable *var = &baton->bindVars[i];
if (isReturning && var->bindDir == NJS_BIND_OUT &&
if (stmtInfo.isReturning && var->bindDir == NJS_BIND_OUT &&
var->varTypeNum == DPI_VARTYPE_RAW) {
baton->error = njsMessages::Get(errBufferReturningInvalid);
return false;

View File

@ -90,13 +90,17 @@ njsOracledb::njsOracledb()
void njsOracledb::Init(Handle<Object> target)
{
Nan::HandleScope scope;
dpiErrorInfo errorInfo;
char driverName[30];
snprintf(driverName, sizeof(driverName), "%s : %d.%d.%d",
NJS_DRIVERNAME_PREFIX, NJS_NODE_ORACLEDB_MAJOR,
NJS_NODE_ORACLEDB_MINOR, NJS_NODE_ORACLEDB_PATCH);
dpiGlobal_Initialize(DPI_CONN_PARAMS_MODE_THREADED, "UTF-8", "UTF-8",
driverName);
if (dpiGlobal_Initialize(DPI_CONN_PARAMS_MODE_THREADED, "UTF-8", "UTF-8",
driverName, &errorInfo) < 0) {
Nan::ThrowError(errorInfo.message);
return;
}
Local<FunctionTemplate> temp = Nan::New<FunctionTemplate>(New);
temp->InstanceTemplate()->SetInternalFieldCount(1);

View File

@ -405,7 +405,7 @@ NAN_METHOD(njsPool::Terminate)
//-----------------------------------------------------------------------------
void njsPool::Async_Terminate(njsBaton *baton)
{
if (dpiPool_Destroy(baton->dpiPoolHandle) < 0)
if (dpiPool_Close(baton->dpiPoolHandle) < 0)
baton->GetDPIPoolError(baton->dpiPoolHandle);
}