Skip to content

Commit f5032b5

Browse files
committed
Implemented methods to manage blobs cache size at client side and maximum size of blob to transfer inline.
1 parent 6cab8f2 commit f5032b5

File tree

13 files changed

+648
-23
lines changed

13 files changed

+648
-23
lines changed

src/include/firebird/FirebirdInterface.idl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,11 @@ version: // 3.0 => 4.0
521521
version: // 3.0.7 => 3.0.8, 4.0.0 => 4.0.1
522522
[notImplementedAction if ::FB_UsedInYValve then defaultAction else call deprecatedFree(status) endif]
523523
void free(Status status);
524+
525+
version: // 6.0
526+
// Inline blob transfer
527+
uint getMaxInlineBlobSize(Status status);
528+
void setMaxInlineBlobSize(Status status, uint size);
524529
}
525530

526531
interface Batch : ReferenceCounted
@@ -713,6 +718,15 @@ version: // 3.0.7 => 3.0.8, 4.0.0 => 4.0.1
713718
void detach(Status status);
714719
[notImplementedAction if ::FB_UsedInYValve then defaultAction else call deprecatedDropDatabase(status) endif]
715720
void dropDatabase(Status status);
721+
722+
version: // 6.0
723+
// Blob caching by client
724+
uint getMaxBlobCacheSize(Status status);
725+
void setMaxBlobCacheSize(Status status, uint size);
726+
727+
// Inline blob transfer
728+
uint getMaxInlineBlobSize(Status status);
729+
void setMaxInlineBlobSize(Status status, uint size);
716730
}
717731

718732
interface Service : ReferenceCounted

src/include/firebird/IdlFbInterfaces.h

Lines changed: 188 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ namespace Firebird
18691869
}
18701870
};
18711871

1872-
#define FIREBIRD_ISTATEMENT_VERSION 5u
1872+
#define FIREBIRD_ISTATEMENT_VERSION 6u
18731873

18741874
class IStatement : public IReferenceCounted
18751875
{
@@ -1891,6 +1891,8 @@ namespace Firebird
18911891
void (CLOOP_CARG *setTimeout)(IStatement* self, IStatus* status, unsigned timeOut) CLOOP_NOEXCEPT;
18921892
IBatch* (CLOOP_CARG *createBatch)(IStatement* self, IStatus* status, IMessageMetadata* inMetadata, unsigned parLength, const unsigned char* par) CLOOP_NOEXCEPT;
18931893
void (CLOOP_CARG *free)(IStatement* self, IStatus* status) CLOOP_NOEXCEPT;
1894+
unsigned (CLOOP_CARG *getMaxInlineBlobSize)(IStatement* self, IStatus* status) CLOOP_NOEXCEPT;
1895+
void (CLOOP_CARG *setMaxInlineBlobSize)(IStatement* self, IStatus* status, unsigned size) CLOOP_NOEXCEPT;
18941896
};
18951897

18961898
protected:
@@ -2064,6 +2066,33 @@ namespace Firebird
20642066
static_cast<VTable*>(this->cloopVTable)->free(this, status);
20652067
StatusType::checkException(status);
20662068
}
2069+
2070+
template <typename StatusType> unsigned getMaxInlineBlobSize(StatusType* status)
2071+
{
2072+
if (cloopVTable->version < 6)
2073+
{
2074+
StatusType::setVersionError(status, "IStatement", cloopVTable->version, 6);
2075+
StatusType::checkException(status);
2076+
return 0;
2077+
}
2078+
StatusType::clearException(status);
2079+
unsigned ret = static_cast<VTable*>(this->cloopVTable)->getMaxInlineBlobSize(this, status);
2080+
StatusType::checkException(status);
2081+
return ret;
2082+
}
2083+
2084+
template <typename StatusType> void setMaxInlineBlobSize(StatusType* status, unsigned size)
2085+
{
2086+
if (cloopVTable->version < 6)
2087+
{
2088+
StatusType::setVersionError(status, "IStatement", cloopVTable->version, 6);
2089+
StatusType::checkException(status);
2090+
return;
2091+
}
2092+
StatusType::clearException(status);
2093+
static_cast<VTable*>(this->cloopVTable)->setMaxInlineBlobSize(this, status, size);
2094+
StatusType::checkException(status);
2095+
}
20672096
};
20682097

20692098
#define FIREBIRD_IBATCH_VERSION 4u
@@ -2499,7 +2528,7 @@ namespace Firebird
24992528
}
25002529
};
25012530

2502-
#define FIREBIRD_IATTACHMENT_VERSION 5u
2531+
#define FIREBIRD_IATTACHMENT_VERSION 6u
25032532

