Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions extern/cloop/src/cloop/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ void Parser::parse()
}
}

static bool hasVersionedMethods(const Interface& interface)
{
const auto& methods = interface.methods;
return methods.size() >= 2 && methods.front()->version != methods.back()->version;
}

void Parser::parseInterface(bool exception)
{
auto newInterface = std::make_shared<Interface>();
Expand All @@ -140,6 +146,9 @@ void Parser::parseInterface(bool exception)
error(token, string("Super interface '") + superName + "' not found.");

interface->super = static_cast<Interface*>(superIt->second.get());
if (hasVersionedMethods(*interface->super))
error(token, string("Inheriting from the interface '" + superName + "' is not possible because it contains versioned methods."));

interface->version = interface->super->version + 1;
}
else
Expand Down
9 changes: 6 additions & 3 deletions src/include/firebird/FirebirdInterface.idl
Original file line number Diff line number Diff line change
Expand Up @@ -1382,9 +1382,6 @@ interface TraceStatement : Versioned
{
int64 getStmtID();
PerformanceInfo* getPerf();

version: // 5.0 -> 6.0
PerformanceStats getPerfStats();
}

interface TraceSQLStatement : TraceStatement
Expand All @@ -1394,13 +1391,19 @@ interface TraceSQLStatement : TraceStatement
TraceParams getInputs();
const string getTextUTF8();
const string getExplainedPlan();

version: // 5.0 -> 6.0
PerformanceStats getPerfStats();
}

interface TraceBLRStatement : TraceStatement
{
const uchar* getData();
uint getDataLength();
const string getText();

version: // 5.0 -> 6.0
PerformanceStats getPerfStats();
}

interface TraceDYNRequest : Versioned
Expand Down
92 changes: 45 additions & 47 deletions src/include/firebird/IdlFbInterfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -5609,7 +5609,7 @@ namespace Firebird
}
};

#define FIREBIRD_ITRACE_STATEMENT_VERSION 3u
#define FIREBIRD_ITRACE_STATEMENT_VERSION 2u

class ITraceStatement : public IVersioned
{
Expand All @@ -5618,7 +5618,6 @@ namespace Firebird
{
ISC_INT64 (CLOOP_CARG *getStmtID)(ITraceStatement* self) CLOOP_NOEXCEPT;
PerformanceInfo* (CLOOP_CARG *getPerf)(ITraceStatement* self) CLOOP_NOEXCEPT;
IPerformanceStats* (CLOOP_CARG *getPerfStats)(ITraceStatement* self) CLOOP_NOEXCEPT;
};

protected:
Expand All @@ -5645,16 +5644,6 @@ namespace Firebird
PerformanceInfo* ret = static_cast<VTable*>(this->cloopVTable)->getPerf(this);
return ret;
}

IPerformanceStats* getPerfStats()
{
if (cloopVTable->version < 3)
{
return 0;
}
IPerformanceStats* ret = static_cast<VTable*>(this->cloopVTable)->getPerfStats(this);
return ret;
}
};

#define FIREBIRD_ITRACE_SQLSTATEMENT_VERSION 4u
Expand All @@ -5669,6 +5658,7 @@ namespace Firebird
ITraceParams* (CLOOP_CARG *getInputs)(ITraceSQLStatement* self) CLOOP_NOEXCEPT;
const char* (CLOOP_CARG *getTextUTF8)(ITraceSQLStatement* self) CLOOP_NOEXCEPT;
const char* (CLOOP_CARG *getExplainedPlan)(ITraceSQLStatement* self) CLOOP_NOEXCEPT;
IPerformanceStats* (CLOOP_CARG *getPerfStats)(ITraceSQLStatement* self) CLOOP_NOEXCEPT;
};

protected:
Expand Down Expand Up @@ -5713,6 +5703,16 @@ namespace Firebird
const char* ret = static_cast<VTable*>(this->cloopVTable)->getExplainedPlan(this);
return ret;
}

