@@ -205,9 +205,11 @@ OCCChild::OCCChild(const InitParams& _params) : Worker(_params),
205
205
enable_hb_fix(false ),
206
206
hb_sender(NULL ),
207
207
enable_cache(true ),
208
+ enable_oci_stmt_cache(true ),
208
209
stmt_cache(NULL ),
209
210
cur_stmt(NULL ),
210
211
max_cache_size(0 ),
212
+ max_oci_stmt_cache_size(0 )
211
213
max_statement_age(0 ),
212
214
cache_size(0 ),
213
215
cache_size_peak(0 ),
@@ -340,6 +342,9 @@ OCCChild::OCCChild(const InitParams& _params) : Worker(_params),
340
342
// initialize statement cache vars
341
343
// check if statement caching is enabled
342
344
enable_cache = config->is_switch_enabled (" enable_cache" , FALSE );
345
+
346
+ // Enable OCI statement cache
347
+ enable_oci_stmt_cache = config->is_switch_enabled (" enable_oci_stmt_cache" , FALSE );
343
348
enable_whitelist_test = config->is_switch_enabled (" enable_whitelist_test" , FALSE );
344
349
345
350
// PPSCR00377721
@@ -356,6 +361,16 @@ OCCChild::OCCChild(const InitParams& _params) : Worker(_params),
356
361
return ;
357
362
}
358
363
364
+ // MAX OCI statement cache size parameter and it should be > 0
365
+ if (config->get_value (" max_oci_stmt_cache_size" , cval))
366
+ max_oci_stmt_cache_size = StringUtil::to_int (c_val);
367
+
368
+ if (enable_oci_stmt_cache && max_oci_stmt_cache_size < 1 )
369
+ {
370
+ WRITE_LOG_ENTRY (logfile, LOG_ALERT, " max_oci_stmt_cache_size undefined or invalid" );
371
+ constructor_success = 0 ;
372
+ return ;
373
+ }
359
374
// if global caching is enabled or session caching is enabled
360
375
if (enable_cache || max_cache_size > 0 )
361
376
{
@@ -1654,12 +1669,12 @@ int OCCChild::connect(const std::string& db_username, const std::string& db_pass
1654
1669
}
1655
1670
1656
1671
// Enable statement cache
1657
- if (enable_cache )
1672
+ if (enable_oci_stmt_cache )
1658
1673
{
1659
- rc = OCIAttrSet (svchp, OCI_HTYPE_SVCCTX, &max_cache_size , (ub4)0 , (ub4)OCI_ATTR_STMTCACHESIZE, errhp);
1674
+ rc = OCIAttrSet (svchp, OCI_HTYPE_SVCCTX, &max_oci_stmt_cache_size , (ub4)0 , (ub4)OCI_ATTR_STMTCACHESIZE, errhp);
1660
1675
if (rc != OCI_SUCCESS)
1661
1676
{
1662
- log_oracle_error (rc, " Failed to set statement cache." );
1677
+ log_oracle_error (rc, " Failed to set OCI statement cache." );
1663
1678
}
1664
1679
}
1665
1680
0 commit comments