From 9a4689d3e972dc5117dcc4611323a5d7c069bb69 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Fri, 8 Apr 2011 16:43:05 +0000 Subject: [PATCH] Use interface IBlrMessage instead passing C++ class pointer to API interface's functions --- src/common/classes/ImplementHelper.h | 51 ++++++++++++++++++ src/dsql/dsql.h | 8 +-- src/include/ProviderInterface.h | 43 ++++----------- src/jrd/Attachment.h | 4 +- src/jrd/extds/InternalDS.cpp | 16 +++--- src/jrd/jrd.cpp | 64 +++++++++++------------ src/remote/client/interface.cpp | 78 +++++++++++++--------------- src/yvalve/why.cpp | 44 ++++++++-------- 8 files changed, 163 insertions(+), 145 deletions(-) diff --git a/src/common/classes/ImplementHelper.h b/src/common/classes/ImplementHelper.h index 30bac81741..bd3f409196 100644 --- a/src/common/classes/ImplementHelper.h +++ b/src/common/classes/ImplementHelper.h @@ -31,6 +31,7 @@ #include "FirebirdPluginApi.h" #include "Timer.h" +#include "ProviderInterface.h" #include "../common/classes/alloc.h" #include "gen/iberror.h" #include "../yvalve/gds_proto.h" @@ -234,6 +235,56 @@ private: typedef GlobalPtr UnloadDetector; + +class BlrMessage +{ +public: + BlrMessage(unsigned aBlrLength, const unsigned char* aBlr, unsigned aBufferLength) + : blrLength(aBlrLength), + blr(aBlr), + bufferLength(aBufferLength) + { + } + +public: + unsigned blrLength; + const unsigned char* blr; + unsigned bufferLength; +}; + +class BlrMessageBuffer : public IBlrMessage +{ +public: + BlrMessageBuffer(const BlrMessage* aMessage, unsigned char* aBuffer) + : message(aMessage), + buffer(aBuffer) + { + } + +private: + const BlrMessage* const message; + unsigned char* const buffer; + +public: + unsigned int FB_CARG getBlrLength() const + { + return message ? message->blrLength : 0; + } + const unsigned char* FB_CARG getBlr() const + { + return message ? message->blr : NULL; + } + unsigned int FB_CARG getBufferLength() const + { + return message ? message->bufferLength : 0; + } + unsigned char* FB_CARG getBuffer() const + { + return buffer; + } +}; + + } // namespace Firebird diff --git a/src/dsql/dsql.h b/src/dsql/dsql.h index 3307659a73..0211811663 100644 --- a/src/dsql/dsql.h +++ b/src/dsql/dsql.h @@ -613,10 +613,10 @@ public: virtual void FB_CARG setCursorName(IStatus* status, const char* name, unsigned int type); virtual Firebird::ITransaction* FB_CARG execute(IStatus* status, Firebird::ITransaction* tra, unsigned int in_msg_type, - const Firebird::MessageBuffer* inMsgBuffer, - const Firebird::MessageBuffer* outMsgBuffer); - virtual int FB_CARG fetch(IStatus* status, const Firebird::MessageBuffer* msgBuffer); // returns 100 if EOF, 101 if fragmented - virtual void FB_CARG insert(IStatus* status, const Firebird::MessageBuffer* msgBuffer); + const Firebird::IBlrMessage* inMsgBuffer, + const Firebird::IBlrMessage* outMsgBuffer); + virtual int FB_CARG fetch(IStatus* status, const Firebird::IBlrMessage* msgBuffer); // returns 100 if EOF, 101 if fragmented + virtual void FB_CARG insert(IStatus* status, const Firebird::IBlrMessage* msgBuffer); virtual void FB_CARG free(IStatus* status, unsigned int option); }; diff --git a/src/include/ProviderInterface.h b/src/include/ProviderInterface.h index 3705df4aed..091229f8d7 100644 --- a/src/include/ProviderInterface.h +++ b/src/include/ProviderInterface.h @@ -38,34 +38,13 @@ namespace Firebird { class IAttachment; // Forward -class Message +class IBlrMessage { public: - Message(unsigned aBlrLength, const unsigned char* aBlr, unsigned aBufferLength) - : blrLength(aBlrLength), - blr(aBlr), - bufferLength(aBufferLength) - { - } - -public: - unsigned blrLength; - const unsigned char* blr; - unsigned bufferLength; -}; - -class MessageBuffer -{ -public: - MessageBuffer(const Message* aMessage, unsigned char* aBuffer) - : message(aMessage), - buffer(aBuffer) - { - } - -public: - const Message* const message; - unsigned char* const buffer; + virtual unsigned int FB_CARG getBlrLength() const = 0; + virtual const unsigned char* FB_CARG getBlr() const = 0; + virtual unsigned int FB_CARG getBufferLength() const = 0; + virtual unsigned char* FB_CARG getBuffer() const = 0; }; class IEventCallback @@ -137,10 +116,10 @@ public: unsigned int bufferLength, unsigned char* buffer) = 0; virtual void FB_CARG setCursorName(IStatus* status, const char* name, unsigned int type) = 0; virtual ITransaction* FB_CARG execute(IStatus* status, ITransaction* tra, - unsigned int inMsgType, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer) = 0; - virtual int FB_CARG fetch(IStatus* status, const MessageBuffer* msgBuffer) = 0; // returns 100 if EOF, 101 if fragmented - virtual void FB_CARG insert(IStatus* status, const MessageBuffer* msgBuffer) = 0; + unsigned int inMsgType, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer) = 0; + virtual int FB_CARG fetch(IStatus* status, const IBlrMessage* msgBuffer) = 0; // returns 100 if EOF, 101 if fragmented + virtual void FB_CARG insert(IStatus* status, const IBlrMessage* msgBuffer) = 0; virtual void FB_CARG free(IStatus* status, unsigned int option) = 0; }; #define FB_I_STATEMENT_VERSION (FB_INTERFACE_VERSION + 7) @@ -203,8 +182,8 @@ public: const unsigned char* dyn) = 0; virtual ITransaction* FB_CARG execute(IStatus* status, ITransaction* transaction, unsigned int length, const char* string, unsigned int dialect, - unsigned int inMsgType, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer) = 0; + unsigned int inMsgType, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer) = 0; virtual IEvents* FB_CARG queEvents(IStatus* status, IEventCallback* callback, unsigned int length, const unsigned char* events) = 0; virtual void FB_CARG cancelOperation(IStatus* status, int option) = 0; diff --git a/src/jrd/Attachment.h b/src/jrd/Attachment.h index 01bf84a175..b522a8917b 100644 --- a/src/jrd/Attachment.h +++ b/src/jrd/Attachment.h @@ -255,8 +255,8 @@ public: unsigned int length, const unsigned char* dyn); virtual Firebird::ITransaction* FB_CARG execute(IStatus* status, Firebird::ITransaction* transaction, unsigned int length, const char* string, unsigned int dialect, - unsigned int in_msg_type, const Firebird::MessageBuffer* inMsgBuffer, - const Firebird::MessageBuffer* outMsgBuffer); + unsigned int in_msg_type, const Firebird::IBlrMessage* inMsgBuffer, + const Firebird::IBlrMessage* outMsgBuffer); virtual Firebird::IEvents* FB_CARG queEvents(IStatus* status, Firebird::IEventCallback* callback, unsigned int length, const unsigned char* events); virtual void FB_CARG cancelOperation(IStatus* status, int option); diff --git a/src/jrd/extds/InternalDS.cpp b/src/jrd/extds/InternalDS.cpp index b43fef4d87..2aba2093ba 100644 --- a/src/jrd/extds/InternalDS.cpp +++ b/src/jrd/extds/InternalDS.cpp @@ -495,10 +495,10 @@ void InternalStatement::doExecute(thread_db* tdbb) { EngineCallbackGuard guard(tdbb, *this); - Message inMessage(m_inBlr.getCount(), m_inBlr.begin(), m_in_buffer.getCount()); - MessageBuffer inMsgBuffer(&inMessage, m_in_buffer.begin()); - Message outMessage(m_outBlr.getCount(), m_outBlr.begin(), m_out_buffer.getCount()); - MessageBuffer outMsgBuffer(&outMessage, m_out_buffer.begin()); + BlrMessage inMessage(m_inBlr.getCount(), m_inBlr.begin(), m_in_buffer.getCount()); + BlrMessageBuffer inMsgBuffer(&inMessage, m_in_buffer.begin()); + BlrMessage outMessage(m_outBlr.getCount(), m_outBlr.begin(), m_out_buffer.getCount()); + BlrMessageBuffer outMsgBuffer(&outMessage, m_out_buffer.begin()); m_request->execute(&status, transaction, 0, &inMsgBuffer, &outMsgBuffer); } @@ -516,8 +516,8 @@ void InternalStatement::doOpen(thread_db* tdbb) { EngineCallbackGuard guard(tdbb, *this); - Message inMessage(m_inBlr.getCount(), m_inBlr.begin(), m_in_buffer.getCount()); - MessageBuffer inMsgBuffer(&inMessage, m_in_buffer.begin()); + BlrMessage inMessage(m_inBlr.getCount(), m_inBlr.begin(), m_in_buffer.getCount()); + BlrMessageBuffer inMsgBuffer(&inMessage, m_in_buffer.begin()); m_request->execute(&status, transaction, 0, &inMsgBuffer, NULL); } @@ -533,8 +533,8 @@ bool InternalStatement::doFetch(thread_db* tdbb) int res = 0; { EngineCallbackGuard guard(tdbb, *this); - Message message(m_outBlr.getCount(), m_outBlr.begin(), m_out_buffer.getCount()); - MessageBuffer msgBuffer(&message, m_out_buffer.begin()); + BlrMessage message(m_outBlr.getCount(), m_outBlr.begin(), m_out_buffer.getCount()); + BlrMessageBuffer msgBuffer(&message, m_out_buffer.begin()); res = m_request->fetch(&status, &msgBuffer); } diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 3ffe700a9d..c85d3c66c2 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -4169,7 +4169,7 @@ Firebird::IStatement* Attachment::allocateStatement(IStatus* user_status) Firebird::ITransaction* dsql_req::execute(IStatus* user_status, Firebird::ITransaction* apiTra, - unsigned int in_msg_type, const MessageBuffer* inMsgBuffer, const MessageBuffer* outMsgBuffer) + unsigned int in_msg_type, const IBlrMessage* inMsgBuffer, const IBlrMessage* outMsgBuffer) { jrd_tra* tra = reinterpret_cast(apiTra); @@ -4188,17 +4188,15 @@ Firebird::ITransaction* dsql_req::execute(IStatus* user_status, Firebird::ITrans try { - const Message* inMessage = inMsgBuffer ? inMsgBuffer->message : NULL; - unsigned in_blr_length = inMessage ? inMessage->blrLength : 0; - const unsigned char* in_blr = inMessage ? inMessage->blr : NULL; - unsigned in_msg_length = inMessage ? inMessage->bufferLength : 0; - unsigned char* in_msg = inMsgBuffer ? inMsgBuffer->buffer : NULL; + unsigned in_blr_length = inMsgBuffer ? inMsgBuffer->getBlrLength() : 0; + const unsigned char* in_blr = inMsgBuffer ? inMsgBuffer->getBlr() : NULL; + unsigned in_msg_length = inMsgBuffer ? inMsgBuffer->getBufferLength() : 0; + unsigned char* in_msg = inMsgBuffer ? inMsgBuffer->getBuffer() : NULL; - const Message* outMessage = outMsgBuffer ? outMsgBuffer->message : NULL; - unsigned out_blr_length = outMessage ? outMessage->blrLength : 0; - const unsigned char* out_blr = outMessage ? outMessage->blr : NULL; - unsigned out_msg_length = outMessage ? outMessage->bufferLength : 0; - unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->buffer : NULL; + unsigned out_blr_length = outMsgBuffer ? outMsgBuffer->getBlrLength() : 0; + const unsigned char* out_blr = outMsgBuffer ? outMsgBuffer->getBlr() : NULL; + unsigned out_msg_length = outMsgBuffer ? outMsgBuffer->getBufferLength() : 0; + unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->getBuffer() : NULL; DSQL_execute(tdbb, &tra, this, in_blr_length, in_blr, in_msg_type, in_msg_length, in_msg, out_blr_length, out_blr, out_msg_length, out_msg); @@ -4223,8 +4221,8 @@ Firebird::ITransaction* dsql_req::execute(IStatus* user_status, Firebird::ITrans Firebird::ITransaction* Attachment::execute(IStatus* user_status, Firebird::ITransaction* apiTra, unsigned int length, const char* string, unsigned int dialect, - unsigned int /*in_msg_type*/, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer) + unsigned int /*in_msg_type*/, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer) { jrd_tra* tra = reinterpret_cast(apiTra); @@ -4243,17 +4241,15 @@ Firebird::ITransaction* Attachment::execute(IStatus* user_status, Firebird::ITra try { - const Message* inMessage = inMsgBuffer ? inMsgBuffer->message : NULL; - unsigned in_blr_length = inMessage ? inMessage->blrLength : 0; - const unsigned char* in_blr = inMessage ? inMessage->blr : NULL; - unsigned in_msg_length = inMessage ? inMessage->bufferLength : 0; - unsigned char* in_msg = inMsgBuffer ? inMsgBuffer->buffer : NULL; + unsigned in_blr_length = inMsgBuffer ? inMsgBuffer->getBlrLength() : 0; + const unsigned char* in_blr = inMsgBuffer ? inMsgBuffer->getBlr() : NULL; + unsigned in_msg_length = inMsgBuffer ? inMsgBuffer->getBufferLength() : 0; + unsigned char* in_msg = inMsgBuffer ? inMsgBuffer->getBuffer() : NULL; - const Message* outMessage = outMsgBuffer ? outMsgBuffer->message : NULL; - unsigned out_blr_length = outMessage ? outMessage->blrLength : 0; - const unsigned char* out_blr = outMessage ? outMessage->blr : NULL; - unsigned out_msg_length = outMessage ? outMessage->bufferLength : 0; - unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->buffer : NULL; + unsigned out_blr_length = outMsgBuffer ? outMsgBuffer->getBlrLength() : 0; + const unsigned char* out_blr = outMsgBuffer ? outMsgBuffer->getBlr() : NULL; + unsigned out_msg_length = outMsgBuffer ? outMsgBuffer->getBufferLength() : 0; + unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->getBuffer() : NULL; DSQL_execute_immediate(tdbb, this, &tra, length, string, dialect, in_blr_length, in_blr, @@ -4279,7 +4275,7 @@ Firebird::ITransaction* Attachment::execute(IStatus* user_status, Firebird::ITra } -int dsql_req::fetch(IStatus* user_status, const MessageBuffer* msgBuffer) +int dsql_req::fetch(IStatus* user_status, const IBlrMessage* msgBuffer) { int return_code = 0; @@ -4293,11 +4289,10 @@ int dsql_req::fetch(IStatus* user_status, const MessageBuffer* msgBuffer) try { - const Message* bufMessage = msgBuffer ? msgBuffer->message : NULL; - unsigned blr_length = bufMessage ? bufMessage->blrLength : 0; - const unsigned char* blr = bufMessage ? bufMessage->blr : NULL; - unsigned msg_length = bufMessage ? bufMessage->bufferLength : 0; - unsigned char* msg = msgBuffer ? msgBuffer->buffer : NULL; + unsigned blr_length = msgBuffer ? msgBuffer->getBlrLength() : 0; + const unsigned char* blr = msgBuffer ? msgBuffer->getBlr() : NULL; + unsigned msg_length = msgBuffer ? msgBuffer->getBufferLength() : 0; + unsigned char* msg = msgBuffer ? msgBuffer->getBuffer() : NULL; return_code = DSQL_fetch(tdbb, this, blr_length, blr, /*msg_type,*/ msg_length, msg); @@ -4350,7 +4345,7 @@ void dsql_req::free(IStatus* user_status, unsigned int option) } -void dsql_req::insert(IStatus* user_status, const MessageBuffer* msgBuffer) +void dsql_req::insert(IStatus* user_status, const IBlrMessage* msgBuffer) { try { @@ -4362,11 +4357,10 @@ void dsql_req::insert(IStatus* user_status, const MessageBuffer* msgBuffer) try { - const Message* bufMessage = msgBuffer ? msgBuffer->message : NULL; - unsigned blr_length = bufMessage ? bufMessage->blrLength : 0; - const unsigned char* blr = bufMessage ? bufMessage->blr : NULL; - unsigned msg_length = bufMessage ? bufMessage->bufferLength : 0; - unsigned char* msg = msgBuffer ? msgBuffer->buffer : NULL; + unsigned blr_length = msgBuffer ? msgBuffer->getBlrLength() : 0; + const unsigned char* blr = msgBuffer ? msgBuffer->getBlr() : NULL; + unsigned msg_length = msgBuffer ? msgBuffer->getBufferLength() : 0; + unsigned char* msg = msgBuffer ? msgBuffer->getBuffer() : NULL; DSQL_insert(tdbb, this, blr_length, blr, msg_length, msg); } diff --git a/src/remote/client/interface.cpp b/src/remote/client/interface.cpp index 4375f00153..fc6acd29f6 100644 --- a/src/remote/client/interface.cpp +++ b/src/remote/client/interface.cpp @@ -234,10 +234,10 @@ public: unsigned int bufferLength, unsigned char* buffer); virtual void FB_CARG setCursorName(IStatus* status, const char* name, unsigned int type); virtual Firebird::ITransaction* FB_CARG execute(IStatus* status, Firebird::ITransaction* tra, - unsigned int in_msg_type, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer); - virtual int FB_CARG fetch(IStatus* status, const MessageBuffer* msgBuffer); // returns 100 if EOF, 101 if fragmented - virtual void FB_CARG insert(IStatus* status, const MessageBuffer* msgBuffer); + unsigned int in_msg_type, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer); + virtual int FB_CARG fetch(IStatus* status, const IBlrMessage* msgBuffer); // returns 100 if EOF, 101 if fragmented + virtual void FB_CARG insert(IStatus* status, const IBlrMessage* msgBuffer); virtual void FB_CARG free(IStatus* status, unsigned int option); public: @@ -369,8 +369,8 @@ public: const unsigned char* dyn); virtual Firebird::ITransaction* FB_CARG execute(IStatus* status, Firebird::ITransaction* transaction, unsigned int length, const char* string, unsigned int dialect, - unsigned int in_msg_type, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer); + unsigned int in_msg_type, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer); virtual Firebird::IEvents* FB_CARG queEvents(IStatus* status, Firebird::IEventCallback* callback, unsigned int length, const unsigned char* events); virtual void FB_CARG cancelOperation(IStatus* status, int option); @@ -1482,8 +1482,8 @@ Firebird::IStatement* Attachment::allocateStatement(IStatus* status) Firebird::ITransaction* Statement::execute(IStatus* status, Firebird::ITransaction* apiTra, - unsigned int in_msg_type, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer) + unsigned int in_msg_type, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer) { /************************************** * @@ -1507,17 +1507,15 @@ Firebird::ITransaction* Statement::execute(IStatus* status, Firebird::ITransacti Rdb* rdb = statement->rsr_rdb; CHECK_HANDLE(rdb, isc_bad_db_handle); - const Message* inMessage = inMsgBuffer ? inMsgBuffer->message : NULL; - unsigned in_blr_length = inMessage ? inMessage->blrLength : 0; - const unsigned char* in_blr = inMessage ? inMessage->blr : NULL; - unsigned in_msg_length = inMessage ? inMessage->bufferLength : 0; - unsigned char* in_msg = inMsgBuffer ? inMsgBuffer->buffer : NULL; + unsigned in_blr_length = inMsgBuffer ? inMsgBuffer->getBlrLength() : 0; + const unsigned char* in_blr = inMsgBuffer ? inMsgBuffer->getBlr() : NULL; + unsigned in_msg_length = inMsgBuffer ? inMsgBuffer->getBufferLength() : 0; + unsigned char* in_msg = inMsgBuffer ? inMsgBuffer->getBuffer() : NULL; - const Message* outMessage = outMsgBuffer ? outMsgBuffer->message : NULL; - unsigned out_blr_length = outMessage ? outMessage->blrLength : 0; - const unsigned char* out_blr = outMessage ? outMessage->blr : NULL; - unsigned out_msg_length = outMessage ? outMessage->bufferLength : 0; - unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->buffer : NULL; + unsigned out_blr_length = outMsgBuffer ? outMsgBuffer->getBlrLength() : 0; + const unsigned char* out_blr = outMsgBuffer ? outMsgBuffer->getBlr() : NULL; + unsigned out_msg_length = outMsgBuffer ? outMsgBuffer->getBufferLength() : 0; + unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->getBuffer() : NULL; rem_port* port = rdb->rdb_port; RefMutexGuard portGuard(*port->port_sync); @@ -1679,8 +1677,8 @@ Firebird::ITransaction* Statement::execute(IStatus* status, Firebird::ITransacti Firebird::ITransaction* Attachment::execute(IStatus* status, Firebird::ITransaction* apiTra, unsigned int length, const char* string, unsigned int dialect, - unsigned int in_msg_type, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer) + unsigned int in_msg_type, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer) { /************************************** * @@ -1701,17 +1699,15 @@ Firebird::ITransaction* Attachment::execute(IStatus* status, Firebird::ITransact rem_port* port = rdb->rdb_port; RefMutexGuard portGuard(*port->port_sync); - const Message* inMessage = inMsgBuffer ? inMsgBuffer->message : NULL; - unsigned in_blr_length = inMessage ? inMessage->blrLength : 0; - const unsigned char* in_blr = inMessage ? inMessage->blr : NULL; - unsigned in_msg_length = inMessage ? inMessage->bufferLength : 0; - unsigned char* in_msg = inMsgBuffer ? inMsgBuffer->buffer : NULL; + unsigned in_blr_length = inMsgBuffer ? inMsgBuffer->getBlrLength() : 0; + const unsigned char* in_blr = inMsgBuffer ? inMsgBuffer->getBlr() : NULL; + unsigned in_msg_length = inMsgBuffer ? inMsgBuffer->getBufferLength() : 0; + unsigned char* in_msg = inMsgBuffer ? inMsgBuffer->getBuffer() : NULL; - const Message* outMessage = outMsgBuffer ? outMsgBuffer->message : NULL; - unsigned out_blr_length = outMessage ? outMessage->blrLength : 0; - const unsigned char* out_blr = outMessage ? outMessage->blr : NULL; - unsigned out_msg_length = outMessage ? outMessage->bufferLength : 0; - unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->buffer : NULL; + unsigned out_blr_length = outMsgBuffer ? outMsgBuffer->getBlrLength() : 0; + const unsigned char* out_blr = outMsgBuffer ? outMsgBuffer->getBlr() : NULL; + unsigned out_msg_length = outMsgBuffer ? outMsgBuffer->getBufferLength() : 0; + unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->getBuffer() : NULL; Rtr* transaction = NULL; if (apiTra) @@ -1866,7 +1862,7 @@ Firebird::ITransaction* Attachment::execute(IStatus* status, Firebird::ITransact } -int Statement::fetch(IStatus* status, const MessageBuffer* msgBuffer) +int Statement::fetch(IStatus* status, const IBlrMessage* msgBuffer) { /************************************** * @@ -1891,11 +1887,10 @@ int Statement::fetch(IStatus* status, const MessageBuffer* msgBuffer) CHECK_HANDLE(rdb, isc_bad_db_handle); rem_port* port = rdb->rdb_port; - const Message* bufMessage = msgBuffer ? msgBuffer->message : NULL; - unsigned blr_length = bufMessage ? bufMessage->blrLength : 0; - const unsigned char* blr = bufMessage ? bufMessage->blr : NULL; - unsigned msg_length = bufMessage ? bufMessage->bufferLength : 0; - unsigned char* msg = msgBuffer ? msgBuffer->buffer : NULL; + unsigned blr_length = msgBuffer ? msgBuffer->getBlrLength() : 0; + const unsigned char* blr = msgBuffer ? msgBuffer->getBlr() : NULL; + unsigned msg_length = msgBuffer ? msgBuffer->getBufferLength() : 0; + unsigned char* msg = msgBuffer ? msgBuffer->getBuffer() : NULL; RefMutexGuard portGuard(*port->port_sync); @@ -2215,7 +2210,7 @@ void Statement::free(IStatus* status, unsigned int option) } -void Statement::insert(IStatus* status, const MessageBuffer* msgBuffer) +void Statement::insert(IStatus* status, const IBlrMessage* msgBuffer) { /************************************** * @@ -2240,11 +2235,10 @@ void Statement::insert(IStatus* status, const MessageBuffer* msgBuffer) CHECK_HANDLE(rdb, isc_bad_db_handle); rem_port* port = rdb->rdb_port; - const Message* bufMessage = msgBuffer ? msgBuffer->message : NULL; - unsigned blr_length = bufMessage ? bufMessage->blrLength : 0; - const unsigned char* blr = bufMessage ? bufMessage->blr : NULL; - unsigned msg_length = bufMessage ? bufMessage->bufferLength : 0; - unsigned char* msg = msgBuffer ? msgBuffer->buffer : NULL; + unsigned blr_length = msgBuffer ? msgBuffer->getBlrLength() : 0; + const unsigned char* blr = msgBuffer ? msgBuffer->getBlr() : NULL; + unsigned msg_length = msgBuffer ? msgBuffer->getBufferLength() : 0; + unsigned char* msg = msgBuffer ? msgBuffer->getBuffer() : NULL; RefMutexGuard portGuard(*port->port_sync); diff --git a/src/yvalve/why.cpp b/src/yvalve/why.cpp index 516a0750e6..b79871de7b 100644 --- a/src/yvalve/why.cpp +++ b/src/yvalve/why.cpp @@ -994,10 +994,10 @@ namespace const unsigned char* items, unsigned int bufferLength, unsigned char* buffer); virtual void FB_CARG setCursorName(IStatus* status, const char* name, unsigned int type); virtual YTransaction* FB_CARG execute(IStatus* status, ITransaction* transaction, - unsigned int inMsgType, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer); - virtual int FB_CARG fetch(IStatus* status, const MessageBuffer* msgBuffer); - virtual void FB_CARG insert(IStatus* status, const MessageBuffer* msgBuffer); + unsigned int inMsgType, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer); + virtual int FB_CARG fetch(IStatus* status, const IBlrMessage* msgBuffer); + virtual void FB_CARG insert(IStatus* status, const IBlrMessage* msgBuffer); virtual void FB_CARG free(IStatus* status, unsigned int option); public: @@ -1081,7 +1081,7 @@ namespace const unsigned char* dyn); virtual YTransaction* FB_CARG execute(IStatus* status, ITransaction* transaction, unsigned int length, const char* string, unsigned int dialect, unsigned int inMsgType, - const MessageBuffer* inMsgBuffer, const MessageBuffer* outMsgBuffer); + const IBlrMessage* inMsgBuffer, const IBlrMessage* outMsgBuffer); virtual YEvents* FB_CARG queEvents(IStatus* status, IEventCallback* callback, unsigned int length, const unsigned char* eventsData); virtual void FB_CARG cancelOperation(IStatus* status, int option); @@ -2156,10 +2156,10 @@ ISC_STATUS API_ROUTINE isc_dsql_execute2_m(ISC_STATUS* userStatus, FB_API_HANDLE if (traHandle && *traHandle) transaction = translateHandle(transactions, traHandle); - Message inMessage(inBlrLength, reinterpret_cast(inBlr), inMsgLength); - MessageBuffer inMsgBuffer(&inMessage, reinterpret_cast(const_cast(inMsg))); - Message outMessage(outBlrLength, reinterpret_cast(outBlr), outMsgLength); - MessageBuffer outMsgBuffer(&outMessage, reinterpret_cast(outMsg)); + BlrMessage inMessage(inBlrLength, reinterpret_cast(inBlr), inMsgLength); + BlrMessageBuffer inMsgBuffer(&inMessage, reinterpret_cast(const_cast(inMsg))); + BlrMessage outMessage(outBlrLength, reinterpret_cast(outBlr), outMsgLength); + BlrMessageBuffer outMsgBuffer(&outMessage, reinterpret_cast(outMsg)); YTransaction* newTrans = statement->execute(&status, transaction, inMsgType, &inMsgBuffer, &outMsgBuffer); @@ -2374,10 +2374,10 @@ ISC_STATUS API_ROUTINE isc_dsql_exec_immed3_m(ISC_STATUS* userStatus, FB_API_HAN if (traHandle && *traHandle) transaction = translateHandle(transactions, traHandle); - Message inMessage(inBlrLength, reinterpret_cast(inBlr), inMsgLength); - MessageBuffer inMsgBuffer(&inMessage, reinterpret_cast(const_cast(inMsg))); - Message outMessage(outBlrLength, reinterpret_cast(outBlr), outMsgLength); - MessageBuffer outMsgBuffer(&outMessage, reinterpret_cast(outMsg)); + BlrMessage inMessage(inBlrLength, reinterpret_cast(inBlr), inMsgLength); + BlrMessageBuffer inMsgBuffer(&inMessage, reinterpret_cast(const_cast(inMsg))); + BlrMessage outMessage(outBlrLength, reinterpret_cast(outBlr), outMsgLength); + BlrMessageBuffer outMsgBuffer(&outMessage, reinterpret_cast(outMsg)); YTransaction* newTrans = attachment->execute(&status, transaction, stmtLength, sqlStmt, dialect, inMsgType, &inMsgBuffer, &outMsgBuffer); @@ -2458,8 +2458,8 @@ ISC_STATUS API_ROUTINE isc_dsql_fetch_m(ISC_STATUS* userStatus, FB_API_HANDLE* s { RefPtr statement(translateHandle(statements, stmtHandle)); - Message message(blrLength, reinterpret_cast(blr), msgLength); - MessageBuffer msgBuffer(&message, reinterpret_cast(msg)); + BlrMessage message(blrLength, reinterpret_cast(blr), msgLength); + BlrMessageBuffer msgBuffer(&message, reinterpret_cast(msg)); int s = statement->fetch(&status, &msgBuffer); @@ -2542,8 +2542,8 @@ ISC_STATUS API_ROUTINE isc_dsql_insert_m(ISC_STATUS* userStatus, FB_API_HANDLE* { RefPtr statement(translateHandle(statements, stmtHandle)); - Message message(blrLength, reinterpret_cast(blr), msgLength); - MessageBuffer msgBuffer(&message, reinterpret_cast(const_cast(msg))); + BlrMessage message(blrLength, reinterpret_cast(blr), msgLength); + BlrMessageBuffer msgBuffer(&message, reinterpret_cast(const_cast(msg))); statement->insert(&status, &msgBuffer); } @@ -3994,8 +3994,8 @@ void YStatement::setCursorName(IStatus* status, const char* name, unsigned int t } YTransaction* YStatement::execute(IStatus* status, ITransaction* transaction, - unsigned int inMsgType, const MessageBuffer* inMsgBuffer, - const MessageBuffer* outMsgBuffer) + unsigned int inMsgType, const IBlrMessage* inMsgBuffer, + const IBlrMessage* outMsgBuffer) { try { @@ -4022,7 +4022,7 @@ YTransaction* YStatement::execute(IStatus* status, ITransaction* transaction, return NULL; } -int YStatement::fetch(IStatus* status, const MessageBuffer* msgBuffer) +int YStatement::fetch(IStatus* status, const IBlrMessage* msgBuffer) { try { @@ -4037,7 +4037,7 @@ int YStatement::fetch(IStatus* status, const MessageBuffer* msgBuffer) return status->get()[1]; } -void YStatement::insert(IStatus* status, const MessageBuffer* msgBuffer) +void YStatement::insert(IStatus* status, const IBlrMessage* msgBuffer) { try { @@ -4714,7 +4714,7 @@ void YAttachment::ddl(IStatus* status, ITransaction* transaction, unsigned int l YTransaction* YAttachment::execute(IStatus* status, ITransaction* transaction, unsigned int length, const char* string, unsigned int dialect, unsigned int inMsgType, - const MessageBuffer* inMsgBuffer, const MessageBuffer* outMsgBuffer) + const IBlrMessage* inMsgBuffer, const IBlrMessage* outMsgBuffer) { try {