@@ -954,6 +954,9 @@ class Attachment final : public RefCntIface<IAttachmentImpl<Attachment, CheckSta
954954 Transaction* remoteTransactionInterface (ITransaction* apiTra);
955955 Statement* createStatement (CheckStatusWrapper* status, unsigned dialect);
956956
957+ // Set params that was set in DPB, ignoring unknown and not applicable tags.
958+ void setParamsFromDPB (ClumpletReader& dpb);
959+
957960 Replicator* replicator;
958961
959962private:
@@ -965,7 +968,7 @@ class Attachment final : public RefCntIface<IAttachmentImpl<Attachment, CheckSta
965968
966969 // Returns nullptr if all items was handled or if user buffer is full, else
967970 // returns pointer into unused buffer space. Handled info items are removed.
968- unsigned char * getWireStatsInfo (UCharBuffer& info, unsigned int buffer_length,
971+ unsigned char * getLocalInfo (UCharBuffer& info, unsigned int buffer_length,
969972 unsigned char * buffer);
970973
971974 Rdb* rdb;
@@ -1264,9 +1267,11 @@ IAttachment* RProvider::attach(CheckStatusWrapper* status, const char* filename,
12641267 if (!init (status, cBlock, port, op_attach, expanded_name, newDpb, intl, cryptCallback))
12651268 return NULL ;
12661269
1267- Attachment* a = FB_NEW Attachment (port->port_context , filename);
1268- a->addRef ();
1269- return a;
1270+ Attachment* att = FB_NEW Attachment (port->port_context , filename);
1271+ att->addRef ();
1272+ att->setParamsFromDPB (newDpb);
1273+
1274+ return att;
12701275 }
12711276 catch (const Exception& ex)
12721277 {
@@ -2002,7 +2007,7 @@ IAttachment* Loopback::createDatabase(CheckStatusWrapper* status, const char* fi
20022007}
20032008
20042009
2005- unsigned char * Attachment::getWireStatsInfo (UCharBuffer& info, unsigned int buffer_length,
2010+ unsigned char * Attachment::getLocalInfo (UCharBuffer& info, unsigned int buffer_length,
20062011 unsigned char * buffer)
20072012{
20082013 const rem_port* const port = rdb->rdb_port ;
@@ -2022,6 +2027,9 @@ unsigned char* Attachment::getWireStatsInfo(UCharBuffer& info, unsigned int buff
20222027 break ;
20232028 }
20242029
2030+ FB_UINT64 value;
2031+ bool skip = false ;
2032+
20252033 switch (*item)
20262034 {
20272035 case fb_info_wire_snd_packets:
@@ -2033,25 +2041,37 @@ unsigned char* Attachment::getWireStatsInfo(UCharBuffer& info, unsigned int buff
20332041 case fb_info_wire_out_bytes:
20342042 case fb_info_wire_in_bytes:
20352043 case fb_info_wire_roundtrips:
2036- {
2037- const FB_UINT64 value = port-> getStatItem (*item) ;
2044+ value = port-> getStatItem (*item);
2045+ break ;
20382046
2039- if (value <= MAX_SLONG)
2040- ptr = fb_utils::putInfoItemInt (*item, (SLONG) value, ptr, end);
2041- else
2042- ptr = fb_utils::putInfoItemInt (*item, value, ptr, end);
2047+ case fb_info_max_blob_cache_size:
2048+ value = rdb->rdb_blob_cache_size ;
2049+ break ;
20432050
2044- if (!ptr)
2045- return nullptr ;
2051+ case fb_info_max_inline_blob_size:
2052+ value = rdb->rdb_inline_blob_size ;
2053+ break ;
20462054
2047- info.remove (item);
2055+ default :
2056+ skip = true ;
20482057 break ;
20492058 }
20502059
2051- default :
2060+ if (skip)
2061+ {
20522062 item++;
2053- break ;
2063+ continue ;
20542064 }
2065+
2066+ if (value <= MAX_SLONG)
2067+ ptr = fb_utils::putInfoItemInt (*item, (SLONG) value, ptr, end);
2068+ else
2069+ ptr = fb_utils::putInfoItemInt (*item, value, ptr, end);
2070+
2071+ if (!ptr)
2072+ return nullptr ;
2073+
2074+ info.remove (item);
20552075 }
20562076
20572077 if (info.isEmpty () && ptr < end)
@@ -2090,7 +2110,7 @@ void Attachment::getInfo(CheckStatusWrapper* status,
20902110 RefMutexGuard portGuard (*port->port_sync , FB_FUNCTION);
20912111
20922112 UCharBuffer tempInfo (items, item_length);
2093- UCHAR* ptr = getWireStatsInfo (tempInfo, buffer_length, buffer);
2113+ UCHAR* ptr = getLocalInfo (tempInfo, buffer_length, buffer);
20942114 if (!ptr)
20952115 return ;
20962116
@@ -2471,47 +2491,106 @@ Batch* Attachment::createBatch(CheckStatusWrapper* status, ITransaction* transac
24712491}
24722492
24732493
2494+ void Attachment::setParamsFromDPB (ClumpletReader& dpb)
2495+ {
2496+ dpb.rewind ();
2497+ for (; !dpb.isEof (); dpb.moveNext ())
2498+ {
2499+ const UCHAR item = dpb.getClumpTag ();
2500+ switch (item)
2501+ {
2502+ case isc_dpb_max_blob_cache_size:
2503+ if (rdb->rdb_port ->port_protocol >= PROTOCOL_INLINE_BLOB)
2504+ rdb->rdb_blob_cache_size = dpb.getInt ();
2505+ break ;
2506+
2507+ case isc_dpb_max_inline_blob_size:
2508+ if (rdb->rdb_port ->port_protocol >= PROTOCOL_INLINE_BLOB)
2509+ rdb->rdb_inline_blob_size = dpb.getInt ();
2510+ break ;
2511+
2512+ default :
2513+ break ;
2514+ }
2515+ }
2516+ }
2517+
2518+
24742519unsigned Attachment::getMaxBlobCacheSize (CheckStatusWrapper* status)
24752520{
2476- if (rdb-> rdb_port -> port_protocol < PROTOCOL_INLINE_BLOB)
2521+ try
24772522 {
2478- status->setErrors (Arg::Gds (isc_wish_list).value ());
2479- return 0 ;
2523+ reset (status);
2524+ CHECK_HANDLE (rdb, isc_bad_db_handle);
2525+
2526+ if (rdb->rdb_port ->port_protocol < PROTOCOL_INLINE_BLOB)
2527+ unsupported ();
2528+
2529+ return rdb->rdb_blob_cache_size ;
2530+ }
2531+ catch (const Exception& ex)
2532+ {
2533+ ex.stuffException (status);
24802534 }
2481- return rdb-> rdb_blob_cache_size ;
2535+ return 0 ;
24822536}
24832537
24842538
24852539void Attachment::setMaxBlobCacheSize (CheckStatusWrapper* status, unsigned size)
24862540{
2487- if (rdb-> rdb_port -> port_protocol < PROTOCOL_INLINE_BLOB)
2541+ try
24882542 {
2489- status->setErrors (Arg::Gds (isc_wish_list).value ());
2490- return ;
2543+ reset (status);
2544+ CHECK_HANDLE (rdb, isc_bad_db_handle);
2545+
2546+ if (rdb->rdb_port ->port_protocol < PROTOCOL_INLINE_BLOB)
2547+ unsupported ();
2548+
2549+ rdb->rdb_blob_cache_size = size;
2550+ }
2551+ catch (const Exception& ex)
2552+ {
2553+ ex.stuffException (status);
24912554 }
2492- rdb->rdb_blob_cache_size = size;
24932555}
24942556
24952557
24962558unsigned Attachment::getMaxInlineBlobSize (CheckStatusWrapper* status)
24972559{
2498- if (rdb-> rdb_port -> port_protocol < PROTOCOL_INLINE_BLOB)
2560+ try
24992561 {
2500- status->setErrors (Arg::Gds (isc_wish_list).value ());
2501- return 0 ;
2562+ reset (status);
2563+ CHECK_HANDLE (rdb, isc_bad_db_handle);
2564+
2565+ if (rdb->rdb_port ->port_protocol < PROTOCOL_INLINE_BLOB)
2566+ unsupported ();
2567+
2568+ return rdb->rdb_inline_blob_size ;
2569+ }
2570+ catch (const Exception& ex)
2571+ {
2572+ ex.stuffException (status);
25022573 }
2503- return rdb-> rdb_inline_blob_size ;
2574+ return 0 ;
25042575}
25052576
25062577
25072578void Attachment::setMaxInlineBlobSize (CheckStatusWrapper* status, unsigned size)
25082579{
2509- if (rdb-> rdb_port -> port_protocol < PROTOCOL_INLINE_BLOB)
2580+ try
25102581 {
2511- status->setErrors (Arg::Gds (isc_wish_list).value ());
2512- return ;
2582+ reset (status);
2583+ CHECK_HANDLE (rdb, isc_bad_db_handle);
2584+
2585+ if (rdb->rdb_port ->port_protocol < PROTOCOL_INLINE_BLOB)
2586+ unsupported ();
2587+
2588+ rdb->rdb_inline_blob_size = size;
2589+ }
2590+ catch (const Exception& ex)
2591+ {
2592+ ex.stuffException (status);
25132593 }
2514- rdb->rdb_inline_blob_size = size;
25152594}
25162595
25172596
0 commit comments