Skip to content

Replace internal 'dsc' with public 'paramdsc' in the API #8489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion src/common/dsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,19 @@ typedef struct dsc
d.dsc_length = dsc_length;
d.dsc_sub_type = dsc_sub_type;
d.dsc_flags = dsc_flags;
d.dsc_offset = (ULONG)(IPTR)dsc_address;
d.dsc_offset = (ULONG)(IPTR) dsc_address;
return d;
}

operator paramdsc() const
{
paramdsc d;
d.dsc_dtype = dsc_dtype;
d.dsc_scale = dsc_scale;
d.dsc_length = dsc_length;
d.dsc_sub_type = dsc_sub_type;
d.dsc_flags = dsc_flags;
d.dsc_address = dsc_address;
return d;
}

Expand Down
4 changes: 2 additions & 2 deletions src/include/firebird/FirebirdInterface.idl
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ interface XpbBuilder : Disposable
// Database trace objects

struct PerformanceInfo;
struct dsc;
struct paramdsc;

interface TraceConnection : Versioned
{
Expand Down Expand Up @@ -1350,7 +1350,7 @@ version: // 3.0.4 -> 3.0.5
interface TraceParams : Versioned
{
uint getCount();
const dsc* getParam(uint idx);
const paramdsc* getParam(uint idx);

version:
const string getTextUTF8(Status status, uint idx);
Expand Down
12 changes: 6 additions & 6 deletions src/include/firebird/IdlFbInterfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -5477,7 +5477,7 @@ namespace Firebird
struct VTable : public IVersioned::VTable
{
unsigned (CLOOP_CARG *getCount)(ITraceParams* self) CLOOP_NOEXCEPT;
const dsc* (CLOOP_CARG *getParam)(ITraceParams* self, unsigned idx) CLOOP_NOEXCEPT;
const paramdsc* (CLOOP_CARG *getParam)(ITraceParams* self, unsigned idx) CLOOP_NOEXCEPT;
const char* (CLOOP_CARG *getTextUTF8)(ITraceParams* self, IStatus* status, unsigned idx) CLOOP_NOEXCEPT;
};

Expand All @@ -5500,9 +5500,9 @@ namespace Firebird
return ret;
}

const dsc* getParam(unsigned idx)
const paramdsc* getParam(unsigned idx)
{
const dsc* ret = static_cast<VTable*>(this->cloopVTable)->getParam(this, idx);
const paramdsc* ret = static_cast<VTable*>(this->cloopVTable)->getParam(this, idx);
return ret;
}

Expand Down Expand Up @@ -17551,7 +17551,7 @@ namespace Firebird
}
}

static const dsc* CLOOP_CARG cloopgetParamDispatcher(ITraceParams* self, unsigned idx) CLOOP_NOEXCEPT
static const paramdsc* CLOOP_CARG cloopgetParamDispatcher(ITraceParams* self, unsigned idx) CLOOP_NOEXCEPT
{
try
{
Expand All @@ -17560,7 +17560,7 @@ namespace Firebird
catch (...)
{
StatusType::catchException(0);
return static_cast<const dsc*>(0);
return static_cast<const paramdsc*>(0);
}
}

Expand Down Expand Up @@ -17594,7 +17594,7 @@ namespace Firebird
}

virtual unsigned getCount() = 0;
virtual const dsc* getParam(unsigned idx) = 0;
virtual const paramdsc* getParam(unsigned idx) = 0;
virtual const char* getTextUTF8(StatusType* status, unsigned idx) = 0;
};

Expand Down
12 changes: 6 additions & 6 deletions src/include/gen/Firebird.pas
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ ISC_TIMESTAMP_TZ_EX = record
IntegerPtr = ^Integer;
NativeIntPtr = ^NativeInt;
PerformanceInfoPtr = ^PerformanceInfo;
dscPtr = ^dsc;
paramdscPtr = ^paramdsc;

IReferenceCounted_addRefPtr = procedure(this: IReferenceCounted); cdecl;
IReferenceCounted_releasePtr = function(this: IReferenceCounted): Integer; cdecl;
Expand Down Expand Up @@ -607,7 +607,7 @@ ISC_TIMESTAMP_TZ_EX = record
ITraceTransaction_getInitialIDPtr = function(this: ITraceTransaction): Int64; cdecl;
ITraceTransaction_getPreviousIDPtr = function(this: ITraceTransaction): Int64; cdecl;
ITraceParams_getCountPtr = function(this: ITraceParams): Cardinal; cdecl;
ITraceParams_getParamPtr = function(this: ITraceParams; idx: Cardinal): dscPtr; cdecl;
ITraceParams_getParamPtr = function(this: ITraceParams; idx: Cardinal): paramdscPtr; cdecl;
ITraceParams_getTextUTF8Ptr = function(this: ITraceParams; status: IStatus; idx: Cardinal): PAnsiChar; cdecl;
ITraceStatement_getStmtIDPtr = function(this: ITraceStatement): Int64; cdecl;
ITraceStatement_getPerfPtr = function(this: ITraceStatement): PerformanceInfoPtr; cdecl;
Expand Down Expand Up @@ -3067,15 +3067,15 @@ ITraceParams = class(IVersioned)
const VERSION = 3;