IPerformanceStats* getPerfStats()
{
if (cloopVTable->version < 4)
{
return 0;
}
IPerformanceStats* ret = static_cast<VTable*>(this->cloopVTable)->getPerfStats(this);
return ret;
}
};

#define FIREBIRD_ITRACE_BLRSTATEMENT_VERSION 4u
Expand All @@ -5725,6 +5725,7 @@ namespace Firebird
const unsigned char* (CLOOP_CARG *getData)(ITraceBLRStatement* self) CLOOP_NOEXCEPT;
unsigned (CLOOP_CARG *getDataLength)(ITraceBLRStatement* self) CLOOP_NOEXCEPT;
const char* (CLOOP_CARG *getText)(ITraceBLRStatement* self) CLOOP_NOEXCEPT;
IPerformanceStats* (CLOOP_CARG *getPerfStats)(ITraceBLRStatement* self) CLOOP_NOEXCEPT;
};

protected:
Expand Down Expand Up @@ -5757,6 +5758,16 @@ namespace Firebird
const char* ret = static_cast<VTable*>(this->cloopVTable)->getText(this);
return ret;
}

IPerformanceStats* getPerfStats()
{
if (cloopVTable->version < 4)
{
return 0;
}
IPerformanceStats* ret = static_cast<VTable*>(this->cloopVTable)->getPerfStats(this);
return ret;
}
};

#define FIREBIRD_ITRACE_DYNREQUEST_VERSION 2u
Expand Down Expand Up @@ -18062,7 +18073,6 @@ namespace Firebird
this->version = Base::VERSION;
this->getStmtID = &Name::cloopgetStmtIDDispatcher;
this->getPerf = &Name::cloopgetPerfDispatcher;
this->getPerfStats = &Name::cloopgetPerfStatsDispatcher;
}
} vTable;

Expand Down Expand Up @@ -18094,19 +18104,6 @@ namespace Firebird
return static_cast<PerformanceInfo*>(0);
}
}

static IPerformanceStats* CLOOP_CARG cloopgetPerfStatsDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
{
try
{
return static_cast<Name*>(self)->Name::getPerfStats();
}
catch (...)
{
StatusType::catchException(0);
return static_cast<IPerformanceStats*>(0);
}
}
};

template <typename Name, typename StatusType, typename Base = IVersionedImpl<Name, StatusType, Inherit<ITraceStatement> > >
Expand All @@ -18124,7 +18121,6 @@ namespace Firebird

virtual ISC_INT64 getStmtID() = 0;
virtual PerformanceInfo* getPerf() = 0;
virtual IPerformanceStats* getPerfStats() = 0;
};

template <typename Name, typename StatusType, typename Base>
Expand All @@ -18142,12 +18138,12 @@ namespace Firebird
this->version = Base::VERSION;
this->getStmtID = &Name::cloopgetStmtIDDispatcher;
this->getPerf = &Name::cloopgetPerfDispatcher;
this->getPerfStats = &Name::cloopgetPerfStatsDispatcher;
this->getText = &Name::cloopgetTextDispatcher;
this->getPlan = &Name::cloopgetPlanDispatcher;
this->getInputs = &Name::cloopgetInputsDispatcher;
this->getTextUTF8 = &Name::cloopgetTextUTF8Dispatcher;
this->getExplainedPlan = &Name::cloopgetExplainedPlanDispatcher;
this->getPerfStats = &Name::cloopgetPerfStatsDispatcher;
}
} vTable;

Expand Down Expand Up @@ -18219,42 +18215,42 @@ namespace Firebird
}
}

static ISC_INT64 CLOOP_CARG cloopgetStmtIDDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
static IPerformanceStats* CLOOP_CARG cloopgetPerfStatsDispatcher(ITraceSQLStatement* self) CLOOP_NOEXCEPT
{
try
{
return static_cast<Name*>(self)->Name::getStmtID();
return static_cast<Name*>(self)->Name::getPerfStats();
}
catch (...)
{
StatusType::catchException(0);
return static_cast<ISC_INT64>(0);
return static_cast<IPerformanceStats*>(0);
}
}

