@@ -1406,7 +1406,7 @@ bool njsConnection::ProcessSubscriptionOptions(Local<Object> options,
1406
1406
if (!baton->GetUnsignedIntFromJSON (options, " namespace" , 1 ,
1407
1407
&temp))
1408
1408
return false ;
1409
- baton->subscrNamespace = ( dpiSubscrNamespace) temp;
1409
+ baton->subscription -> SetNamespace (( dpiSubscrNamespace) temp) ;
1410
1410
if (!baton->GetStringFromJSON (options, " ipAddress" , 1 ,
1411
1411
baton->ipAddress ))
1412
1412
return false ;
@@ -1439,14 +1439,20 @@ bool njsConnection::ProcessSubscriptionOptions(Local<Object> options,
1439
1439
}
1440
1440
1441
1441
// get options that are used for registering queries
1442
- if (!baton->GetStringFromJSON (options, " sql" , 1 , baton->sql ))
1443
- return false ;
1444
- Local<Value> binds;
1445
- Local<String> key = Nan::New (" binds" ).ToLocalChecked ();
1446
- if (!Nan::Get (options, key).ToLocal (&binds))
1447
- return false ;
1448
- if (!ProcessExecuteBinds (binds.As <Object>(), baton))
1449
- return false ;
1442
+ if (baton->subscription ->GetNamespace () == DPI_SUBSCR_NAMESPACE_DBCHANGE) {
1443
+ if (!baton->GetStringFromJSON (options, " sql" , 1 , baton->sql ))
1444
+ return false ;
1445
+ if (baton->sql .empty ()) {
1446
+ baton->error = njsMessages::Get (errMissingSubscrSql);
1447
+ return false ;
1448
+ }
1449
+ Local<Value> binds;
1450
+ Local<String> key = Nan::New (" binds" ).ToLocalChecked ();
1451
+ if (!Nan::Get (options, key).ToLocal (&binds))
1452
+ return false ;
1453
+ if (!ProcessExecuteBinds (binds.As <Object>(), baton))
1454
+ return false ;
1455
+ }
1450
1456
1451
1457
return true ;
1452
1458
}
@@ -2514,7 +2520,7 @@ void njsConnection::Async_Subscribe(njsBaton *baton)
2514
2520
baton->GetDPIError ();
2515
2521
return ;
2516
2522
}
2517
- params.subscrNamespace = baton->subscrNamespace ;
2523
+ params.subscrNamespace = baton->subscription -> GetNamespace () ;
2518
2524
params.name = baton->name .c_str ();
2519
2525
params.nameLength = baton->name .length ();
2520
2526
params.protocol = DPI_SUBSCR_PROTO_CALLBACK;
0 commit comments