25042533
class IAttachment : public IReferenceCounted
25052534
{
@@ -2532,6 +2561,10 @@ namespace Firebird
25322561
IReplicator* (CLOOP_CARG *createReplicator)(IAttachment* self, IStatus* status) CLOOP_NOEXCEPT;
25332562
void (CLOOP_CARG *detach)(IAttachment* self, IStatus* status) CLOOP_NOEXCEPT;
25342563
void (CLOOP_CARG *dropDatabase)(IAttachment* self, IStatus* status) CLOOP_NOEXCEPT;
2564+
unsigned (CLOOP_CARG *getMaxBlobCacheSize)(IAttachment* self, IStatus* status) CLOOP_NOEXCEPT;
2565+
void (CLOOP_CARG *setMaxBlobCacheSize)(IAttachment* self, IStatus* status, unsigned size) CLOOP_NOEXCEPT;
2566+
unsigned (CLOOP_CARG *getMaxInlineBlobSize)(IAttachment* self, IStatus* status) CLOOP_NOEXCEPT;
2567+
void (CLOOP_CARG *setMaxInlineBlobSize)(IAttachment* self, IStatus* status, unsigned size) CLOOP_NOEXCEPT;
25352568
};
25362569

25372570
protected:
@@ -2800,6 +2833,60 @@ namespace Firebird
28002833
static_cast<VTable*>(this->cloopVTable)->dropDatabase(this, status);
28012834
StatusType::checkException(status);
28022835
}
2836+
2837+
template <typename StatusType> unsigned getMaxBlobCacheSize(StatusType* status)
2838+
{
2839+
if (cloopVTable->version < 6)
2840+
{
2841+
StatusType::setVersionError(status, "IAttachment", cloopVTable->version, 6);
2842+
StatusType::checkException(status);
2843+
return 0;
2844+
}
2845+
StatusType::clearException(status);
2846+
unsigned ret = static_cast<VTable*>(this->cloopVTable)->getMaxBlobCacheSize(this, status);
2847+
StatusType::checkException(status);
2848+
return ret;
2849+
}
2850+
2851+
template <typename StatusType> void setMaxBlobCacheSize(StatusType* status, unsigned size)
2852+
{
2853+
if (cloopVTable->version < 6)
2854+
{
2855+
StatusType::setVersionError(status, "IAttachment", cloopVTable->version, 6);
2856+
StatusType::checkException(status);
2857+
return;
2858+
}
2859+
StatusType::clearException(status);
2860+
static_cast<VTable*>(this->cloopVTable)->setMaxBlobCacheSize(this, status, size);
2861+
StatusType::checkException(status);
2862+
}
2863+
2864+
template <typename StatusType> unsigned getMaxInlineBlobSize(StatusType* status)
2865+
{
2866+
if (cloopVTable->version < 6)
2867+
{
2868+
StatusType::setVersionError(status, "IAttachment", cloopVTable->version, 6);
2869+
StatusType::checkException(status);
2870+
return 0;
2871+
}
2872+
StatusType::clearException(status);
2873+
unsigned ret = static_cast<VTable*>(this->cloopVTable)->getMaxInlineBlobSize(this, status);
2874+
StatusType::checkException(status);
2875+
return ret;
2876+
}
2877+
2878+
template <typename StatusType> void setMaxInlineBlobSize(StatusType* status, unsigned size)
2879+
{
2880+
if (cloopVTable->version < 6)
2881+
{
2882+
StatusType::setVersionError(status, "IAttachment", cloopVTable->version, 6);
2883+
StatusType::checkException(status);
2884+
return;
2885+
}
2886+
StatusType::clearException(status);
2887+
static_cast<VTable*>(this->cloopVTable)->setMaxInlineBlobSize(this, status, size);
2888+
StatusType::checkException(status);
2889+
}
28032890
};
28042891

28052892
#define FIREBIRD_ISERVICE_VERSION 5u
@@ -10525,6 +10612,8 @@ namespace Firebird
1052510612
this->setTimeout = &Name::cloopsetTimeoutDispatcher;
1052610613
this->createBatch = &Name::cloopcreateBatchDispatcher;
1052710614
this->free = &Name::cloopfreeDispatcher;
10615+
this->getMaxInlineBlobSize = &Name::cloopgetMaxInlineBlobSizeDispatcher;
10616+
this->setMaxInlineBlobSize = &Name::cloopsetMaxInlineBlobSizeDispatcher;
1052810617
}
1052910618
} vTable;
1053010619

@@ -10751,6 +10840,35 @@ namespace Firebird
1075110840
}
1075210841
}
1075310842