function getCount(): Cardinal;
function getParam(idx: Cardinal): dscPtr;
function getParam(idx: Cardinal): paramdscPtr;
function getTextUTF8(status: IStatus; idx: Cardinal): PAnsiChar;
end;

ITraceParamsImpl = class(ITraceParams)
constructor create;

function getCount(): Cardinal; virtual; abstract;
function getParam(idx: Cardinal): dscPtr; virtual; abstract;
function getParam(idx: Cardinal): paramdscPtr; virtual; abstract;
function getTextUTF8(status: IStatus; idx: Cardinal): PAnsiChar; virtual; abstract;
end;

Expand Down Expand Up @@ -8969,7 +8969,7 @@ function ITraceParams.getCount(): Cardinal;
Result := TraceParamsVTable(vTable).getCount(Self);
end;

function ITraceParams.getParam(idx: Cardinal): dscPtr;
function ITraceParams.getParam(idx: Cardinal): paramdscPtr;
begin
Result := TraceParamsVTable(vTable).getParam(Self, idx);
end;
Expand Down Expand Up @@ -15196,7 +15196,7 @@ function ITraceParamsImpl_getCountDispatcher(this: ITraceParams): Cardinal; cdec
end
end;

function ITraceParamsImpl_getParamDispatcher(this: ITraceParams; idx: Cardinal): dscPtr; cdecl;
function ITraceParamsImpl_getParamDispatcher(this: ITraceParams; idx: Cardinal): paramdscPtr; cdecl;
begin
Result := nil;
try
Expand Down
23 changes: 10 additions & 13 deletions src/jrd/trace/TraceObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace

// Convert text descriptor into UTF8 string.
// Binary data converted into HEX representation.
bool descToUTF8(const dsc* param, string& result)
bool descToUTF8(const paramdsc* param, string& result)
{
UCHAR* address;
USHORT length;
Expand All @@ -83,7 +83,7 @@ bool descToUTF8(const dsc* param, string& result)
return false;
}

if (param->getCharSet() == CS_BINARY)
if (param->dsc_sub_type == CS_BINARY)
{
// Convert OCTETS and [VAR]BINARY to HEX string

Expand Down Expand Up @@ -311,14 +311,11 @@ void TraceSQLStatementImpl::DSQLParamsImpl::fillParams()
null_flag = DSC_null;
}

dsc* desc = NULL;

const FB_SIZE_T idx = parameter->par_index - 1;
if (idx >= m_descs.getCount())
m_descs.getBuffer(idx + 1);

desc = &m_descs[idx];

paramdsc* const desc = &m_descs[idx];
*desc = parameter->par_desc;
desc->dsc_flags |= null_flag;

Expand All @@ -335,19 +332,19 @@ FB_SIZE_T TraceSQLStatementImpl::DSQLParamsImpl::getCount()
return m_descs.getCount();
}

const dsc* TraceSQLStatementImpl::DSQLParamsImpl::getParam(FB_SIZE_T idx)
const paramdsc* TraceSQLStatementImpl::DSQLParamsImpl::getParam(FB_SIZE_T idx)
{
fillParams();

if (idx >= 0 && idx < m_descs.getCount())
if (idx < m_descs.getCount())
return &m_descs[idx];

return NULL;
}

const char* TraceSQLStatementImpl::DSQLParamsImpl::getTextUTF8(CheckStatusWrapper* status, FB_SIZE_T idx)
{
const dsc* param = getParam(idx);
const paramdsc* const param = getParam(idx);

if (descToUTF8(param, m_tempUTF8))
return m_tempUTF8.c_str();
Expand Down Expand Up @@ -377,14 +374,14 @@ FB_SIZE_T TraceParamsImpl::getCount()
return m_descs->getCount();
}

const dsc* TraceParamsImpl::getParam(FB_SIZE_T idx)
const paramdsc* TraceParamsImpl::getParam(FB_SIZE_T idx)
{
return m_descs->getParam(idx);
}

