Skip to content

Commit 88da242

Browse files
committed
Perform initialization of all scalar values in constructors
1 parent 1e78481 commit 88da242

File tree

5 files changed

+30
-15
lines changed

5 files changed

+30
-15
lines changed

src/njsCommon.h

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,12 @@ class njsVariable {
169169
uint32_t numQueryVars;
170170
njsVariable *queryVars;
171171

172-
njsVariable() : dpiVarHandle(NULL), dpiVarData(NULL), lobs(NULL),
173-
queryVars(NULL) {}
172+
njsVariable() : pos(0), dbTypeNum(DPI_ORACLE_TYPE_VARCHAR),
173+
varTypeNum(DPI_ORACLE_TYPE_VARCHAR),
174+
nativeTypeNum(DPI_NATIVE_TYPE_BYTES), dpiVarHandle(NULL),
175+
dpiVarData(NULL), bindDir(0), maxArraySize(0), maxSize(0),
176+
dbSizeInBytes(0), precision(0), scale(0), isArray(false),
177+
isNullable(false), lobs(NULL), numQueryVars(0), queryVars(NULL) {}
174178
~njsVariable();
175179
njsDataType DataType();
176180
njsDBType DBType();
@@ -293,14 +297,18 @@ class njsBaton {
293297
Nan::Persistent<Function> jsCallback;
294298

295299
njsBaton(Local<Function> callback, Local<Object> callingObj) :
296-
dpiPoolHandle(NULL), dpiConnHandle(NULL), dpiStmtHandle(NULL),
297-
dpiLobHandle(NULL), maxRows(0), numQueryVars(0), queryVars(NULL),
298-
numBindVars(0), bindVars(NULL), numFetchInfo(0), fetchInfo(NULL),
299-
numFetchAsStringTypes(0), fetchAsStringTypes(NULL),
300-
numFetchAsBufferTypes(0), fetchAsBufferTypes(NULL),
301-
protoILob(NULL), keepQueryInfo(false), isReturning(false),
302-
bufferSize(0), bufferPtr(NULL), lobOffset(0), lobAmount(0)
303-
{
300+
poolMin(0), poolMax(0), poolIncrement(0), poolTimeout(0),
301+
poolPingInterval(0), dpiPoolHandle(NULL), dpiConnHandle(NULL),
302+
dpiStmtHandle(NULL), dpiLobHandle(NULL), stmtCacheSize(0),
303+
lobPrefetchSize(0), maxRows(0), fetchArraySize(0), rowsFetched(0),
304+
bufferRowIndex(0), rowsAffected(0), outFormat(0), numQueryVars(0),
305+
queryVars(NULL), numBindVars(0), bindVars(NULL), numFetchInfo(0),
306+
fetchInfo(NULL), numFetchAsStringTypes(0),
307+
fetchAsStringTypes(NULL), numFetchAsBufferTypes(0),
308+
fetchAsBufferTypes(NULL), protoILob(NULL), externalAuth(false),
309+
getRS(false), autoCommit(false), extendedMetaData(false),
310+
keepQueryInfo(false), isReturning(false), isPLSQL(false),
311+
bufferSize(0), bufferPtr(NULL), lobOffset(0), lobAmount(0) {
304312
this->jsCallback.Reset(callback);
305313
this->jsCallingObj.Reset(callingObj);
306314
this->callingObj = Nan::ObjectWrap::Unwrap<njsCommon>(callingObj);

src/njsIntLob.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ friend class njsILob;
7676
friend class njsConnection;
7777
public:
7878

79-
njsProtoILob() : dpiLobHandle(NULL) {}
79+
njsProtoILob() : dpiLobHandle(NULL), dataType(NJS_DATATYPE_DEFAULT),
80+
chunkSize(0), length(0), isAutoClose(false) {}
8081
~njsProtoILob() {
8182
if (dpiLobHandle) {
8283
dpiLob_release(dpiLobHandle);
@@ -112,7 +113,9 @@ class njsILob : public njsCommon {
112113
static bool HasInstance(Local<Value> val);
113114

114115
private:
115-
njsILob() : dpiLobHandle(NULL), bufferPtr(NULL) {}
116+
njsILob() : dpiLobHandle(NULL), dataType(NJS_DATATYPE_DEFAULT),
117+
bufferPtr(NULL), isAutoClose(false), pieceSize(0), chunkSize(0),
118+
length(0), offset(0) {}
116119
~njsILob() {
117120
if (dpiLobHandle) {
118121
dpiLob_release(dpiLobHandle);

src/njsOracle.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
Nan::Persistent<FunctionTemplate> njsOracledb::oracledbTemplate_s;
6363

6464
// DPI context
65-
dpiContext *njsOracledb::globalDPIContext;
65+
dpiContext *njsOracledb::globalDPIContext = NULL;
6666

6767
// common pool/standalone connection creation parameters (fixed)
6868
dpiCommonCreateParams njsCommonCreateParams;
@@ -88,6 +88,7 @@ njsOracledb::njsOracledb()
8888
externalAuth = false;
8989
lobPrefetchSize = NJS_LOB_PREFETCH_SIZE;
9090
poolPingInterval = NJS_POOL_DEFAULT_PING_INTERVAL;
91+
oraClientVer = 0;
9192
}
9293

9394

src/njsPool.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ class njsPool: public njsCommon {
105105
static NAN_SETTER(SetConnectionsInUse);
106106
static NAN_SETTER(SetStmtCacheSize);
107107

108-
njsPool() : dpiPoolHandle(NULL) {}
108+
njsPool() : dpiPoolHandle(NULL), poolMin(0), poolMax(0), poolIncrement(0),
109+
poolTimeout(0), stmtCacheSize(0), lobPrefetchSize(0),
110+
poolPingInterval(0) {}
109111
~njsPool() {
110112
jsOracledb.Reset();
111113
if (dpiPoolHandle) {

src/njsResultSet.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ class njsResultSet: public njsCommon {
7878

7979
private:
8080

81-
njsResultSet() : dpiStmtHandle(NULL), numQueryVars(0), queryVars(NULL) {}
81+
njsResultSet() : dpiStmtHandle(NULL), dpiConnHandle(NULL), numQueryVars(0),
82+
queryVars(NULL), outFormat(0), extendedMetaData(false) {}
8283
~njsResultSet();
8384

8485
static NAN_METHOD(New);

0 commit comments

Comments
 (0)