mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:00:38 +01:00
Avoid prefix Jrd in Statement class and Statement/jrd_req accessors/variables.
Change DSQL methods accordingly prefixing things with Dsql to avoid things as request->getRequest() and statement->getStatement().
This commit is contained in:
parent
68783f0971
commit
7ff8855317
@ -985,7 +985,7 @@ void DdlNode::executeDdlTrigger(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
||||
const MetaName& oldNewObjectName)
|
||||
{
|
||||
executeDdlTrigger(tdbb, transaction, when, action, objectName, oldNewObjectName,
|
||||
*dsqlScratch->getStatement()->getSqlText());
|
||||
*dsqlScratch->getDsqlStatement()->getSqlText());
|
||||
}
|
||||
|
||||
void DdlNode::storeGlobalField(thread_db* tdbb, jrd_tra* transaction, MetaName& name,
|
||||
@ -2354,7 +2354,7 @@ void CreateAlterFunctionNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch*
|
||||
|
||||
stmtNode->genBlr(dsqlScratch);
|
||||
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_DDL);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_DDL);
|
||||
dsqlScratch->appendUChar(blr_end);
|
||||
dsqlScratch->genReturn(false);
|
||||
dsqlScratch->appendUChar(blr_end);
|
||||
@ -2879,7 +2879,7 @@ bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch
|
||||
AutoCacheRequest requestHandle(tdbb, drq_m_prcs2, DYN_REQUESTS);
|
||||
bool modified = false;
|
||||
|
||||
DsqlStatement* statement = dsqlScratch->getStatement();
|
||||
DsqlStatement* statement = dsqlScratch->getDsqlStatement();
|
||||
|
||||
FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
||||
P IN RDB$PROCEDURES
|
||||
@ -3249,7 +3249,7 @@ void CreateAlterProcedureNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch*
|
||||
|
||||
stmtNode->genBlr(dsqlScratch);
|
||||
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_DDL);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_DDL);
|
||||
dsqlScratch->appendUChar(blr_end);
|
||||
dsqlScratch->genReturn(true);
|
||||
dsqlScratch->appendUChar(blr_end);
|
||||
@ -3780,7 +3780,7 @@ void CreateAlterTriggerNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch* d
|
||||
// The statement type may have been set incorrectly when parsing
|
||||
// the trigger actions, so reset it to reflect the fact that this
|
||||
// is a data definition statement; also reset the ddl node.
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_DDL);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_DDL);
|
||||
}
|
||||
|
||||
invalid = false;
|
||||
|
@ -1129,7 +1129,7 @@ public:
|
||||
|
||||
virtual DdlNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
dsqlScratch->getStatement()->setType(
|
||||
dsqlScratch->getDsqlStatement()->setType(
|
||||
legacy ? DsqlStatement::TYPE_SET_GENERATOR : DsqlStatement::TYPE_DDL);
|
||||
return this;
|
||||
}
|
||||
@ -2417,7 +2417,7 @@ public:
|
||||
public:
|
||||
virtual DdlNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
dsqlScratch->getStatement()->setType(
|
||||
dsqlScratch->getDsqlStatement()->setType(
|
||||
create ? DsqlStatement::TYPE_CREATE_DB : DsqlStatement::TYPE_DDL);
|
||||
return this;
|
||||
}
|
||||
|
@ -61,14 +61,14 @@ namespace {
|
||||
}
|
||||
|
||||
DsqlBatch::DsqlBatch(DsqlDmlRequest* req, const dsql_msg* /*message*/, IMessageMetadata* inMeta, ClumpletReader& pb)
|
||||
: m_request(req),
|
||||
: m_dsqlRequest(req),
|
||||
m_batch(NULL),
|
||||
m_meta(inMeta),
|
||||
m_messages(m_request->getPool()),
|
||||
m_blobs(m_request->getPool()),
|
||||
m_blobMap(m_request->getPool()),
|
||||
m_blobMeta(m_request->getPool()),
|
||||
m_defaultBpb(m_request->getPool()),
|
||||
m_messages(m_dsqlRequest->getPool()),
|
||||
m_blobs(m_dsqlRequest->getPool()),
|
||||
m_blobMap(m_dsqlRequest->getPool()),
|
||||
m_blobMeta(m_dsqlRequest->getPool()),
|
||||
m_defaultBpb(m_dsqlRequest->getPool()),
|
||||
m_messageSize(0),
|
||||
m_alignedMessage(0),
|
||||
m_alignment(0),
|
||||
@ -168,13 +168,13 @@ DsqlBatch::~DsqlBatch()
|
||||
{
|
||||
if (m_batch)
|
||||
m_batch->resetHandle();
|
||||
if (m_request)
|
||||
m_request->req_batch = NULL;
|
||||
if (m_dsqlRequest)
|
||||
m_dsqlRequest->req_batch = NULL;
|
||||
}
|
||||
|
||||
Attachment* DsqlBatch::getAttachment() const
|
||||
{
|
||||
return m_request->req_dbb->dbb_attachment;
|
||||
return m_dsqlRequest->req_dbb->dbb_attachment;
|
||||
}
|
||||
|
||||
void DsqlBatch::setInterfacePtr(JBatch* interfacePtr) throw()
|
||||
@ -205,13 +205,13 @@ DsqlBatch* DsqlBatch::open(thread_db* tdbb, DsqlDmlRequest* req, IMessageMetadat
|
||||
|
||||
// Sanity checks before creating batch
|
||||
|
||||
if (!req->getJrdRequest())
|
||||
if (!req->getRequest())
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) <<
|
||||
Arg::Gds(isc_unprepared_stmt));
|
||||
}
|
||||
|
||||
const DsqlStatement* statement = req->getStatement();
|
||||
const auto statement = req->getDsqlStatement();
|
||||
|
||||
if (statement->getFlags() & DsqlStatement::FLAG_ORPHAN)
|
||||
{
|
||||
@ -451,7 +451,7 @@ Firebird::IBatchCompletionState* DsqlBatch::execute(thread_db* tdbb)
|
||||
jrd_tra* transaction = tdbb->getTransaction();
|
||||
|
||||
// execution timer
|
||||
thread_db::TimerGuard timerGuard(tdbb, m_request->setupTimer(tdbb), true);
|
||||
thread_db::TimerGuard timerGuard(tdbb, m_dsqlRequest->setupTimer(tdbb), true);
|
||||
|
||||
// sync internal buffers
|
||||
m_messages.done();
|
||||
@ -651,20 +651,20 @@ private:
|
||||
}
|
||||
|
||||
// execute request
|
||||
m_request->req_transaction = transaction;
|
||||
jrd_req* req = m_request->getJrdRequest();
|
||||
m_dsqlRequest->req_transaction = transaction;
|
||||
jrd_req* req = m_dsqlRequest->getRequest();
|
||||
fb_assert(req);
|
||||
|
||||
// prepare completion interface
|
||||
AutoPtr<BatchCompletionState, SimpleDispose> completionState
|
||||
(FB_NEW BatchCompletionState(m_flags & (1 << IBatch::TAG_RECORD_COUNTS), m_detailed));
|
||||
AutoSetRestore<bool> batchFlag(&req->req_batch_mode, true);
|
||||
const dsql_msg* message = m_request->getStatement()->getSendMsg();
|
||||
const dsql_msg* message = m_dsqlRequest->getDsqlStatement()->getSendMsg();
|
||||
bool startRequest = true;
|
||||
|
||||
bool isExecBlock = m_request->getStatement()->getType() == DsqlStatement::TYPE_EXEC_BLOCK;
|
||||
const auto receiveMessage = isExecBlock ? m_request->getStatement()->getReceiveMsg() : nullptr;
|
||||
auto receiveMsgBuffer = isExecBlock ? m_request->req_msg_buffers[receiveMessage->msg_buffer_number] : nullptr;
|
||||
bool isExecBlock = m_dsqlRequest->getDsqlStatement()->getType() == DsqlStatement::TYPE_EXEC_BLOCK;
|
||||
const auto receiveMessage = isExecBlock ? m_dsqlRequest->getDsqlStatement()->getReceiveMsg() : nullptr;
|
||||
auto receiveMsgBuffer = isExecBlock ? m_dsqlRequest->req_msg_buffers[receiveMessage->msg_buffer_number] : nullptr;
|
||||
|
||||
// process messages
|
||||
ULONG remains;
|
||||
@ -720,11 +720,11 @@ private:
|
||||
}
|
||||
|
||||
// map message to internal engine format
|
||||
m_request->mapInOut(tdbb, false, message, m_meta, NULL, data);
|
||||
m_dsqlRequest->mapInOut(tdbb, false, message, m_meta, NULL, data);
|
||||
data += m_messageSize;
|
||||
remains -= m_messageSize;
|
||||
|
||||
UCHAR* msgBuffer = m_request->req_msg_buffers[message->msg_buffer_number];
|
||||
UCHAR* msgBuffer = m_dsqlRequest->req_msg_buffers[message->msg_buffer_number];
|
||||
try
|
||||
{
|
||||
// runsend data to request and collect stats
|
||||
|
@ -101,7 +101,7 @@ private:
|
||||
m_flags &= ~(1 << bit);
|
||||
}
|
||||
|
||||
DsqlDmlRequest* const m_request;
|
||||
DsqlDmlRequest* const m_dsqlRequest;
|
||||
JBatch* m_batch;
|
||||
Firebird::IMessageMetadata* m_meta;
|
||||
|
||||
|
@ -74,11 +74,11 @@ public:
|
||||
|
||||
public:
|
||||
DsqlCompilerScratch(MemoryPool& p, dsql_dbb* aDbb, jrd_tra* aTransaction,
|
||||
DsqlStatement* aStatement = nullptr, DsqlCompilerScratch* aMainScratch = nullptr)
|
||||
DsqlStatement* aDsqlStatement = nullptr, DsqlCompilerScratch* aMainScratch = nullptr)
|
||||
: BlrDebugWriter(p),
|
||||
dbb(aDbb),
|
||||
transaction(aTransaction),
|
||||
statement(aStatement),
|
||||
dsqlStatement(aDsqlStatement),
|
||||
flags(0),
|
||||
nestingLevel(0),
|
||||
relation(NULL),
|
||||
@ -144,7 +144,7 @@ public:
|
||||
public:
|
||||
virtual bool isVersion4()
|
||||
{
|
||||
return statement->getBlrVersion() == 4;
|
||||
return dsqlStatement->getBlrVersion() == 4;
|
||||
}
|
||||
|
||||
MemoryPool& getPool()
|
||||
@ -167,14 +167,14 @@ public:
|
||||
transaction = value;
|
||||
}
|
||||
|
||||
DsqlStatement* getStatement() const
|
||||
DsqlStatement* getDsqlStatement() const
|
||||
{
|
||||
return statement;
|
||||
return dsqlStatement;
|
||||
}
|
||||
|
||||
void setStatement(DsqlStatement* aStatement)
|
||||
void setDsqlStatement(DsqlStatement* aDsqlStatement)
|
||||
{
|
||||
statement = aStatement;
|
||||
dsqlStatement = aDsqlStatement;
|
||||
}
|
||||
|
||||
void putBlrMarkers(ULONG marks);
|
||||
@ -272,7 +272,7 @@ private:
|
||||
|
||||
dsql_dbb* dbb; // DSQL attachment
|
||||
jrd_tra* transaction; // Transaction
|
||||
DsqlStatement* statement; // Compiled statement
|
||||
DsqlStatement* dsqlStatement; // DSQL statement
|
||||
|
||||
public:
|
||||
unsigned flags; // flags
|
||||
|
@ -34,12 +34,12 @@ static const char* const SCRATCH = "fb_cursor_";
|
||||
static const ULONG PREFETCH_SIZE = 65536; // 64 KB
|
||||
|
||||
DsqlCursor::DsqlCursor(DsqlDmlRequest* req, ULONG flags)
|
||||
: m_request(req), m_message(req->getStatement()->getReceiveMsg()),
|
||||
: m_dsqlRequest(req), m_message(req->getDsqlStatement()->getReceiveMsg()),
|
||||
m_resultSet(NULL), m_flags(flags),
|
||||
m_space(req->getPool(), SCRATCH),
|
||||
m_state(BOS), m_eof(false), m_position(0), m_cachedCount(0)
|
||||
{
|
||||
TRA_link_cursor(m_request->req_transaction, this);
|
||||
TRA_link_cursor(m_dsqlRequest->req_transaction, this);
|
||||
}
|
||||
|
||||
DsqlCursor::~DsqlCursor()
|
||||
@ -50,12 +50,12 @@ DsqlCursor::~DsqlCursor()
|
||||
|
||||
jrd_tra* DsqlCursor::getTransaction() const
|
||||
{
|
||||
return m_request->req_transaction;
|
||||
return m_dsqlRequest->req_transaction;
|
||||
}
|
||||
|
||||
Attachment* DsqlCursor::getAttachment() const
|
||||
{
|
||||
return m_request->req_dbb->dbb_attachment;
|
||||
return m_dsqlRequest->req_dbb->dbb_attachment;
|
||||
}
|
||||
|
||||
void DsqlCursor::setInterfacePtr(JResultSet* interfacePtr) throw()
|
||||
@ -70,34 +70,34 @@ void DsqlCursor::close(thread_db* tdbb, DsqlCursor* cursor)
|
||||
return;
|
||||
|
||||
const auto attachment = cursor->getAttachment();
|
||||
const auto request = cursor->m_request;
|
||||
const auto dsqlRequest = cursor->m_dsqlRequest;
|
||||
|
||||
if (request->getJrdRequest())
|
||||
if (dsqlRequest->getRequest())
|
||||
{
|
||||
ThreadStatusGuard status_vector(tdbb);
|
||||
try
|
||||
{
|
||||
// Report some remaining fetches if any
|
||||
if (request->req_fetch_baseline)
|
||||
if (dsqlRequest->req_fetch_baseline)
|
||||
{
|
||||
TraceDSQLFetch trace(attachment, request);
|
||||
TraceDSQLFetch trace(attachment, dsqlRequest);
|
||||
trace.fetch(true, ITracePlugin::RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
if (request->req_traced && TraceManager::need_dsql_free(attachment))
|
||||
if (dsqlRequest->req_traced && TraceManager::need_dsql_free(attachment))
|
||||
{
|
||||
TraceSQLStatementImpl stmt(request, NULL);
|
||||
TraceSQLStatementImpl stmt(dsqlRequest, NULL);
|
||||
TraceManager::event_dsql_free(attachment, &stmt, DSQL_close);
|
||||
}
|
||||
|
||||
JRD_unwind_request(tdbb, request->getJrdRequest());
|
||||
JRD_unwind_request(tdbb, dsqlRequest->getRequest());
|
||||
}
|
||||
catch (Firebird::Exception&)
|
||||
{} // no-op
|
||||
}
|
||||
|
||||
request->req_cursor = NULL;
|
||||
TRA_unlink_cursor(request->req_transaction, cursor);
|
||||
dsqlRequest->req_cursor = NULL;
|
||||
TRA_unlink_cursor(dsqlRequest->req_transaction, cursor);
|
||||
delete cursor;
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ int DsqlCursor::fetchNext(thread_db* tdbb, UCHAR* buffer)
|
||||
{
|
||||
if (!(m_flags & IStatement::CURSOR_TYPE_SCROLLABLE))
|
||||
{
|
||||
m_eof = !m_request->fetch(tdbb, buffer);
|
||||
m_eof = !m_dsqlRequest->fetch(tdbb, buffer);
|
||||
|
||||
if (m_eof)
|
||||
{
|
||||
@ -223,13 +223,13 @@ int DsqlCursor::fetchFromCache(thread_db* tdbb, UCHAR* buffer, FB_UINT64 positio
|
||||
|
||||
fb_assert(position < m_cachedCount);
|
||||
|
||||
UCHAR* const msgBuffer = m_request->req_msg_buffers[m_message->msg_buffer_number];
|
||||
UCHAR* const msgBuffer = m_dsqlRequest->req_msg_buffers[m_message->msg_buffer_number];
|
||||
|
||||
const FB_UINT64 offset = position * m_message->msg_length;
|
||||
const FB_UINT64 readBytes = m_space.read(offset, msgBuffer, m_message->msg_length);
|
||||
fb_assert(readBytes == m_message->msg_length);
|
||||
|
||||
m_request->mapInOut(tdbb, true, m_message, NULL, buffer);
|
||||
m_dsqlRequest->mapInOut(tdbb, true, m_message, NULL, buffer);
|
||||
|
||||
m_position = position;
|
||||
m_state = POSITIONED;
|
||||
@ -241,13 +241,13 @@ bool DsqlCursor::cacheInput(thread_db* tdbb, FB_UINT64 position)
|
||||
fb_assert(!m_eof);
|
||||
|
||||
const ULONG prefetchCount = MAX(PREFETCH_SIZE / m_message->msg_length, 1);
|
||||
const UCHAR* const msgBuffer = m_request->req_msg_buffers[m_message->msg_buffer_number];
|
||||
const UCHAR* const msgBuffer = m_dsqlRequest->req_msg_buffers[m_message->msg_buffer_number];
|
||||
|
||||
while (position >= m_cachedCount)
|
||||
{
|
||||
for (ULONG count = 0; count < prefetchCount; count++)
|
||||
{
|
||||
if (!m_request->fetch(tdbb, NULL))
|
||||
if (!m_dsqlRequest->fetch(tdbb, NULL))
|
||||
{
|
||||
m_eof = true;
|
||||
break;
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
int fetchFromCache(thread_db* tdbb, UCHAR* buffer, FB_UINT64 position);
|
||||
bool cacheInput(thread_db* tdbb, FB_UINT64 position = MAX_UINT64);
|
||||
|
||||
DsqlDmlRequest* const m_request;
|
||||
DsqlDmlRequest* const m_dsqlRequest;
|
||||
const dsql_msg* const m_message;
|
||||
JResultSet* m_resultSet;
|
||||
const ULONG m_flags;
|
||||
|
@ -43,10 +43,10 @@ static void checkD(IStatus* st);
|
||||
|
||||
// DsqlRequest
|
||||
|
||||
DsqlRequest::DsqlRequest(MemoryPool& pool, dsql_dbb* dbb, DsqlStatement* aStatement)
|
||||
DsqlRequest::DsqlRequest(MemoryPool& pool, dsql_dbb* dbb, DsqlStatement* aDsqlStatement)
|
||||
: PermanentStorage(pool),
|
||||
req_dbb(dbb),
|
||||
statement(aStatement)
|
||||
dsqlStatement(aDsqlStatement)
|
||||
{
|
||||
}
|
||||
|
||||
@ -100,17 +100,17 @@ void DsqlRequest::setTimeout(unsigned int timeOut)
|
||||
|
||||
TimeoutTimer* DsqlRequest::setupTimer(thread_db* tdbb)
|
||||
{
|
||||
auto jrdRequest = getJrdRequest();
|
||||
auto request = getRequest();
|
||||
|
||||
if (jrdRequest)
|
||||
if (request)
|
||||
{
|
||||
if (jrdRequest->hasInternalStatement())
|
||||
if (request->hasInternalStatement())
|
||||
return req_timer;
|
||||
|
||||
jrdRequest->req_timeout = this->req_timeout;
|
||||
request->req_timeout = this->req_timeout;
|
||||
|
||||
fb_assert(!jrdRequest->req_caller);
|
||||
if (jrdRequest->req_caller)
|
||||
fb_assert(!request->req_caller);
|
||||
if (request->req_caller)
|
||||
{
|
||||
if (req_timer)
|
||||
req_timer->setup(0, 0);
|
||||
@ -146,8 +146,8 @@ TimeoutTimer* DsqlRequest::setupTimer(thread_db* tdbb)
|
||||
if (!req_timer && timeOut)
|
||||
{
|
||||
req_timer = FB_NEW TimeoutTimer();
|
||||
fb_assert(jrdRequest);
|
||||
jrdRequest->req_timer = this->req_timer;
|
||||
fb_assert(request);
|
||||
request->req_timer = this->req_timer;
|
||||
}
|
||||
|
||||
if (req_timer)
|
||||
@ -160,19 +160,19 @@ TimeoutTimer* DsqlRequest::setupTimer(thread_db* tdbb)
|
||||
}
|
||||
|
||||
// Release a dynamic request.
|
||||
void DsqlRequest::destroy(thread_db* tdbb, DsqlRequest* request)
|
||||
void DsqlRequest::destroy(thread_db* tdbb, DsqlRequest* dsqlRequest)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
if (request->req_timer)
|
||||
if (dsqlRequest->req_timer)
|
||||
{
|
||||
request->req_timer->stop();
|
||||
request->req_timer = nullptr;
|
||||
dsqlRequest->req_timer->stop();
|
||||
dsqlRequest->req_timer = nullptr;
|
||||
}
|
||||
|
||||
// If request is parent, orphan the children and release a portion of their requests
|
||||
|
||||
for (auto childStatement : request->cursors)
|
||||
for (auto childStatement : dsqlRequest->cursors)
|
||||
{
|
||||
childStatement->addFlags(DsqlStatement::FLAG_ORPHAN);
|
||||
childStatement->setParentRequest(nullptr);
|
||||
@ -189,37 +189,37 @@ void DsqlRequest::destroy(thread_db* tdbb, DsqlRequest* request)
|
||||
|
||||
// If the request had an open cursor, close it
|
||||
|
||||
if (request->req_cursor)
|
||||
DsqlCursor::close(tdbb, request->req_cursor);
|
||||
if (dsqlRequest->req_cursor)
|
||||
DsqlCursor::close(tdbb, dsqlRequest->req_cursor);
|
||||
|
||||
if (request->req_batch)
|
||||
if (dsqlRequest->req_batch)
|
||||
{
|
||||
delete request->req_batch;
|
||||
request->req_batch = nullptr;
|
||||
delete dsqlRequest->req_batch;
|
||||
dsqlRequest->req_batch = nullptr;
|
||||
}
|
||||
|
||||
Jrd::Attachment* att = request->req_dbb->dbb_attachment;
|
||||
const bool need_trace_free = request->req_traced && TraceManager::need_dsql_free(att);
|
||||
Jrd::Attachment* att = dsqlRequest->req_dbb->dbb_attachment;
|
||||
const bool need_trace_free = dsqlRequest->req_traced && TraceManager::need_dsql_free(att);
|
||||
if (need_trace_free)
|
||||
{
|
||||
TraceSQLStatementImpl stmt(request, NULL);
|
||||
TraceSQLStatementImpl stmt(dsqlRequest, NULL);
|
||||
TraceManager::event_dsql_free(att, &stmt, DSQL_drop);
|
||||
}
|
||||
|
||||
if (request->req_cursor_name.hasData())
|
||||
request->req_dbb->dbb_cursors.remove(request->req_cursor_name);
|
||||
if (dsqlRequest->req_cursor_name.hasData())
|
||||
dsqlRequest->req_dbb->dbb_cursors.remove(dsqlRequest->req_cursor_name);
|
||||
|
||||
// If a request has been compiled, release it now
|
||||
if (request->getJrdRequest())
|
||||
EXE_release(tdbb, request->getJrdRequest());
|
||||
if (dsqlRequest->getRequest())
|
||||
EXE_release(tdbb, dsqlRequest->getRequest());
|
||||
|
||||
// Increase the statement refCount so its pool is not destroyed before the request is gone.
|
||||
auto statement = request->getStatement();
|
||||
auto dsqlStatement = dsqlRequest->getDsqlStatement();
|
||||
|
||||
// Release the entire request
|
||||
delete request;
|
||||
delete dsqlRequest;
|
||||
|
||||
statement = nullptr;
|
||||
dsqlStatement = nullptr;
|
||||
}
|
||||
|
||||
// Parse the message of a request.
|
||||
@ -333,13 +333,13 @@ DsqlDmlRequest::DsqlDmlRequest(thread_db* tdbb, MemoryPool& pool, dsql_dbb* dbb,
|
||||
req_msg_buffers.add(msgBuffer);
|
||||
}
|
||||
|
||||
jrdRequest = aStatement->getJrdStatement()->findRequest(tdbb);
|
||||
tdbb->getAttachment()->att_requests.add(jrdRequest);
|
||||
request = aStatement->getStatement()->findRequest(tdbb);
|
||||
tdbb->getAttachment()->att_requests.add(request);
|
||||
}
|
||||
|
||||
JrdStatement* DsqlDmlRequest::getJrdStatement() const
|
||||
Statement* DsqlDmlRequest::getStatement() const
|
||||
{
|
||||
return jrdRequest ? jrdRequest->getStatement() : nullptr;
|
||||
return request ? request->getStatement() : nullptr;
|
||||
}
|
||||
|
||||
// Provide backward-compatibility
|
||||
@ -364,10 +364,8 @@ bool DsqlDmlRequest::fetch(thread_db* tdbb, UCHAR* msgBuffer)
|
||||
|
||||
Jrd::ContextPoolHolder context(tdbb, &getPool());
|
||||
|
||||
const auto statement = getStatement();
|
||||
|
||||
// if the cursor isn't open, we've got a problem
|
||||
if (statement->isCursorBased())
|
||||
if (dsqlStatement->isCursorBased())
|
||||
{
|
||||
if (!req_cursor)
|
||||
{
|
||||
@ -377,13 +375,13 @@ bool DsqlDmlRequest::fetch(thread_db* tdbb, UCHAR* msgBuffer)
|
||||
}
|
||||
}
|
||||
|
||||
if (!jrdRequest)
|
||||
if (!request)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) <<
|
||||
Arg::Gds(isc_unprepared_stmt));
|
||||
}
|
||||
|
||||
dsql_msg* message = (dsql_msg*) statement->getReceiveMsg();
|
||||
dsql_msg* message = (dsql_msg*) dsqlStatement->getReceiveMsg();
|
||||
|
||||
if (delayedFormat && message)
|
||||
{
|
||||
@ -410,11 +408,11 @@ bool DsqlDmlRequest::fetch(thread_db* tdbb, UCHAR* msgBuffer)
|
||||
fb_assert(tra == req_transaction);
|
||||
}
|
||||
else
|
||||
JRD_receive(tdbb, jrdRequest, message->msg_number, message->msg_length, dsqlMsgBuffer);
|
||||
JRD_receive(tdbb, request, message->msg_number, message->msg_length, dsqlMsgBuffer);
|
||||
|
||||
firstRowFetched = true;
|
||||
|
||||
const dsql_par* const eof = statement->getEof();
|
||||
const dsql_par* const eof = dsqlStatement->getEof();
|
||||
const USHORT* eofPtr = eof ? (USHORT*) (dsqlMsgBuffer + (IPTR) eof->par_desc.dsc_address) : NULL;
|
||||
const bool eofReached = eof && !(*eofPtr);
|
||||
|
||||
@ -517,7 +515,7 @@ DsqlCursor* DsqlDmlRequest::openCursor(thread_db* tdbb, jrd_tra** traHandle,
|
||||
|
||||
Jrd::ContextPoolHolder context(tdbb, &getPool());
|
||||
|
||||
if (statement->getFlags() & DsqlStatement::FLAG_ORPHAN)
|
||||
if (dsqlStatement->getFlags() & DsqlStatement::FLAG_ORPHAN)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
|
||||
Arg::Gds(isc_bad_req_handle));
|
||||
@ -533,7 +531,7 @@ DsqlCursor* DsqlDmlRequest::openCursor(thread_db* tdbb, jrd_tra** traHandle,
|
||||
|
||||
// Validate statement type
|
||||
|
||||
if (!statement->isCursorBased())
|
||||
if (!dsqlStatement->isCursorBased())
|
||||
Arg::Gds(isc_no_cursor).raise();
|
||||
|
||||
// Validate cursor or batch being not already open
|
||||
@ -569,28 +567,28 @@ void DsqlDmlRequest::doExecute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
bool singleton)
|
||||
{
|
||||
firstRowFetched = false;
|
||||
const dsql_msg* message = statement->getSendMsg();
|
||||
const dsql_msg* message = dsqlStatement->getSendMsg();
|
||||
|
||||
if (!message)
|
||||
JRD_start(tdbb, jrdRequest, req_transaction);
|
||||
JRD_start(tdbb, request, req_transaction);
|
||||
else
|
||||
{
|
||||
UCHAR* msgBuffer = req_msg_buffers[message->msg_buffer_number];
|
||||
JRD_start_and_send(tdbb, jrdRequest, req_transaction, message->msg_number,
|
||||
JRD_start_and_send(tdbb, request, req_transaction, message->msg_number,
|
||||
message->msg_length, msgBuffer);
|
||||
}
|
||||
|
||||
// Selectable execute block should get the "proc fetch" flag assigned,
|
||||
// which ensures that the savepoint stack is preserved while suspending
|
||||
if (statement->getType() == DsqlStatement::TYPE_SELECT_BLOCK)
|
||||
jrdRequest->req_flags |= req_proc_fetch;
|
||||
if (dsqlStatement->getType() == DsqlStatement::TYPE_SELECT_BLOCK)
|
||||
request->req_flags |= req_proc_fetch;
|
||||
|
||||
// TYPE_EXEC_BLOCK has no outputs so there are no out_msg
|
||||
// supplied from client side, but TYPE_EXEC_BLOCK requires
|
||||
// 2-byte message for EOS synchronization
|
||||
const bool isBlock = (statement->getType() == DsqlStatement::TYPE_EXEC_BLOCK);
|
||||
const bool isBlock = (dsqlStatement->getType() == DsqlStatement::TYPE_EXEC_BLOCK);
|
||||
|
||||
message = statement->getReceiveMsg();
|
||||
message = dsqlStatement->getReceiveMsg();
|
||||
|
||||
if (outMetadata == DELAYED_OUT_FORMAT)
|
||||
{
|
||||
@ -619,7 +617,7 @@ void DsqlDmlRequest::doExecute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
msgBuffer = FB_ALIGN(temp_buffer, FB_DOUBLE_ALIGN);
|
||||
}
|
||||
|
||||
JRD_receive(tdbb, jrdRequest, message->msg_number, message->msg_length, msgBuffer);
|
||||
JRD_receive(tdbb, request, message->msg_number, message->msg_length, msgBuffer);
|
||||
|
||||
if (outMsg)
|
||||
mapInOut(tdbb, true, message, NULL, outMsg);
|
||||
@ -647,7 +645,7 @@ void DsqlDmlRequest::doExecute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
|
||||
try
|
||||
{
|
||||
JRD_receive(tdbb, jrdRequest, message->msg_number,
|
||||
JRD_receive(tdbb, request, message->msg_number,
|
||||
message->msg_length, message_buffer);
|
||||
status = FB_SUCCESS;
|
||||
}
|
||||
@ -672,10 +670,10 @@ void DsqlDmlRequest::doExecute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
}
|
||||
}
|
||||
|
||||
switch (statement->getType())
|
||||
switch (dsqlStatement->getType())
|
||||
{
|
||||
case DsqlStatement::TYPE_UPDATE_CURSOR:
|
||||
if (!jrdRequest->req_records_updated)
|
||||
if (!request->req_records_updated)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-913) <<
|
||||
Arg::Gds(isc_deadlock) <<
|
||||
@ -684,7 +682,7 @@ void DsqlDmlRequest::doExecute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
break;
|
||||
|
||||
case DsqlStatement::TYPE_DELETE_CURSOR:
|
||||
if (!jrdRequest->req_records_deleted)
|
||||
if (!request->req_records_deleted)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-913) <<
|
||||
Arg::Gds(isc_deadlock) <<
|
||||
@ -706,7 +704,7 @@ void DsqlDmlRequest::execute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
IMessageMetadata* outMetadata, UCHAR* outMsg,
|
||||
bool singleton)
|
||||
{
|
||||
if (!jrdRequest)
|
||||
if (!request)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) <<
|
||||
Arg::Gds(isc_unprepared_stmt));
|
||||
@ -714,7 +712,7 @@ void DsqlDmlRequest::execute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
|
||||
// If there is no data required, just start the request
|
||||
|
||||
const dsql_msg* message = statement->getSendMsg();
|
||||
const dsql_msg* message = dsqlStatement->getSendMsg();
|
||||
if (message)
|
||||
mapInOut(tdbb, false, message, inMetadata, NULL, inMsg);
|
||||
|
||||
@ -723,7 +721,7 @@ void DsqlDmlRequest::execute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
TraceDSQLExecute trace(req_dbb->dbb_attachment, this);
|
||||
|
||||
// Setup and start timeout timer
|
||||
const bool have_cursor = statement->isCursorBased() && !singleton;
|
||||
const bool have_cursor = dsqlStatement->isCursorBased() && !singleton;
|
||||
|
||||
setupTimer(tdbb);
|
||||
thread_db::TimerGuard timerGuard(tdbb, req_timer, !have_cursor);
|
||||
@ -741,7 +739,7 @@ void DsqlDmlRequest::executeReceiveWithRestarts(thread_db* tdbb, jrd_tra** traHa
|
||||
IMessageMetadata* outMetadata, UCHAR* outMsg,
|
||||
bool singleton, bool exec, bool fetch)
|
||||
{
|
||||
jrdRequest->req_flags &= ~req_update_conflict;
|
||||
request->req_flags &= ~req_update_conflict;
|
||||
int numTries = 0;
|
||||
const int MAX_RESTARTS = 10;
|
||||
|
||||
@ -753,7 +751,7 @@ void DsqlDmlRequest::executeReceiveWithRestarts(thread_db* tdbb, jrd_tra** traHa
|
||||
// It allows to raise update conflict error (if any) as usual and
|
||||
// handle error by PSQL handler.
|
||||
const ULONG flag = (numTries >= MAX_RESTARTS) ? 0 : req_restart_ready;
|
||||
AutoSetRestoreFlag<ULONG> restartReady(&jrdRequest->req_flags, flag, true);
|
||||
AutoSetRestoreFlag<ULONG> restartReady(&request->req_flags, flag, true);
|
||||
try
|
||||
{
|
||||
if (exec)
|
||||
@ -761,24 +759,24 @@ void DsqlDmlRequest::executeReceiveWithRestarts(thread_db* tdbb, jrd_tra** traHa
|
||||
|
||||
if (fetch)
|
||||
{
|
||||
fb_assert(statement->isCursorBased());
|
||||
fb_assert(dsqlStatement->isCursorBased());
|
||||
|
||||
const dsql_msg* message = statement->getReceiveMsg();
|
||||
const dsql_msg* message = dsqlStatement->getReceiveMsg();
|
||||
|
||||
UCHAR* dsqlMsgBuffer = req_msg_buffers[message->msg_buffer_number];
|
||||
JRD_receive(tdbb, jrdRequest, message->msg_number, message->msg_length, dsqlMsgBuffer);
|
||||
JRD_receive(tdbb, request, message->msg_number, message->msg_length, dsqlMsgBuffer);
|
||||
}
|
||||
}
|
||||
catch (const status_exception&)
|
||||
{
|
||||
if (!(req_transaction->tra_flags & TRA_ex_restart))
|
||||
{
|
||||
jrdRequest->req_flags &= ~req_update_conflict;
|
||||
request->req_flags &= ~req_update_conflict;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(jrdRequest->req_flags & req_update_conflict))
|
||||
if (!(request->req_flags & req_update_conflict))
|
||||
{
|
||||
fb_assert((req_transaction->tra_flags & TRA_ex_restart) == 0);
|
||||
req_transaction->tra_flags &= ~TRA_ex_restart;
|
||||
@ -798,7 +796,7 @@ void DsqlDmlRequest::executeReceiveWithRestarts(thread_db* tdbb, jrd_tra** traHa
|
||||
|
||||
fb_assert((req_transaction->tra_flags & TRA_ex_restart) != 0);
|
||||
|
||||
jrdRequest->req_flags &= ~req_update_conflict;
|
||||
request->req_flags &= ~req_update_conflict;
|
||||
req_transaction->tra_flags &= ~TRA_ex_restart;
|
||||
fb_utils::init_status(tdbb->tdbb_status_vector);
|
||||
|
||||
@ -811,7 +809,7 @@ void DsqlDmlRequest::executeReceiveWithRestarts(thread_db* tdbb, jrd_tra** traHa
|
||||
{
|
||||
gds__log("Update conflict: unable to get a stable set of rows in the source tables\n"
|
||||
"\tafter %d attempts of restart.\n"
|
||||
"\tQuery:\n%s\n", numTries, jrdRequest->getStatement()->sqlText->c_str() );
|
||||
"\tQuery:\n%s\n", numTries, request->getStatement()->sqlText->c_str() );
|
||||
}
|
||||
|
||||
// When restart we must execute query
|
||||
@ -946,15 +944,15 @@ void DsqlDmlRequest::mapInOut(thread_db* tdbb, bool toExternal, const dsql_msg*
|
||||
Arg::Gds(isc_dsql_wrong_param_num) << Arg::Num(count) <<Arg::Num(count2));
|
||||
}
|
||||
|
||||
const auto statement = getStatement();
|
||||
const auto dsqlStatement = getDsqlStatement();
|
||||
const dsql_par* parameter;
|
||||
|
||||
const dsql_par* dbkey;
|
||||
if (!toExternal && (dbkey = statement->getParentDbKey()) &&
|
||||
(parameter = statement->getDbKey()))
|
||||
if (!toExternal && (dbkey = dsqlStatement->getParentDbKey()) &&
|
||||
(parameter = dsqlStatement->getDbKey()))
|
||||
{
|
||||
UCHAR* parentMsgBuffer = statement->getParentRequest() ?
|
||||
statement->getParentRequest()->req_msg_buffers[dbkey->par_message->msg_buffer_number] : NULL;
|
||||
UCHAR* parentMsgBuffer = dsqlStatement->getParentRequest() ?
|
||||
dsqlStatement->getParentRequest()->req_msg_buffers[dbkey->par_message->msg_buffer_number] : NULL;
|
||||
UCHAR* msgBuffer = req_msg_buffers[parameter->par_message->msg_buffer_number];
|
||||
|
||||
fb_assert(parentMsgBuffer);
|
||||
@ -979,11 +977,11 @@ void DsqlDmlRequest::mapInOut(thread_db* tdbb, bool toExternal, const dsql_msg*
|
||||
}
|
||||
|
||||
const dsql_par* rec_version;
|
||||
if (!toExternal && (rec_version = statement->getParentRecVersion()) &&
|
||||
(parameter = statement->getRecVersion()))
|
||||
if (!toExternal && (rec_version = dsqlStatement->getParentRecVersion()) &&
|
||||
(parameter = dsqlStatement->getRecVersion()))
|
||||
{
|
||||
UCHAR* parentMsgBuffer = statement->getParentRequest() ?
|
||||
statement->getParentRequest()->req_msg_buffers[rec_version->par_message->msg_buffer_number] :
|
||||
UCHAR* parentMsgBuffer = dsqlStatement->getParentRequest() ?
|
||||
dsqlStatement->getParentRequest()->req_msg_buffers[rec_version->par_message->msg_buffer_number] :
|
||||
NULL;
|
||||
UCHAR* msgBuffer = req_msg_buffers[parameter->par_message->msg_buffer_number];
|
||||
|
||||
@ -1013,7 +1011,7 @@ void DsqlDmlRequest::mapInOut(thread_db* tdbb, bool toExternal, const dsql_msg*
|
||||
// DsqlDdlRequest
|
||||
|
||||
DsqlDdlRequest::DsqlDdlRequest(MemoryPool& pool, dsql_dbb* dbb, DsqlCompilerScratch* aInternalScratch, DdlNode* aNode)
|
||||
: DsqlRequest(pool, dbb, aInternalScratch->getStatement()),
|
||||
: DsqlRequest(pool, dbb, aInternalScratch->getDsqlStatement()),
|
||||
internalScratch(aInternalScratch),
|
||||
node(aNode)
|
||||
{
|
||||
@ -1043,7 +1041,7 @@ void DsqlDdlRequest::execute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
(internalScratch->flags & DsqlCompilerScratch::FLAG_INTERNAL_REQUEST);
|
||||
|
||||
if (!isInternalRequest && node->mustBeReplicated())
|
||||
REPL_exec_sql(tdbb, req_transaction, getStatement()->getOrgText());
|
||||
REPL_exec_sql(tdbb, req_transaction, getDsqlStatement()->getOrgText());
|
||||
}
|
||||
catch (status_exception& ex)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class DsqlDmlStatement;
|
||||
class dsql_par;
|
||||
class jrd_req;
|
||||
class jrd_tra;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class SessionManagementNode;
|
||||
class TransactionNode;
|
||||
|
||||
@ -60,17 +60,17 @@ public:
|
||||
return req_transaction;
|
||||
}
|
||||
|
||||
Firebird::RefPtr<DsqlStatement> getStatement()
|
||||
Firebird::RefPtr<DsqlStatement> getDsqlStatement()
|
||||
{
|
||||
return statement;
|
||||
return dsqlStatement;
|
||||
}
|
||||
|
||||
virtual JrdStatement* getJrdStatement() const
|
||||
virtual Statement* getStatement() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual jrd_req* getJrdRequest() const
|
||||
virtual jrd_req* getRequest() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@ -126,7 +126,7 @@ public:
|
||||
|
||||
public:
|
||||
dsql_dbb* req_dbb; // DSQL attachment
|
||||
Firebird::RefPtr<DsqlStatement> statement;
|
||||
Firebird::RefPtr<DsqlStatement> dsqlStatement;
|
||||
Firebird::Array<DsqlDmlStatement*> cursors{getPool()}; // Cursor update statements
|
||||
|
||||
jrd_tra* req_transaction = nullptr; // JRD transaction
|
||||
@ -150,19 +150,19 @@ protected:
|
||||
class DsqlDmlRequest final : public DsqlRequest
|
||||
{
|
||||
public:
|
||||
DsqlDmlRequest(thread_db* tdbb, MemoryPool& pool, dsql_dbb* dbb, DsqlStatement* aStatement);
|
||||
DsqlDmlRequest(thread_db* tdbb, MemoryPool& pool, dsql_dbb* dbb, DsqlStatement* aDsqlStatement);
|
||||
|
||||
// Reintroduce method to fake covariant return type with RefPtr.
|
||||
auto getStatement()
|
||||
auto getDsqlStatement()
|
||||
{
|
||||
return Firebird::RefPtr<DsqlDmlStatement>((DsqlDmlStatement*) statement.getPtr());
|
||||
return Firebird::RefPtr<DsqlDmlStatement>((DsqlDmlStatement*) dsqlStatement.getPtr());
|
||||
}
|
||||
|
||||
JrdStatement* getJrdStatement() const override;
|
||||
Statement* getStatement() const override;
|
||||
|
||||
jrd_req* getJrdRequest() const override
|
||||
jrd_req* getRequest() const override
|
||||
{
|
||||
return jrdRequest;
|
||||
return request;
|
||||
}
|
||||
|
||||
bool isDml() const override
|
||||
@ -209,7 +209,7 @@ public:
|
||||
|
||||
private:
|
||||
Firebird::RefPtr<Firebird::IMessageMetadata> delayedFormat;
|
||||
jrd_req* jrdRequest = nullptr;
|
||||
jrd_req* request = nullptr;
|
||||
bool needDelayedFormat = false;
|
||||
bool firstRowFetched = false;
|
||||
};
|
||||
|
@ -103,14 +103,14 @@ void DsqlDmlStatement::doRelease()
|
||||
parent->cursors.remove(pos);
|
||||
}
|
||||
|
||||
if (jrdStatement)
|
||||
if (statement)
|
||||
{
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
ThreadStatusGuard status_vector(tdbb);
|
||||
|
||||
try
|
||||
{
|
||||
jrdStatement->release(tdbb);
|
||||
statement->release(tdbb);
|
||||
}
|
||||
catch (Exception&)
|
||||
{} // no-op
|
||||
@ -127,9 +127,9 @@ void DsqlDmlStatement::dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch, n
|
||||
}
|
||||
|
||||
if (scratch->clientDialect > SQL_DIALECT_V5)
|
||||
scratch->getStatement()->setBlrVersion(5);
|
||||
scratch->getDsqlStatement()->setBlrVersion(5);
|
||||
else
|
||||
scratch->getStatement()->setBlrVersion(4);
|
||||
scratch->getDsqlStatement()->setBlrVersion(4);
|
||||
|
||||
GEN_statement(scratch, node);
|
||||
|
||||
@ -171,17 +171,17 @@ void DsqlDmlStatement::dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch, n
|
||||
const auto& blr = scratch->getBlrData();
|
||||
const auto& debugData = scratch->getDebugData();
|
||||
|
||||
jrdStatement = CMP_compile(tdbb, blr.begin(), blr.getCount(),
|
||||
statement = CMP_compile(tdbb, blr.begin(), blr.getCount(),
|
||||
(scratch->flags & DsqlCompilerScratch::FLAG_INTERNAL_REQUEST),
|
||||
debugData.getCount(), debugData.begin());
|
||||
|
||||
if (getSqlText())
|
||||
jrdStatement->sqlText = getSqlText();
|
||||
statement->sqlText = getSqlText();
|
||||
|
||||
fb_assert(jrdStatement->blr.isEmpty());
|
||||
fb_assert(statement->blr.isEmpty());
|
||||
|
||||
if (attachment->getDebugOptions().getDsqlKeepBlr())
|
||||
jrdStatement->blr.insert(0, blr.begin(), blr.getCount());
|
||||
statement->blr.insert(0, blr.begin(), blr.getCount());
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
@ -264,9 +264,9 @@ void DsqlDdlStatement::dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch, n
|
||||
}
|
||||
|
||||
if (scratch->clientDialect > SQL_DIALECT_V5)
|
||||
scratch->getStatement()->setBlrVersion(5);
|
||||
scratch->getDsqlStatement()->setBlrVersion(5);
|
||||
else
|
||||
scratch->getStatement()->setBlrVersion(4);
|
||||
scratch->getDsqlStatement()->setBlrVersion(4);
|
||||
|
||||
this->scratch = scratch;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class dsql_msg;
|
||||
class dsql_par;
|
||||
class DsqlRequest;
|
||||
class DsqlCompilerScratch;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class SessionManagementNode;
|
||||
class TransactionNode;
|
||||
|
||||
@ -134,7 +134,7 @@ public:
|
||||
void setEof(dsql_par* value) { eof = value; }
|
||||
|
||||
public:
|
||||
virtual JrdStatement* getJrdStatement() const
|
||||
virtual Statement* getStatement() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@ -182,9 +182,9 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
JrdStatement* getJrdStatement() const override
|
||||
Statement* getStatement() const override
|
||||
{
|
||||
return jrdStatement;
|
||||
return statement;
|
||||
}
|
||||
|
||||
void dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch, ntrace_result_t* traceResult) override;
|
||||
@ -214,7 +214,7 @@ protected:
|
||||
|
||||
private:
|
||||
NestConst<StmtNode> node;
|
||||
JrdStatement* jrdStatement = nullptr;
|
||||
Statement* statement = nullptr;
|
||||
dsql_par* dbKey = nullptr; // Database key for current of
|
||||
dsql_par* recVersion = nullptr; // Record Version for current of
|
||||
dsql_par* parentRecVersion = nullptr; // parent record version
|
||||
|
@ -9484,7 +9484,7 @@ ValueExprNode* ParameterNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
|
||||
auto msg = dsqlMessage ? dsqlMessage :
|
||||
dsqlParameter ? dsqlParameter->par_message :
|
||||
dsqlScratch->getStatement()->getSendMsg();
|
||||
dsqlScratch->getDsqlStatement()->getSendMsg();
|
||||
|
||||
auto node = FB_NEW_POOL(dsqlScratch->getPool()) ParameterNode(dsqlScratch->getPool());
|
||||
node->dsqlParameter = MAKE_parameter(msg, true, true, dsqlParameterIndex, nullptr);
|
||||
@ -9556,7 +9556,7 @@ bool ParameterNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
|
||||
|
||||
if (!dsqlParameter)
|
||||
{
|
||||
dsqlParameter = MAKE_parameter(dsqlScratch->getStatement()->getSendMsg(), true, true,
|
||||
dsqlParameter = MAKE_parameter(dsqlScratch->getDsqlStatement()->getSendMsg(), true, true,
|
||||
dsqlParameterIndex, NULL);
|
||||
dsqlParameterIndex = dsqlParameter->par_index;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public:
|
||||
|
||||
virtual DdlNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_DDL);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_DDL);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ public:
|
||||
{
|
||||
Node::dsqlPass(dsqlScratch);
|
||||
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_SESSION_MANAGEMENT);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_SESSION_MANAGEMENT);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -2076,7 +2076,7 @@ void DeclareSubProcNode::genBlr(DsqlCompilerScratch* dsqlScratch)
|
||||
dsqlScratch->appendUChar(SUB_ROUTINE_TYPE_PSQL);
|
||||
|
||||
dsqlScratch->appendUChar(
|
||||
blockScratch->getStatement()->getFlags() & DsqlStatement::FLAG_SELECTABLE ? 1 : 0);
|
||||
blockScratch->getDsqlStatement()->getFlags() & DsqlStatement::FLAG_SELECTABLE ? 1 : 0);
|
||||
|
||||
genParameters(dsqlScratch, dsqlBlock->parameters);
|
||||
genParameters(dsqlScratch, dsqlBlock->returns);
|
||||
@ -2290,7 +2290,7 @@ StmtNode* EraseNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
return SavepointEncloseNode::make(dsqlScratch->getPool(), dsqlScratch, node);
|
||||
}
|
||||
|
||||
dsqlScratch->getStatement()->setType(dsqlCursorName.hasData() ?
|
||||
dsqlScratch->getDsqlStatement()->setType(dsqlCursorName.hasData() ?
|
||||
DsqlStatement::TYPE_DELETE_CURSOR : DsqlStatement::TYPE_DELETE);
|
||||
|
||||
// Generate record selection expression.
|
||||
@ -2377,7 +2377,7 @@ void EraseNode::genBlr(DsqlCompilerScratch* dsqlScratch)
|
||||
else
|
||||
{
|
||||
dsqlScratch->appendUChar(blr_send);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getStatement()->getReceiveMsg()->msg_number);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getDsqlStatement()->getReceiveMsg()->msg_number);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2990,7 +2990,7 @@ ExecProcedureNode* ExecProcedureNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
}
|
||||
|
||||
if (!dsqlScratch->isPsql())
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_EXEC_PROCEDURE);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_EXEC_PROCEDURE);
|
||||
|
||||
ExecProcedureNode* node = FB_NEW_POOL(dsqlScratch->getPool()) ExecProcedureNode(dsqlScratch->getPool(), dsqlName);
|
||||
node->dsqlProcedure = procedure;
|
||||
@ -3081,7 +3081,7 @@ ValueListNode* ExecProcedureNode::explodeOutputs(DsqlCompilerScratch* dsqlScratc
|
||||
*ptr = paramNode;
|
||||
|
||||
dsql_par* parameter = paramNode->dsqlParameter = MAKE_parameter(
|
||||
dsqlScratch->getStatement()->getReceiveMsg(), true, true, 0, NULL);
|
||||
dsqlScratch->getDsqlStatement()->getReceiveMsg(), true, true, 0, NULL);
|
||||
paramNode->dsqlParameterIndex = parameter->par_index;
|
||||
|
||||
DsqlDescMaker::fromField(¶meter->par_desc, field);
|
||||
@ -3112,9 +3112,9 @@ void ExecProcedureNode::genBlr(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
const dsql_msg* message = NULL;
|
||||
|
||||
if (dsqlScratch->getStatement()->getType() == DsqlStatement::TYPE_EXEC_PROCEDURE)
|
||||
if (dsqlScratch->getDsqlStatement()->getType() == DsqlStatement::TYPE_EXEC_PROCEDURE)
|
||||
{
|
||||
if ((message = dsqlScratch->getStatement()->getReceiveMsg()))
|
||||
if ((message = dsqlScratch->getDsqlStatement()->getReceiveMsg()))
|
||||
{
|
||||
dsqlScratch->appendUChar(blr_begin);
|
||||
dsqlScratch->appendUChar(blr_send);
|
||||
@ -4267,7 +4267,7 @@ const StmtNode* InitVariableNode::execute(thread_db* tdbb, jrd_req* request, Exe
|
||||
|
||||
ExecBlockNode* ExecBlockNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
DsqlStatement* const statement = dsqlScratch->getStatement();
|
||||
DsqlStatement* const statement = dsqlScratch->getDsqlStatement();
|
||||
|
||||
if (returns.hasData())
|
||||
statement->setType(DsqlStatement::TYPE_SELECT_BLOCK);
|
||||
@ -4404,7 +4404,7 @@ void ExecBlockNode::genBlr(DsqlCompilerScratch* dsqlScratch)
|
||||
}
|
||||
}
|
||||
|
||||
DsqlStatement* const statement = dsqlScratch->getStatement();
|
||||
DsqlStatement* const statement = dsqlScratch->getDsqlStatement();
|
||||
|
||||
dsqlScratch->appendUChar(blr_begin);
|
||||
|
||||
@ -5968,7 +5968,7 @@ StmtNode* MergeNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
if (!dsqlScratch->isPsql())
|
||||
{
|
||||
// Describe it as TYPE_RETURNING_CURSOR if RETURNING is present or as INSERT otherwise.
|
||||
dsqlScratch->getStatement()->setType(returning ?
|
||||
dsqlScratch->getDsqlStatement()->setType(returning ?
|
||||
DsqlStatement::TYPE_RETURNING_CURSOR :
|
||||
DsqlStatement::TYPE_INSERT);
|
||||
}
|
||||
@ -6529,7 +6529,7 @@ StmtNode* ModifyNode::internalDsqlPass(DsqlCompilerScratch* dsqlScratch, bool up
|
||||
return node;
|
||||
}
|
||||
|
||||
dsqlScratch->getStatement()->setType(dsqlCursorName.hasData() ?
|
||||
dsqlScratch->getDsqlStatement()->setType(dsqlCursorName.hasData() ?
|
||||
DsqlStatement::TYPE_UPDATE_CURSOR : DsqlStatement::TYPE_UPDATE);
|
||||
|
||||
doDsqlPass(dsqlScratch, node->dsqlRelation, relation, false);
|
||||
@ -6656,7 +6656,7 @@ void ModifyNode::genBlr(DsqlCompilerScratch* dsqlScratch)
|
||||
else
|
||||
{
|
||||
dsqlScratch->appendUChar(blr_send);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getStatement()->getReceiveMsg()->msg_number);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getDsqlStatement()->getReceiveMsg()->msg_number);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7461,7 +7461,7 @@ StmtNode* StoreNode::internalDsqlPass(DsqlCompilerScratch* dsqlScratch,
|
||||
{
|
||||
DsqlContextStack::AutoRestore autoContext(*dsqlScratch->context);
|
||||
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_INSERT);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_INSERT);
|
||||
|
||||
const auto node = FB_NEW_POOL(dsqlScratch->getPool()) StoreNode(dsqlScratch->getPool());
|
||||
node->overrideClause = overrideClause;
|
||||
@ -7671,7 +7671,7 @@ void StoreNode::genBlr(DsqlCompilerScratch* dsqlScratch)
|
||||
else if (!(dsqlScratch->flags & DsqlCompilerScratch::FLAG_UPDATE_OR_INSERT))
|
||||
{
|
||||
dsqlScratch->appendUChar(blr_send);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getStatement()->getReceiveMsg()->msg_number);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getDsqlStatement()->getReceiveMsg()->msg_number);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8164,8 +8164,8 @@ SelectNode* SelectNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
|
||||
if (dsqlForUpdate)
|
||||
{
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_SELECT_UPD);
|
||||
dsqlScratch->getStatement()->addFlags(DsqlStatement::FLAG_NO_BATCH);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_SELECT_UPD);
|
||||
dsqlScratch->getDsqlStatement()->addFlags(DsqlStatement::FLAG_NO_BATCH);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -8177,8 +8177,8 @@ SelectNode* SelectNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
|
||||
if (rseNode->dsqlOrder || rseNode->dsqlDistinct)
|
||||
{
|
||||
dsqlScratch->getStatement()->setFlags(
|
||||
dsqlScratch->getStatement()->getFlags() & ~DsqlStatement::FLAG_NO_BATCH);
|
||||
dsqlScratch->getDsqlStatement()->setFlags(
|
||||
dsqlScratch->getDsqlStatement()->getFlags() & ~DsqlStatement::FLAG_NO_BATCH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8204,7 +8204,7 @@ void SelectNode::genBlr(DsqlCompilerScratch* dsqlScratch)
|
||||
RseNode* const rse = nodeAs<RseNode>(dsqlRse);
|
||||
fb_assert(rse);
|
||||
|
||||
DsqlStatement* const statement = dsqlScratch->getStatement();
|
||||
DsqlStatement* const statement = dsqlScratch->getDsqlStatement();
|
||||
|
||||
// Set up parameter for things in the select list.
|
||||
ValueListNode* list = rse->dsqlSelectList;
|
||||
@ -8532,7 +8532,7 @@ DmlNode* SuspendNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch*
|
||||
|
||||
SuspendNode* SuspendNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
DsqlStatement* const statement = dsqlScratch->getStatement();
|
||||
DsqlStatement* const statement = dsqlScratch->getDsqlStatement();
|
||||
|
||||
if (dsqlScratch->flags & (DsqlCompilerScratch::FLAG_TRIGGER | DsqlCompilerScratch::FLAG_FUNCTION))
|
||||
{
|
||||
@ -8790,7 +8790,7 @@ const StmtNode* SavepointEncloseNode::execute(thread_db* tdbb, jrd_req* request,
|
||||
|
||||
SetTransactionNode* SetTransactionNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_START_TRANS);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_START_TRANS);
|
||||
|
||||
// Generate tpb for set transaction. Use blr string of dsqlScratch.
|
||||
// If a value is not specified, default is not stuffed, let the engine handle it.
|
||||
@ -9365,7 +9365,7 @@ StmtNode* UpdateOrInsertNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
|
||||
// If RETURNING is present, type is already DsqlStatement::TYPE_EXEC_PROCEDURE.
|
||||
if (!returning)
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_INSERT);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_INSERT);
|
||||
|
||||
return SavepointEncloseNode::make(dsqlScratch->getPool(), dsqlScratch, node);
|
||||
}
|
||||
@ -9438,12 +9438,12 @@ CommitRollbackNode* CommitRollbackNode::dsqlPass(DsqlCompilerScratch* dsqlScratc
|
||||
switch (command)
|
||||
{
|
||||
case CMD_COMMIT:
|
||||
dsqlScratch->getStatement()->setType(retain ?
|
||||
dsqlScratch->getDsqlStatement()->setType(retain ?
|
||||
DsqlStatement::TYPE_COMMIT_RETAIN : DsqlStatement::TYPE_COMMIT);
|
||||
break;
|
||||
|
||||
case CMD_ROLLBACK:
|
||||
dsqlScratch->getStatement()->setType(retain ?
|
||||
dsqlScratch->getDsqlStatement()->setType(retain ?
|
||||
DsqlStatement::TYPE_ROLLBACK_RETAIN : DsqlStatement::TYPE_ROLLBACK);
|
||||
break;
|
||||
}
|
||||
@ -9499,7 +9499,7 @@ Firebird::string UserSavepointNode::internalPrint(NodePrinter& printer) const
|
||||
|
||||
UserSavepointNode* UserSavepointNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
dsqlScratch->getStatement()->setType(DsqlStatement::TYPE_SAVEPOINT);
|
||||
dsqlScratch->getDsqlStatement()->setType(DsqlStatement::TYPE_SAVEPOINT);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -9666,7 +9666,7 @@ static void dsqlGenEofAssignment(DsqlCompilerScratch* dsqlScratch, SSHORT value)
|
||||
|
||||
dsqlScratch->appendUChar(blr_assignment);
|
||||
LiteralNode::genConstant(dsqlScratch, &valueDesc, false);
|
||||
GEN_parameter(dsqlScratch, dsqlScratch->getStatement()->getEof());
|
||||
GEN_parameter(dsqlScratch, dsqlScratch->getDsqlStatement()->getEof());
|
||||
}
|
||||
|
||||
static void dsqlGenReturning(DsqlCompilerScratch* dsqlScratch, ReturningClause* returning,
|
||||
@ -9734,7 +9734,7 @@ static void dsqlGenReturningLocalTableCursor(DsqlCompilerScratch* dsqlScratch, R
|
||||
dsqlScratch->appendUChar(blr_end);
|
||||
|
||||
dsqlScratch->appendUChar(blr_send);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getStatement()->getReceiveMsg()->msg_number);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getDsqlStatement()->getReceiveMsg()->msg_number);
|
||||
|
||||
dsqlScratch->appendUChar(blr_begin);
|
||||
|
||||
@ -9752,7 +9752,7 @@ static void dsqlGenReturningLocalTableCursor(DsqlCompilerScratch* dsqlScratch, R
|
||||
dsqlScratch->appendUChar(blr_end);
|
||||
|
||||
dsqlScratch->appendUChar(blr_send);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getStatement()->getReceiveMsg()->msg_number);
|
||||
dsqlScratch->appendUChar(dsqlScratch->getDsqlStatement()->getReceiveMsg()->msg_number);
|
||||
dsqlGenEofAssignment(dsqlScratch, 0);
|
||||
}
|
||||
|
||||
@ -10004,8 +10004,8 @@ static RseNode* dsqlPassCursorReference(DsqlCompilerScratch* dsqlScratch, const
|
||||
|
||||
// Verify that the cursor is appropriate and updatable
|
||||
|
||||
dsql_par* source = dsqlFindDbKey(parent->getStatement(), relation_name);
|
||||
dsql_par* rv_source = dsqlFindRecordVersion(parent->getStatement(), relation_name);
|
||||
dsql_par* source = dsqlFindDbKey(parent->getDsqlStatement(), relation_name);
|
||||
dsql_par* rv_source = dsqlFindRecordVersion(parent->getDsqlStatement(), relation_name);
|
||||
|
||||
if (!source || !rv_source)
|
||||
{
|
||||
@ -10014,7 +10014,7 @@ static RseNode* dsqlPassCursorReference(DsqlCompilerScratch* dsqlScratch, const
|
||||
Arg::Gds(isc_dsql_cursor_update_err) << cursor);
|
||||
}
|
||||
|
||||
const auto statement = static_cast<DsqlDmlStatement*>(dsqlScratch->getStatement());
|
||||
const auto statement = static_cast<DsqlDmlStatement*>(dsqlScratch->getDsqlStatement());
|
||||
|
||||
statement->setParentRequest(parent);
|
||||
statement->setParentDbKey(source);
|
||||
@ -10261,7 +10261,7 @@ static ReturningClause* dsqlProcessReturning(DsqlCompilerScratch* dsqlScratch, d
|
||||
|
||||
for (auto& src : node->first->items)
|
||||
{
|
||||
auto parameter = MAKE_parameter(dsqlScratch->getStatement()->getReceiveMsg(),
|
||||
auto parameter = MAKE_parameter(dsqlScratch->getDsqlStatement()->getReceiveMsg(),
|
||||
true, true, 0, src);
|
||||
parameter->par_node = src;
|
||||
DsqlDescMaker::fromNode(dsqlScratch, ¶meter->par_desc, src, true);
|
||||
@ -10278,8 +10278,8 @@ static ReturningClause* dsqlProcessReturning(DsqlCompilerScratch* dsqlScratch, d
|
||||
if (!singleton)
|
||||
{
|
||||
// Set up parameter to handle EOF
|
||||
auto parameter = MAKE_parameter(dsqlScratch->getStatement()->getReceiveMsg(), false, false, 0, nullptr);
|
||||
dsqlScratch->getStatement()->setEof(parameter);
|
||||
auto parameter = MAKE_parameter(dsqlScratch->getDsqlStatement()->getReceiveMsg(), false, false, 0, nullptr);
|
||||
dsqlScratch->getDsqlStatement()->setEof(parameter);
|
||||
parameter->par_desc.dsc_dtype = dtype_short;
|
||||
parameter->par_desc.dsc_scale = 0;
|
||||
parameter->par_desc.dsc_length = sizeof(SSHORT);
|
||||
@ -10289,7 +10289,7 @@ static ReturningClause* dsqlProcessReturning(DsqlCompilerScratch* dsqlScratch, d
|
||||
|
||||
if (!dsqlScratch->isPsql())
|
||||
{
|
||||
dsqlScratch->getStatement()->setType(singleton ?
|
||||
dsqlScratch->getDsqlStatement()->setType(singleton ?
|
||||
DsqlStatement::TYPE_EXEC_PROCEDURE : DsqlStatement::TYPE_RETURNING_CURSOR);
|
||||
}
|
||||
|
||||
|
@ -1473,9 +1473,9 @@ public:
|
||||
|
||||
// Save and reset the statement type, as SessionManagementNode sets it to TYPE_SESSION_MANAGEMENT but
|
||||
// we are a DML statement.
|
||||
DsqlStatement::Type statementType = dsqlScratch->getStatement()->getType();
|
||||
DsqlStatement::Type statementType = dsqlScratch->getDsqlStatement()->getType();
|
||||
wrapped->dsqlPass(dsqlScratch);
|
||||
dsqlScratch->getStatement()->setType(statementType);
|
||||
dsqlScratch->getDsqlStatement()->setType(statementType);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -117,15 +117,15 @@ dsql_dbb::~dsql_dbb()
|
||||
// Execute a dynamic SQL statement.
|
||||
void DSQL_execute(thread_db* tdbb,
|
||||
jrd_tra** tra_handle,
|
||||
DsqlRequest* request,
|
||||
DsqlRequest* dsqlRequest,
|
||||
IMessageMetadata* in_meta, const UCHAR* in_msg,
|
||||
IMessageMetadata* out_meta, UCHAR* out_msg)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Jrd::ContextPoolHolder context(tdbb, &request->getPool());
|
||||
Jrd::ContextPoolHolder context(tdbb, &dsqlRequest->getPool());
|
||||
|
||||
const DsqlStatement* statement = request->getStatement();
|
||||
const auto statement = dsqlRequest->getDsqlStatement();
|
||||
|
||||
if (statement->getFlags() & DsqlStatement::FLAG_ORPHAN)
|
||||
{
|
||||
@ -151,7 +151,7 @@ void DSQL_execute(thread_db* tdbb,
|
||||
|
||||
if (statement->isCursorBased())
|
||||
{
|
||||
if (request->req_cursor)
|
||||
if (dsqlRequest->req_cursor)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) <<
|
||||
Arg::Gds(isc_dsql_cursor_open_err));
|
||||
@ -161,8 +161,8 @@ void DSQL_execute(thread_db* tdbb,
|
||||
(Arg::Gds(isc_random) << "Cannot execute SELECT statement").raise();
|
||||
}
|
||||
|
||||
request->req_transaction = *tra_handle;
|
||||
request->execute(tdbb, tra_handle, in_meta, in_msg, out_meta, out_msg, singleton);
|
||||
dsqlRequest->req_transaction = *tra_handle;
|
||||
dsqlRequest->execute(tdbb, tra_handle, in_meta, in_msg, out_meta, out_msg, singleton);
|
||||
}
|
||||
|
||||
|
||||
@ -178,33 +178,33 @@ void DSQL_execute(thread_db* tdbb,
|
||||
@param option
|
||||
|
||||
**/
|
||||
void DSQL_free_statement(thread_db* tdbb, DsqlRequest* request, USHORT option)
|
||||
void DSQL_free_statement(thread_db* tdbb, DsqlRequest* dsqlRequest, USHORT option)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Jrd::ContextPoolHolder context(tdbb, &request->getPool());
|
||||
Jrd::ContextPoolHolder context(tdbb, &dsqlRequest->getPool());
|
||||
|
||||
const DsqlStatement* statement = request->getStatement();
|
||||
const auto dsqlStatement = dsqlRequest->getDsqlStatement();
|
||||
|
||||
fb_assert(!(option & DSQL_unprepare)); // handled in y-valve
|
||||
|
||||
if (option & DSQL_drop)
|
||||
{
|
||||
// Release everything associated with the request
|
||||
DsqlRequest::destroy(tdbb, request);
|
||||
DsqlRequest::destroy(tdbb, dsqlRequest);
|
||||
}
|
||||
else if (option & DSQL_close)
|
||||
{
|
||||
// Just close the cursor associated with the request
|
||||
if (statement->isCursorBased())
|
||||
if (dsqlStatement->isCursorBased())
|
||||
{
|
||||
if (!request->req_cursor)
|
||||
if (!dsqlRequest->req_cursor)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-501) <<
|
||||
Arg::Gds(isc_dsql_cursor_close_err));
|
||||
}
|
||||
|
||||
DsqlCursor::close(tdbb, request->req_cursor);
|
||||
DsqlCursor::close(tdbb, dsqlRequest->req_cursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,18 +238,18 @@ DsqlRequest* DSQL_prepare(thread_db* tdbb,
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
dsql_dbb* database = init(tdbb, attachment);
|
||||
DsqlRequest* request = NULL;
|
||||
DsqlRequest* dsqlRequest = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
// Allocate a new request block and then prepare the request.
|
||||
|
||||
request = prepareRequest(tdbb, database, transaction, length, string, dialect,
|
||||
dsqlRequest = prepareRequest(tdbb, database, transaction, length, string, dialect,
|
||||
isInternalRequest);
|
||||
|
||||
// Can not prepare a CREATE DATABASE/SCHEMA statement
|
||||
|
||||
const DsqlStatement* statement = request->getStatement();
|
||||
const auto statement = dsqlRequest->getDsqlStatement();
|
||||
if (statement->getType() == DsqlStatement::TYPE_CREATE_DB)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-530) <<
|
||||
@ -258,19 +258,19 @@ DsqlRequest* DSQL_prepare(thread_db* tdbb,
|
||||
|
||||
if (items && buffer)
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, &request->getPool());
|
||||
sql_info(tdbb, request, items->getCount(), items->begin(),
|
||||
Jrd::ContextPoolHolder context(tdbb, &dsqlRequest->getPool());
|
||||
sql_info(tdbb, dsqlRequest, items->getCount(), items->begin(),
|
||||
buffer->getCount(), buffer->begin());
|
||||
}
|
||||
|
||||
return request;
|
||||
return dsqlRequest;
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
if (request)
|
||||
if (dsqlRequest)
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, &request->getPool());
|
||||
DsqlRequest::destroy(tdbb, request);
|
||||
Jrd::ContextPoolHolder context(tdbb, &dsqlRequest->getPool());
|
||||
DsqlRequest::destroy(tdbb, dsqlRequest);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
@ -293,15 +293,15 @@ DsqlRequest* DSQL_prepare(thread_db* tdbb,
|
||||
|
||||
**/
|
||||
void DSQL_sql_info(thread_db* tdbb,
|
||||
DsqlRequest* request,
|
||||
DsqlRequest* dsqlRequest,
|
||||
ULONG item_length, const UCHAR* items,
|
||||
ULONG info_length, UCHAR* info)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Jrd::ContextPoolHolder context(tdbb, &request->getPool());
|
||||
Jrd::ContextPoolHolder context(tdbb, &dsqlRequest->getPool());
|
||||
|
||||
sql_info(tdbb, request, item_length, items, info_length, info);
|
||||
sql_info(tdbb, dsqlRequest, item_length, items, info_length, info);
|
||||
}
|
||||
|
||||
|
||||
@ -315,47 +315,47 @@ void DSQL_execute_immediate(thread_db* tdbb, Jrd::Attachment* attachment, jrd_tr
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
dsql_dbb* const database = init(tdbb, attachment);
|
||||
DsqlRequest* request = NULL;
|
||||
DsqlRequest* dsqlRequest = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
request = prepareRequest(tdbb, database, *tra_handle, length, string, dialect,
|
||||
dsqlRequest = prepareRequest(tdbb, database, *tra_handle, length, string, dialect,
|
||||
isInternalRequest);
|
||||
|
||||
const DsqlStatement* statement = request->getStatement();
|
||||
const auto dsqlStatement = dsqlRequest->getDsqlStatement();
|
||||
|
||||
// Only allow NULL trans_handle if we're starting a transaction or set session properties
|
||||
|
||||
if (!*tra_handle &&
|
||||
statement->getType() != DsqlStatement::TYPE_START_TRANS &&
|
||||
statement->getType() != DsqlStatement::TYPE_SESSION_MANAGEMENT)
|
||||
dsqlStatement->getType() != DsqlStatement::TYPE_START_TRANS &&
|
||||
dsqlStatement->getType() != DsqlStatement::TYPE_SESSION_MANAGEMENT)
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
|
||||
Arg::Gds(isc_bad_trans_handle));
|
||||
}
|
||||
|
||||
Jrd::ContextPoolHolder context(tdbb, &request->getPool());
|
||||
Jrd::ContextPoolHolder context(tdbb, &dsqlRequest->getPool());
|
||||
|
||||
// A select having cursor is a singleton select when executed immediate
|
||||
const bool singleton = statement->isCursorBased();
|
||||
const bool singleton = dsqlStatement->isCursorBased();
|
||||
if (singleton && !(out_msg && out_meta))
|
||||
{
|
||||
ERRD_post(Arg::Gds(isc_dsql_sqlda_err) <<
|
||||
Arg::Gds(isc_dsql_no_output_sqlda));
|
||||
}
|
||||
|
||||
request->req_transaction = *tra_handle;
|
||||
dsqlRequest->req_transaction = *tra_handle;
|
||||
|
||||
request->execute(tdbb, tra_handle, in_meta, in_msg, out_meta, out_msg, singleton);
|
||||
dsqlRequest->execute(tdbb, tra_handle, in_meta, in_msg, out_meta, out_msg, singleton);
|
||||
|
||||
DsqlRequest::destroy(tdbb, request);
|
||||
DsqlRequest::destroy(tdbb, dsqlRequest);
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
if (request)
|
||||
if (dsqlRequest)
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, &request->getPool());
|
||||
DsqlRequest::destroy(tdbb, request);
|
||||
Jrd::ContextPoolHolder context(tdbb, &dsqlRequest->getPool());
|
||||
DsqlRequest::destroy(tdbb, dsqlRequest);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
@ -374,16 +374,16 @@ void DSQL_execute_immediate(thread_db* tdbb, Jrd::Attachment* attachment, jrd_tr
|
||||
@param buffer
|
||||
|
||||
**/
|
||||
static ULONG get_request_info(thread_db* tdbb, DsqlRequest* request, ULONG buffer_length, UCHAR* buffer)
|
||||
static ULONG get_request_info(thread_db* tdbb, DsqlRequest* dsqlRequest, ULONG buffer_length, UCHAR* buffer)
|
||||
{
|
||||
if (!request->getJrdRequest()) // DDL
|
||||
if (!dsqlRequest->getRequest()) // DDL
|
||||
return 0;
|
||||
|
||||
// get the info for the request from the engine
|
||||
|
||||
try
|
||||
{
|
||||
return INF_request_info(request->getJrdRequest(), sizeof(record_info), record_info,
|
||||
return INF_request_info(dsqlRequest->getRequest(), sizeof(record_info), record_info,
|
||||
buffer_length, buffer);
|
||||
}
|
||||
catch (Exception&)
|
||||
@ -438,13 +438,13 @@ static DsqlRequest* prepareRequest(thread_db* tdbb, dsql_dbb* database, jrd_tra*
|
||||
auto statement = prepareStatement(tdbb, database, transaction, textLength, text,
|
||||
clientDialect, isInternalRequest, &traceResult);
|
||||
|
||||
auto request = statement->createRequest(tdbb, database);
|
||||
auto dsqlRequest = statement->createRequest(tdbb, database);
|
||||
|
||||
request->req_traced = true;
|
||||
trace.setStatement(request);
|
||||
dsqlRequest->req_traced = true;
|
||||
trace.setStatement(dsqlRequest);
|
||||
trace.prepare(traceResult);
|
||||
|
||||
return request;
|
||||
return dsqlRequest;
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
@ -502,7 +502,7 @@ static RefPtr<DsqlStatement> prepareStatement(thread_db* tdbb, dsql_dbb* databas
|
||||
MemoryPool* scratchPool = nullptr;
|
||||
DsqlCompilerScratch* scratch = nullptr;
|
||||
MemoryPool* statementPool = database->createPool();
|
||||
RefPtr<DsqlStatement> statement;
|
||||
RefPtr<DsqlStatement> dsqlStatement;
|
||||
|
||||
Jrd::ContextPoolHolder statementContext(tdbb, statementPool);
|
||||
try
|
||||
@ -532,9 +532,9 @@ static RefPtr<DsqlStatement> prepareStatement(thread_db* tdbb, dsql_dbb* databas
|
||||
dbDialect, text, textLength, charSetId);
|
||||
|
||||
// Parse the SQL statement. If it croaks, return
|
||||
statement = parser.parse();
|
||||
dsqlStatement = parser.parse();
|
||||
|
||||
scratch->setStatement(statement);
|
||||
scratch->setDsqlStatement(dsqlStatement);
|
||||
|
||||
if (parser.isStmtAmbiguous())
|
||||
scratch->flags |= DsqlCompilerScratch::FLAG_AMBIGUOUS_STMT;
|
||||
@ -573,34 +573,34 @@ static RefPtr<DsqlStatement> prepareStatement(thread_db* tdbb, dsql_dbb* databas
|
||||
transformedText.assign(temp.begin(), temp.getCount());
|
||||
}
|
||||
|
||||
statement->setSqlText(FB_NEW_POOL(*statementPool) RefString(*statementPool, transformedText));
|
||||
dsqlStatement->setSqlText(FB_NEW_POOL(*statementPool) RefString(*statementPool, transformedText));
|
||||
|
||||
// allocate the send and receive messages
|
||||
|
||||
statement->setSendMsg(FB_NEW_POOL(*statementPool) dsql_msg(*statementPool));
|
||||
dsqlStatement->setSendMsg(FB_NEW_POOL(*statementPool) dsql_msg(*statementPool));
|
||||
dsql_msg* message = FB_NEW_POOL(*statementPool) dsql_msg(*statementPool);
|
||||
statement->setReceiveMsg(message);
|
||||
dsqlStatement->setReceiveMsg(message);
|
||||
message->msg_number = 1;
|
||||
|
||||
statement->setType(DsqlStatement::TYPE_SELECT);
|
||||
statement->dsqlPass(tdbb, scratch, traceResult);
|
||||
dsqlStatement->setType(DsqlStatement::TYPE_SELECT);
|
||||
dsqlStatement->dsqlPass(tdbb, scratch, traceResult);
|
||||
|
||||
if (!statement->shouldPreserveScratch())
|
||||
if (!dsqlStatement->shouldPreserveScratch())
|
||||
database->deletePool(scratchPool);
|
||||
|
||||
scratchPool = nullptr;
|
||||
|
||||
if (!isInternalRequest && statement->mustBeReplicated())
|
||||
statement->setOrgText(text, textLength);
|
||||
if (!isInternalRequest && dsqlStatement->mustBeReplicated())
|
||||
dsqlStatement->setOrgText(text, textLength);
|
||||
|
||||
return statement;
|
||||
return dsqlStatement;
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
if (scratchPool)
|
||||
database->deletePool(scratchPool);
|
||||
|
||||
if (!statement)
|
||||
if (!dsqlStatement)
|
||||
database->deletePool(statementPool);
|
||||
|
||||
throw;
|
||||
@ -678,7 +678,7 @@ string IntlString::toUtf8(jrd_tra* transaction) const
|
||||
|
||||
@brief Return DSQL information buffer.
|
||||
|
||||
@param request
|
||||
@param dsqlRequest
|
||||
@param item_length
|
||||
@param items
|
||||
@param info_length
|
||||
@ -687,7 +687,7 @@ string IntlString::toUtf8(jrd_tra* transaction) const
|
||||
**/
|
||||
|
||||
static void sql_info(thread_db* tdbb,
|
||||
DsqlRequest* request,
|
||||
DsqlRequest* dsqlRequest,
|
||||
ULONG item_length,
|
||||
const UCHAR* items,
|
||||
ULONG info_length,
|
||||
@ -720,7 +720,7 @@ static void sql_info(thread_db* tdbb,
|
||||
bool messageFound = false;
|
||||
USHORT first_index = 0;
|
||||
|
||||
const DsqlStatement* statement = request->getStatement();
|
||||
const auto dsqlStatement = dsqlRequest->getDsqlStatement();
|
||||
|
||||
while (items < end_items && *items != isc_info_end && info < end_info)
|
||||
{
|
||||
@ -734,7 +734,7 @@ static void sql_info(thread_db* tdbb,
|
||||
case isc_info_sql_select:
|
||||
case isc_info_sql_bind:
|
||||
message = (item == isc_info_sql_select) ?
|
||||
statement->getReceiveMsg() : statement->getSendMsg();
|
||||
dsqlStatement->getReceiveMsg() : dsqlStatement->getSendMsg();
|
||||
messageFound = true;
|
||||
if (info + 1 >= end_info)
|
||||
{
|
||||
@ -746,7 +746,7 @@ static void sql_info(thread_db* tdbb,
|
||||
|
||||
case isc_info_sql_stmt_flags:
|
||||
value = IStatement::FLAG_REPEAT_EXECUTE;
|
||||
switch (statement->getType())
|
||||
switch (dsqlStatement->getType())
|
||||
{
|
||||
case DsqlStatement::TYPE_CREATE_DB:
|
||||
case DsqlStatement::TYPE_DDL:
|
||||
@ -766,7 +766,7 @@ static void sql_info(thread_db* tdbb,
|
||||
break;
|
||||
|
||||
case isc_info_sql_stmt_type:
|
||||
switch (statement->getType())
|
||||
switch (dsqlStatement->getType())
|
||||
{
|
||||
case DsqlStatement::TYPE_SELECT:
|
||||
case DsqlStatement::TYPE_RETURNING_CURSOR:
|
||||
@ -852,7 +852,7 @@ static void sql_info(thread_db* tdbb,
|
||||
break;
|
||||
|
||||
case isc_info_sql_batch_fetch:
|
||||
if (statement->getFlags() & DsqlStatement::FLAG_NO_BATCH)
|
||||
if (dsqlStatement->getFlags() & DsqlStatement::FLAG_NO_BATCH)
|
||||
number = 0;
|
||||
else
|
||||
number = 1;
|
||||
@ -862,14 +862,14 @@ static void sql_info(thread_db* tdbb,
|
||||
break;
|
||||
|
||||
case isc_info_sql_records:
|
||||
length = get_request_info(tdbb, request, sizeof(buffer), buffer);
|
||||
length = get_request_info(tdbb, dsqlRequest, sizeof(buffer), buffer);
|
||||
if (length && !(info = put_item(item, length, buffer, info, end_info)))
|
||||
return;
|
||||
break;
|
||||
|
||||
case isc_info_sql_stmt_timeout_user:
|
||||
case isc_info_sql_stmt_timeout_run:
|
||||
value = (item == isc_info_sql_stmt_timeout_user) ? request->getTimeout() : request->getActualTimeout();
|
||||
value = (item == isc_info_sql_stmt_timeout_user) ? dsqlRequest->getTimeout() : dsqlRequest->getActualTimeout();
|
||||
|
||||
length = put_vax_long(buffer, value);
|
||||
if (!(info = put_item(item, length, buffer, info, end_info)))
|
||||
@ -889,7 +889,7 @@ static void sql_info(thread_db* tdbb,
|
||||
{
|
||||
const bool detailed = (item == isc_info_sql_explain_plan);
|
||||
string plan = tdbb->getAttachment()->stringToUserCharSet(tdbb,
|
||||
Optimizer::getPlan(tdbb, request->getJrdStatement(), detailed));
|
||||
Optimizer::getPlan(tdbb, dsqlRequest->getStatement(), detailed));
|
||||
|
||||
if (plan.hasData())
|
||||
{
|
||||
@ -939,9 +939,9 @@ static void sql_info(thread_db* tdbb,
|
||||
{
|
||||
HalfStaticArray<UCHAR, 128> path;
|
||||
|
||||
if (request->getJrdStatement())
|
||||
if (dsqlRequest->getStatement())
|
||||
{
|
||||
const auto& blr = request->getJrdStatement()->blr;
|
||||
const auto& blr = dsqlRequest->getStatement()->blr;
|
||||
|
||||
if (blr.hasData())
|
||||
{
|
||||
@ -1011,7 +1011,7 @@ static void sql_info(thread_db* tdbb,
|
||||
}
|
||||
|
||||
info = var_info(message, items, end_describe, info, end_info, first_index,
|
||||
message == statement->getSendMsg());
|
||||
message == dsqlStatement->getSendMsg());
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
|
@ -220,14 +220,14 @@ void GEN_port(DsqlCompilerScratch* dsqlScratch, dsql_msg* message)
|
||||
|
||||
message->msg_length = offset;
|
||||
|
||||
dsqlScratch->getStatement()->getPorts().add(message);
|
||||
dsqlScratch->getDsqlStatement()->getPorts().add(message);
|
||||
}
|
||||
|
||||
|
||||
// Generate complete blr for a dsqlScratch.
|
||||
void GEN_statement(DsqlCompilerScratch* scratch, DmlNode* node)
|
||||
{
|
||||
DsqlStatement* statement = scratch->getStatement();
|
||||
DsqlStatement* statement = scratch->getDsqlStatement();
|
||||
|
||||
if (statement->getBlrVersion() == 4)
|
||||
scratch->appendUChar(blr_version4);
|
||||
|
@ -583,7 +583,7 @@ static void gen_send( const gpre_req* request, const gpre_port* port, int column
|
||||
align(column);
|
||||
fprintf(gpreGlob.out_file, "if (ignore_perm)");
|
||||
align(column);
|
||||
fprintf(gpreGlob.out_file, "\trequest->getStatement()->flags |= JrdStatement::FLAG_IGNORE_PERM;");
|
||||
fprintf(gpreGlob.out_file, "\trequest->getStatement()->flags |= Statement::FLAG_IGNORE_PERM;");
|
||||
}
|
||||
align(column);
|
||||
|
||||
|
@ -669,7 +669,7 @@ jrd_req* Jrd::Attachment::findSystemRequest(thread_db* tdbb, USHORT id, USHORT w
|
||||
|
||||
fb_assert(which == IRQ_REQUESTS || which == DYN_REQUESTS);
|
||||
|
||||
JrdStatement* statement = (which == IRQ_REQUESTS ? att_internal[id] : att_dyn_req[id]);
|
||||
Statement* statement = (which == IRQ_REQUESTS ? att_internal[id] : att_dyn_req[id]);
|
||||
|
||||
if (!statement)
|
||||
return NULL;
|
||||
@ -846,13 +846,13 @@ void Jrd::Attachment::releaseLocks(thread_db* tdbb)
|
||||
|
||||
// And release the system requests
|
||||
|
||||
for (JrdStatement** itr = att_internal.begin(); itr != att_internal.end(); ++itr)
|
||||
for (Statement** itr = att_internal.begin(); itr != att_internal.end(); ++itr)
|
||||
{
|
||||
if (*itr)
|
||||
(*itr)->release(tdbb);
|
||||
}
|
||||
|
||||
for (JrdStatement** itr = att_dyn_req.begin(); itr != att_dyn_req.end(); ++itr)
|
||||
for (Statement** itr = att_dyn_req.begin(); itr != att_dyn_req.end(); ++itr)
|
||||
{
|
||||
if (*itr)
|
||||
(*itr)->release(tdbb);
|
||||
|
@ -94,7 +94,7 @@ namespace Jrd
|
||||
class Trigger;
|
||||
class TrigVector;
|
||||
class Function;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class Validation;
|
||||
class Applier;
|
||||
|
||||
@ -545,7 +545,7 @@ private:
|
||||
StableAttachmentPart* att_stable;
|
||||
|
||||
public:
|
||||
Firebird::SortedArray<JrdStatement*> att_statements; // Statements belonging to attachment
|
||||
Firebird::SortedArray<Statement*> att_statements; // Statements belonging to attachment
|
||||
Firebird::SortedArray<jrd_req*> att_requests; // Requests belonging to attachment
|
||||
Lock* att_id_lock; // Attachment lock (if any)
|
||||
AttNumber att_attachment_id; // Attachment ID
|
||||
@ -620,8 +620,8 @@ public:
|
||||
Firebird::Array<Function*> att_functions; // User defined functions
|
||||
GeneratorFinder att_generators;
|
||||
|
||||
Firebird::Array<JrdStatement*> att_internal; // internal statements
|
||||
Firebird::Array<JrdStatement*> att_dyn_req; // internal dyn statements
|
||||
Firebird::Array<Statement*> att_internal; // internal statements
|
||||
Firebird::Array<Statement*> att_dyn_req; // internal dyn statements
|
||||
Firebird::ICryptKeyCallback* att_crypt_callback; // callback for DB crypt
|
||||
Firebird::DecimalStatus att_dec_status; // error handling and rounding
|
||||
|
||||
|
@ -36,7 +36,7 @@ class jrd_tra;
|
||||
class DsqlCursor;
|
||||
class DsqlBatch;
|
||||
class DsqlRequest;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class StableAttachmentPart;
|
||||
class Attachment;
|
||||
class Service;
|
||||
@ -346,20 +346,20 @@ public:
|
||||
void deprecatedFree(Firebird::CheckStatusWrapper* status) override;
|
||||
|
||||
public:
|
||||
JRequest(JrdStatement* handle, StableAttachmentPart* sa);
|
||||
JRequest(Statement* handle, StableAttachmentPart* sa);
|
||||
|
||||
StableAttachmentPart* getAttachment()
|
||||
{
|
||||
return sAtt;
|
||||
}
|
||||
|
||||
JrdStatement* getHandle() throw()
|
||||
Statement* getHandle() throw()
|
||||
{
|
||||
return rq;
|
||||
}
|
||||
|
||||
private:
|
||||
JrdStatement* rq;
|
||||
Statement* rq;
|
||||
Firebird::RefPtr<StableAttachmentPart> sAtt;
|
||||
|
||||
void freeEngineData(Firebird::CheckStatusWrapper* status);
|
||||
|
@ -1387,7 +1387,7 @@ void ExtEngineManager::makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::
|
||||
extFunctionNode->statement = FB_NEW_POOL(csbPool) MessageMoverNode(
|
||||
csbPool, extOutMessageNode, intOutMessageNode);
|
||||
|
||||
JrdStatement* statement = udf->getStatement();
|
||||
Statement* statement = udf->getStatement();
|
||||
PAR_preparsed_node(tdbb, NULL, mainNode, NULL, &csb, &statement, false, 0);
|
||||
udf->setStatement(statement);
|
||||
}
|
||||
@ -1519,7 +1519,7 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
|
||||
extInMessageNode, extOutMessageNode, intOutMessageNode, prc->getExternal());
|
||||
mainNode->statements.add(extProcedureNode);
|
||||
|
||||
JrdStatement* statement = prc->getStatement();
|
||||
Statement* statement = prc->getStatement();
|
||||
PAR_preparsed_node(tdbb, NULL, mainNode, NULL, &csb, &statement, false, 0);
|
||||
prc->setStatement(statement);
|
||||
}
|
||||
|
@ -1140,7 +1140,7 @@ void Monitoring::putTransaction(SnapshotData::DumpRecord& record, const jrd_tra*
|
||||
}
|
||||
|
||||
|
||||
void Monitoring::putStatement(SnapshotData::DumpRecord& record, const JrdStatement* statement, const string& plan)
|
||||
void Monitoring::putStatement(SnapshotData::DumpRecord& record, const Statement* statement, const string& plan)
|
||||
{
|
||||
fb_assert(statement);
|
||||
|
||||
@ -1209,7 +1209,7 @@ void Monitoring::putRequest(SnapshotData::DumpRecord& record, const jrd_req* req
|
||||
else
|
||||
record.storeInteger(f_mon_stmt_state, mon_state_idle);
|
||||
|
||||
const JrdStatement* const statement = request->getStatement();
|
||||
const Statement* const statement = request->getStatement();
|
||||
|
||||
// sql text
|
||||
if (statement->sqlText)
|
||||
@ -1259,7 +1259,7 @@ void Monitoring::putCall(SnapshotData::DumpRecord& record, const jrd_req* reques
|
||||
if (initialRequest != request->req_caller)
|
||||
record.storeInteger(f_mon_call_caller_id, request->req_caller->getRequestId());
|
||||
|
||||
const JrdStatement* statement = request->getStatement();
|
||||
const Statement* statement = request->getStatement();
|
||||
const Routine* routine = statement->getRoutine();
|
||||
|
||||
// object name/type
|
||||
@ -1477,7 +1477,7 @@ void Monitoring::dumpAttachment(thread_db* tdbb, Attachment* attachment)
|
||||
request->adjustCallerStats();
|
||||
|
||||
if (!(request->getStatement()->flags &
|
||||
(JrdStatement::FLAG_INTERNAL | JrdStatement::FLAG_SYS_TRIGGER)) &&
|
||||
(Statement::FLAG_INTERNAL | Statement::FLAG_SYS_TRIGGER)) &&
|
||||
request->req_caller)
|
||||
{
|
||||
putCall(record, request);
|
||||
@ -1491,7 +1491,7 @@ void Monitoring::dumpAttachment(thread_db* tdbb, Attachment* attachment)
|
||||
|
||||
for (const auto statement : attachment->att_statements)
|
||||
{
|
||||
if (!(statement->flags & (JrdStatement::FLAG_INTERNAL | JrdStatement::FLAG_SYS_TRIGGER)))
|
||||
if (!(statement->flags & (Statement::FLAG_INTERNAL | Statement::FLAG_SYS_TRIGGER)))
|
||||
{
|
||||
const string plan = Optimizer::getPlan(tdbb, statement, true);
|
||||
putStatement(record, statement, plan);
|
||||
@ -1505,7 +1505,7 @@ void Monitoring::dumpAttachment(thread_db* tdbb, Attachment* attachment)
|
||||
{
|
||||
const auto statement = request->getStatement();
|
||||
|
||||
if (!(statement->flags & (JrdStatement::FLAG_INTERNAL | JrdStatement::FLAG_SYS_TRIGGER)))
|
||||
if (!(statement->flags & (Statement::FLAG_INTERNAL | Statement::FLAG_SYS_TRIGGER)))
|
||||
{
|
||||
const string plan = Optimizer::getPlan(tdbb, statement, true);
|
||||
putRequest(record, request, plan);
|
||||
|
@ -389,7 +389,7 @@ private:
|
||||
|
||||
static void putAttachment(SnapshotData::DumpRecord&, const Attachment*);
|
||||
static void putTransaction(SnapshotData::DumpRecord&, const jrd_tra*);
|
||||
static void putStatement(SnapshotData::DumpRecord&, const JrdStatement*, const Firebird::string&);
|
||||
static void putStatement(SnapshotData::DumpRecord&, const Statement*, const Firebird::string&);
|
||||
static void putRequest(SnapshotData::DumpRecord&, const jrd_req*, const Firebird::string&);
|
||||
static void putCall(SnapshotData::DumpRecord&, const jrd_req*);
|
||||
static void putStatistics(SnapshotData::DumpRecord&, const RuntimeStatistics&, int, int);
|
||||
|
@ -302,7 +302,7 @@ PreparedStatement::~PreparedStatement()
|
||||
{
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
|
||||
DSQL_free_statement(tdbb, request, DSQL_drop);
|
||||
DSQL_free_statement(tdbb, dsqlRequest, DSQL_drop);
|
||||
|
||||
if (resultSet)
|
||||
resultSet->stmt = NULL;
|
||||
@ -315,30 +315,28 @@ void PreparedStatement::init(thread_db* tdbb, Attachment* attachment, jrd_tra* t
|
||||
AutoSetRestore<SSHORT> autoAttCharset(&attachment->att_charset,
|
||||
(isInternalRequest ? CS_METADATA : attachment->att_charset));
|
||||
|
||||
request = NULL;
|
||||
dsqlRequest = NULL;
|
||||
try
|
||||
{
|
||||
const Database& dbb = *tdbb->getDatabase();
|
||||
const int dialect = isInternalRequest || (dbb.dbb_flags & DBB_DB_SQL_dialect_3) ?
|
||||
SQL_DIALECT_V6 : SQL_DIALECT_V5;
|
||||
|
||||
request = DSQL_prepare(tdbb, attachment, transaction, text.length(), text.c_str(), dialect, 0,
|
||||
dsqlRequest = DSQL_prepare(tdbb, attachment, transaction, text.length(), text.c_str(), dialect, 0,
|
||||
NULL, NULL, isInternalRequest);
|
||||
|
||||
const DsqlStatement* statement = request->getStatement();
|
||||
const auto dsqlStatement = dsqlRequest->getDsqlStatement();
|
||||
|
||||
if (statement->getSendMsg())
|
||||
parseDsqlMessage(statement->getSendMsg(), inValues, inMetadata, inMessage);
|
||||
if (dsqlStatement->getSendMsg())
|
||||
parseDsqlMessage(dsqlStatement->getSendMsg(), inValues, inMetadata, inMessage);
|
||||
|
||||
if (statement->getReceiveMsg())
|
||||
parseDsqlMessage(statement->getReceiveMsg(), outValues, outMetadata, outMessage);
|
||||
if (dsqlStatement->getReceiveMsg())
|
||||
parseDsqlMessage(dsqlStatement->getReceiveMsg(), outValues, outMetadata, outMessage);
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
if (request)
|
||||
{
|
||||
DSQL_free_statement(tdbb, request, DSQL_drop);
|
||||
}
|
||||
if (dsqlRequest)
|
||||
DSQL_free_statement(tdbb, dsqlRequest, DSQL_drop);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -348,12 +346,12 @@ void PreparedStatement::setDesc(thread_db* tdbb, unsigned param, const dsc& valu
|
||||
{
|
||||
fb_assert(param > 0);
|
||||
|
||||
jrd_req* jrdRequest = getRequest()->getJrdRequest();
|
||||
jrd_req* request = getDsqlRequest()->getRequest();
|
||||
|
||||
// Setup tdbb info necessary for blobs.
|
||||
AutoSetRestore2<jrd_req*, thread_db> autoRequest(
|
||||
tdbb, &thread_db::getRequest, &thread_db::setRequest, jrdRequest);
|
||||
AutoSetRestore<jrd_tra*> autoRequestTrans(&jrdRequest->req_transaction,
|
||||
tdbb, &thread_db::getRequest, &thread_db::setRequest, request);
|
||||
AutoSetRestore<jrd_tra*> autoRequestTrans(&request->req_transaction,
|
||||
tdbb->getTransaction());
|
||||
|
||||
MOV_move(tdbb, const_cast<dsc*>(&value), &inValues[(param - 1) * 2]);
|
||||
@ -371,7 +369,7 @@ void PreparedStatement::execute(thread_db* tdbb, jrd_tra* transaction)
|
||||
if (builder)
|
||||
builder->moveToStatement(tdbb, this);
|
||||
|
||||
DSQL_execute(tdbb, &transaction, request, inMetadata, inMessage.begin(), NULL, NULL);
|
||||
DSQL_execute(tdbb, &transaction, dsqlRequest, inMetadata, inMessage.begin(), NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -382,13 +380,13 @@ void PreparedStatement::open(thread_db* tdbb, jrd_tra* transaction)
|
||||
if (builder)
|
||||
builder->moveToStatement(tdbb, this);
|
||||
|
||||
request->openCursor(tdbb, &transaction, inMetadata, inMessage.begin(), outMetadata, 0);
|
||||
dsqlRequest->openCursor(tdbb, &transaction, inMetadata, inMessage.begin(), outMetadata, 0);
|
||||
}
|
||||
|
||||
|
||||
ResultSet* PreparedStatement::executeQuery(thread_db* tdbb, jrd_tra* transaction)
|
||||
{
|
||||
fb_assert(resultSet == NULL && request->getStatement()->getReceiveMsg());
|
||||
fb_assert(resultSet == NULL && dsqlRequest->getDsqlStatement()->getReceiveMsg());
|
||||
|
||||
if (builder)
|
||||
builder->moveToStatement(tdbb, this);
|
||||
@ -400,7 +398,7 @@ ResultSet* PreparedStatement::executeQuery(thread_db* tdbb, jrd_tra* transaction
|
||||
unsigned PreparedStatement::executeUpdate(thread_db* tdbb, jrd_tra* transaction)
|
||||
{
|
||||
execute(tdbb, transaction);
|
||||
return getRequest()->getJrdRequest()->req_records_updated;
|
||||
return getDsqlRequest()->getRequest()->req_records_updated;
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,9 +359,9 @@ public:
|
||||
|
||||
int getResultCount() const;
|
||||
|
||||
DsqlRequest* getRequest()
|
||||
DsqlRequest* getDsqlRequest()
|
||||
{
|
||||
return request;
|
||||
return dsqlRequest;
|
||||
}
|
||||
|
||||
static void parseDsqlMessage(const dsql_msg* dsqlMsg, Firebird::Array<dsc>& values,
|
||||
@ -369,7 +369,7 @@ public:
|
||||
|
||||
private:
|
||||
const Builder* builder;
|
||||
DsqlRequest* request;
|
||||
DsqlRequest* dsqlRequest;
|
||||
Firebird::Array<dsc> inValues, outValues;
|
||||
Firebird::RefPtr<Firebird::MsgMetadata> inMetadata, outMetadata;
|
||||
Firebird::UCharBuffer inMessage, outMessage;
|
||||
|
@ -54,14 +54,14 @@ ResultSet::~ResultSet()
|
||||
|
||||
stmt->resultSet = NULL;
|
||||
|
||||
if (stmt->request->getStatement()->getType() != DsqlStatement::TYPE_EXEC_PROCEDURE)
|
||||
DSQL_free_statement(tdbb, stmt->request, DSQL_close);
|
||||
if (stmt->dsqlRequest->getDsqlStatement()->getType() != DsqlStatement::TYPE_EXEC_PROCEDURE)
|
||||
DSQL_free_statement(tdbb, stmt->dsqlRequest, DSQL_close);
|
||||
}
|
||||
|
||||
|
||||
bool ResultSet::fetch(thread_db* tdbb)
|
||||
{
|
||||
if (stmt->request->getStatement()->getType() == DsqlStatement::TYPE_EXEC_PROCEDURE &&
|
||||
if (stmt->dsqlRequest->getDsqlStatement()->getType() == DsqlStatement::TYPE_EXEC_PROCEDURE &&
|
||||
firstFetchDone)
|
||||
{
|
||||
return false;
|
||||
@ -69,7 +69,7 @@ bool ResultSet::fetch(thread_db* tdbb)
|
||||
|
||||
memset(stmt->outMessage.begin(), 0, stmt->outMessage.getCount());
|
||||
|
||||
if (!stmt->request->fetch(tdbb, stmt->outMessage.begin()))
|
||||
if (!stmt->dsqlRequest->fetch(tdbb, stmt->outMessage.begin()))
|
||||
return false;
|
||||
|
||||
if (stmt->builder)
|
||||
@ -103,12 +103,12 @@ Firebird::string ResultSet::getString(thread_db* tdbb, unsigned param)
|
||||
{
|
||||
fb_assert(param > 0);
|
||||
|
||||
jrd_req* jrdRequest = stmt->getRequest()->getJrdRequest();
|
||||
jrd_req* request = stmt->getDsqlRequest()->getRequest();
|
||||
|
||||
// Setup tdbb info necessary for blobs.
|
||||
AutoSetRestore2<jrd_req*, thread_db> autoRequest(
|
||||
tdbb, &thread_db::getRequest, &thread_db::setRequest, jrdRequest);
|
||||
AutoSetRestore<jrd_tra*> autoRequestTrans(&jrdRequest->req_transaction,
|
||||
tdbb, &thread_db::getRequest, &thread_db::setRequest, request);
|
||||
AutoSetRestore<jrd_tra*> autoRequestTrans(&request->req_transaction,
|
||||
tdbb->getTransaction());
|
||||
|
||||
return MOV_make_string2(tdbb, &getDesc(param), CS_NONE);
|
||||
@ -131,12 +131,12 @@ void ResultSet::moveDesc(thread_db* tdbb, unsigned param, dsc& desc)
|
||||
{
|
||||
fb_assert(param > 0);
|
||||
|
||||
jrd_req* jrdRequest = stmt->getRequest()->getJrdRequest();
|
||||
jrd_req* request = stmt->getDsqlRequest()->getRequest();
|
||||
|
||||
// Setup tdbb info necessary for blobs.
|
||||
AutoSetRestore2<jrd_req*, thread_db> autoRequest(
|
||||
tdbb, &thread_db::getRequest, &thread_db::setRequest, jrdRequest);
|
||||
AutoSetRestore<jrd_tra*> autoRequestTrans(&jrdRequest->req_transaction,
|
||||
tdbb, &thread_db::getRequest, &thread_db::setRequest, request);
|
||||
AutoSetRestore<jrd_tra*> autoRequestTrans(&request->req_transaction,
|
||||
tdbb->getTransaction());
|
||||
|
||||
MOV_move(tdbb, &getDesc(param), &desc);
|
||||
|
@ -111,7 +111,7 @@ Format* Routine::createFormat(MemoryPool& pool, IMessageMetadata* params, bool a
|
||||
return format;
|
||||
}
|
||||
|
||||
void Routine::setStatement(JrdStatement* value)
|
||||
void Routine::setStatement(Statement* value)
|
||||
{
|
||||
statement = value;
|
||||
|
||||
@ -173,7 +173,7 @@ void Routine::parseBlr(thread_db* tdbb, CompilerScratch* csb, bid* blob_id, bid*
|
||||
|
||||
flags &= ~Routine::FLAG_RELOAD;
|
||||
|
||||
JrdStatement* statement = getStatement();
|
||||
Statement* statement = getStatement();
|
||||
PAR_blr(tdbb, NULL, tmp.begin(), (ULONG) tmp.getCount(), NULL, &csb, &statement, false, 0);
|
||||
setStatement(statement);
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace Jrd
|
||||
{
|
||||
class thread_db;
|
||||
class CompilerScratch;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class Lock;
|
||||
class Format;
|
||||
class Parameter;
|
||||
@ -105,8 +105,8 @@ namespace Jrd
|
||||
const MetaName& getSecurityName() const { return securityName; }
|
||||
void setSecurityName(const MetaName& value) { securityName = value; }
|
||||
|
||||
/*const*/ JrdStatement* getStatement() const { return statement; }
|
||||
void setStatement(JrdStatement* value);
|
||||
/*const*/ Statement* getStatement() const { return statement; }
|
||||
void setStatement(Statement* value);
|
||||
|
||||
bool isSubRoutine() const { return subRoutine; }
|
||||
void setSubRoutine(bool value) { subRoutine = value; }
|
||||
@ -166,7 +166,7 @@ namespace Jrd
|
||||
USHORT id; // routine ID
|
||||
QualifiedName name; // routine name
|
||||
MetaName securityName; // security class name
|
||||
JrdStatement* statement; // compiled routine statement
|
||||
Statement* statement; // compiled routine statement
|
||||
bool subRoutine; // Is this a subroutine?
|
||||
bool implemented; // Is the packaged routine missing the body/entrypoint?
|
||||
bool defined; // UDF has its implementation module available
|
||||
|
@ -41,7 +41,7 @@ using namespace Firebird;
|
||||
using namespace Jrd;
|
||||
|
||||
|
||||
template <typename T> static void makeSubRoutines(thread_db* tdbb, JrdStatement* statement,
|
||||
template <typename T> static void makeSubRoutines(thread_db* tdbb, Statement* statement,
|
||||
CompilerScratch* csb, T& subs);
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ ULONG CompilerScratch::allocImpure(ULONG align, ULONG size)
|
||||
{
|
||||
const ULONG offset = FB_ALIGN(csb_impure, align);
|
||||
|
||||
if (offset + size > JrdStatement::MAX_REQUEST_SIZE)
|
||||
if (offset + size > Statement::MAX_REQUEST_SIZE)
|
||||
IBERROR(226); // msg 226: request size limit exceeded
|
||||
|
||||
csb_impure = offset + size;
|
||||
@ -59,7 +59,7 @@ ULONG CompilerScratch::allocImpure(ULONG align, ULONG size)
|
||||
|
||||
|
||||
// Start to turn a parsed scratch into a statement. This is completed by makeStatement.
|
||||
JrdStatement::JrdStatement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
|
||||
Statement::Statement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
|
||||
: pool(p),
|
||||
rpbsSetup(*p),
|
||||
requests(*p),
|
||||
@ -133,7 +133,7 @@ JrdStatement::JrdStatement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
|
||||
#ifdef DEBUG_PROCS
|
||||
string buffer;
|
||||
buffer.printf(
|
||||
"Called from JrdStatement::makeRequest:\n\t Incrementing use count of %s\n",
|
||||
"Called from Statement::makeRequest:\n\t Incrementing use count of %s\n",
|
||||
routine->getName()->toString().c_str());
|
||||
JRD_print_procedure_info(tdbb, buffer.c_str());
|
||||
#endif
|
||||
@ -189,7 +189,7 @@ JrdStatement::JrdStatement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
|
||||
}
|
||||
catch (Exception&)
|
||||
{
|
||||
for (JrdStatement** subStatement = subStatements.begin();
|
||||
for (Statement** subStatement = subStatements.begin();
|
||||
subStatement != subStatements.end();
|
||||
++subStatement)
|
||||
{
|
||||
@ -201,7 +201,7 @@ JrdStatement::JrdStatement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
|
||||
}
|
||||
|
||||
// Turn a parsed scratch into a statement.
|
||||
JrdStatement* JrdStatement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag)
|
||||
Statement* Statement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag)
|
||||
{
|
||||
DEV_BLKCHK(csb, type_csb);
|
||||
SET_TDBB(tdbb);
|
||||
@ -212,7 +212,7 @@ JrdStatement* JrdStatement::makeStatement(thread_db* tdbb, CompilerScratch* csb,
|
||||
jrd_req* const old_request = tdbb->getRequest();
|
||||
tdbb->setRequest(NULL);
|
||||
|
||||
JrdStatement* statement = NULL;
|
||||
Statement* statement = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
@ -279,7 +279,7 @@ JrdStatement* JrdStatement::makeStatement(thread_db* tdbb, CompilerScratch* csb,
|
||||
|
||||
MemoryPool* const pool = tdbb->getDefaultPool();
|
||||
|
||||
statement = FB_NEW_POOL(*pool) JrdStatement(tdbb, pool, csb);
|
||||
statement = FB_NEW_POOL(*pool) Statement(tdbb, pool, csb);
|
||||
|
||||
tdbb->setRequest(old_request);
|
||||
} // try
|
||||
@ -288,7 +288,7 @@ JrdStatement* JrdStatement::makeStatement(thread_db* tdbb, CompilerScratch* csb,
|
||||
if (statement)
|
||||
{
|
||||
// Release sub statements.
|
||||
for (JrdStatement** subStatement = statement->subStatements.begin();
|
||||
for (Statement** subStatement = statement->subStatements.begin();
|
||||
subStatement != statement->subStatements.end();
|
||||
++subStatement)
|
||||
{
|
||||
@ -310,14 +310,14 @@ JrdStatement* JrdStatement::makeStatement(thread_db* tdbb, CompilerScratch* csb,
|
||||
}
|
||||
|
||||
// Turn a parsed scratch into an executable request.
|
||||
jrd_req* JrdStatement::makeRequest(thread_db* tdbb, CompilerScratch* csb, bool internalFlag)
|
||||
jrd_req* Statement::makeRequest(thread_db* tdbb, CompilerScratch* csb, bool internalFlag)
|
||||
{
|
||||
JrdStatement* statement = makeStatement(tdbb, csb, internalFlag);
|
||||
Statement* statement = makeStatement(tdbb, csb, internalFlag);
|
||||
return statement->getRequest(tdbb, 0);
|
||||
}
|
||||
|
||||
// Returns function or procedure routine.
|
||||
const Routine* JrdStatement::getRoutine() const
|
||||
const Routine* Statement::getRoutine() const
|
||||
{
|
||||
fb_assert(!(procedure && function));
|
||||
|
||||
@ -328,7 +328,7 @@ const Routine* JrdStatement::getRoutine() const
|
||||
}
|
||||
|
||||
// Determine if any request of this statement are active.
|
||||
bool JrdStatement::isActive() const
|
||||
bool Statement::isActive() const
|
||||
{
|
||||
for (const jrd_req* const* request = requests.begin(); request != requests.end(); ++request)
|
||||
{
|
||||
@ -339,12 +339,12 @@ bool JrdStatement::isActive() const
|
||||
return false;
|
||||
}
|
||||
|
||||
jrd_req* JrdStatement::findRequest(thread_db* tdbb, bool unique)
|
||||
jrd_req* Statement::findRequest(thread_db* tdbb, bool unique)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
Attachment* const attachment = tdbb->getAttachment();
|
||||
|
||||
const JrdStatement* const thisPointer = this; // avoid warning
|
||||
const Statement* const thisPointer = this; // avoid warning
|
||||
if (!thisPointer)
|
||||
BUGCHECK(167); /* msg 167 invalid SEND request */
|
||||
|
||||
@ -391,7 +391,7 @@ jrd_req* JrdStatement::findRequest(thread_db* tdbb, bool unique)
|
||||
return clone;
|
||||
}
|
||||
|
||||
jrd_req* JrdStatement::getRequest(thread_db* tdbb, USHORT level)
|
||||
jrd_req* Statement::getRequest(thread_db* tdbb, USHORT level)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
@ -420,7 +420,7 @@ jrd_req* JrdStatement::getRequest(thread_db* tdbb, USHORT level)
|
||||
|
||||
// Check that we have enough rights to access all resources this request touches including
|
||||
// resources it used indirectly via procedures or triggers.
|
||||
void JrdStatement::verifyAccess(thread_db* tdbb)
|
||||
void Statement::verifyAccess(thread_db* tdbb)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
@ -590,12 +590,12 @@ void JrdStatement::verifyAccess(thread_db* tdbb)
|
||||
}
|
||||
|
||||
// Release a statement.
|
||||
void JrdStatement::release(thread_db* tdbb)
|
||||
void Statement::release(thread_db* tdbb)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
// Release sub statements.
|
||||
for (JrdStatement** subStatement = subStatements.begin();
|
||||
for (Statement** subStatement = subStatements.begin();
|
||||
subStatement != subStatements.end();
|
||||
++subStatement)
|
||||
{
|
||||
@ -665,7 +665,7 @@ void JrdStatement::release(thread_db* tdbb)
|
||||
}
|
||||
|
||||
// Returns a formatted textual plan for all RseNode's in the specified request
|
||||
string JrdStatement::getPlan(thread_db* tdbb, bool detailed) const
|
||||
string Statement::getPlan(thread_db* tdbb, bool detailed) const
|
||||
{
|
||||
string plan;
|
||||
|
||||
@ -679,7 +679,7 @@ string JrdStatement::getPlan(thread_db* tdbb, bool detailed) const
|
||||
}
|
||||
|
||||
// Check that we have enough rights to access all resources this list of triggers touches.
|
||||
void JrdStatement::verifyTriggerAccess(thread_db* tdbb, jrd_rel* ownerRelation,
|
||||
void Statement::verifyTriggerAccess(thread_db* tdbb, jrd_rel* ownerRelation,
|
||||
TrigVector* triggers, MetaName userName)
|
||||
{
|
||||
if (!triggers)
|
||||
@ -743,7 +743,7 @@ void JrdStatement::verifyTriggerAccess(thread_db* tdbb, jrd_rel* ownerRelation,
|
||||
}
|
||||
|
||||
// Invoke buildExternalAccess for triggers in vector
|
||||
inline void JrdStatement::triggersExternalAccess(thread_db* tdbb, ExternalAccessList& list,
|
||||
inline void Statement::triggersExternalAccess(thread_db* tdbb, ExternalAccessList& list,
|
||||
TrigVector* tvec, const MetaName& user)
|
||||
{
|
||||
if (!tvec)
|
||||
@ -764,7 +764,7 @@ inline void JrdStatement::triggersExternalAccess(thread_db* tdbb, ExternalAccess
|
||||
|
||||
// Recursively walk external dependencies (procedures, triggers) for request to assemble full
|
||||
// list of requests it depends on.
|
||||
void JrdStatement::buildExternalAccess(thread_db* tdbb, ExternalAccessList& list, const MetaName &user)
|
||||
void Statement::buildExternalAccess(thread_db* tdbb, ExternalAccessList& list, const MetaName &user)
|
||||
{
|
||||
for (ExternalAccess* item = externalList.begin(); item != externalList.end(); ++item)
|
||||
{
|
||||
@ -834,7 +834,7 @@ void JrdStatement::buildExternalAccess(thread_db* tdbb, ExternalAccessList& list
|
||||
|
||||
|
||||
// Make sub routines.
|
||||
template <typename T> static void makeSubRoutines(thread_db* tdbb, JrdStatement* statement,
|
||||
template <typename T> static void makeSubRoutines(thread_db* tdbb, Statement* statement,
|
||||
CompilerScratch* csb, T& subs)
|
||||
{
|
||||
typename T::Accessor subAccessor(&subs);
|
||||
@ -845,7 +845,7 @@ template <typename T> static void makeSubRoutines(thread_db* tdbb, JrdStatement*
|
||||
Routine* subRoutine = subNode->routine;
|
||||
CompilerScratch*& subCsb = subNode->subCsb;
|
||||
|
||||
JrdStatement* subStatement = JrdStatement::makeStatement(tdbb, subCsb, false);
|
||||
Statement* subStatement = Statement::makeStatement(tdbb, subCsb, false);
|
||||
subStatement->parentStatement = statement;
|
||||
subRoutine->setStatement(subStatement);
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
namespace Jrd {
|
||||
|
||||
// Compiled statement.
|
||||
class JrdStatement : public pool_alloc<type_req>
|
||||
class Statement : public pool_alloc<type_req>
|
||||
{
|
||||
public:
|
||||
static const unsigned FLAG_SYS_TRIGGER = 0x01;
|
||||
@ -42,10 +42,10 @@ public:
|
||||
static const unsigned MAX_REQUEST_SIZE = 50 * 1048576; // 50 MB - just to be safe
|
||||
|
||||
private:
|
||||
JrdStatement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb);
|
||||
Statement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb);
|
||||
|
||||
public:
|
||||
static JrdStatement* makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag);
|
||||
static Statement* makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag);
|
||||
static jrd_req* makeRequest(thread_db* tdbb, CompilerScratch* csb, bool internalFlag);
|
||||
|
||||
StmtNumber getStatementId() const
|
||||
@ -87,8 +87,8 @@ public:
|
||||
const Function* function; // function, if any
|
||||
MetaName triggerName; // name of request (trigger), if any
|
||||
Jrd::UserId* triggerInvoker; // user name if trigger run with SQL SECURITY DEFINER
|
||||
JrdStatement* parentStatement; // Sub routine's parent statement
|
||||
Firebird::Array<JrdStatement*> subStatements; // Array of subroutines' statements
|
||||
Statement* parentStatement; // Sub routine's parent statement
|
||||
Firebird::Array<Statement*> subStatements; // Array of subroutines' statements
|
||||
const StmtNode* topNode; // top of execution tree
|
||||
Firebird::Array<const RecordSource*> fors; // record sources
|
||||
Firebird::Array<const DeclareLocalTableNode*> localTables; // local tables
|
||||
|
@ -43,7 +43,7 @@ namespace Jrd {
|
||||
class jrd_rel;
|
||||
class jrd_tra;
|
||||
template <typename T> class vec;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
struct temporary_key;
|
||||
class jrd_tra;
|
||||
class BtrPageGCLock;
|
||||
@ -66,7 +66,7 @@ struct index_desc
|
||||
vec<int>* idx_foreign_indexes; // ids for foreign key partner indexes
|
||||
ValueExprNode* idx_expression; // node tree for indexed expresssion
|
||||
dsc idx_expression_desc; // descriptor for expression result
|
||||
JrdStatement* idx_expression_statement; // stored statement for expression evaluation
|
||||
Statement* idx_expression_statement; // stored statement for expression evaluation
|
||||
// This structure should exactly match IRTD structure for current ODS
|
||||
struct idx_repeat
|
||||
{
|
||||
@ -246,7 +246,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
static bool checkPool(const Lock* lock, Firebird::MemoryPool* pool)
|
||||
static bool checkPool(const Lock* lock, Firebird::MemoryPool* pool)
|
||||
{
|
||||
if (!pool || !lock)
|
||||
return false;
|
||||
|
@ -142,10 +142,10 @@ BoolExprNode* CMP_clone_node_opt(thread_db* tdbb, CompilerScratch* csb, BoolExpr
|
||||
}
|
||||
|
||||
// Compile a statement.
|
||||
JrdStatement* CMP_compile(thread_db* tdbb, const UCHAR* blr, ULONG blrLength, bool internalFlag,
|
||||
Statement* CMP_compile(thread_db* tdbb, const UCHAR* blr, ULONG blrLength, bool internalFlag,
|
||||
ULONG dbginfoLength, const UCHAR* dbginfo)
|
||||
{
|
||||
JrdStatement* statement = nullptr;
|
||||
Statement* statement = nullptr;
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
const auto att = tdbb->getAttachment();
|
||||
@ -160,7 +160,7 @@ JrdStatement* CMP_compile(thread_db* tdbb, const UCHAR* blr, ULONG blrLength, bo
|
||||
|
||||
const auto csb = PAR_parse(tdbb, blr, blrLength, internalFlag, dbginfoLength, dbginfo);
|
||||
|
||||
statement = JrdStatement::makeStatement(tdbb, csb, internalFlag);
|
||||
statement = Statement::makeStatement(tdbb, csb, internalFlag);
|
||||
|
||||
#ifdef CMP_DEBUG
|
||||
if (csb->csb_dump.hasData())
|
||||
|
@ -37,7 +37,7 @@ StreamType* CMP_alloc_map(Jrd::thread_db*, Jrd::CompilerScratch*, StreamType str
|
||||
Jrd::ValueExprNode* CMP_clone_node_opt(Jrd::thread_db*, Jrd::CompilerScratch*, Jrd::ValueExprNode*);
|
||||
Jrd::BoolExprNode* CMP_clone_node_opt(Jrd::thread_db*, Jrd::CompilerScratch*, Jrd::BoolExprNode*);
|
||||
Jrd::ValueExprNode* CMP_clone_node(Jrd::thread_db*, Jrd::CompilerScratch*, Jrd::ValueExprNode*);
|
||||
Jrd::JrdStatement* CMP_compile(Jrd::thread_db* tdbb, const UCHAR* blr, ULONG blrLength, bool internalFlag,
|
||||
Jrd::Statement* CMP_compile(Jrd::thread_db* tdbb, const UCHAR* blr, ULONG blrLength, bool internalFlag,
|
||||
ULONG dbginfoLength, const UCHAR* dbginfo);
|
||||
Jrd::jrd_req* CMP_compile_request(Jrd::thread_db*, const UCHAR* blr, ULONG blrLength, bool internalFlag);
|
||||
Jrd::CompilerScratch::csb_repeat* CMP_csb_element(Jrd::CompilerScratch*, StreamType element);
|
||||
|
@ -983,7 +983,7 @@ namespace
|
||||
|
||||
if (routine && !blobId.isEmpty())
|
||||
{
|
||||
JrdStatement* statement = NULL;
|
||||
Statement* statement = NULL;
|
||||
// Nickolay Samofatov: allocate statement memory pool...
|
||||
MemoryPool* new_pool = attachment->createPool();
|
||||
// block is used to ensure MET_verify_cache
|
||||
@ -5433,7 +5433,7 @@ static void get_trigger_dependencies(DeferredWork* work, bool compile, jrd_tra*
|
||||
|
||||
if ((relation || (type & TRIGGER_TYPE_MASK) != TRIGGER_TYPE_DML) && !blob_id.isEmpty())
|
||||
{
|
||||
JrdStatement* statement = NULL;
|
||||
Statement* statement = NULL;
|
||||
// Nickolay Samofatov: allocate statement memory pool...
|
||||
MemoryPool* new_pool = attachment->createPool();
|
||||
USHORT par_flags;
|
||||
@ -5905,7 +5905,7 @@ static bool make_version(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
|
||||
if (notNull && !defaultValue->isEmpty())
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, attachment->createPool());
|
||||
JrdStatement* defaultStatement = NULL;
|
||||
Statement* defaultStatement = NULL;
|
||||
try
|
||||
{
|
||||
ValueExprNode* defaultNode = static_cast<ValueExprNode*>(MET_parse_blob(
|
||||
|
@ -930,7 +930,7 @@ void EXE_unwind(thread_db* tdbb, jrd_req* request)
|
||||
|
||||
if (request->req_flags & req_active)
|
||||
{
|
||||
const JrdStatement* statement = request->getStatement();
|
||||
const Statement* statement = request->getStatement();
|
||||
|
||||
if (statement->fors.getCount() || request->req_ext_resultset || request->req_ext_stmt)
|
||||
{
|
||||
@ -1199,7 +1199,7 @@ void EXE_execute_triggers(thread_db* tdbb,
|
||||
TraceTrigExecute trace(tdbb, trigger, which_trig);
|
||||
|
||||
{ // Scope to replace att_ss_user
|
||||
const JrdStatement* s = trigger->getStatement();
|
||||
const Statement* s = trigger->getStatement();
|
||||
UserId* invoker = s->triggerInvoker ? s->triggerInvoker : tdbb->getAttachment()->att_ss_user;
|
||||
AutoSetRestore<UserId*> userIdHolder(&tdbb->getAttachment()->att_ss_user, invoker);
|
||||
|
||||
@ -1252,7 +1252,7 @@ static void stuff_stack_trace(const jrd_req* request)
|
||||
|
||||
for (const jrd_req* req = request; req; req = req->req_caller)
|
||||
{
|
||||
const JrdStatement* const statement = req->getStatement();
|
||||
const Statement* const statement = req->getStatement();
|
||||
|
||||
string context, name;
|
||||
|
||||
@ -1572,7 +1572,7 @@ static void trigger_failure(thread_db* tdbb, jrd_req* trigger)
|
||||
MET_trigger_msg(tdbb, msg, trigger->getStatement()->triggerName, trigger->req_label);
|
||||
if (msg.hasData())
|
||||
{
|
||||
if (trigger->getStatement()->flags & JrdStatement::FLAG_SYS_TRIGGER)
|
||||
if (trigger->getStatement()->flags & Statement::FLAG_SYS_TRIGGER)
|
||||
{
|
||||
ISC_STATUS code = PAR_symbol_to_gdscode(msg);
|
||||
if (code)
|
||||
|
@ -460,7 +460,7 @@ void InternalStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
if (m_callerPrivileges)
|
||||
{
|
||||
jrd_req* request = tdbb->getRequest();
|
||||
JrdStatement* statement = request ? request->getStatement() : NULL;
|
||||
auto statement = request ? request->getStatement() : NULL;
|
||||
CallerName callerName;
|
||||
const Routine* routine;
|
||||
|
||||
@ -504,13 +504,13 @@ void InternalStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
raise(&status, tdbb, "JAttachment::prepare", &sql);
|
||||
|
||||
const DsqlStatement* statement = m_request->getHandle()->getStatement();
|
||||
const auto dsqlStatement = m_request->getHandle()->getDsqlStatement();
|
||||
|
||||
if (statement->getSendMsg())
|
||||
if (dsqlStatement->getSendMsg())
|
||||
{
|
||||
try
|
||||
{
|
||||
PreparedStatement::parseDsqlMessage(statement->getSendMsg(), m_inDescs,
|
||||
PreparedStatement::parseDsqlMessage(dsqlStatement->getSendMsg(), m_inDescs,
|
||||
m_inMetadata, m_in_buffer);
|
||||
m_inputs = m_inMetadata->getCount();
|
||||
}
|
||||
@ -522,11 +522,11 @@ void InternalStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
else
|
||||
m_inputs = 0;
|
||||
|
||||
if (statement->getReceiveMsg())
|
||||
if (dsqlStatement->getReceiveMsg())
|
||||
{
|
||||
try
|
||||
{
|
||||
PreparedStatement::parseDsqlMessage(statement->getReceiveMsg(), m_outDescs,
|
||||
PreparedStatement::parseDsqlMessage(dsqlStatement->getReceiveMsg(), m_outDescs,
|
||||
m_outMetadata, m_out_buffer);
|
||||
m_outputs = m_outMetadata->getCount();
|
||||
}
|
||||
@ -540,7 +540,7 @@ void InternalStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
|
||||
m_stmt_selectable = false;
|
||||
|
||||
switch (statement->getType())
|
||||
switch (dsqlStatement->getType())
|
||||
{
|
||||
case DsqlStatement::TYPE_SELECT:
|
||||
case DsqlStatement::TYPE_RETURNING_CURSOR:
|
||||
|
@ -333,7 +333,7 @@ JResultSet::JResultSet(DsqlCursor* handle, JStatement* aStatement)
|
||||
{
|
||||
}
|
||||
|
||||
JRequest::JRequest(JrdStatement* handle, StableAttachmentPart* sa)
|
||||
JRequest::JRequest(Statement* handle, StableAttachmentPart* sa)
|
||||
: rq(handle), sAtt(sa)
|
||||
{
|
||||
}
|
||||
@ -647,7 +647,7 @@ namespace
|
||||
tdbb->setTransaction(transaction);
|
||||
}
|
||||
|
||||
inline void validateHandle(thread_db* tdbb, JrdStatement* const statement)
|
||||
inline void validateHandle(thread_db* tdbb, Statement* const statement)
|
||||
{
|
||||
if (!statement)
|
||||
status_exception::raise(Arg::Gds(isc_bad_req_handle));
|
||||
@ -942,10 +942,10 @@ void Trigger::compile(thread_db* tdbb)
|
||||
statement->triggerInvoker = att->getUserId(owner);
|
||||
|
||||
if (sysTrigger)
|
||||
statement->flags |= JrdStatement::FLAG_SYS_TRIGGER;
|
||||
statement->flags |= Statement::FLAG_SYS_TRIGGER;
|
||||
|
||||
if (flags & TRG_ignore_perm)
|
||||
statement->flags |= JrdStatement::FLAG_IGNORE_PERM;
|
||||
statement->flags |= Statement::FLAG_IGNORE_PERM;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1311,7 +1311,7 @@ static bool drop_files(const jrd_file*);
|
||||
static void find_intl_charset(thread_db*, Jrd::Attachment*, const DatabaseOptions*);
|
||||
static void init_database_lock(thread_db*);
|
||||
static void run_commit_triggers(thread_db* tdbb, jrd_tra* transaction);
|
||||
static jrd_req* verify_request_synchronization(JrdStatement* statement, USHORT level);
|
||||
static jrd_req* verify_request_synchronization(Statement* statement, USHORT level);
|
||||
static void purge_transactions(thread_db*, Jrd::Attachment*, const bool);
|
||||
static void check_single_maintenance(thread_db* tdbb);
|
||||
|
||||
@ -2681,7 +2681,7 @@ JRequest* JAttachment::compileRequest(CheckStatusWrapper* user_status,
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
JrdStatement* stmt = NULL;
|
||||
Statement* stmt = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
@ -4713,7 +4713,7 @@ void JAttachment::transactRequest(CheckStatusWrapper* user_status, ITransaction*
|
||||
CompilerScratch* csb = PAR_parse(tdbb, reinterpret_cast<const UCHAR*>(blr),
|
||||
blr_length, false);
|
||||
|
||||
request = JrdStatement::makeRequest(tdbb, csb, false);
|
||||
request = Statement::makeRequest(tdbb, csb, false);
|
||||
request->getStatement()->verifyAccess(tdbb);
|
||||
|
||||
for (FB_SIZE_T i = 0; i < csb->csb_rpt.getCount(); i++)
|
||||
@ -8335,7 +8335,7 @@ static void run_commit_triggers(thread_db* tdbb, jrd_tra* transaction)
|
||||
//
|
||||
// @param request The incoming, parent request to be replaced.
|
||||
// @param level The level of the sub-request we need to find.
|
||||
static jrd_req* verify_request_synchronization(JrdStatement* statement, USHORT level)
|
||||
static jrd_req* verify_request_synchronization(Statement* statement, USHORT level)
|
||||
{
|
||||
if (level)
|
||||
{
|
||||
@ -8945,7 +8945,7 @@ ISC_STATUS thread_db::getCancelState(ISC_STATUS* secondary)
|
||||
if ((!request ||
|
||||
!(request->getStatement()->flags &
|
||||
// temporary change to fix shutdown
|
||||
(/*JrdStatement::FLAG_INTERNAL | */JrdStatement::FLAG_SYS_TRIGGER))) &&
|
||||
(/*Statement::FLAG_INTERNAL | */Statement::FLAG_SYS_TRIGGER))) &&
|
||||
(!transaction || !(transaction->tra_flags & TRA_system)))
|
||||
{
|
||||
return isc_cancelled;
|
||||
|
@ -107,7 +107,7 @@ class thread_db;
|
||||
class Attachment;
|
||||
class jrd_tra;
|
||||
class jrd_req;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class jrd_file;
|
||||
class Format;
|
||||
class BufferDesc;
|
||||
@ -136,7 +136,7 @@ class Trigger
|
||||
public:
|
||||
Firebird::HalfStaticArray<UCHAR, 128> blr; // BLR code
|
||||
Firebird::HalfStaticArray<UCHAR, 128> debugInfo; // Debug info
|
||||
JrdStatement* statement; // Compiled statement
|
||||
Statement* statement; // Compiled statement
|
||||
bool releaseInProgress;
|
||||
bool sysTrigger;
|
||||
FB_UINT64 type; // Trigger type
|
||||
@ -305,7 +305,7 @@ class IndexBlock : public pool_alloc<type_idb>
|
||||
public:
|
||||
IndexBlock* idb_next;
|
||||
ValueExprNode* idb_expression; // node tree for index expression
|
||||
JrdStatement* idb_expression_statement; // statement for index expression evaluation
|
||||
Statement* idb_expression_statement; // statement for index expression evaluation
|
||||
dsc idb_expression_desc; // descriptor for expression result
|
||||
Lock* idb_lock; // lock to synchronize changes to index
|
||||
USHORT idb_id;
|
||||
|
@ -36,7 +36,7 @@ namespace Jrd {
|
||||
class blb;
|
||||
struct bid;
|
||||
class jrd_req;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class Service;
|
||||
class thread_db;
|
||||
struct teb;
|
||||
|
@ -122,7 +122,7 @@ static void make_relation_scope_name(const TEXT*, const USHORT, string& str);
|
||||
static ValueExprNode* parse_field_default_blr(thread_db* tdbb, bid* blob_id);
|
||||
static BoolExprNode* parse_field_validation_blr(thread_db* tdbb, bid* blob_id, const MetaName name);
|
||||
static bool resolve_charset_and_collation(thread_db*, USHORT*, const UCHAR*, const UCHAR*);
|
||||
static void save_trigger_data(thread_db*, TrigVector**, jrd_rel*, JrdStatement*, blb*, blb*,
|
||||
static void save_trigger_data(thread_db*, TrigVector**, jrd_rel*, Statement*, blb*, blb*,
|
||||
const TEXT*, FB_UINT64, bool, USHORT, const MetaName&, const string&,
|
||||
const bid*, Nullable<bool> ssDefiner);
|
||||
static void scan_partners(thread_db*, jrd_rel*);
|
||||
@ -131,10 +131,10 @@ static void store_dependencies(thread_db*, CompilerScratch*, const jrd_rel*,
|
||||
static bool verify_TRG_ignore_perm(thread_db*, const MetaName&);
|
||||
|
||||
|
||||
static void inc_int_use_count(JrdStatement* statement)
|
||||
static void inc_int_use_count(Statement* statement)
|
||||
{
|
||||
// Handle sub-statements
|
||||
for (JrdStatement** subStatement = statement->subStatements.begin();
|
||||
for (Statement** subStatement = statement->subStatements.begin();
|
||||
subStatement != statement->subStatements.end();
|
||||
++subStatement)
|
||||
{
|
||||
@ -175,7 +175,7 @@ static void post_used_procedures(TrigVector* vector)
|
||||
|
||||
for (FB_SIZE_T i = 0; i < vector->getCount(); i++)
|
||||
{
|
||||
JrdStatement* stmt = (*vector)[i].statement;
|
||||
Statement* stmt = (*vector)[i].statement;
|
||||
if (stmt && !stmt->isActive())
|
||||
inc_int_use_count(stmt);
|
||||
}
|
||||
@ -1648,7 +1648,7 @@ DmlNode* MET_get_dependencies(thread_db* tdbb,
|
||||
const ULONG blob_length,
|
||||
CompilerScratch* view_csb,
|
||||
bid* blob_id,
|
||||
JrdStatement** statementPtr,
|
||||
Statement** statementPtr,
|
||||
CompilerScratch** csb_ptr,
|
||||
const MetaName& object_name,
|
||||
int type,
|
||||
@ -3073,7 +3073,7 @@ DmlNode* MET_parse_blob(thread_db* tdbb,
|
||||
jrd_rel* relation,
|
||||
bid* blob_id,
|
||||
CompilerScratch** csb_ptr,
|
||||
JrdStatement** statementPtr,
|
||||
Statement** statementPtr,
|
||||
const bool trigger,
|
||||
bool validationExpr)
|
||||
{
|
||||
@ -3198,7 +3198,7 @@ void MET_parse_sys_trigger(thread_db* tdbb, jrd_rel* relation)
|
||||
else
|
||||
par_flags |= csb_post_trigger;
|
||||
|
||||
JrdStatement* statement = NULL;
|
||||
Statement* statement = NULL;
|
||||
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, attachment->createPool());
|
||||
@ -3207,9 +3207,9 @@ void MET_parse_sys_trigger(thread_db* tdbb, jrd_rel* relation)
|
||||
|
||||
statement->triggerName = name;
|
||||
|
||||
statement->flags |= JrdStatement::FLAG_SYS_TRIGGER;
|
||||
statement->flags |= Statement::FLAG_SYS_TRIGGER;
|
||||
if (trig_flags & TRG_ignore_perm)
|
||||
statement->flags |= JrdStatement::FLAG_IGNORE_PERM;
|
||||
statement->flags |= Statement::FLAG_IGNORE_PERM;
|
||||
|
||||
save_trigger_data(tdbb, ptr, relation, statement, NULL, NULL, NULL, type, true, 0, "",
|
||||
"", NULL, Nullable<bool>());
|
||||
@ -4771,7 +4771,7 @@ void MET_release_trigger(thread_db* tdbb, TrigVector** vector_ptr, const MetaNam
|
||||
{
|
||||
if (vector[i].name == name)
|
||||
{
|
||||
JrdStatement* stmt = vector[i].statement;
|
||||
Statement* stmt = vector[i].statement;
|
||||
if (stmt)
|
||||
{
|
||||
if (stmt->isActive())
|
||||
@ -4933,7 +4933,7 @@ static bool resolve_charset_and_collation(thread_db* tdbb,
|
||||
|
||||
|
||||
static void save_trigger_data(thread_db* tdbb, TrigVector** ptr, jrd_rel* relation,
|
||||
JrdStatement* statement, blb* blrBlob, blb* debugInfoBlob,
|
||||
Statement* statement, blb* blrBlob, blb* debugInfoBlob,
|
||||
const TEXT* name, FB_UINT64 type,
|
||||
bool sys_trigger, USHORT flags,
|
||||
const MetaName& engine, const string& entryPoint,
|
||||
|
@ -32,7 +32,7 @@ namespace Jrd
|
||||
{
|
||||
class jrd_tra;
|
||||
class jrd_req;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class jrd_prc;
|
||||
class Format;
|
||||
class jrd_rel;
|
||||
@ -86,7 +86,7 @@ Jrd::Format* MET_format(Jrd::thread_db*, Jrd::jrd_rel*, USHORT);
|
||||
bool MET_get_char_coll_subtype(Jrd::thread_db*, USHORT*, const UCHAR*, USHORT);
|
||||
bool MET_get_char_coll_subtype_info(Jrd::thread_db*, USHORT, SubtypeInfo* info);
|
||||
Jrd::DmlNode* MET_get_dependencies(Jrd::thread_db*, Jrd::jrd_rel*, const UCHAR*, const ULONG,
|
||||
Jrd::CompilerScratch*, Jrd::bid*, Jrd::JrdStatement**,
|
||||
Jrd::CompilerScratch*, Jrd::bid*, Jrd::Statement**,
|
||||
Jrd::CompilerScratch**, const Jrd::MetaName&, int, USHORT,
|
||||
Jrd::jrd_tra*, const Jrd::MetaName& = Jrd::MetaName());
|
||||
Jrd::jrd_fld* MET_get_field(const Jrd::jrd_rel*, USHORT);
|
||||
@ -115,7 +115,7 @@ Jrd::jrd_prc* MET_lookup_procedure_id(Jrd::thread_db*, USHORT, bool, bool, USHOR
|
||||
Jrd::jrd_rel* MET_lookup_relation(Jrd::thread_db*, const Jrd::MetaName&);
|
||||
Jrd::jrd_rel* MET_lookup_relation_id(Jrd::thread_db*, SLONG, bool);
|
||||
Jrd::DmlNode* MET_parse_blob(Jrd::thread_db*, Jrd::jrd_rel*, Jrd::bid*, Jrd::CompilerScratch**,
|
||||
Jrd::JrdStatement**, bool, bool);
|
||||
Jrd::Statement**, bool, bool);
|
||||
void MET_parse_sys_trigger(Jrd::thread_db*, Jrd::jrd_rel*);
|
||||
void MET_post_existence(Jrd::thread_db*, Jrd::jrd_rel*);
|
||||
void MET_prepare(Jrd::thread_db*, Jrd::jrd_tra*, USHORT, const UCHAR*);
|
||||
|
@ -330,7 +330,7 @@ public:
|
||||
return ConjunctIterator(begin, end);
|
||||
}
|
||||
|
||||
static Firebird::string getPlan(thread_db* tdbb, const JrdStatement* statement, bool detailed)
|
||||
static Firebird::string getPlan(thread_db* tdbb, const Statement* statement, bool detailed)
|
||||
{
|
||||
return statement ? statement->getPlan(tdbb, detailed) : "";
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ namespace
|
||||
// Parse blr, returning a compiler scratch block with the results.
|
||||
// Caller must do pool handling.
|
||||
DmlNode* PAR_blr(thread_db* tdbb, jrd_rel* relation, const UCHAR* blr, ULONG blr_length,
|
||||
CompilerScratch* view_csb, CompilerScratch** csb_ptr, JrdStatement** statementPtr,
|
||||
CompilerScratch* view_csb, CompilerScratch** csb_ptr, Statement** statementPtr,
|
||||
const bool trigger, USHORT flags)
|
||||
{
|
||||
#ifdef CMP_DEBUG
|
||||
@ -188,7 +188,7 @@ DmlNode* PAR_blr(thread_db* tdbb, jrd_rel* relation, const UCHAR* blr, ULONG blr
|
||||
PAR_syntax_error(csb, "end_of_command");
|
||||
|
||||
if (statementPtr)
|
||||
*statementPtr = JrdStatement::makeStatement(tdbb, csb, false);
|
||||
*statementPtr = Statement::makeStatement(tdbb, csb, false);
|
||||
|
||||
return csb->csb_node;
|
||||
}
|
||||
@ -197,7 +197,7 @@ DmlNode* PAR_blr(thread_db* tdbb, jrd_rel* relation, const UCHAR* blr, ULONG blr
|
||||
// Finish parse of memory nodes, returning a compiler scratch block with the results.
|
||||
// Caller must do pool handling.
|
||||
void PAR_preparsed_node(thread_db* tdbb, jrd_rel* relation, DmlNode* node,
|
||||
CompilerScratch* view_csb, CompilerScratch** csb_ptr, JrdStatement** statementPtr,
|
||||
CompilerScratch* view_csb, CompilerScratch** csb_ptr, Statement** statementPtr,
|
||||
const bool trigger, USHORT flags)
|
||||
{
|
||||
BlrParseWrapper csb(*tdbb->getDefaultPool(), relation, view_csb, csb_ptr, trigger, flags);
|
||||
@ -206,7 +206,7 @@ void PAR_preparsed_node(thread_db* tdbb, jrd_rel* relation, DmlNode* node,
|
||||
csb->csb_node = node;
|
||||
|
||||
if (statementPtr)
|
||||
*statementPtr = JrdStatement::makeStatement(tdbb, csb, false);
|
||||
*statementPtr = Statement::makeStatement(tdbb, csb, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace Jrd {
|
||||
class CompilerScratch;
|
||||
class jrd_rel;
|
||||
class jrd_req;
|
||||
class JrdStatement;
|
||||
class Statement;
|
||||
class thread_db;
|
||||
class ItemInfo;
|
||||
class BoolExprNode;
|
||||
@ -46,9 +46,9 @@ struct dsc;
|
||||
Jrd::ValueListNode* PAR_args(Jrd::thread_db*, Jrd::CompilerScratch*, USHORT, USHORT);
|
||||
Jrd::ValueListNode* PAR_args(Jrd::thread_db*, Jrd::CompilerScratch*);
|
||||
Jrd::DmlNode* PAR_blr(Jrd::thread_db*, Jrd::jrd_rel*, const UCHAR*, ULONG blr_length,
|
||||
Jrd::CompilerScratch*, Jrd::CompilerScratch**, Jrd::JrdStatement**, const bool, USHORT);
|
||||
Jrd::CompilerScratch*, Jrd::CompilerScratch**, Jrd::Statement**, const bool, USHORT);
|
||||
void PAR_preparsed_node(Jrd::thread_db*, Jrd::jrd_rel*, Jrd::DmlNode*,
|
||||
Jrd::CompilerScratch*, Jrd::CompilerScratch**, Jrd::JrdStatement**, const bool, USHORT);
|
||||
Jrd::CompilerScratch*, Jrd::CompilerScratch**, Jrd::Statement**, const bool, USHORT);
|
||||
Jrd::BoolExprNode* PAR_validation_blr(Jrd::thread_db*, Jrd::jrd_rel*, const UCHAR* blr,
|
||||
ULONG blr_length, Jrd::CompilerScratch*, Jrd::CompilerScratch**, USHORT);
|
||||
StreamType PAR_context(Jrd::CompilerScratch*, SSHORT*);
|
||||
|
@ -240,7 +240,7 @@ Applier* Applier::create(thread_db* tdbb)
|
||||
Jrd::ContextPoolHolder context(tdbb, req_pool);
|
||||
AutoPtr<CompilerScratch> csb(FB_NEW_POOL(*req_pool) CompilerScratch(*req_pool));
|
||||
|
||||
const auto request = JrdStatement::makeRequest(tdbb, csb, true);
|
||||
const auto request = Statement::makeRequest(tdbb, csb, true);
|
||||
request->validateTimeStamp();
|
||||
request->req_attachment = attachment;
|
||||
|
||||
|
@ -266,7 +266,7 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
jrd_req(Attachment* attachment, /*const*/ JrdStatement* aStatement,
|
||||
jrd_req(Attachment* attachment, /*const*/ Statement* aStatement,
|
||||
Firebird::MemoryStats* parent_stats)
|
||||
: statement(aStatement),
|
||||
req_pool(statement->pool),
|
||||
@ -290,30 +290,30 @@ public:
|
||||
impureArea.grow(statement->impureSize);
|
||||
}
|
||||
|
||||
JrdStatement* getStatement()
|
||||
Statement* getStatement()
|
||||
{
|
||||
return statement;
|
||||
}
|
||||
|
||||
const JrdStatement* getStatement() const
|
||||
const Statement* getStatement() const
|
||||
{
|
||||
return statement;
|
||||
}
|
||||
|
||||
bool hasInternalStatement() const
|
||||
{
|
||||
return statement->flags & JrdStatement::FLAG_INTERNAL;
|
||||
return statement->flags & Statement::FLAG_INTERNAL;
|
||||
}
|
||||
|
||||
bool hasPowerfulStatement() const
|
||||
{
|
||||
return statement->flags & JrdStatement::FLAG_POWERFUL;
|
||||
return statement->flags & Statement::FLAG_POWERFUL;
|
||||
}
|
||||
|
||||
void setAttachment(Attachment* newAttachment)
|
||||
{
|
||||
req_attachment = newAttachment;
|
||||
charSetId = statement->flags & JrdStatement::FLAG_INTERNAL ?
|
||||
charSetId = statement->flags & Statement::FLAG_INTERNAL ?
|
||||
CS_METADATA : req_attachment->att_charset;
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
JrdStatement* const statement;
|
||||
Statement* const statement;
|
||||
mutable StmtNumber req_id; // request identifier
|
||||
TimeStampCache req_timeStampCache; // time stamp cache
|
||||
|
||||
|
@ -111,31 +111,31 @@ private:
|
||||
class TraceDSQLExecute
|
||||
{
|
||||
public:
|
||||
TraceDSQLExecute(Attachment* attachment, DsqlRequest* request) :
|
||||
TraceDSQLExecute(Attachment* attachment, DsqlRequest* dsqlRequest) :
|
||||
m_attachment(attachment),
|
||||
m_request(request)
|
||||
m_dsqlRequest(dsqlRequest)
|
||||
{
|
||||
m_need_trace = m_request->req_traced && TraceManager::need_dsql_execute(m_attachment);
|
||||
m_need_trace = m_dsqlRequest->req_traced && TraceManager::need_dsql_execute(m_attachment);
|
||||
if (!m_need_trace)
|
||||
return;
|
||||
|
||||
{ // scope
|
||||
TraceSQLStatementImpl stmt(request, NULL);
|
||||
TraceManager::event_dsql_execute(m_attachment, request->req_transaction, &stmt, true,
|
||||
TraceSQLStatementImpl stmt(dsqlRequest, NULL);
|
||||
TraceManager::event_dsql_execute(m_attachment, dsqlRequest->req_transaction, &stmt, true,
|
||||
ITracePlugin::RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
m_start_clock = fb_utils::query_performance_counter();
|
||||
|
||||
m_request->req_fetch_elapsed = 0;
|
||||
m_request->req_fetch_rowcount = 0;
|
||||
fb_assert(!m_request->req_fetch_baseline);
|
||||
m_request->req_fetch_baseline = NULL;
|
||||
m_dsqlRequest->req_fetch_elapsed = 0;
|
||||
m_dsqlRequest->req_fetch_rowcount = 0;
|
||||
fb_assert(!m_dsqlRequest->req_fetch_baseline);
|
||||
m_dsqlRequest->req_fetch_baseline = NULL;
|
||||
|
||||
if (auto jrdRequest = m_request->getJrdRequest())
|
||||
if (auto request = m_dsqlRequest->getRequest())
|
||||
{
|
||||
MemoryPool* pool = MemoryPool::getContextPool();
|
||||
m_request->req_fetch_baseline = FB_NEW_POOL(*pool) RuntimeStatistics(*pool, jrdRequest->req_stats);
|
||||
m_dsqlRequest->req_fetch_baseline = FB_NEW_POOL(*pool) RuntimeStatistics(*pool, request->req_stats);
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,19 +147,19 @@ public:
|
||||
m_need_trace = false;
|
||||
if (have_cursor)
|
||||
{
|
||||
m_request->req_fetch_elapsed = fb_utils::query_performance_counter() - m_start_clock;
|
||||
m_dsqlRequest->req_fetch_elapsed = fb_utils::query_performance_counter() - m_start_clock;
|
||||
return;
|
||||
}
|
||||
|
||||
TraceRuntimeStats stats(m_attachment, m_request->req_fetch_baseline,
|
||||
m_request->getJrdRequest() ? &m_request->getJrdRequest()->req_stats : NULL,
|
||||
TraceRuntimeStats stats(m_attachment, m_dsqlRequest->req_fetch_baseline,
|
||||
m_dsqlRequest->getRequest() ? &m_dsqlRequest->getRequest()->req_stats : NULL,
|
||||
fb_utils::query_performance_counter() - m_start_clock,
|
||||
m_request->req_fetch_rowcount);
|
||||
m_dsqlRequest->req_fetch_rowcount);
|
||||
|
||||
TraceSQLStatementImpl stmt(m_request, stats.getPerf());
|
||||
TraceManager::event_dsql_execute(m_attachment, m_request->req_transaction, &stmt, false, result);
|
||||
TraceSQLStatementImpl stmt(m_dsqlRequest, stats.getPerf());
|
||||
TraceManager::event_dsql_execute(m_attachment, m_dsqlRequest->req_transaction, &stmt, false, result);
|
||||
|
||||
m_request->req_fetch_baseline = NULL;
|
||||
m_dsqlRequest->req_fetch_baseline = NULL;
|
||||
}
|
||||
|
||||
~TraceDSQLExecute()
|
||||
@ -170,7 +170,7 @@ public:
|
||||
private:
|
||||
bool m_need_trace;
|
||||
Attachment* const m_attachment;
|
||||
DsqlRequest* const m_request;
|
||||
DsqlRequest* const m_dsqlRequest;
|
||||
SINT64 m_start_clock;
|
||||
};
|
||||
|
||||
@ -179,14 +179,14 @@ class TraceDSQLFetch
|
||||
public:
|
||||
TraceDSQLFetch(Attachment* attachment, DsqlRequest* request) :
|
||||
m_attachment(attachment),
|
||||
m_request(request)
|
||||
m_dsqlRequest(request)
|
||||
{
|
||||
m_need_trace = m_request->req_traced && TraceManager::need_dsql_execute(m_attachment) &&
|
||||
m_request->getJrdRequest() && (m_request->getJrdRequest()->req_flags & req_active);
|
||||
m_need_trace = m_dsqlRequest->req_traced && TraceManager::need_dsql_execute(m_attachment) &&
|
||||
m_dsqlRequest->getRequest() && (m_dsqlRequest->getRequest()->req_flags & req_active);
|
||||
|
||||
if (!m_need_trace)
|
||||
{
|
||||
m_request->req_fetch_baseline = NULL;
|
||||
m_dsqlRequest->req_fetch_baseline = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -204,30 +204,30 @@ public:
|
||||
return;
|
||||
|
||||
m_need_trace = false;
|
||||
m_request->req_fetch_elapsed += fb_utils::query_performance_counter() - m_start_clock;
|
||||
m_dsqlRequest->req_fetch_elapsed += fb_utils::query_performance_counter() - m_start_clock;
|
||||
if (!eof)
|
||||
{
|
||||
m_request->req_fetch_rowcount++;
|
||||
m_dsqlRequest->req_fetch_rowcount++;
|
||||
return;
|
||||
}
|
||||
|
||||
TraceRuntimeStats stats(m_attachment, m_request->req_fetch_baseline,
|
||||
&m_request->getJrdRequest()->req_stats, m_request->req_fetch_elapsed,
|
||||
m_request->req_fetch_rowcount);
|
||||
TraceRuntimeStats stats(m_attachment, m_dsqlRequest->req_fetch_baseline,
|
||||
&m_dsqlRequest->getRequest()->req_stats, m_dsqlRequest->req_fetch_elapsed,
|
||||
m_dsqlRequest->req_fetch_rowcount);
|
||||
|
||||
TraceSQLStatementImpl stmt(m_request, stats.getPerf());
|
||||
TraceSQLStatementImpl stmt(m_dsqlRequest, stats.getPerf());
|
||||
|
||||
TraceManager::event_dsql_execute(m_attachment, m_request->req_transaction,
|
||||
TraceManager::event_dsql_execute(m_attachment, m_dsqlRequest->req_transaction,
|
||||
&stmt, false, result);
|
||||
|
||||
m_request->req_fetch_elapsed = 0;
|
||||
m_request->req_fetch_baseline = NULL;
|
||||
m_dsqlRequest->req_fetch_elapsed = 0;
|
||||
m_dsqlRequest->req_fetch_baseline = NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_need_trace;
|
||||
Attachment* const m_attachment;
|
||||
DsqlRequest* const m_request;
|
||||
DsqlRequest* const m_dsqlRequest;
|
||||
SINT64 m_start_clock;
|
||||
};
|
||||
|
||||
|
@ -317,7 +317,7 @@ public:
|
||||
m_which_trig(which_trig)
|
||||
{
|
||||
TraceManager* trace_mgr = m_tdbb->getAttachment()->att_trace_manager;
|
||||
m_need_trace = !(m_request->getStatement()->flags & JrdStatement::FLAG_SYS_TRIGGER) &&
|
||||
m_need_trace = !(m_request->getStatement()->flags & Statement::FLAG_SYS_TRIGGER) &&
|
||||
trace_mgr->needs(ITraceFactory::TRACE_EVENT_TRIGGER_EXECUTE);
|
||||
|
||||
if (!m_need_trace)
|
||||
@ -392,7 +392,7 @@ public:
|
||||
m_start_clock = fb_utils::query_performance_counter();
|
||||
}
|
||||
|
||||
void finish(JrdStatement* statement, ntrace_result_t result)
|
||||
void finish(Statement* statement, ntrace_result_t result)
|
||||
{
|
||||
if (!m_need_trace)
|
||||
return;
|
||||
@ -442,11 +442,11 @@ public:
|
||||
m_request(request)
|
||||
{
|
||||
Attachment* attachment = m_tdbb->getAttachment();
|
||||
JrdStatement* statement = m_request->getStatement();
|
||||
Statement* statement = m_request->getStatement();
|
||||
|
||||
m_need_trace = attachment->att_trace_manager->needs(ITraceFactory::TRACE_EVENT_BLR_EXECUTE) &&
|
||||
!statement->sqlText &&
|
||||
!(statement->flags & JrdStatement::FLAG_INTERNAL) &&
|
||||
!(statement->flags & Statement::FLAG_INTERNAL) &&
|
||||
!attachment->isUtility();
|
||||
|
||||
if (!m_need_trace)
|
||||
|
@ -169,21 +169,21 @@ ISC_INT64 TraceTransactionImpl::getInitialID()
|
||||
|
||||
ISC_INT64 TraceSQLStatementImpl::getStmtID()
|
||||
{
|
||||
if (m_stmt->getJrdRequest())
|
||||
return m_stmt->getJrdRequest()->getRequestId();
|
||||
if (m_stmt->getRequest())
|
||||
return m_stmt->getRequest()->getRequestId();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* TraceSQLStatementImpl::getText()
|
||||
{
|
||||
const string* stmtText = m_stmt->getStatement()->getSqlText();
|
||||
const string* stmtText = m_stmt->getDsqlStatement()->getSqlText();
|
||||
return stmtText ? stmtText->c_str() : "";
|
||||
}
|
||||
|
||||
const char* TraceSQLStatementImpl::getTextUTF8()
|
||||
{
|
||||
const string* stmtText = m_stmt->getStatement()->getSqlText();
|
||||
const string* stmtText = m_stmt->getDsqlStatement()->getSqlText();
|
||||
|
||||
if (m_textUTF8.isEmpty() && stmtText && !stmtText->isEmpty())
|
||||
{
|
||||
@ -211,8 +211,8 @@ void TraceSQLStatementImpl::fillPlan(bool explained)
|
||||
if (m_plan.isEmpty() || m_planExplained != explained)
|
||||
{
|
||||
m_planExplained = explained;
|
||||
if (m_stmt->getJrdStatement())
|
||||
m_plan = Optimizer::getPlan(JRD_get_thread_data(), m_stmt->getJrdStatement(), m_planExplained);
|
||||
if (m_stmt->getStatement())
|
||||
m_plan = Optimizer::getPlan(JRD_get_thread_data(), m_stmt->getStatement(), m_planExplained);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ private:
|
||||
class TraceBLRStatementImpl : public BLRPrinter<TraceBLRStatementImpl>
|
||||
{
|
||||
public:
|
||||
TraceBLRStatementImpl(const JrdStatement* stmt, Firebird::PerformanceInfo* perf) :
|
||||
TraceBLRStatementImpl(const Statement* stmt, Firebird::PerformanceInfo* perf) :
|
||||
BLRPrinter(stmt->blr.begin(), stmt->blr.getCount()),
|
||||
m_stmt(stmt),
|
||||
m_perf(perf)
|
||||
@ -156,7 +156,7 @@ public:
|
||||
Firebird::PerformanceInfo* getPerf() { return m_perf; }
|
||||
|
||||
private:
|
||||
const JrdStatement* const m_stmt;
|
||||
const Statement* const m_stmt;
|
||||
Firebird::PerformanceInfo* const m_perf;
|
||||
};
|
||||
|
||||
@ -203,7 +203,7 @@ private:
|
||||
m_params(NULL),
|
||||
m_descs(pool)
|
||||
{
|
||||
const dsql_msg* msg = m_stmt->getStatement()->getSendMsg();
|
||||
const dsql_msg* msg = m_stmt->getDsqlStatement()->getSendMsg();
|
||||
if (msg)
|
||||
m_params = &msg->msg_parameters;
|
||||
}
|
||||
|
@ -3713,7 +3713,7 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
|
||||
EVL_field(0, rpb->rpb_record, f_trg_rname, &desc);
|
||||
|
||||
// check if this request go through without checking permissions
|
||||
if (!(request->getStatement()->flags & (JrdStatement::FLAG_IGNORE_PERM | JrdStatement::FLAG_INTERNAL)))
|
||||
if (!(request->getStatement()->flags & (Statement::FLAG_IGNORE_PERM | Statement::FLAG_INTERNAL)))
|
||||
SCL_check_relation(tdbb, &desc, SCL_control | SCL_alter);
|
||||
|
||||
if (EVL_field(0, rpb->rpb_record, f_trg_rname, &desc2))
|
||||
|
Loading…
Reference in New Issue
Block a user