const char* TraceParamsImpl::getTextUTF8(CheckStatusWrapper* status, FB_SIZE_T idx)
{
const dsc* param = getParam(idx);
const paramdsc* const param = getParam(idx);

if (descToUTF8(param, m_tempUTF8))
return m_tempUTF8.c_str();
Expand Down Expand Up @@ -465,7 +462,7 @@ void TraceDscFromMsg::fillParams()
const dsc* fmtDesc = m_format->fmt_desc.begin();
const dsc* const fmtEnd = m_format->fmt_desc.end();

dsc* desc = m_descs.getBuffer(m_format->fmt_count / 2);
paramdsc* desc = m_descs.getBuffer(m_format->fmt_count / 2);

for (; fmtDesc < fmtEnd; fmtDesc += 2, desc++)
{
Expand All @@ -477,7 +474,7 @@ void TraceDscFromMsg::fillParams()
const ULONG nullOffset = (IPTR) fmtDesc[1].dsc_address;
const SSHORT* const nullPtr = (const SSHORT*) (m_inMsg + nullOffset);
if (*nullPtr == -1)
desc->setNull();
desc->dsc_flags |= DSC_null;
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/jrd/trace/TraceObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ class TraceSQLStatementImpl :
}

FB_SIZE_T getCount();
const dsc* getParam(FB_SIZE_T idx);
const paramdsc* getParam(FB_SIZE_T idx);
const char* getTextUTF8(Firebird::CheckStatusWrapper* status, FB_SIZE_T idx);

private:
void fillParams();

DsqlRequest* const m_stmt;
const Firebird::Array<dsql_par*>* m_params = nullptr;
Firebird::HalfStaticArray<dsc, 16> m_descs;
Firebird::HalfStaticArray<paramdsc, 16> m_descs;
Firebird::string m_tempUTF8;
};

Expand Down Expand Up @@ -335,7 +335,7 @@ class TraceParamsImpl :

// TraceParams implementation
FB_SIZE_T getCount();
const dsc* getParam(FB_SIZE_T idx);
const paramdsc* getParam(FB_SIZE_T idx);
const char* getTextUTF8(Firebird::CheckStatusWrapper* status, FB_SIZE_T idx);

private:
Expand All @@ -358,11 +358,11 @@ class TraceDescriptors
return m_descs.getCount();
}

const dsc* getParam(FB_SIZE_T idx)
const paramdsc* getParam(FB_SIZE_T idx)
{
fillParams();

if (/*idx >= 0 &&*/ idx < m_descs.getCount())
if (idx < m_descs.getCount())
return &m_descs[idx];

return NULL;
Expand All @@ -376,7 +376,7 @@ class TraceDescriptors
protected:
virtual void fillParams() = 0;

Firebird::HalfStaticArray<dsc, 16> m_descs;
Firebird::HalfStaticArray<paramdsc, 16> m_descs;

private:
TraceParamsImpl m_traceParams;
Expand Down Expand Up @@ -429,7 +429,7 @@ class TraceDscFromDsc : public TraceDescriptors
else
{
m_descs.grow(1);
m_descs[0].setNull();
m_descs[0].dsc_flags |= DSC_null;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/utilities/ntrace/TracePluginImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ void TracePluginImpl::appendParams(ITraceParams* params)

for (FB_SIZE_T i = 0; i < paramcount; i++)
{
const struct dsc* parameters = params->getParam(i);
const paramdsc* const parameters = params->getParam(i);

// See if we need to print any more arguments
if (config.max_arg_count && i >= config.max_arg_count)
Expand All @@ -829,7 +829,7 @@ void TracePluginImpl::appendParams(ITraceParams* params)
switch (parameters->dsc_dtype)
{
case dtype_text:
if (parameters->getTextType() == fb_text_subtype_binary)
if (parameters->dsc_sub_type == fb_text_subtype_binary)
paramtype.printf("binary(%d)", parameters->dsc_length);
else
paramtype.printf("char(%d)", parameters->dsc_length);
Expand All @@ -838,7 +838,7 @@ void TracePluginImpl::appendParams(ITraceParams* params)
paramtype.printf("cstring(%d)", parameters->dsc_length - 1);
break;
case dtype_varying:
if (parameters->getTextType() == fb_text_subtype_binary)
if (parameters->dsc_sub_type == fb_text_subtype_binary)
paramtype.printf("varbinary(%d)", parameters->dsc_length - 2);
else
paramtype.printf("varchar(%d)", parameters->dsc_length - 2);
Expand Down
Loading