10843+
static unsigned CLOOP_CARG cloopgetMaxInlineBlobSizeDispatcher(IStatement* self, IStatus* status) CLOOP_NOEXCEPT
10844+
{
10845+
StatusType status2(status);
10846+
10847+
try
10848+
{
10849+
return static_cast<Name*>(self)->Name::getMaxInlineBlobSize(&status2);
10850+
}
10851+
catch (...)
10852+
{
10853+
StatusType::catchException(&status2);
10854+
return static_cast<unsigned>(0);
10855+
}
10856+
}
10857+
10858+
static void CLOOP_CARG cloopsetMaxInlineBlobSizeDispatcher(IStatement* self, IStatus* status, unsigned size) CLOOP_NOEXCEPT
10859+
{
10860+
StatusType status2(status);
10861+
10862+
try
10863+
{
10864+
static_cast<Name*>(self)->Name::setMaxInlineBlobSize(&status2, size);
10865+
}
10866+
catch (...)
10867+
{
10868+
StatusType::catchException(&status2);
10869+
}
10870+
}
10871+
1075410872
static void CLOOP_CARG cloopaddRefDispatcher(IReferenceCounted* self) CLOOP_NOEXCEPT
1075510873
{
1075610874
try
@@ -10805,6 +10923,8 @@ namespace Firebird
1080510923
virtual void setTimeout(StatusType* status, unsigned timeOut) = 0;
1080610924
virtual IBatch* createBatch(StatusType* status, IMessageMetadata* inMetadata, unsigned parLength, const unsigned char* par) = 0;
1080710925
virtual void free(StatusType* status) = 0;
10926+
virtual unsigned getMaxInlineBlobSize(StatusType* status) = 0;
10927+
virtual void setMaxInlineBlobSize(StatusType* status, unsigned size) = 0;
1080810928
};
1080910929

1081010930
template <typename Name, typename StatusType, typename Base>
@@ -11630,6 +11750,10 @@ namespace Firebird
1163011750
this->createReplicator = &Name::cloopcreateReplicatorDispatcher;
1163111751
this->detach = &Name::cloopdetachDispatcher;
1163211752
this->dropDatabase = &Name::cloopdropDatabaseDispatcher;
11753+
this->getMaxBlobCacheSize = &Name::cloopgetBlobCacheSizeDispatcher;
11754+
this->setMaxBlobCacheSize = &Name::cloopsetBlobCacheSizeDispatcher;
11755+
this->getMaxInlineBlobSize = &Name::cloopgetMaxInlineBlobSizeDispatcher;
11756+
this->setMaxInlineBlobSize = &Name::cloopsetMaxInlineBlobSizeDispatcher;
1163311757
}
1163411758
} vTable;
1163511759

@@ -12014,6 +12138,64 @@ namespace Firebird
1201412138
}
1201512139
}
1201612140

12141+
static unsigned CLOOP_CARG cloopgetBlobCacheSizeDispatcher(IAttachment* self, IStatus* status) CLOOP_NOEXCEPT
12142+
{
12143+
StatusType status2(status);
12144+
12145+
try
12146+
{
12147+
return static_cast<Name*>(self)->Name::getMaxBlobCacheSize(&status2);
12148+
}
12149+
catch (...)
12150+
{
12151+
StatusType::catchException(&status2);
12152+
return static_cast<unsigned>(0);
12153+
}
12154+
}
12155+
12156+
static void CLOOP_CARG cloopsetBlobCacheSizeDispatcher(IAttachment* self, IStatus* status, unsigned size) CLOOP_NOEXCEPT
12157+
{
12158+
StatusType status2(status);
12159+
12160+
try
12161+
{
12162+
static_cast<Name*>(self)->Name::setMaxBlobCacheSize(&status2, size);
12163+
}
12164+
catch (...)
12165+
{
12166+
StatusType::catchException(&status2);
12167+
}
12168+
}
12169+
12170+
static unsigned CLOOP_CARG cloopgetMaxInlineBlobSizeDispatcher(IAttachment* self, IStatus* status) CLOOP_NOEXCEPT
12171+
{
12172+
StatusType status2(status);
12173+
12174+
try
12175+
{
12176+
return static_cast<Name*>(self)->Name::getMaxInlineBlobSize(&status2);
12177+
}
12178+
catch (...)
12179+
{
12180+
StatusType::catchException(&status2);
12181+
return static_cast<unsigned>(0);
12182+
}
12183+
}
12184+
12185+
static void CLOOP_CARG cloopsetMaxInlineBlobSizeDispatcher(IAttachment* self, IStatus* status, unsigned size) CLOOP_NOEXCEPT
12186+
{
12187+
StatusType status2(status);
12188+
12189+
try
12190+
{
12191+
static_cast<Name*>(self)->Name::setMaxInlineBlobSize(&status2, size);
12192+
}
12193+
catch (...)
12194+
{
12195+
StatusType::catchException(&status2);
12196+
}
12197+
}
12198+
1201712199
static void CLOOP_CARG cloopaddRefDispatcher(IReferenceCounted* self) CLOOP_NOEXCEPT
1201812200
{
1201912201
try
@@ -12079,6 +12261,10 @@ namespace Firebird
1207912261
virtual IReplicator* createReplicator(StatusType* status) = 0;
1208012262
virtual void detach(StatusType* status) = 0;
1208112263
virtual void dropDatabase(StatusType* status) = 0;
12264+
virtual unsigned getMaxBlobCacheSize(StatusType* status) = 0;
12265+
virtual void setMaxBlobCacheSize(StatusType* status, unsigned size) = 0;
12266+
virtual unsigned getMaxInlineBlobSize(StatusType* status) = 0;
12267+
virtual void setMaxInlineBlobSize(StatusType* status, unsigned size) = 0;
1208212268
};
1208312269

1208412270
template <typename Name, typename StatusType, typename Base>

0 commit comments

Comments
 (0)