static PerformanceInfo* CLOOP_CARG cloopgetPerfDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
static ISC_INT64 CLOOP_CARG cloopgetStmtIDDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
{
try
{
return static_cast<Name*>(self)->Name::getPerf();
return static_cast<Name*>(self)->Name::getStmtID();
}
catch (...)
{
StatusType::catchException(0);
return static_cast<PerformanceInfo*>(0);
return static_cast<ISC_INT64>(0);
}
}

static IPerformanceStats* CLOOP_CARG cloopgetPerfStatsDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
static PerformanceInfo* CLOOP_CARG cloopgetPerfDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
{
try
{
return static_cast<Name*>(self)->Name::getPerfStats();
return static_cast<Name*>(self)->Name::getPerf();
}
catch (...)
{
StatusType::catchException(0);
return static_cast<IPerformanceStats*>(0);
return static_cast<PerformanceInfo*>(0);
}
}
};
Expand All @@ -18277,6 +18273,7 @@ namespace Firebird
virtual ITraceParams* getInputs() = 0;
virtual const char* getTextUTF8() = 0;
virtual const char* getExplainedPlan() = 0;
virtual IPerformanceStats* getPerfStats() = 0;
};

template <typename Name, typename StatusType, typename Base>
Expand All @@ -18294,10 +18291,10 @@ namespace Firebird
this->version = Base::VERSION;
this->getStmtID = &Name::cloopgetStmtIDDispatcher;
this->getPerf = &Name::cloopgetPerfDispatcher;
this->getPerfStats = &Name::cloopgetPerfStatsDispatcher;
this->getData = &Name::cloopgetDataDispatcher;
this->getDataLength = &Name::cloopgetDataLengthDispatcher;
this->getText = &Name::cloopgetTextDispatcher;
this->getPerfStats = &Name::cloopgetPerfStatsDispatcher;
}
} vTable;

Expand Down Expand Up @@ -18343,42 +18340,42 @@ namespace Firebird
}
}

static ISC_INT64 CLOOP_CARG cloopgetStmtIDDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
static IPerformanceStats* CLOOP_CARG cloopgetPerfStatsDispatcher(ITraceBLRStatement* self) CLOOP_NOEXCEPT
{
try
{
return static_cast<Name*>(self)->Name::getStmtID();
return static_cast<Name*>(self)->Name::getPerfStats();
}
catch (...)
{
StatusType::catchException(0);
return static_cast<ISC_INT64>(0);
return static_cast<IPerformanceStats*>(0);
}
}

static PerformanceInfo* CLOOP_CARG cloopgetPerfDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
static ISC_INT64 CLOOP_CARG cloopgetStmtIDDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
{
try
{
return static_cast<Name*>(self)->Name::getPerf();
return static_cast<Name*>(self)->Name::getStmtID();
}
catch (...)
{
StatusType::catchException(0);
return static_cast<PerformanceInfo*>(0);
return static_cast<ISC_INT64>(0);
}
}

static IPerformanceStats* CLOOP_CARG cloopgetPerfStatsDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
static PerformanceInfo* CLOOP_CARG cloopgetPerfDispatcher(ITraceStatement* self) CLOOP_NOEXCEPT
{
try
{
return static_cast<Name*>(self)->Name::getPerfStats();
return static_cast<Name*>(self)->Name::getPerf();
}
catch (...)
{
StatusType::catchException(0);
return static_cast<IPerformanceStats*>(0);
return static_cast<PerformanceInfo*>(0);
}
}
};
Expand All @@ -18399,6 +18396,7 @@ namespace Firebird
virtual const unsigned char* getData() = 0;
virtual unsigned getDataLength() = 0;
virtual const char* getText() = 0;
virtual IPerformanceStats* getPerfStats() = 0;
};

template <typename Name, typename StatusType, typename Base>
Expand Down
Loading
Loading