mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:43:03 +01:00
Avoid limits on size of status vector in engine. Ensure that status is always clean on entry to interface methods.
This commit is contained in:
parent
91e8bc68cc
commit
c4c9daf132
@ -56,7 +56,8 @@ namespace Auth {
|
||||
DebugServer::DebugServer(Firebird::IPluginConfig* pConf)
|
||||
: str(getPool())
|
||||
{
|
||||
Firebird::LocalStatus s;
|
||||
Firebird::LocalStatus ls;
|
||||
Firebird::CheckStatusWrapper s(&ls);
|
||||
config.assignRefNoIncr(pConf->getDefaultConfig(&s));
|
||||
check(&s);
|
||||
}
|
||||
@ -96,7 +97,8 @@ int DebugServer::authenticate(Firebird::CheckStatusWrapper* status, Firebird::IS
|
||||
#ifdef AUTH_VERBOSE
|
||||
fprintf(stderr, "DebugServer::authenticate2: %s\n", str.c_str());
|
||||
#endif
|
||||
Firebird::LocalStatus s;
|
||||
Firebird::LocalStatus ls;
|
||||
Firebird::CheckStatusWrapper s(&ls);
|
||||
writerInterface->add(&s, str.c_str());
|
||||
check(&s);
|
||||
str.erase();
|
||||
|
@ -26,7 +26,8 @@ class Meta : public Firebird::RefPtr<Firebird::IMessageMetadata>
|
||||
public:
|
||||
Meta(Firebird::IStatement* stmt, bool out)
|
||||
{
|
||||
Firebird::LocalStatus st;
|
||||
Firebird::LocalStatus ls;
|
||||
Firebird::CheckStatusWrapper st(&ls);
|
||||
Firebird::IMessageMetadata* m = out ? stmt->getOutputMetadata(&st) : stmt->getInputMetadata(&st);
|
||||
if (st.getState() & Firebird::IStatus::STATE_ERRORS)
|
||||
{
|
||||
|
@ -260,7 +260,8 @@ public:
|
||||
if (att)
|
||||
{
|
||||
// detach from database
|
||||
Firebird::LocalStatus lStatus;
|
||||
Firebird::LocalStatus ls;
|
||||
Firebird::CheckStatusWrapper lStatus(&ls);
|
||||
att->detach(&lStatus);
|
||||
att = NULL;
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ public:
|
||||
verifier(getPool()), salt(getPool()), sessionKey(getPool()),
|
||||
secDbName(NULL)
|
||||
{
|
||||
Firebird::LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
config.assignRefNoIncr(par->getFirebirdConf(&s));
|
||||
check(&s);
|
||||
}
|
||||
@ -198,7 +199,8 @@ int SrpServer::authenticate(CheckStatusWrapper* status, IServerBlock* sb, IWrite
|
||||
}
|
||||
catch(const Exception&)
|
||||
{
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
|
||||
if (stmt) stmt->free(&s);
|
||||
if (tra) tra->rollback(&s);
|
||||
|
@ -371,7 +371,8 @@ int SecurityDatabase::verify(IWriter* authBlock, IServerBlock* sBlock)
|
||||
}
|
||||
}
|
||||
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
authBlock->add(&s, login.c_str());
|
||||
check(&s);
|
||||
authBlock->setDb(&s, secureDbName);
|
||||
@ -447,7 +448,8 @@ int SecurityDatabase::shutdown()
|
||||
{
|
||||
if (curInstances[i])
|
||||
{
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
TimerInterfacePtr()->stop(&s, curInstances[i]);
|
||||
check(&s);
|
||||
curInstances[i]->release();
|
||||
@ -483,7 +485,8 @@ int SecurityDatabaseServer::authenticate(Firebird::CheckStatusWrapper* status, I
|
||||
{
|
||||
PathName secDbName;
|
||||
{ // config scope
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
RefPtr<IFirebirdConf> config(REF_NO_INCR, iParameter->getFirebirdConf(&s));
|
||||
check(&s);
|
||||
|
||||
@ -526,7 +529,8 @@ int SecurityDatabaseServer::authenticate(Firebird::CheckStatusWrapper* status, I
|
||||
int rc = instance->verify(writerInterface, sBlock);
|
||||
#define USE_ATT_RQ_CACHE
|
||||
#ifdef USE_ATT_RQ_CACHE
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
TimerInterfacePtr()->start(&s, instance, 10 * 1000 * 1000);
|
||||
if (s.getState() & IStatus::STATE_ERRORS)
|
||||
instance->handler();
|
||||
|
143
src/common/DynamicStrings.cpp
Normal file
143
src/common/DynamicStrings.cpp
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* PROGRAM: Firebird exceptions classes
|
||||
* MODULE: StatusHolder.cpp
|
||||
* DESCRIPTION: Firebird's exception classes
|
||||
*
|
||||
* The contents of this file are subject to the Initial
|
||||
* Developer's Public License Version 1.0 (the "License");
|
||||
* you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
||||
*
|
||||
* Software distributed under the License is distributed AS IS,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing rights
|
||||
* and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Vlad Khorsun
|
||||
* for the Firebird Open Source RDBMS project.
|
||||
*
|
||||
* Copyright (c) 2007 Vlad Khorsun <hvlad at users.sourceforge.net>
|
||||
* and all contributors signed below.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
|
||||
#include "DynamicStrings.h"
|
||||
#include "utils_proto.h"
|
||||
#include "gen/iberror.h"
|
||||
#include "classes/alloc.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_STATUS* const src) throw(BadAlloc)
|
||||
{
|
||||
const ISC_STATUS* end = &src[length];
|
||||
|
||||
// allocate space for strings
|
||||
size_t len = 0;
|
||||
for (const ISC_STATUS* from = src; from < end; ++from)
|
||||
{
|
||||
const ISC_STATUS type = *from++;
|
||||
if (from == end || type == isc_arg_end)
|
||||
{
|
||||
end = from - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case isc_arg_cstring:
|
||||
if (from + 1 >= end)
|
||||
{
|
||||
end = from - 1;
|
||||
break;
|
||||
}
|
||||
len += *from++;
|
||||
len++;
|
||||
break;
|
||||
|
||||
case isc_arg_string:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
len += strlen(reinterpret_cast<const char*>(*from));
|
||||
len++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char* string = len ? FB_NEW(*getDefaultMemoryPool()) char[len] : NULL;
|
||||
ISC_STATUS* to = dst;
|
||||
|
||||
// copy status vector saving strings in local buffer
|
||||
for (const ISC_STATUS* from = src; from < end; ++from)
|
||||
{
|
||||
const ISC_STATUS type = *from++;
|
||||
*to++ = type == isc_arg_cstring ? isc_arg_string : type;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case isc_arg_cstring:
|
||||
fb_assert(string);
|
||||
*to++ = (ISC_STATUS)(IPTR) string;
|
||||
memcpy(string, reinterpret_cast<const char*>(from[1]), from[0]);
|
||||
string += *from++;
|
||||
*string++ = 0;
|
||||
break;
|
||||
|
||||
case isc_arg_string:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
fb_assert(string);
|
||||
*to++ = (ISC_STATUS)(IPTR) string;
|
||||
strcpy(string, reinterpret_cast<const char*>(*from));
|
||||
string += strlen(string);
|
||||
string++;
|
||||
break;
|
||||
|
||||
default:
|
||||
*to++ = *from;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*to++ = isc_arg_end;
|
||||
return (to - dst) - 1;
|
||||
}
|
||||
|
||||
char* freeDynamicStrings(unsigned length, ISC_STATUS* ptr) throw()
|
||||
{
|
||||
while (length--)
|
||||
{
|
||||
const ISC_STATUS type = *ptr++;
|
||||
if (type == isc_arg_end)
|
||||
break;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case isc_arg_cstring:
|
||||
fb_assert(false); // CVC: according to the new logic, this case cannot happen
|
||||
ptr++;
|
||||
|
||||
case isc_arg_string:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
return reinterpret_cast<char*>(*ptr);
|
||||
|
||||
default:
|
||||
ptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Firebird
|
44
src/common/DynamicStrings.h
Normal file
44
src/common/DynamicStrings.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* PROGRAM: Firebird status vector support.
|
||||
* MODULE: DynamicStrings.h
|
||||
* DESCRIPTION: Dynamically store strings in status vector.
|
||||
*
|
||||
* The contents of this file are subject to the Initial
|
||||
* Developer's Public License Version 1.0 (the "License");
|
||||
* you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
||||
*
|
||||
* Software distributed under the License is distributed AS IS,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing rights
|
||||
* and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Alex Peshkov
|
||||
* for the Firebird Open Source RDBMS project.
|
||||
*
|
||||
* Copyright (c) 2015 Alex Peshkov <peshkoff at mail dot ru>
|
||||
* and all contributors signed below.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FB_DYNAMIC_STRINGS
|
||||
#define FB_DYNAMIC_STRINGS
|
||||
|
||||
#include "firebird/Interface.h"
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
class BadAlloc;
|
||||
|
||||
unsigned makeDynamicStrings(unsigned len, ISC_STATUS* const dst, const ISC_STATUS* const src) throw(BadAlloc);
|
||||
char* freeDynamicStrings(unsigned len, ISC_STATUS* ptr) throw();
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
|
||||
#endif // FB_DYNAMIC_STRINGS
|
@ -329,7 +329,8 @@ IMetadataBuilder* MsgMetadata::getBuilder(CheckStatusWrapper* status)
|
||||
|
||||
void MsgMetadata::assign(IMessageMetadata* from)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
|
||||
unsigned count = from->getCount(&status);
|
||||
check(&status);
|
||||
|
@ -426,9 +426,10 @@ void StatementMetadata::parse(unsigned bufferLength, const UCHAR* buffer)
|
||||
void StatementMetadata::getAndParse(unsigned itemsLength, const UCHAR* items,
|
||||
unsigned bufferLength, UCHAR* buffer)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
statement->getInfo(&status, itemsLength, items, bufferLength, buffer);
|
||||
status.check();
|
||||
ls.check();
|
||||
|
||||
parse(bufferLength, buffer);
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ Base::Base(ISC_STATUS k, ISC_STATUS c) throw(Firebird::BadAlloc) :
|
||||
{
|
||||
}
|
||||
|
||||
StatusVector::ImplStatusVector::ImplStatusVector(const ISC_STATUS* s) throw() : Base::ImplBase(0, 0)
|
||||
StatusVector::ImplStatusVector::ImplStatusVector(const ISC_STATUS* s) throw()
|
||||
: Base::ImplBase(0, 0),
|
||||
m_status_vector(*getDefaultMemoryPool())
|
||||
{
|
||||
fb_assert(s);
|
||||
|
||||
@ -66,27 +68,26 @@ StatusVector::ImplStatusVector::ImplStatusVector(const ISC_STATUS* s) throw() :
|
||||
|
||||
// special case - empty initialized status vector, no warnings
|
||||
if (s[0] != isc_arg_gds || s[1] != 0 || s[2] != 0)
|
||||
{
|
||||
append(s, FB_NELEM(m_status_vector) - 1);
|
||||
}
|
||||
append(s);
|
||||
}
|
||||
|
||||
StatusVector::ImplStatusVector::ImplStatusVector(const IStatus* s) throw() :
|
||||
Base::ImplBase(0, 0)
|
||||
StatusVector::ImplStatusVector::ImplStatusVector(const IStatus* s) throw()
|
||||
: Base::ImplBase(0, 0),
|
||||
m_status_vector(*getDefaultMemoryPool())
|
||||
{
|
||||
fb_assert(s);
|
||||
|
||||
clear();
|
||||
|
||||
if (s->getState() & IStatus::STATE_ERRORS)
|
||||
append(s->getErrors(), FB_NELEM(m_status_vector) - 1);
|
||||
|
||||
append(s->getErrors());
|
||||
if (s->getState() & IStatus::STATE_WARNINGS)
|
||||
append(s->getWarnings(), FB_NELEM(m_status_vector) - 1);
|
||||
append(s->getWarnings());
|
||||
}
|
||||
|
||||
StatusVector::ImplStatusVector::ImplStatusVector(const Exception& ex) throw() :
|
||||
Base::ImplBase(0, 0)
|
||||
StatusVector::ImplStatusVector::ImplStatusVector(const Exception& ex) throw()
|
||||
: Base::ImplBase(0, 0),
|
||||
m_status_vector(*getDefaultMemoryPool())
|
||||
{
|
||||
assign(ex);
|
||||
}
|
||||
@ -119,20 +120,19 @@ StatusVector::StatusVector() throw(Firebird::BadAlloc) :
|
||||
|
||||
void StatusVector::ImplStatusVector::clear() throw()
|
||||
{
|
||||
m_length = 0;
|
||||
m_warning = 0;
|
||||
m_status_vector[0] = isc_arg_end;
|
||||
m_status_vector.clear();
|
||||
m_status_vector.push(isc_arg_end);
|
||||
}
|
||||
|
||||
bool StatusVector::ImplStatusVector::compare(const StatusVector& v) const throw()
|
||||
{
|
||||
return m_length == v.length() &&
|
||||
memcmp(m_status_vector, v.value(), m_length * sizeof(ISC_STATUS)) == 0;
|
||||
return length() == v.length() && fb_utils::cmpStatus(length(), value(), v.value());
|
||||
}
|
||||
|
||||
void StatusVector::ImplStatusVector::makePermanent() throw()
|
||||
{
|
||||
makePermanentVector(m_status_vector);
|
||||
makePermanentVector(m_status_vector.begin());
|
||||
}
|
||||
|
||||
void StatusVector::ImplStatusVector::assign(const StatusVector& v) throw()
|
||||
@ -143,9 +143,8 @@ void StatusVector::ImplStatusVector::assign(const StatusVector& v) throw()
|
||||
|
||||
void StatusVector::ImplStatusVector::assign(const Exception& ex) throw()
|
||||
{
|
||||
clear();
|
||||
ex.stuff_exception(m_status_vector);
|
||||
m_length = fb_utils::statusLength(m_status_vector);
|
||||
m_status_vector.clear();
|
||||
ex.stuffException(m_status_vector);
|
||||
}
|
||||
|
||||
void StatusVector::ImplStatusVector::append(const StatusVector& v) throw()
|
||||
@ -195,17 +194,20 @@ bool StatusVector::ImplStatusVector::appendWarnings(const ImplBase* const v) thr
|
||||
bool StatusVector::ImplStatusVector::append(const ISC_STATUS* const from, const unsigned int count) throw()
|
||||
{
|
||||
// CVC: I didn't expect count to be zero but it's, in some calls
|
||||
fb_assert(count >= 0 && count <= ISC_STATUS_LENGTH);
|
||||
fb_assert(count >= 0);
|
||||
if (!count)
|
||||
return true; // not sure it's the best option here
|
||||
|
||||
unsigned lenBefore = length();
|
||||
ISC_STATUS* s = m_status_vector.getBuffer(lenBefore + count + 1);
|
||||
unsigned int copied =
|
||||
fb_utils::copyStatus(&m_status_vector[m_length], FB_NELEM(m_status_vector) - m_length, from, count);
|
||||
m_length += copied;
|
||||
fb_utils::copyStatus(&s[lenBefore], count + 1, from, count);
|
||||
if (copied < count)
|
||||
m_status_vector.shrink(lenBefore + copied + 1);
|
||||
|
||||
if (!m_warning)
|
||||
{
|
||||
for (unsigned n = 0; n < m_length; )
|
||||
for (unsigned n = 0; n < length(); )
|
||||
{
|
||||
if (m_status_vector[n] == isc_arg_warning)
|
||||
{
|
||||
@ -219,19 +221,22 @@ bool StatusVector::ImplStatusVector::append(const ISC_STATUS* const from, const
|
||||
return copied == count;
|
||||
}
|
||||
|
||||
void StatusVector::ImplStatusVector::append(const ISC_STATUS* const from) throw()
|
||||
{
|
||||
unsigned l = fb_utils::statusLength(from);
|
||||
append(from, l + 1);
|
||||
}
|
||||
|
||||
void StatusVector::ImplStatusVector::shiftLeft(const Base& arg) throw()
|
||||
{
|
||||
if (m_length < FB_NELEM(m_status_vector) - 2)
|
||||
{
|
||||
m_status_vector[m_length++] = arg.getKind();
|
||||
m_status_vector[m_length++] = arg.getCode();
|
||||
m_status_vector[m_length] = isc_arg_end;
|
||||
}
|
||||
m_status_vector[length()] = arg.getKind();
|
||||
m_status_vector.push(arg.getCode());
|
||||
m_status_vector.push(isc_arg_end);
|
||||
}
|
||||
|
||||
void StatusVector::ImplStatusVector::shiftLeft(const Warning& arg) throw()
|
||||
{
|
||||
const int cur = m_warning ? 0 : m_length;
|
||||
const int cur = m_warning ? 0 : length();
|
||||
shiftLeft(*static_cast<const Base*>(&arg));
|
||||
if (cur && m_status_vector[cur] == isc_arg_warning)
|
||||
m_warning = cur;
|
||||
@ -265,6 +270,7 @@ ISC_STATUS StatusVector::ImplStatusVector::copyTo(ISC_STATUS* dest) const throw(
|
||||
{
|
||||
if (hasData())
|
||||
{
|
||||
unsigned l = (length() >= ISC_STATUS_LENGTH) ? (ISC_STATUS_LENGTH - 1u) : length();
|
||||
memcpy(dest, value(), (length() + 1u) * sizeof(ISC_STATUS));
|
||||
}
|
||||
else
|
||||
@ -276,25 +282,24 @@ ISC_STATUS StatusVector::ImplStatusVector::copyTo(ISC_STATUS* dest) const throw(
|
||||
return dest[1];
|
||||
}
|
||||
|
||||
ISC_STATUS StatusVector::ImplStatusVector::copyTo(IStatus* dest) const throw()
|
||||
void StatusVector::ImplStatusVector::copyTo(IStatus* dest) const throw()
|
||||
{
|
||||
dest->init();
|
||||
if (hasData())
|
||||
{
|
||||
const ISC_STATUS* v = m_status_vector;
|
||||
unsigned int length = m_length;
|
||||
const ISC_STATUS* v = m_status_vector.begin();
|
||||
unsigned int len = length();
|
||||
unsigned int warning = m_warning;
|
||||
|
||||
if (v[warning] == isc_arg_warning)
|
||||
{
|
||||
dest->setWarnings2(length - warning, &v[warning]);
|
||||
dest->setWarnings2(len - warning, &v[warning]);
|
||||
if (warning)
|
||||
dest->setErrors2(warning, v);
|
||||
}
|
||||
else
|
||||
dest->setErrors2(length, v);
|
||||
dest->setErrors2(len, v);
|
||||
}
|
||||
return m_status_vector[1];
|
||||
}
|
||||
|
||||
Gds::Gds(ISC_STATUS s) throw() :
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "fb_exception.h"
|
||||
#include "firebird/Interface.h"
|
||||
#include "../common/SimpleStatusVector.h"
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
@ -72,7 +73,7 @@ protected:
|
||||
virtual void assign(const StatusVector& ex) throw() { }
|
||||
virtual void assign(const Exception& ex) throw() { }
|
||||
virtual ISC_STATUS copyTo(ISC_STATUS*) const throw() { return 0; }
|
||||
virtual ISC_STATUS copyTo(IStatus*) const throw() { return 0; }
|
||||
virtual void copyTo(IStatus*) const throw() { }
|
||||
|
||||
virtual void shiftLeft(const Base&) throw() { }
|
||||
virtual void shiftLeft(const Warning&) throw() { }
|
||||
@ -103,18 +104,19 @@ protected:
|
||||
class ImplStatusVector : public ImplBase
|
||||
{
|
||||
private:
|
||||
ISC_STATUS_ARRAY m_status_vector;
|
||||
unsigned int m_length, m_warning;
|
||||
SimpleStatusVector<> m_status_vector;
|
||||
unsigned int m_warning;
|
||||
|
||||
bool appendErrors(const ImplBase* const v) throw();
|
||||
bool appendWarnings(const ImplBase* const v) throw();
|
||||
bool append(const ISC_STATUS* const from, const unsigned int count) throw();
|
||||
void append(const ISC_STATUS* const from) throw();
|
||||
|
||||
public:
|
||||
virtual const ISC_STATUS* value() const throw() { return m_status_vector; }
|
||||
virtual unsigned int length() const throw() { return m_length; }
|
||||
virtual const ISC_STATUS* value() const throw() { return m_status_vector.begin(); }
|
||||
virtual unsigned int length() const throw() { return m_status_vector.getCount() - 1u; }
|
||||
virtual unsigned int firstWarning() const throw() { return m_warning; }
|
||||
virtual bool hasData() const throw() { return m_length > 0; }
|
||||
virtual bool hasData() const throw() { return length() > 0u; }
|
||||
virtual void clear() throw();
|
||||
virtual void makePermanent() throw();
|
||||
virtual void append(const StatusVector& v) throw();
|
||||
@ -122,7 +124,7 @@ protected:
|
||||
virtual void assign(const StatusVector& v) throw();
|
||||
virtual void assign(const Exception& ex) throw();
|
||||
virtual ISC_STATUS copyTo(ISC_STATUS* dest) const throw();
|
||||
virtual ISC_STATUS copyTo(IStatus* dest) const throw();
|
||||
virtual void copyTo(IStatus* dest) const throw();
|
||||
virtual void shiftLeft(const Base& arg) throw();
|
||||
virtual void shiftLeft(const Warning& arg) throw();
|
||||
virtual void shiftLeft(const char* text) throw();
|
||||
@ -130,7 +132,9 @@ protected:
|
||||
virtual void shiftLeft(const MetaName& text) throw();
|
||||
virtual bool compare(const StatusVector& v) const throw();
|
||||
|
||||
ImplStatusVector(ISC_STATUS k, ISC_STATUS c) throw() : ImplBase(k, c)
|
||||
ImplStatusVector(ISC_STATUS k, ISC_STATUS c) throw()
|
||||
: ImplBase(k, c),
|
||||
m_status_vector(*getDefaultMemoryPool())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@ -162,7 +166,7 @@ public:
|
||||
void assign(const Exception& ex) throw() { implementation->assign(ex); }
|
||||
void raise() const;
|
||||
ISC_STATUS copyTo(ISC_STATUS* dest) const throw() { return implementation->copyTo(dest); }
|
||||
ISC_STATUS copyTo(IStatus* dest) const throw() { return implementation->copyTo(dest); }
|
||||
void copyTo(IStatus* dest) const throw() { implementation->copyTo(dest); }
|
||||
|
||||
// generic argument insert
|
||||
StatusVector& operator<<(const Base& arg) throw()
|
||||
|
@ -33,14 +33,14 @@
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
ISC_STATUS DynamicStatusVector::merge(const IStatus* status)
|
||||
ISC_STATUS DynamicStatusVector::load(const IStatus* status)
|
||||
{
|
||||
SimpleStatusVector<> tmp;
|
||||
unsigned length = fb_utils::statusLength(status->getErrors());
|
||||
length += fb_utils::statusLength(status->getWarnings());
|
||||
ISC_STATUS* s = tmp.getBuffer(length + 1);
|
||||
fb_utils::mergeStatus(s, length + 1, status);
|
||||
return save(s);
|
||||
return save(s, false);
|
||||
}
|
||||
|
||||
ISC_STATUS StatusHolder::save(IStatus* status)
|
||||
@ -73,107 +73,4 @@ void StatusHolder::raise()
|
||||
}
|
||||
}
|
||||
|
||||
unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_STATUS* const src)
|
||||
{
|
||||
const ISC_STATUS* end = &src[length];
|
||||
|
||||
// allocate space for strings
|
||||
size_t len = 0;
|
||||
for (const ISC_STATUS* from = src; from < end; ++from)
|
||||
{
|
||||
const ISC_STATUS type = *from++;
|
||||
if (from >= end || type == isc_arg_end)
|
||||
{
|
||||
end = from - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case isc_arg_cstring:
|
||||
if (from + 1 >= end)
|
||||
{
|
||||
end = from - 1;
|
||||
break;
|
||||
}
|
||||
len += *from++;
|
||||
len++;
|
||||
break;
|
||||
|
||||
case isc_arg_string:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
len += strlen(reinterpret_cast<const char*>(*from));
|
||||
len++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char* string = len ? FB_NEW(*getDefaultMemoryPool()) char[len] : NULL;
|
||||
ISC_STATUS* to = dst;
|
||||
|
||||
// copy status vector saving strings in local buffer
|
||||
for (const ISC_STATUS* from = src; from < end; ++from)
|
||||
{
|
||||
const ISC_STATUS type = *from++;
|
||||
*to++ = type == isc_arg_cstring ? isc_arg_string : type;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case isc_arg_cstring:
|
||||
fb_assert(string);
|
||||
*to++ = (ISC_STATUS)(IPTR) string;
|
||||
memcpy(string, reinterpret_cast<const char*>(from[1]), from[0]);
|
||||
string += *from++;
|
||||
*string++ = 0;
|
||||
break;
|
||||
|
||||
case isc_arg_string:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
fb_assert(string);
|
||||
*to++ = (ISC_STATUS)(IPTR) string;
|
||||
strcpy(string, reinterpret_cast<const char*>(*from));
|
||||
string += strlen(string);
|
||||
string++;
|
||||
break;
|
||||
|
||||
default:
|
||||
*to++ = *from;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*to++ = isc_arg_end;
|
||||
return (to - dst) - 1;
|
||||
}
|
||||
|
||||
void freeDynamicStrings(unsigned length, ISC_STATUS* ptr)
|
||||
{
|
||||
while (length--)
|
||||
{
|
||||
const ISC_STATUS type = *ptr++;
|
||||
if (type == isc_arg_end)
|
||||
return;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case isc_arg_cstring:
|
||||
fb_assert(false); // CVC: according to the new logic, this case cannot happen
|
||||
ptr++;
|
||||
|
||||
case isc_arg_string:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
delete[] reinterpret_cast<char*>(*ptr++);
|
||||
return;
|
||||
|
||||
default:
|
||||
ptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Firebird
|
||||
|
@ -32,29 +32,11 @@
|
||||
#include "firebird/Interface.h"
|
||||
#include "../common/utils_proto.h"
|
||||
#include "../common/classes/ImplementHelper.h"
|
||||
#include "../common/classes/array.h"
|
||||
#include "../common/SimpleStatusVector.h"
|
||||
#include "../common/DynamicStrings.h"
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_STATUS* const src);
|
||||
void freeDynamicStrings(unsigned length, ISC_STATUS* ptr);
|
||||
|
||||
|
||||
// This trivial container is used when we need to grow vector element by element w/o any conversions
|
||||
template <unsigned S = ISC_STATUS_LENGTH>
|
||||
class SimpleStatusVector : public HalfStaticArray<ISC_STATUS, S>
|
||||
{
|
||||
public:
|
||||
SimpleStatusVector()
|
||||
: HalfStaticArray<ISC_STATUS, S>()
|
||||
{ }
|
||||
|
||||
explicit SimpleStatusVector(MemoryPool& p)
|
||||
: HalfStaticArray<ISC_STATUS, S>(p)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
// DynamicVector owns strings, contained in it
|
||||
template <unsigned S>
|
||||
class DynamicVector : private SimpleStatusVector<S>
|
||||
@ -68,34 +50,68 @@ public:
|
||||
|
||||
~DynamicVector()
|
||||
{
|
||||
freeDynamicStrings(this->getCount(), this->begin());
|
||||
delete[] freeDynamicStrings(this->getCount(), this->begin());
|
||||
}
|
||||
|
||||
private:
|
||||
char* prepareForNewValue()
|
||||
{
|
||||
char* oldBuffer = freeDynamicStrings(this->getCount(), this->begin());
|
||||
this->resize(0);
|
||||
return oldBuffer;
|
||||
}
|
||||
|
||||
public:
|
||||
void clear()
|
||||
{
|
||||
freeDynamicStrings(this->getCount(), this->begin());
|
||||
this->resize(0);
|
||||
delete[] this->prepareForNewValue();
|
||||
fb_utils::init_status(this->getBuffer(3));
|
||||
}
|
||||
|
||||
void save(unsigned int length, const ISC_STATUS* status)
|
||||
void save(unsigned int length, const ISC_STATUS* status, bool warningMode) throw()
|
||||
{
|
||||
clear();
|
||||
this->resize(0);
|
||||
unsigned newLen = makeDynamicStrings(length, this->getBuffer(length), status);
|
||||
try
|
||||
{
|
||||
char* oldBuffer = this->prepareForNewValue();
|
||||
ISC_STATUS* b = this->getBuffer(length + 1);
|
||||
unsigned newLen = makeDynamicStrings(length, b, status);
|
||||
delete[] oldBuffer;
|
||||
|
||||
fb_assert(newLen <= length);
|
||||
fb_assert(newLen <= length);
|
||||
|
||||
// Sanity check
|
||||
if (newLen < 2)
|
||||
fb_utils::init_status(this->getBuffer(3));
|
||||
else
|
||||
this->resize(newLen);
|
||||
// Sanity check
|
||||
if (newLen < 2)
|
||||
fb_utils::init_status(this->getBuffer(3));
|
||||
else
|
||||
this->resize(newLen + 1);
|
||||
}
|
||||
catch(const BadAlloc&)
|
||||
{
|
||||
if (!warningMode)
|
||||
{
|
||||
// do not use stuff here to avoid endless cycle
|
||||
this->shrink(3);
|
||||
ISC_STATUS* s = this->getBuffer(3); // Should not throw - see assert() in ctor
|
||||
fb_utils::statusBadAlloc(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->clear();
|
||||
}
|
||||
}
|
||||
catch(const Exception&)
|
||||
{
|
||||
fb_assert(false);
|
||||
|
||||
this->shrink(3);
|
||||
ISC_STATUS* s = this->getBuffer(3); // Should not throw - see assert() in ctor
|
||||
fb_utils::statusUnknown(s);
|
||||
}
|
||||
}
|
||||
|
||||
ISC_STATUS save(const ISC_STATUS* status)
|
||||
ISC_STATUS save(const ISC_STATUS* status, bool warningMode = false) throw()
|
||||
{
|
||||
save(fb_utils::statusLength(status), status);
|
||||
save(fb_utils::statusLength(status), status, warningMode);
|
||||
return status[1];
|
||||
}
|
||||
|
||||
@ -119,7 +135,7 @@ public:
|
||||
: DynamicVector(*getDefaultMemoryPool())
|
||||
{ }
|
||||
|
||||
ISC_STATUS merge(const IStatus* status);
|
||||
ISC_STATUS load(const IStatus* status);
|
||||
|
||||
ISC_STATUS getError() const
|
||||
{
|
||||
@ -147,22 +163,22 @@ public:
|
||||
|
||||
void setErrors(const ISC_STATUS* value)
|
||||
{
|
||||
errors.save(fb_utils::statusLength(value), value);
|
||||
errors.save(fb_utils::statusLength(value), value, false);
|
||||
}
|
||||
|
||||
void setErrors2(unsigned int length, const ISC_STATUS* value)
|
||||
{
|
||||
errors.save(length, value);
|
||||
errors.save(length, value, false);
|
||||
}
|
||||
|
||||
void setWarnings(const ISC_STATUS* value)
|
||||
{
|
||||
warnings.save(fb_utils::statusLength(value), value);
|
||||
warnings.save(fb_utils::statusLength(value), value, true);
|
||||
}
|
||||
|
||||
void setWarnings2(unsigned int length, const ISC_STATUS* value)
|
||||
{
|
||||
warnings.save(length, value);
|
||||
warnings.save(length, value, true);
|
||||
}
|
||||
|
||||
const ISC_STATUS* getErrors() const
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
virtual ULONG getBytes(UCHAR*, ULONG) { return 0; }
|
||||
virtual void setServiceStatus(const ISC_STATUS*) { }
|
||||
virtual void setServiceStatus(const USHORT, const USHORT, const MsgFormat::SafeArg&) { }
|
||||
virtual const ISC_STATUS* getStatus() { return 0; }
|
||||
virtual const Firebird::CheckStatusWrapper* getStatus() { return NULL; }
|
||||
virtual void fillDpb(ClumpletWriter&) { }
|
||||
virtual bool finished() { return false; }
|
||||
virtual void initStatus() { }
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
virtual ULONG getBytes(UCHAR*, ULONG) = 0;
|
||||
virtual void setServiceStatus(const ISC_STATUS*) = 0;
|
||||
virtual void setServiceStatus(const USHORT, const USHORT, const MsgFormat::SafeArg&) = 0;
|
||||
virtual const ISC_STATUS* getStatus() = 0;
|
||||
virtual const Firebird::CheckStatusWrapper* getStatus() = 0;
|
||||
virtual void initStatus() = 0;
|
||||
virtual void checkService() = 0;
|
||||
virtual void hidePasswd(ArgvType&, int) = 0;
|
||||
|
@ -42,9 +42,8 @@ class GetPlugins
|
||||
public:
|
||||
GetPlugins(unsigned int interfaceType, const char* namesList = NULL)
|
||||
: masterInterface(), pluginInterface(),
|
||||
pluginSet(NULL), currentPlugin(NULL)
|
||||
pluginSet(NULL), currentPlugin(NULL), status(&ls)
|
||||
{
|
||||
LocalStatus status;
|
||||
pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType,
|
||||
(namesList ? namesList : Config::getDefaultConfig()->getPlugins(interfaceType)),
|
||||
NULL));
|
||||
@ -56,9 +55,8 @@ public:
|
||||
GetPlugins(unsigned int interfaceType,
|
||||
Config* knownConfig, const char* namesList = NULL)
|
||||
: masterInterface(), pluginInterface(),
|
||||
pluginSet(NULL), currentPlugin(NULL)
|
||||
pluginSet(NULL), currentPlugin(NULL), status(&ls)
|
||||
{
|
||||
LocalStatus status;
|
||||
pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType,
|
||||
(namesList ? namesList : knownConfig->getPlugins(interfaceType)),
|
||||
new FirebirdConf(knownConfig)));
|
||||
@ -89,7 +87,6 @@ public:
|
||||
pluginInterface->releasePlugin(currentPlugin);
|
||||
currentPlugin = NULL;
|
||||
|
||||
LocalStatus status;
|
||||
pluginSet->next(&status);
|
||||
check(&status);
|
||||
getPlugin();
|
||||
@ -104,7 +101,6 @@ public:
|
||||
currentPlugin = NULL;
|
||||
}
|
||||
|
||||
LocalStatus status;
|
||||
pluginSet->set(&status, newName);
|
||||
check(&status);
|
||||
getPlugin();
|
||||
@ -124,10 +120,11 @@ private:
|
||||
PluginManagerInterfacePtr pluginInterface;
|
||||
RefPtr<IPluginSet> pluginSet;
|
||||
P* currentPlugin;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status;
|
||||
|
||||
void getPlugin()
|
||||
{
|
||||
LocalStatus status;
|
||||
currentPlugin = (P*) pluginSet->getPlugin(&status);
|
||||
check(&status);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "../common/classes/array.h"
|
||||
#include "../common/ThreadStart.h"
|
||||
#include "../common/utils_proto.h"
|
||||
#include "../common/SimpleStatusVector.h"
|
||||
#include "../common/StatusHolder.h"
|
||||
|
||||
namespace Firebird {
|
||||
@ -90,16 +91,45 @@ ISC_STATUS Exception::stuff_exception(ISC_STATUS* const status_vector) const thr
|
||||
return status_vector[1];
|
||||
}
|
||||
|
||||
ISC_STATUS Exception::stuffException(SimpleStatusVector<>& status_vector) const throw()
|
||||
{
|
||||
LocalStatus status;
|
||||
stuffException(&status);
|
||||
try
|
||||
{
|
||||
status_vector.mergeStatus(&status);
|
||||
}
|
||||
catch(const BadAlloc&)
|
||||
{
|
||||
// do not use stuff here to avoid endless cycle
|
||||
status_vector.shrink(3);
|
||||
ISC_STATUS* s = status_vector.getBuffer(3); // Should not throw - see assert() in ctor
|
||||
fb_utils::statusBadAlloc(s);
|
||||
}
|
||||
catch(const Exception&)
|
||||
{
|
||||
fb_assert(false);
|
||||
|
||||
status_vector.shrink(3);
|
||||
ISC_STATUS* s = status_vector.getBuffer(3); // Should not throw - see assert() in ctor
|
||||
fb_utils::statusUnknown(s);
|
||||
}
|
||||
|
||||
return status_vector[1];
|
||||
}
|
||||
|
||||
// ********************************* status_exception *******************************
|
||||
|
||||
status_exception::status_exception() throw()
|
||||
: m_status_vector(m_buffer)
|
||||
{
|
||||
memset(m_status_vector, 0, sizeof(m_status_vector));
|
||||
fb_utils::init_status(m_status_vector);
|
||||
}
|
||||
|
||||
status_exception::status_exception(const ISC_STATUS *status_vector) throw()
|
||||
: m_status_vector(m_buffer)
|
||||
{
|
||||
memset(m_status_vector, 0, sizeof(m_status_vector));
|
||||
fb_utils::init_status(m_status_vector);
|
||||
|
||||
if (status_vector)
|
||||
{
|
||||
@ -110,12 +140,35 @@ status_exception::status_exception(const ISC_STATUS *status_vector) throw()
|
||||
void status_exception::set_status(const ISC_STATUS *new_vector) throw()
|
||||
{
|
||||
fb_assert(new_vector != 0);
|
||||
unsigned len = fb_utils::statusLength(new_vector);
|
||||
|
||||
makePermanentVector(m_status_vector, new_vector);
|
||||
try
|
||||
{
|
||||
if (len >= FB_NELEM(m_buffer))
|
||||
{
|
||||
m_status_vector = FB_NEW(*getDefaultMemoryPool()) ISC_STATUS[len + 1];
|
||||
}
|
||||
len = makeDynamicStrings(len, m_status_vector, new_vector);
|
||||
m_status_vector[len] = isc_arg_end;
|
||||
}
|
||||
catch(const BadAlloc&)
|
||||
{
|
||||
if (m_status_vector != m_buffer)
|
||||
{
|
||||
delete[] m_status_vector;
|
||||
m_status_vector = m_buffer;
|
||||
}
|
||||
fb_utils::statusBadAlloc(m_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
status_exception::~status_exception() throw()
|
||||
{
|
||||
delete[] freeDynamicStrings(fb_utils::statusLength(m_status_vector), m_status_vector);
|
||||
if (m_status_vector != m_buffer)
|
||||
{
|
||||
delete[] m_status_vector;
|
||||
}
|
||||
}
|
||||
|
||||
const char* status_exception::what() const throw()
|
||||
@ -130,9 +183,9 @@ void status_exception::raise(const ISC_STATUS *status_vector)
|
||||
|
||||
void status_exception::raise(const IStatus* status)
|
||||
{
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
fb_utils::mergeStatus(status_vector, ISC_STATUS_LENGTH, status);
|
||||
throw status_exception(status_vector);
|
||||
SimpleStatusVector<> status_vector;
|
||||
status_vector.mergeStatus(status);
|
||||
throw status_exception(status_vector.begin());
|
||||
}
|
||||
|
||||
void status_exception::raise(const Arg::StatusVector& statusVector)
|
||||
|
@ -587,9 +587,23 @@ void iscLogStatus(const TEXT* text, const ISC_STATUS* status_vector)
|
||||
|
||||
void iscLogStatus(const TEXT* text, Firebird::IStatus* status)
|
||||
{
|
||||
ISC_STATUS_BIG_ARRAY tmp;
|
||||
fb_utils::mergeStatus(tmp, FB_NELEM(tmp), status);
|
||||
iscLogStatus(text, tmp);
|
||||
Firebird::SimpleStatusVector<> tmp;
|
||||
tmp.mergeStatus(status);
|
||||
iscLogStatus(text, tmp.begin());
|
||||
}
|
||||
|
||||
|
||||
void iscDbLogStatus(const TEXT* text, Firebird::IStatus* status)
|
||||
{
|
||||
const TEXT* hdr = NULL;
|
||||
Firebird::string buf;
|
||||
if (text)
|
||||
{
|
||||
buf = "Database: ";
|
||||
buf += text;
|
||||
hdr = buf.c_str();
|
||||
}
|
||||
iscLogStatus(hdr, status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,8 @@ const TEXT* ISC_get_host(Firebird::string&);
|
||||
bool ISC_get_user(Firebird::string*, int*, int*);
|
||||
SLONG ISC_set_prefix(const TEXT*, const TEXT*);
|
||||
|
||||
// Does not add word "Database" in the beginning like gds__log_status
|
||||
void iscDbLogStatus(const TEXT* text, Firebird::IStatus* status);
|
||||
// Do not add word "Database" in the beginning like gds__log_status / iscDbLogStatus
|
||||
void iscLogStatus(const TEXT* text, const ISC_STATUS* status_vector);
|
||||
void iscLogStatus(const TEXT* text, Firebird::IStatus* status);
|
||||
void iscLogException(const TEXT* text, const Firebird::Exception& e);
|
||||
|
@ -44,7 +44,7 @@ struct sdl_arg
|
||||
SLONG* sdl_arg_variables;
|
||||
SDL_walk_callback sdl_arg_callback;
|
||||
array_slice* sdl_arg_argument;
|
||||
ISC_STATUS* sdl_arg_status_vector;
|
||||
CheckStatusWrapper* sdl_arg_status_vector;
|
||||
IPTR sdl_arg_compiled[COMPILE_SIZE];
|
||||
IPTR* sdl_arg_next;
|
||||
const IPTR* sdl_arg_end;
|
||||
@ -63,7 +63,7 @@ struct array_range
|
||||
};
|
||||
|
||||
static const UCHAR* compile(const UCHAR*, sdl_arg*);
|
||||
static ISC_STATUS error(ISC_STATUS* status_vector, const Arg::StatusVector& v);
|
||||
static ISC_STATUS error(CheckStatusWrapper* status_vector, const Arg::StatusVector& v);
|
||||
static bool execute(sdl_arg*);
|
||||
static const UCHAR* get_range(const UCHAR*, array_range*, SLONG*, SLONG*);
|
||||
|
||||
@ -114,7 +114,7 @@ const int op_scalar = 12;
|
||||
*/
|
||||
|
||||
|
||||
SLONG SDL_compute_subscript(ISC_STATUS* status_vector,
|
||||
SLONG SDL_compute_subscript(CheckStatusWrapper* status_vector,
|
||||
const Ods::InternalArrayDesc* desc,
|
||||
USHORT dimensions,
|
||||
const SLONG* subscripts)
|
||||
@ -160,6 +160,27 @@ SLONG SDL_compute_subscript(ISC_STATUS* status_vector,
|
||||
ISC_STATUS SDL_info(ISC_STATUS* status_vector,
|
||||
const UCHAR* sdl, sdl_info* info, SLONG* vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S D L _ i n f o
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Status vector time changing form.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus s1;
|
||||
CheckStatusWrapper s2(&s1);
|
||||
ISC_STATUS rc = SDL_info(&s2, sdl, info, vector);
|
||||
fb_utils::mergeStatus(status_vector, ISC_STATUS_LENGTH, &s2);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
ISC_STATUS SDL_info(CheckStatusWrapper* status_vector,
|
||||
const UCHAR* sdl, sdl_info* info, SLONG* vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* S D L _ i n f o
|
||||
@ -232,7 +253,7 @@ ISC_STATUS SDL_info(ISC_STATUS* status_vector,
|
||||
}
|
||||
|
||||
|
||||
int SDL_walk(ISC_STATUS* status_vector,
|
||||
int SDL_walk(CheckStatusWrapper* status_vector,
|
||||
const UCHAR* sdl,
|
||||
UCHAR* array,
|
||||
Ods::InternalArrayDesc* array_desc,
|
||||
@ -470,7 +491,7 @@ static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg)
|
||||
}
|
||||
|
||||
|
||||
static ISC_STATUS error(ISC_STATUS* status_vector, const Arg::StatusVector& v)
|
||||
static ISC_STATUS error(CheckStatusWrapper* status_vector, const Arg::StatusVector& v)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -479,15 +500,12 @@ static ISC_STATUS error(ISC_STATUS* status_vector, const Arg::StatusVector& v)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Post an error sequence to the status vector. Since an error
|
||||
* sequence can, in theory, be arbitrarily lock, pull a cheap
|
||||
* trick to get the address of the argument vector.
|
||||
* Post an error sequence to the status vector.
|
||||
*
|
||||
**************************************/
|
||||
v.copyTo(status_vector);
|
||||
makePermanentVector(status_vector);
|
||||
|
||||
return status_vector[1];
|
||||
return status_vector->getErrors()[1];
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,9 +31,10 @@ namespace Ods {
|
||||
struct sdl_info;
|
||||
struct array_alice;
|
||||
|
||||
SLONG SDL_compute_subscript(ISC_STATUS*, const Ods::InternalArrayDesc*, USHORT, const SLONG*);
|
||||
SLONG SDL_compute_subscript(Firebird::CheckStatusWrapper*, const Ods::InternalArrayDesc*, USHORT, const SLONG*);
|
||||
ISC_STATUS SDL_info(ISC_STATUS*, const UCHAR*, sdl_info*, SLONG*);
|
||||
int SDL_walk(ISC_STATUS*, const UCHAR*, UCHAR*, Ods::InternalArrayDesc*, SLONG*,
|
||||
ISC_STATUS SDL_info(Firebird::CheckStatusWrapper*, const UCHAR*, sdl_info*, SLONG*);
|
||||
int SDL_walk(Firebird::CheckStatusWrapper*, const UCHAR*, UCHAR*, Ods::InternalArrayDesc*, SLONG*,
|
||||
SDL_walk_callback, array_slice*);
|
||||
|
||||
#endif // JRD_SDL_PROTO_H
|
||||
|
@ -1170,6 +1170,17 @@ unsigned int mergeStatus(ISC_STATUS* const dest, unsigned int space,
|
||||
return copied;
|
||||
}
|
||||
|
||||
void copyStatus(Firebird::CheckStatusWrapper* to, const Firebird::CheckStatusWrapper* from) throw()
|
||||
{
|
||||
to->init();
|
||||
|
||||
int flags = from->getState();
|
||||
if (flags & Firebird::CheckStatusWrapper::STATE_ERRORS)
|
||||
to->setErrors(from->getErrors());
|
||||
if (flags & Firebird::CheckStatusWrapper::STATE_WARNINGS)
|
||||
to->setWarnings(from->getWarnings());
|
||||
}
|
||||
|
||||
void setIStatus(Firebird::IStatus* to, const ISC_STATUS* from) throw()
|
||||
{
|
||||
try
|
||||
@ -1196,6 +1207,121 @@ unsigned int statusLength(const ISC_STATUS* const status) throw()
|
||||
}
|
||||
}
|
||||
|
||||
bool cmpStatus(unsigned int len, const ISC_STATUS* a, const ISC_STATUS* b) throw()
|
||||
{
|
||||
for (unsigned i = 0; i < len; )
|
||||
{
|
||||
const ISC_STATUS* op1 = &a[i];
|
||||
const ISC_STATUS* op2 = &b[i];
|
||||
if (*op1 != *op2)
|
||||
return false;
|
||||
|
||||
if (i == len - 1 && *op1 == isc_arg_end)
|
||||
break;
|
||||
|
||||
i += (*op1 == isc_arg_cstring ? 3 : 2);
|
||||
if (i > len) // arg does not fit
|
||||
return false;
|
||||
|
||||
unsigned l1, l2;
|
||||
const char *s1, *s2;
|
||||
switch (*op1)
|
||||
{
|
||||
case isc_arg_cstring:
|
||||
case isc_arg_string:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
if (*op1 == isc_arg_cstring)
|
||||
{
|
||||
l1 = op1[1];
|
||||
l2 = op2[1];
|
||||
s1 = (const char*)(op1[2]);
|
||||
s2 = (const char*)(op2[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = (const char*)(op1[1]);
|
||||
s2 = (const char*)(op2[1]);
|
||||
l1 = strlen(s1);
|
||||
l2 = strlen(s2);
|
||||
}
|
||||
|
||||
if (l1 != l2)
|
||||
return false;
|
||||
if (memcmp(s1, s2, l1) != 0)
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (op1[1] != op2[1])
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int subStatus(const ISC_STATUS* in, unsigned int cin,
|
||||
const ISC_STATUS* sub, unsigned int csub) throw()
|
||||
{
|
||||
for (unsigned pos = 0; csub <= cin - pos; )
|
||||
{
|
||||
for (unsigned i = 0; i < csub; )
|
||||
{
|
||||
const ISC_STATUS* op1 = &in[pos + i];
|
||||
const ISC_STATUS* op2 = &sub[i];
|
||||
if (*op1 != *op2)
|
||||
goto miss;
|
||||
|
||||
i += (*op1 == isc_arg_cstring ? 3 : 2);
|
||||
if (i > csub) // arg does not fit
|
||||
goto miss;
|
||||
|
||||
unsigned l1, l2;
|
||||
const char *s1, *s2;
|
||||
switch (*op1)
|
||||
{
|
||||
case isc_arg_cstring:
|
||||
case isc_arg_string:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
if (*op1 == isc_arg_cstring)
|
||||
{
|
||||
l1 = op1[1];
|
||||
l2 = op2[1];
|
||||
s1 = (const char*)(op1[2]);
|
||||
s2 = (const char*)(op2[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = (const char*)(op1[1]);
|
||||
s2 = (const char*)(op2[1]);
|
||||
l1 = strlen(s1);
|
||||
l2 = strlen(s2);
|
||||
}
|
||||
|
||||
if (l1 != l2)
|
||||
goto miss;
|
||||
if (memcmp(s1, s2, l1) != 0)
|
||||
goto miss;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (op1[1] != op2[1])
|
||||
goto miss;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return pos;
|
||||
|
||||
miss: pos += (in[pos] == isc_arg_cstring ? 3 : 2);
|
||||
}
|
||||
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
// moves DB path information (from limbo transaction) to another buffer
|
||||
void getDbPathInfo(unsigned int& itemsLength, const unsigned char*& items,
|
||||
unsigned int& bufferLength, unsigned char*& buffer,
|
||||
|
@ -105,14 +105,28 @@ namespace fb_utils
|
||||
|
||||
Firebird::PathName get_process_name();
|
||||
SLONG genUniqueId();
|
||||
|
||||
void getCwd(Firebird::PathName& pn);
|
||||
|
||||
void inline initStatusTo(ISC_STATUS* status, ISC_STATUS to)
|
||||
{
|
||||
status[0] = isc_arg_gds;
|
||||
status[1] = to;
|
||||
status[2] = isc_arg_end;
|
||||
}
|
||||
|
||||
void inline init_status(ISC_STATUS* status)
|
||||
{
|
||||
status[0] = isc_arg_gds;
|
||||
status[1] = FB_SUCCESS;
|
||||
status[2] = isc_arg_end;
|
||||
initStatusTo(status, FB_SUCCESS);
|
||||
}
|
||||
|
||||
void inline statusBadAlloc(ISC_STATUS* status)
|
||||
{
|
||||
initStatusTo(status, isc_virmemexh);
|
||||
}
|
||||
|
||||
void inline statusUnknown(ISC_STATUS* status)
|
||||
{
|
||||
initStatusTo(status, isc_exception_sigill); // Any better ideas? New error code?
|
||||
}
|
||||
|
||||
void inline init_status(Firebird::CheckStatusWrapper* status)
|
||||
@ -122,12 +136,13 @@ namespace fb_utils
|
||||
|
||||
unsigned int copyStatus(ISC_STATUS* const to, const unsigned int space,
|
||||
const ISC_STATUS* const from, const unsigned int count) throw();
|
||||
|
||||
void copyStatus(Firebird::CheckStatusWrapper* to, const Firebird::CheckStatusWrapper* from) throw();
|
||||
unsigned int mergeStatus(ISC_STATUS* const to, unsigned int space, const Firebird::IStatus* from) throw();
|
||||
|
||||
void setIStatus(Firebird::IStatus* to, const ISC_STATUS* from) throw();
|
||||
|
||||
unsigned int statusLength(const ISC_STATUS* const status) throw();
|
||||
unsigned int subStatus(const ISC_STATUS* in, unsigned int cin,
|
||||
const ISC_STATUS* sub, unsigned int csub) throw();
|
||||
bool cmpStatus(unsigned int len, const ISC_STATUS* a, const ISC_STATUS* b) throw();
|
||||
|
||||
enum FetchPassResult {
|
||||
FETCH_PASS_OK,
|
||||
|
@ -238,7 +238,8 @@ public:
|
||||
objType(aObjType),
|
||||
objName(pool, aObjName),
|
||||
subName(pool, aSubName),
|
||||
text(pool, aText)
|
||||
text(pool, aText),
|
||||
str(pool)
|
||||
{
|
||||
}
|
||||
|
||||
@ -250,23 +251,19 @@ public:
|
||||
protected:
|
||||
virtual void putErrorPrefix(Firebird::Arg::StatusVector& statusVector)
|
||||
{
|
||||
Firebird::string str(objName.toString());
|
||||
str = objName.toString();
|
||||
|
||||
if (subName.hasData())
|
||||
str.append(".").append(subName.c_str());
|
||||
|
||||
//// ASF: What a hack, as StatusVector does not save the pointer content!
|
||||
const char* p = Firebird::MasterInterfacePtr()->circularAlloc(str.c_str(), str.length(),
|
||||
(intptr_t) getThreadId());
|
||||
|
||||
statusVector << Firebird::Arg::Gds(isc_dsql_comment_on_failed) << p;
|
||||
statusVector << Firebird::Arg::Gds(isc_dsql_comment_on_failed) << str;
|
||||
}
|
||||
|
||||
private:
|
||||
int objType;
|
||||
Firebird::QualifiedName objName;
|
||||
Firebird::MetaName subName;
|
||||
Firebird::string text;
|
||||
Firebird::string text, str;
|
||||
};
|
||||
|
||||
|
||||
|
@ -663,7 +663,7 @@ bool BlockNode::testAndFixupError(thread_db* tdbb, jrd_req* request, const Excep
|
||||
if (tdbb->tdbb_flags & TDBB_sys_error)
|
||||
return false;
|
||||
|
||||
ISC_STATUS* statusVector = tdbb->tdbb_status_vector;
|
||||
Jrd::FbStatusVector* statusVector = tdbb->tdbb_status_vector;
|
||||
|
||||
bool found = false;
|
||||
|
||||
@ -673,7 +673,7 @@ bool BlockNode::testAndFixupError(thread_db* tdbb, jrd_req* request, const Excep
|
||||
{
|
||||
case ExceptionItem::SQL_CODE:
|
||||
{
|
||||
const SSHORT sqlcode = gds__sqlcode(statusVector);
|
||||
const SSHORT sqlcode = gds__sqlcode(statusVector->getErrors());
|
||||
if (sqlcode == conditions[i].code)
|
||||
found = true;
|
||||
}
|
||||
@ -682,22 +682,22 @@ bool BlockNode::testAndFixupError(thread_db* tdbb, jrd_req* request, const Excep
|
||||
case ExceptionItem::SQL_STATE:
|
||||
{
|
||||
FB_SQLSTATE_STRING sqlstate;
|
||||
fb_sqlstate(sqlstate, statusVector);
|
||||
fb_sqlstate(sqlstate, statusVector->getErrors());
|
||||
if (conditions[i].name == sqlstate)
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ExceptionItem::GDS_CODE:
|
||||
if (statusVector[1] == conditions[i].code)
|
||||
if (statusVector->getErrors()[1] == conditions[i].code)
|
||||
found = true;
|
||||
break;
|
||||
|
||||
case ExceptionItem::XCP_CODE:
|
||||
// Look at set_error() routine to understand how the
|
||||
// exception ID info is encoded inside the status vector.
|
||||
if ((statusVector[1] == isc_except) &&
|
||||
(statusVector[3] == conditions[i].code))
|
||||
if ((statusVector->getErrors()[1] == isc_except) &&
|
||||
(statusVector->getErrors()[3] == conditions[i].code))
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "../jrd/intl.h"
|
||||
#include "../common/intlobj_new.h"
|
||||
#include "../jrd/jrd.h"
|
||||
#include "../jrd/status.h"
|
||||
#include "../common/CharSet.h"
|
||||
#include "../dsql/Parser.h"
|
||||
#include "../dsql/ddl_proto.h"
|
||||
@ -599,14 +600,13 @@ void DsqlDmlRequest::dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch,
|
||||
}
|
||||
#endif
|
||||
|
||||
ISC_STATUS_ARRAY localStatus;
|
||||
MOVE_CLEAR(localStatus, sizeof(localStatus));
|
||||
FbLocalStatus localStatus;
|
||||
|
||||
// check for warnings
|
||||
if (tdbb->tdbb_status_vector[2] == isc_arg_warning)
|
||||
if (tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_WARNINGS)
|
||||
{
|
||||
// save a status vector
|
||||
memcpy(localStatus, tdbb->tdbb_status_vector, sizeof(ISC_STATUS_ARRAY));
|
||||
fb_utils::copyStatus(localStatus, tdbb->tdbb_status_vector);
|
||||
fb_utils::init_status(tdbb->tdbb_status_vector);
|
||||
}
|
||||
|
||||
@ -622,27 +622,19 @@ void DsqlDmlRequest::dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch,
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
status = tdbb->tdbb_status_vector[1];
|
||||
status = tdbb->tdbb_status_vector->getErrors()[1];
|
||||
*traceResult = status == isc_no_priv ?
|
||||
ITracePlugin::RESULT_UNAUTHORIZED : ITracePlugin::RESULT_FAILED;
|
||||
}
|
||||
|
||||
// restore warnings (if there are any)
|
||||
if (localStatus[2] == isc_arg_warning)
|
||||
if (localStatus->getState() & FbStatusVector::STATE_WARNINGS)
|
||||
{
|
||||
FB_SIZE_T indx, len, warning;
|
||||
Arg::StatusVector cur(tdbb->tdbb_status_vector->getWarnings());
|
||||
Arg::StatusVector saved(localStatus->getWarnings());
|
||||
saved << cur;
|
||||
|
||||
// find end of a status vector
|
||||
PARSE_STATUS(tdbb->tdbb_status_vector, indx, warning);
|
||||
if (indx)
|
||||
--indx;
|
||||
|
||||
// calculate length of saved warnings
|
||||
PARSE_STATUS(localStatus, len, warning);
|
||||
len -= 2;
|
||||
|
||||
if ((len + indx - 1) < ISC_STATUS_LENGTH)
|
||||
memcpy(&tdbb->tdbb_status_vector[indx], &localStatus[2], sizeof(ISC_STATUS) * len);
|
||||
tdbb->tdbb_status_vector->setWarnings2(saved.length(), saved.value());
|
||||
}
|
||||
|
||||
// free blr memory
|
||||
@ -738,12 +730,12 @@ void DsqlDmlRequest::execute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
UCHAR* message_buffer = (UCHAR*) gds__alloc(message->msg_length);
|
||||
|
||||
ISC_STATUS status = FB_SUCCESS;
|
||||
ISC_STATUS_ARRAY localStatus;
|
||||
FbLocalStatus localStatus;
|
||||
|
||||
for (counter = 0; counter < 2 && !status; counter++)
|
||||
{
|
||||
AutoSetRestore<ISC_STATUS*> autoStatus(&tdbb->tdbb_status_vector, localStatus);
|
||||
fb_utils::init_status(localStatus);
|
||||
localStatus->init();
|
||||
AutoSetRestore<Jrd::FbStatusVector*> autoStatus(&tdbb->tdbb_status_vector, localStatus);
|
||||
|
||||
try
|
||||
{
|
||||
@ -753,7 +745,7 @@ void DsqlDmlRequest::execute(thread_db* tdbb, jrd_tra** traHandle,
|
||||
}
|
||||
catch (Firebird::Exception&)
|
||||
{
|
||||
status = tdbb->tdbb_status_vector[1];
|
||||
status = tdbb->tdbb_status_vector->getErrors()[1];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1195,7 +1187,7 @@ static USHORT parse_metadata(dsql_req* request, IMessageMetadata* meta,
|
||||
if (!meta)
|
||||
return parameters.getCount();
|
||||
|
||||
LocalStatus st;
|
||||
FbLocalStatus st;
|
||||
unsigned count = meta->getCount(&st);
|
||||
checkD(&st);
|
||||
|
||||
|
@ -59,7 +59,7 @@ using namespace Jrd;
|
||||
using namespace Firebird;
|
||||
|
||||
|
||||
static void internal_post(const ISC_STATUS* status_vector);
|
||||
static void internal_post(const Arg::StatusVector& v);
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
/**
|
||||
@ -142,42 +142,15 @@ void ERRD_error(const char* text)
|
||||
@param
|
||||
|
||||
**/
|
||||
bool ERRD_post_warning(const Firebird::Arg::StatusVector& v)
|
||||
void ERRD_post_warning(const Firebird::Arg::StatusVector& v)
|
||||
{
|
||||
fb_assert(v.value()[0] == isc_arg_warning);
|
||||
|
||||
ISC_STATUS* status_vector = JRD_get_thread_data()->tdbb_status_vector;
|
||||
FB_SIZE_T indx = 0;
|
||||
Jrd::FbStatusVector* status_vector = JRD_get_thread_data()->tdbb_status_vector;
|
||||
|
||||
if (status_vector[0] != isc_arg_gds ||
|
||||
(status_vector[0] == isc_arg_gds && status_vector[1] == 0 &&
|
||||
status_vector[2] != isc_arg_warning))
|
||||
{
|
||||
// this is a blank status vector
|
||||
status_vector[0] = isc_arg_gds;
|
||||
status_vector[1] = 0;
|
||||
status_vector[2] = isc_arg_end;
|
||||
indx = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// find end of a status vector
|
||||
FB_SIZE_T warning_indx = 0;
|
||||
PARSE_STATUS(status_vector, indx, warning_indx);
|
||||
if (indx) {
|
||||
--indx;
|
||||
}
|
||||
}
|
||||
|
||||
if (indx + v.length() + 1 < ISC_STATUS_LENGTH)
|
||||
{
|
||||
memcpy(&status_vector[indx], v.value(), sizeof(ISC_STATUS) * (v.length() + 1));
|
||||
ERR_make_permanent(&status_vector[indx]);
|
||||
return true;
|
||||
}
|
||||
|
||||
// not enough free space
|
||||
return false;
|
||||
Arg::StatusVector cur(status_vector->getWarnings());
|
||||
cur << v;
|
||||
status_vector->setWarnings2(cur.length(), cur.value());
|
||||
}
|
||||
|
||||
|
||||
@ -193,11 +166,11 @@ bool ERRD_post_warning(const Firebird::Arg::StatusVector& v)
|
||||
@param
|
||||
|
||||
**/
|
||||
void ERRD_post(const Firebird::Arg::StatusVector& v)
|
||||
void ERRD_post(const Arg::StatusVector& v)
|
||||
{
|
||||
fb_assert(v.value()[0] == isc_arg_gds);
|
||||
|
||||
internal_post(v.value());
|
||||
internal_post(v);
|
||||
}
|
||||
|
||||
|
||||
@ -213,83 +186,29 @@ void ERRD_post(const Firebird::Arg::StatusVector& v)
|
||||
@param
|
||||
|
||||
**/
|
||||
static void internal_post(const ISC_STATUS* tmp_status)
|
||||
static void internal_post(const Arg::StatusVector& v)
|
||||
{
|
||||
ISC_STATUS* status_vector = JRD_get_thread_data()->tdbb_status_vector;
|
||||
|
||||
// calculate length of the status
|
||||
FB_SIZE_T tmp_status_len = 0, warning_indx = 0;
|
||||
PARSE_STATUS(tmp_status, tmp_status_len, warning_indx);
|
||||
fb_assert(warning_indx == 0);
|
||||
|
||||
if (status_vector[0] != isc_arg_gds ||
|
||||
(status_vector[0] == isc_arg_gds && status_vector[1] == 0 &&
|
||||
status_vector[2] != isc_arg_warning))
|
||||
// start building resulting vector
|
||||
Jrd::FbStatusVector* status_vector = JRD_get_thread_data()->tdbb_status_vector;
|
||||
Arg::StatusVector final(status_vector->getErrors());
|
||||
if (final.length() == 0)
|
||||
{
|
||||
// this is a blank status vector
|
||||
status_vector[0] = isc_arg_gds;
|
||||
status_vector[1] = isc_dsql_error;
|
||||
status_vector[2] = isc_arg_end;
|
||||
final << Arg::Gds(isc_dsql_error);
|
||||
}
|
||||
|
||||
FB_SIZE_T status_len = 0;
|
||||
PARSE_STATUS(status_vector, status_len, warning_indx);
|
||||
if (status_len)
|
||||
--status_len;
|
||||
|
||||
// check for duplicated error code
|
||||
size_t i;
|
||||
for (i = 0; i < ISC_STATUS_LENGTH; i++)
|
||||
if (fb_utils::subStatus(final.value(), final.length(), v.value(), v.length()) == ~0u)
|
||||
{
|
||||
if (status_vector[i] == isc_arg_end && i == status_len) {
|
||||
break; // end of argument list
|
||||
}
|
||||
|
||||
if (i && i == warning_indx) {
|
||||
break; // vector has no more errors
|
||||
}
|
||||
|
||||
if (status_vector[i] == tmp_status[1] && i && status_vector[i - 1] != isc_arg_warning &&
|
||||
i + tmp_status_len - 2 < ISC_STATUS_LENGTH &&
|
||||
(memcmp(&status_vector[i], &tmp_status[1], sizeof(ISC_STATUS) * (tmp_status_len - 2)) == 0))
|
||||
{
|
||||
// duplicate found
|
||||
ERRD_punt();
|
||||
}
|
||||
// no dup - append new vector to old one
|
||||
final << v;
|
||||
}
|
||||
|
||||
// if the status_vector has only warnings then adjust err_status_len
|
||||
size_t err_status_len = i;
|
||||
if (err_status_len == 2 && warning_indx) {
|
||||
err_status_len = 0;
|
||||
}
|
||||
// keep existing warnings
|
||||
final << Arg::StatusVector(status_vector->getWarnings());
|
||||
|
||||
FB_SIZE_T warning_count = 0;
|
||||
ISC_STATUS_ARRAY warning_status;
|
||||
|
||||
if (warning_indx)
|
||||
{
|
||||
// copy current warning(s) to a temp buffer
|
||||
MOVE_CLEAR(warning_status, sizeof(warning_status));
|
||||
memcpy(warning_status, &status_vector[warning_indx],
|
||||
sizeof(ISC_STATUS) * (ISC_STATUS_LENGTH - warning_indx));
|
||||
PARSE_STATUS(warning_status, warning_count, warning_indx);
|
||||
}
|
||||
|
||||
// add the status into a real buffer right in between last
|
||||
// error and first warning
|
||||
|
||||
i = err_status_len + tmp_status_len;
|
||||
if (i < ISC_STATUS_LENGTH)
|
||||
{
|
||||
memcpy(&status_vector[err_status_len], tmp_status, sizeof(ISC_STATUS) * tmp_status_len);
|
||||
ERR_make_permanent(&status_vector[err_status_len]);
|
||||
// copy current warning(s) to the status_vector
|
||||
if (warning_count && i + warning_count - 1 < ISC_STATUS_LENGTH)
|
||||
{
|
||||
memcpy(&status_vector[i - 1], warning_status, sizeof(ISC_STATUS) * warning_count);
|
||||
}
|
||||
}
|
||||
// save & punt
|
||||
final.copyTo(status_vector);
|
||||
ERRD_punt();
|
||||
}
|
||||
|
||||
@ -304,14 +223,13 @@ static void internal_post(const ISC_STATUS* tmp_status)
|
||||
|
||||
|
||||
**/
|
||||
void ERRD_punt(const ISC_STATUS* local)
|
||||
void ERRD_punt(const Jrd::FbStatusVector* local)
|
||||
{
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
|
||||
// Save any strings in a permanent location
|
||||
if (local)
|
||||
{
|
||||
Firebird::makePermanentVector(tdbb->tdbb_status_vector, local);
|
||||
fb_utils::copyStatus(tdbb->tdbb_status_vector, local);
|
||||
}
|
||||
|
||||
// Give up whatever we were doing and return to the user.
|
||||
|
@ -24,6 +24,8 @@
|
||||
#ifndef DSQL_ERRD_PROTO_H
|
||||
#define DSQL_ERRD_PROTO_H
|
||||
|
||||
#include "../jrd/status.h"
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
void ERRD_assert_msg(const char*, const char*, ULONG);
|
||||
#endif
|
||||
@ -31,8 +33,8 @@ void ERRD_assert_msg(const char*, const char*, ULONG);
|
||||
void ERRD_bugcheck(const char*);
|
||||
void ERRD_error(const char*);
|
||||
void ERRD_post(const Firebird::Arg::StatusVector& v);
|
||||
bool ERRD_post_warning(const Firebird::Arg::StatusVector& v);
|
||||
void ERRD_punt(const ISC_STATUS* = 0);
|
||||
void ERRD_post_warning(const Firebird::Arg::StatusVector& v);
|
||||
void ERRD_punt(const Jrd::FbStatusVector* = 0);
|
||||
|
||||
#endif // DSQL_ERRD_PROTO_H
|
||||
|
||||
|
@ -59,25 +59,3 @@ USHORT UTLD_char_length_to_byte_length(USHORT lengthInChars, USHORT maxBytesPerC
|
||||
return MIN(((MAX_COLUMN_SIZE - overhead) / maxBytesPerChar) * maxBytesPerChar,
|
||||
(ULONG) lengthInChars * maxBytesPerChar);
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS UTLD_copy_status(const ISC_STATUS* from, ISC_STATUS* to)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c o p y _ s t a t u s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Copy a status vector.
|
||||
*
|
||||
**************************************/
|
||||
const ISC_STATUS status = from[1];
|
||||
|
||||
const ISC_STATUS* const end = from + ISC_STATUS_LENGTH;
|
||||
while (from < end)
|
||||
*to++ = *from++;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -28,6 +28,5 @@
|
||||
#define DSQL_UTLD_PROTO_H
|
||||
|
||||
USHORT UTLD_char_length_to_byte_length(USHORT lengthInChars, USHORT maxBytesPerChar, USHORT overhead);
|
||||
ISC_STATUS UTLD_copy_status(const ISC_STATUS*, ISC_STATUS*);
|
||||
|
||||
#endif // DSQL_UTLD_PROTO_H
|
||||
|
@ -48,6 +48,8 @@
|
||||
namespace Firebird
|
||||
{
|
||||
class MemoryPool;
|
||||
template <unsigned S = ISC_STATUS_LENGTH>
|
||||
class SimpleStatusVector;
|
||||
|
||||
class Exception
|
||||
{
|
||||
@ -55,6 +57,11 @@ protected:
|
||||
Exception() throw() { }
|
||||
public:
|
||||
ISC_STATUS stuff_exception(ISC_STATUS* const status_vector) const throw();
|
||||
ISC_STATUS stuff_exception(CheckStatusWrapper* status_vector) const throw()
|
||||
{
|
||||
return stuffException(status_vector);
|
||||
}
|
||||
ISC_STATUS stuffException(SimpleStatusVector<>& status_vector) const throw();
|
||||
virtual ~Exception() throw();
|
||||
virtual ISC_STATUS stuffException(IStatus* status_vector) const throw() = 0;
|
||||
virtual const char* what() const throw() = 0;
|
||||
@ -95,7 +102,7 @@ public:
|
||||
class status_exception : public Exception
|
||||
{
|
||||
public:
|
||||
status_exception(const ISC_STATUS *status_vector) throw();
|
||||
explicit status_exception(const ISC_STATUS *status_vector) throw();
|
||||
virtual ~status_exception() throw();
|
||||
|
||||
virtual ISC_STATUS stuffException(IStatus* status_vector) const throw();
|
||||
@ -115,7 +122,8 @@ protected:
|
||||
void set_status(const ISC_STATUS *new_vector) throw();
|
||||
|
||||
private:
|
||||
ISC_STATUS_ARRAY m_status_vector;
|
||||
ISC_STATUS* m_status_vector;
|
||||
ISC_STATUS_ARRAY m_buffer;
|
||||
};
|
||||
|
||||
// Parameter syscall later in both system_error & system_call_failed
|
||||
|
@ -156,7 +156,4 @@ inline T FB_ALIGN(T n, uintptr_t b)
|
||||
return (T) ((((uintptr_t) n) + b - 1) & ~(b - 1));
|
||||
}
|
||||
|
||||
// Big array for holding long temporal vectors from/to IStatus
|
||||
typedef ISC_STATUS ISC_STATUS_BIG_ARRAY[ISC_STATUS_LENGTH * 3];
|
||||
|
||||
#endif /* INCLUDE_FB_TYPES_H */
|
||||
|
@ -1046,7 +1046,7 @@ interface TraceStatusVector : Versioned
|
||||
{
|
||||
boolean hasError();
|
||||
boolean hasWarning();
|
||||
const intptr* getStatus();
|
||||
Status getStatus();
|
||||
const string getText();
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -122,6 +122,25 @@ namespace Firebird
|
||||
}
|
||||
}
|
||||
|
||||
static void clearException(BaseStatusWrapper* status)
|
||||
{
|
||||
status->clearException();
|
||||
}
|
||||
|
||||
void clearException()
|
||||
{
|
||||
if (dirty)
|
||||
{
|
||||
dirty = false;
|
||||
status->init();
|
||||
}
|
||||
}
|
||||
|
||||
bool isDirty()
|
||||
{
|
||||
return dirty;
|
||||
}
|
||||
|
||||
static void setVersionError(IStatus* status, const char* interfaceName,
|
||||
unsigned currentVersion, unsigned expectedVersion)
|
||||
{
|
||||
@ -149,7 +168,7 @@ namespace Firebird
|
||||
|
||||
virtual void init()
|
||||
{
|
||||
status->init();
|
||||
clearException();
|
||||
}
|
||||
|
||||
virtual unsigned getState() const
|
||||
@ -183,12 +202,12 @@ namespace Firebird
|
||||
|
||||
virtual const intptr_t* getErrors() const
|
||||
{
|
||||
return status->getErrors();
|
||||
return dirty ? status->getErrors() : cleanStatus();
|
||||
}
|
||||
|
||||
virtual const intptr_t* getWarnings() const
|
||||
{
|
||||
return status->getWarnings();
|
||||
return dirty ? status->getWarnings() : cleanStatus();
|
||||
}
|
||||
|
||||
virtual IStatus* clone() const
|
||||
@ -199,6 +218,12 @@ namespace Firebird
|
||||
protected:
|
||||
IStatus* status;
|
||||
bool dirty;
|
||||
|
||||
static const intptr_t* cleanStatus()
|
||||
{
|
||||
static intptr_t clean[3] = {1, 0, 0};
|
||||
return clean;
|
||||
}
|
||||
};
|
||||
|
||||
class CheckStatusWrapper : public BaseStatusWrapper<CheckStatusWrapper>
|
||||
|
@ -8693,7 +8693,8 @@ static int query_abort(const int reason, const int, void*)
|
||||
|
||||
if (DB)
|
||||
{
|
||||
Firebird::LocalStatus status;
|
||||
Firebird::LocalStatus ls;
|
||||
Firebird::CheckStatusWrapper status(&ls);
|
||||
DB->cancelOperation(&status, fb_cancel_raise);
|
||||
flag = !(status.getState() & Firebird::IStatus::STATE_ERRORS);
|
||||
}
|
||||
|
@ -166,12 +166,11 @@ namespace Jrd {
|
||||
{
|
||||
if (!LCK_lock(tdbb, stateLock, LCK_SR, LCK_WAIT))
|
||||
{
|
||||
fb_assert(tdbb->tdbb_status_vector[1]);
|
||||
fb_assert(tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_ERRORS);
|
||||
ERR_punt();
|
||||
}
|
||||
|
||||
fb_utils::init_status(tdbb->tdbb_status_vector);
|
||||
|
||||
tdbb->tdbb_status_vector->init();
|
||||
needLock = false;
|
||||
}
|
||||
}
|
||||
@ -228,7 +227,7 @@ namespace Jrd {
|
||||
LCK_convert(tdbb, stateLock, LCK_PW, LCK_WAIT);
|
||||
if (!ret)
|
||||
{
|
||||
fb_assert(tdbb->tdbb_status_vector[1]);
|
||||
fb_assert(tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_ERRORS);
|
||||
ERR_punt();
|
||||
}
|
||||
fb_utils::init_status(tdbb->tdbb_status_vector);
|
||||
@ -358,7 +357,7 @@ namespace Jrd {
|
||||
|
||||
void CryptoManager::cryptThread()
|
||||
{
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FbLocalStatus status_vector;
|
||||
|
||||
try
|
||||
{
|
||||
@ -511,7 +510,7 @@ namespace Jrd {
|
||||
}
|
||||
}
|
||||
|
||||
bool CryptoManager::decrypt(ISC_STATUS* sv, Ods::pag* page)
|
||||
bool CryptoManager::decrypt(FbStatusVector* sv, Ods::pag* page)
|
||||
{
|
||||
// Code calling us is not ready to process exceptions correctly
|
||||
// Therefore use old (status vector based) method
|
||||
@ -553,13 +552,9 @@ namespace Jrd {
|
||||
}
|
||||
}
|
||||
|
||||
LocalStatus status;
|
||||
cryptPlugin->decrypt(&status, dbb.dbb_page_size - sizeof(Ods::pag), &page[1], &page[1]);
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
fb_utils::mergeStatus(sv, FB_NELEM(sv), &status);
|
||||
cryptPlugin->decrypt(sv, dbb.dbb_page_size - sizeof(Ods::pag), &page[1], &page[1]);
|
||||
if (sv->getState() & IStatus::STATE_ERRORS)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -571,7 +566,7 @@ namespace Jrd {
|
||||
return false;
|
||||
}
|
||||
|
||||
Ods::pag* CryptoManager::encrypt(ISC_STATUS* sv, Ods::pag* from, Ods::pag* to)
|
||||
Ods::pag* CryptoManager::encrypt(FbStatusVector* sv, Ods::pag* from, Ods::pag* to)
|
||||
{
|
||||
// Code calling us is not ready to process exceptions correctly
|
||||
// Therefore use old (status vector based) method
|
||||
@ -581,13 +576,9 @@ namespace Jrd {
|
||||
{
|
||||
to[0] = from[0];
|
||||
|
||||
LocalStatus status;
|
||||
cryptPlugin->encrypt(&status, dbb.dbb_page_size - sizeof(Ods::pag), &from[1], &to[1]);
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
fb_utils::mergeStatus(sv, FB_NELEM(sv), &status);
|
||||
cryptPlugin->encrypt(sv, dbb.dbb_page_size - sizeof(Ods::pag), &from[1], &to[1]);
|
||||
if (sv->getState() & IStatus::STATE_ERRORS)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
to->pag_flags |= Ods::crypted_page;
|
||||
return to;
|
||||
@ -672,7 +663,7 @@ namespace Jrd {
|
||||
keyControl.hasData(); keyControl.next())
|
||||
{
|
||||
IKeyHolderPlugin* keyPlugin = keyControl.plugin();
|
||||
LocalStatus st;
|
||||
FbLocalStatus st;
|
||||
if (keyPlugin->keyCallback(&st, att->att_crypt_callback) == 1) //// FIXME: 1 ???
|
||||
{
|
||||
// holder accepted attachment's key
|
||||
@ -696,10 +687,8 @@ namespace Jrd {
|
||||
ha->registerAttachment(att);
|
||||
break; // Do not need >1 key from attachment to single DB
|
||||
}
|
||||
else if (st.getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
status_exception::raise(&st);
|
||||
}
|
||||
else
|
||||
st.check();
|
||||
}
|
||||
}
|
||||
|
||||
@ -729,12 +718,9 @@ namespace Jrd {
|
||||
vector[i] = knownHolders[i].getPlugin();
|
||||
}
|
||||
|
||||
LocalStatus st;
|
||||
FbLocalStatus st;
|
||||
crypt->setKey(&st, length, vector);
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
status_exception::raise(&st);
|
||||
}
|
||||
st.check();
|
||||
}
|
||||
|
||||
} // namespace Jrd
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "../common/classes/stack.h"
|
||||
#include "../common/ThreadStart.h"
|
||||
#include "../jrd/ods.h"
|
||||
#include "../jrd/status.h"
|
||||
#include "firebird/Interface.h"
|
||||
|
||||
// forward
|
||||
@ -71,8 +72,8 @@ public:
|
||||
void startCryptThread(thread_db* tdbb);
|
||||
void terminateCryptThread(thread_db* tdbb);
|
||||
|
||||
bool decrypt(ISC_STATUS* sv, Ods::pag* page);
|
||||
Ods::pag* encrypt(ISC_STATUS* sv, Ods::pag* from, Ods::pag* to);
|
||||
bool decrypt(FbStatusVector* sv, Ods::pag* page);
|
||||
Ods::pag* encrypt(FbStatusVector* sv, Ods::pag* from, Ods::pag* to);
|
||||
|
||||
void cryptThread();
|
||||
|
||||
|
@ -312,9 +312,9 @@ namespace Jrd
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
Firebird::LocalStatus s;
|
||||
FbLocalStatus s;
|
||||
TimerInterfacePtr()->stop(&s, this);
|
||||
if (!(s.getState() & IStatus::STATE_ERRORS))
|
||||
if (!(s->getState() & IStatus::STATE_ERRORS))
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
@ -323,7 +323,7 @@ namespace Jrd
|
||||
{
|
||||
if (dbb && !active)
|
||||
{
|
||||
Firebird::LocalStatus s;
|
||||
FbLocalStatus s;
|
||||
TimerInterfacePtr()->start(&s, this, seconds * 1000 * 1000);
|
||||
check(&s);
|
||||
active = true;
|
||||
|
@ -47,11 +47,13 @@
|
||||
#include "../jrd/DbCreators.h"
|
||||
#include "../jrd/tra.h"
|
||||
#include "../jrd/ini.h"
|
||||
#include "../jrd/status.h"
|
||||
#include "gen/ids.h"
|
||||
|
||||
#define DBC_DEBUG(A)
|
||||
|
||||
using namespace Firebird;
|
||||
using namespace Jrd;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -74,13 +76,13 @@ bool openDb(const char* securityDb, RefPtr<IAttachment>& att, RefPtr<ITransactio
|
||||
embeddedSysdba.insertByte(isc_dpb_sec_attach, TRUE);
|
||||
embeddedSysdba.insertByte(isc_dpb_no_db_triggers, TRUE);
|
||||
|
||||
LocalStatus st;
|
||||
FbLocalStatus st;
|
||||
att = prov->attachDatabase(&st, securityDb,
|
||||
embeddedSysdba.getBufferLength(), embeddedSysdba.getBuffer());
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.getErrors(), isc_io_error))
|
||||
check("IProvider::attachDatabase", &st);
|
||||
if (!fb_utils::containsErrorCode(st->getErrors(), isc_io_error))
|
||||
check("IProvider::attachDatabase", st);
|
||||
|
||||
// missing security DB - checking granted rights not possible
|
||||
return false;
|
||||
@ -90,7 +92,7 @@ bool openDb(const char* securityDb, RefPtr<IAttachment>& att, RefPtr<ITransactio
|
||||
readOnly.insertTag(isc_tpb_read);
|
||||
readOnly.insertTag(isc_tpb_wait);
|
||||
tra = att->startTransaction(&st, readOnly.getBufferLength(), readOnly.getBuffer());
|
||||
check("IAttachment::startTransaction", &st);
|
||||
check("IAttachment::startTransaction", st);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -111,12 +113,12 @@ bool checkCreateDatabaseGrant(const string& userName, const string& trustedRole,
|
||||
if (!openDb(securityDb, att, tra))
|
||||
return false;
|
||||
|
||||
FbLocalStatus st;
|
||||
string role(sqlRole);
|
||||
if (role.hasData())
|
||||
{
|
||||
const UCHAR info[] = { isc_info_db_sql_dialect, isc_info_end };
|
||||
UCHAR buffer[BUFFER_TINY];
|
||||
LocalStatus st;
|
||||
att->getInfo(&st, sizeof(info), info, sizeof(buffer), buffer);
|
||||
check("IAttachment::getInfo", &st);
|
||||
|
||||
@ -156,12 +158,12 @@ bool checkCreateDatabaseGrant(const string& userName, const string& trustedRole,
|
||||
att->execute(&st, tra, 0, sql, SQL_DIALECT_V6, prm.getMetadata(), prm.getBuffer(),
|
||||
result.getMetadata(), result.getBuffer());
|
||||
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
// isc_dsql_relation_err when exec SQL - i.e. table RDB$USER_PRIVILEGES
|
||||
// is missing due to non-FB security DB
|
||||
if (!fb_utils::containsErrorCode(st.getErrors(), isc_dsql_relation_err))
|
||||
check("IAttachment::execute", &st);
|
||||
if (!fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err))
|
||||
check("IAttachment::execute", st);
|
||||
|
||||
role = "";
|
||||
}
|
||||
@ -187,20 +189,19 @@ bool checkCreateDatabaseGrant(const string& userName, const string& trustedRole,
|
||||
Message result;
|
||||
Field<ISC_INT64> cnt(result);
|
||||
|
||||
LocalStatus st;
|
||||
att->execute(&st, tra, 0,
|
||||
"select count(*) from RDB$DB_CREATORS"
|
||||
" where (RDB$USER_TYPE = ? and RDB$USER = ?) or (RDB$USER_TYPE = ? and RDB$USER = ?)",
|
||||
SQL_DIALECT_V6, gr.getMetadata(), gr.getBuffer(), result.getMetadata(), result.getBuffer());
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
if (fb_utils::containsErrorCode(st.getErrors(), isc_dsql_relation_err))
|
||||
if (fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err))
|
||||
{
|
||||
// isc_dsql_relation_err when exec SQL - i.e. table RDB$DB_CREATORS
|
||||
// is missing due to non-FB3 security DB
|
||||
return false;
|
||||
}
|
||||
check("IAttachment::execute", &st);
|
||||
check("IAttachment::execute", st);
|
||||
}
|
||||
|
||||
return cnt > 0;
|
||||
@ -258,15 +259,15 @@ RecordBuffer* DbCreatorsList::getList(thread_db* tdbb, jrd_rel* relation)
|
||||
Field<ISC_SHORT> uType(gr);
|
||||
Field<Varying> u(gr, MAX_SQL_IDENTIFIER_LEN);
|
||||
|
||||
LocalStatus st;
|
||||
FbLocalStatus st;
|
||||
RefPtr<IResultSet> curs(att->openCursor(&st, tra, 0,
|
||||
"select RDB$USER_TYPE, RDB$USER from RDB$DB_CREATORS",
|
||||
SQL_DIALECT_V6, NULL, NULL, gr.getMetadata(), NULL, 0));
|
||||
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.getErrors(), isc_dsql_relation_err))
|
||||
check("IAttachment::openCursor", &st);
|
||||
if (!fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err))
|
||||
check("IAttachment::openCursor", st);
|
||||
|
||||
// isc_dsql_relation_err when opening cursor - i.e. table
|
||||
// is missing due to non-FB3 security DB
|
||||
|
@ -536,7 +536,7 @@ private:
|
||||
{ // scope
|
||||
Attachment::Checkout attCout(attachment, FB_FUNCTION);
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
obj->getCharSet(&status, attInfo->context, charSetName, MAX_SQL_IDENTIFIER_LEN);
|
||||
status.check();
|
||||
charSetName[MAX_SQL_IDENTIFIER_LEN] = '\0';
|
||||
@ -722,7 +722,7 @@ void ExtEngineManager::Function::execute(thread_db* tdbb, UCHAR* inMsg, UCHAR* o
|
||||
|
||||
Attachment::Checkout attCout(tdbb->getAttachment(), FB_FUNCTION);
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
function->execute(&status, attInfo->context, inMsg, outMsg);
|
||||
status.check();
|
||||
}
|
||||
@ -777,7 +777,7 @@ ExtEngineManager::ResultSet::ResultSet(thread_db* tdbb, UCHAR* inMsg, UCHAR* out
|
||||
|
||||
Attachment::Checkout attCout(attachment, FB_FUNCTION);
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
resultSet = procedure->procedure->open(&status, attInfo->context, inMsg, outMsg);
|
||||
status.check();
|
||||
}
|
||||
@ -810,7 +810,7 @@ bool ExtEngineManager::ResultSet::fetch(thread_db* tdbb)
|
||||
fb_assert(attachment == tdbb->getAttachment());
|
||||
Attachment::Checkout attCout(attachment, FB_FUNCTION);
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
bool ret = resultSet->fetch(&status);
|
||||
status.check();
|
||||
|
||||
@ -850,7 +850,7 @@ ExtEngineManager::Trigger::Trigger(thread_db* tdbb, MemoryPool& pool, ExtEngineM
|
||||
|
||||
format = Routine::createFormat(pool, metadata->triggerFields, false);
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
|
||||
for (unsigned i = 0; i < format->fmt_count / 2u; ++i)
|
||||
{
|
||||
@ -894,7 +894,7 @@ void ExtEngineManager::Trigger::execute(thread_db* tdbb, unsigned action,
|
||||
{ // scope
|
||||
Attachment::Checkout attCout(tdbb->getAttachment(), FB_FUNCTION);
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
trigger->execute(&status, attInfo->context, action,
|
||||
(oldMsg.hasData() ? oldMsg.begin() : NULL), (newMsg.hasData() ? newMsg.begin() : NULL));
|
||||
status.check();
|
||||
@ -1025,7 +1025,7 @@ void ExtEngineManager::closeAttachment(thread_db* tdbb, Attachment* attachment)
|
||||
{
|
||||
{ // scope
|
||||
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
engine->closeAttachment(&status, attInfo->context); //// FIXME: log status
|
||||
}
|
||||
|
||||
@ -1058,7 +1058,7 @@ void ExtEngineManager::makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::
|
||||
metadata->inputParameters = Routine::createMetadata(udf->getInputFields());
|
||||
metadata->outputParameters = Routine::createMetadata(udf->getOutputFields());
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
|
||||
RefPtr<IMetadataBuilder> inBuilder(REF_NO_INCR, metadata->inputParameters->getBuilder(&status));
|
||||
status.check();
|
||||
@ -1167,7 +1167,7 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
|
||||
metadata->inputParameters = Routine::createMetadata(prc->getInputFields());
|
||||
metadata->outputParameters = Routine::createMetadata(prc->getOutputFields());
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
|
||||
RefPtr<IMetadataBuilder> inBuilder(REF_NO_INCR, metadata->inputParameters->getBuilder(&status));
|
||||
status.check();
|
||||
@ -1293,7 +1293,7 @@ void ExtEngineManager::makeTrigger(thread_db* tdbb, CompilerScratch* csb, Jrd::T
|
||||
}
|
||||
}
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
|
||||
RefPtr<IMetadataBuilder> fieldsBuilder(REF_NO_INCR, relation ?
|
||||
metadata->triggerFields->getBuilder(&status) : NULL);
|
||||
@ -1307,7 +1307,7 @@ void ExtEngineManager::makeTrigger(thread_db* tdbb, CompilerScratch* csb, Jrd::T
|
||||
{ // scope
|
||||
Attachment::Checkout attCout(tdbb->getAttachment(), FB_FUNCTION);
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
externalTrigger = attInfo->engine->makeTrigger(&status, attInfo->context, metadata,
|
||||
fieldsBuilder);
|
||||
status.check();
|
||||
@ -1383,7 +1383,7 @@ IExternalEngine* ExtEngineManager::getEngine(thread_db* tdbb, const MetaName& na
|
||||
setupAdminCharSet(tdbb, engine, attInfo);
|
||||
|
||||
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
engine->openAttachment(&status, attInfo->context); //// FIXME: log status
|
||||
}
|
||||
}
|
||||
@ -1450,7 +1450,7 @@ ExtEngineManager::EngineAttachmentInfo* ExtEngineManager::getEngineAttachment(
|
||||
|
||||
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
|
||||
Attachment::Checkout attCout(tdbb->getAttachment(), FB_FUNCTION);
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
engine->openAttachment(&status, attInfo->context); //// FIXME: log status
|
||||
}
|
||||
|
||||
@ -1475,7 +1475,7 @@ void ExtEngineManager::setupAdminCharSet(thread_db* tdbb, IExternalEngine* engin
|
||||
|
||||
char charSetName[MAX_SQL_IDENTIFIER_SIZE] = "NONE";
|
||||
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
engine->open(&status, attInfo->context, charSetName, MAX_SQL_IDENTIFIER_LEN);
|
||||
status.check();
|
||||
|
||||
|
@ -146,9 +146,10 @@ bool GlobalRWLock::lockWrite(thread_db* tdbb, SSHORT wait)
|
||||
|
||||
if (!LCK_lock(tdbb, cachedLock, LCK_write, wait))
|
||||
{
|
||||
ISC_STATUS* const status = tdbb->tdbb_status_vector;
|
||||
FbStatusVector* const vector = tdbb->tdbb_status_vector;
|
||||
const ISC_STATUS* status = vector->getErrors();
|
||||
if ((wait == LCK_NO_WAIT) || ((wait < 0) && (status[1] == isc_lock_timeout)))
|
||||
fb_utils::init_status(status);
|
||||
vector->init();
|
||||
|
||||
Attachment::CheckoutLockGuard counterGuard(att, counterMutex, FB_FUNCTION, true);
|
||||
|
||||
@ -261,9 +262,10 @@ bool GlobalRWLock::lockRead(thread_db* tdbb, SSHORT wait, const bool queueJump)
|
||||
|
||||
if (!LCK_lock(tdbb, cachedLock, LCK_read, wait))
|
||||
{
|
||||
ISC_STATUS* const status = tdbb->tdbb_status_vector;
|
||||
FbStatusVector* const vector = tdbb->tdbb_status_vector;
|
||||
const ISC_STATUS* status = vector->getErrors();
|
||||
if ((wait == LCK_NO_WAIT) || ((wait < 0) && (status[1] == isc_lock_timeout)))
|
||||
fb_utils::init_status(status);
|
||||
vector->init();
|
||||
|
||||
Attachment::CheckoutLockGuard counterGuard(att, counterMutex, FB_FUNCTION, true);
|
||||
--pendingLock;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "../jrd/Mapping.h"
|
||||
#include "../jrd/tra.h"
|
||||
#include "../jrd/ini.h"
|
||||
#include "../jrd/status.h"
|
||||
#include "gen/ids.h"
|
||||
|
||||
#ifdef WIN_NT
|
||||
@ -57,6 +58,7 @@
|
||||
#define MAP_DEBUG(A)
|
||||
|
||||
using namespace Firebird;
|
||||
using namespace Jrd;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -238,7 +240,7 @@ public:
|
||||
|
||||
void populate(IAttachment *att)
|
||||
{
|
||||
LocalStatus st;
|
||||
FbLocalStatus st;
|
||||
|
||||
if (dataFlag)
|
||||
{
|
||||
@ -280,9 +282,9 @@ public:
|
||||
" RDB$MAP_FROM, RDB$MAP_TO_TYPE, RDB$MAP_TO "
|
||||
"FROM RDB$AUTH_MAPPING",
|
||||
3, NULL, NULL, mMap.getMetadata(), NULL, 0);
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
if (fb_utils::containsErrorCode(st.getErrors(), isc_dsql_relation_err))
|
||||
if (fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err))
|
||||
{
|
||||
// isc_dsql_relation_err when opening cursor - i.e. table RDB$AUTH_MAPPING
|
||||
// is missing due to non-FB3 security DB
|
||||
@ -290,7 +292,7 @@ public:
|
||||
dataFlag = true;
|
||||
return;
|
||||
}
|
||||
check("IAttachment::openCursor", &st);
|
||||
check("IAttachment::openCursor", st);
|
||||
}
|
||||
|
||||
while (curs->fetchNext(&st, mMap.getBuffer()) == IStatus::RESULT_OK)
|
||||
@ -899,7 +901,7 @@ void mapUser(string& name, string& trusted_role, Firebird::string* auth_method,
|
||||
SyncType syncType = SYNC_SHARED;
|
||||
IAttachment* iDb = NULL;
|
||||
IAttachment* iSec = NULL;
|
||||
LocalStatus st;
|
||||
FbLocalStatus st;
|
||||
|
||||
try
|
||||
{
|
||||
@ -925,9 +927,9 @@ void mapUser(string& name, string& trusted_role, Firebird::string* auth_method,
|
||||
{
|
||||
iSec = prov->attachDatabase(&st, securityAlias,
|
||||
embeddedSysdba.getBufferLength(), embeddedSysdba.getBuffer());
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.getErrors(), isc_io_error))
|
||||
if (!fb_utils::containsErrorCode(st->getErrors(), isc_io_error))
|
||||
check("IProvider::attachDatabase", &st);
|
||||
|
||||
// missing security DB is not a reason to fail mapping
|
||||
@ -946,9 +948,9 @@ void mapUser(string& name, string& trusted_role, Firebird::string* auth_method,
|
||||
embeddedSysdba.getBufferLength(), embeddedSysdba.getBuffer());
|
||||
}
|
||||
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.getErrors(), isc_io_error))
|
||||
if (!fb_utils::containsErrorCode(st->getErrors(), isc_io_error))
|
||||
check("IProvider::attachDatabase", &st);
|
||||
|
||||
// missing DB is not a reason to fail mapping
|
||||
@ -1149,7 +1151,7 @@ RecordBuffer* MappingList::getList(thread_db* tdbb, jrd_rel* relation)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
LocalStatus st;
|
||||
FbLocalStatus st;
|
||||
DispatcherPtr prov;
|
||||
IAttachment* att = NULL;
|
||||
ITransaction* tra = NULL;
|
||||
@ -1167,9 +1169,9 @@ RecordBuffer* MappingList::getList(thread_db* tdbb, jrd_rel* relation)
|
||||
const char* dbName = tdbb->getDatabase()->dbb_config->getSecurityDatabase();
|
||||
att = prov->attachDatabase(&st, dbName,
|
||||
embeddedSysdba.getBufferLength(), embeddedSysdba.getBuffer());
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.getErrors(), isc_io_error))
|
||||
if (!fb_utils::containsErrorCode(st->getErrors(), isc_io_error))
|
||||
check("IProvider::attachDatabase", &st);
|
||||
|
||||
// In embedded mode we are not raising any errors - silent return
|
||||
@ -1200,9 +1202,9 @@ RecordBuffer* MappingList::getList(thread_db* tdbb, jrd_rel* relation)
|
||||
" RDB$MAP_FROM_TYPE, RDB$MAP_FROM, RDB$MAP_TO_TYPE, RDB$MAP_TO "
|
||||
"FROM RDB$AUTH_MAPPING",
|
||||
3, NULL, NULL, mMap.getMetadata(), NULL, 0);
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
if (st->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.getErrors(), isc_dsql_relation_err))
|
||||
if (!fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err))
|
||||
check("IAttachment::openCursor", &st);
|
||||
|
||||
// isc_dsql_relation_err when opening cursor - i.e. table RDB$AUTH_MAPPING
|
||||
|
@ -53,7 +53,7 @@ MsgMetadata* Routine::createMetadata(const Array<NestConst<Parameter> >& paramet
|
||||
// Create a Format based on an IMessageMetadata.
|
||||
Format* Routine::createFormat(MemoryPool& pool, IMessageMetadata* params, bool addEof)
|
||||
{
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
|
||||
unsigned count = params->getCount(&status);
|
||||
status.check();
|
||||
@ -67,23 +67,28 @@ Format* Routine::createFormat(MemoryPool& pool, IMessageMetadata* params, bool a
|
||||
{
|
||||
unsigned descOffset, nullOffset, descDtype, descLength;
|
||||
|
||||
runOffset = fb_utils::sqlTypeToDsc(runOffset, params->getType(&status, i),
|
||||
params->getLength(&status, i), &descDtype, &descLength,
|
||||
&descOffset, &nullOffset);
|
||||
unsigned t = params->getType(&status, i);
|
||||
status.check();
|
||||
unsigned l = params->getLength(&status, i);
|
||||
status.check();
|
||||
runOffset = fb_utils::sqlTypeToDsc(runOffset, t, l, &descDtype, &descLength,
|
||||
&descOffset, &nullOffset);
|
||||
|
||||
desc->clear();
|
||||
desc->dsc_dtype = descDtype;
|
||||
desc->dsc_length = descLength;
|
||||
desc->dsc_scale = params->getScale(&status, i);
|
||||
status.check();
|
||||
desc->dsc_sub_type = params->getSubType(&status, i);
|
||||
status.check();
|
||||
desc->setTextType(params->getCharSet(&status, i));
|
||||
status.check();
|
||||
desc->dsc_address = (UCHAR*)(IPTR) descOffset;
|
||||
desc->dsc_flags = (params->isNullable(&status, i) ? DSC_nullable : 0);
|
||||
status.check();
|
||||
|
||||
++desc;
|
||||
desc->makeShort(0, (SSHORT*)(IPTR) nullOffset);
|
||||
status.check();
|
||||
|
||||
++desc;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void BLF_close_blob(thread_db* tdbb, BlobControl** filter_handle)
|
||||
|
||||
START_CHECK_FOR_EXCEPTIONS(next->ctl_exception_message.c_str())
|
||||
|
||||
ISC_STATUS_ARRAY localStatus = {0};
|
||||
ISC_STATUS_ARRAY localStatus;
|
||||
|
||||
// Sign off from filter
|
||||
// Walk the chain again, telling each filter stage to close
|
||||
@ -162,7 +162,6 @@ ISC_STATUS BLF_get_segment(thread_db* tdbb,
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS_ARRAY localStatus;
|
||||
fb_utils::init_status(localStatus);
|
||||
|
||||
BlobControl* control = *filter_handle;
|
||||
control->ctl_status = localStatus;
|
||||
@ -273,7 +272,6 @@ void BLF_put_segment(thread_db* tdbb,
|
||||
**************************************/
|
||||
|
||||
ISC_STATUS_ARRAY localStatus;
|
||||
fb_utils::init_status(localStatus);
|
||||
|
||||
BlobControl* control = *filter_handle;
|
||||
control->ctl_status = localStatus;
|
||||
@ -354,14 +352,13 @@ static void open_blob(thread_db* tdbb,
|
||||
temp.ctl_internal[0] = dbb;
|
||||
temp.ctl_internal[1] = tra_handle;
|
||||
temp.ctl_internal[2] = NULL;
|
||||
// CVC: Using ISC_STATUS (SLONG) to return a pointer!!!
|
||||
// CVC: Using FbStatusVector (SLONG) to return a pointer!!!
|
||||
// If we change the function signature, we'll change the public API.
|
||||
// ISC_STATUS to pointer!
|
||||
// FbStatusVector to pointer!
|
||||
BlobControl* prior = (BlobControl*) (*callback) (isc_blob_filter_alloc, &temp);
|
||||
prior->ctl_source = callback;
|
||||
|
||||
ISC_STATUS_ARRAY localStatus;
|
||||
fb_utils::init_status(localStatus);
|
||||
prior->ctl_status = localStatus;
|
||||
|
||||
prior->ctl_internal[0] = dbb;
|
||||
@ -374,7 +371,7 @@ static void open_blob(thread_db* tdbb,
|
||||
status_exception::raise(localStatus);
|
||||
}
|
||||
|
||||
// ISC_STATUS to pointer!
|
||||
// FbStatusVector to pointer!
|
||||
BlobControl* control = (BlobControl*) (*callback) (isc_blob_filter_alloc, &temp);
|
||||
control->ctl_source = filter->blf_filter;
|
||||
control->ctl_handle = prior;
|
||||
|
@ -121,9 +121,9 @@ static int blocking_ast_bdb(void*);
|
||||
#ifdef CACHE_READER
|
||||
static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM);
|
||||
|
||||
static void prefetch_epilogue(Prefetch*, ISC_STATUS *);
|
||||
static void prefetch_epilogue(Prefetch*, FbStatusVector *);
|
||||
static void prefetch_init(Prefetch*, thread_db*);
|
||||
static void prefetch_io(Prefetch*, ISC_STATUS *);
|
||||
static void prefetch_io(Prefetch*, FbStatusVector *);
|
||||
static void prefetch_prologue(Prefetch*, SLONG *);
|
||||
#endif
|
||||
static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM);
|
||||
@ -143,9 +143,9 @@ static void page_validation_error(thread_db*, win*, SSHORT);
|
||||
static SSHORT related(BufferDesc*, const BufferDesc*, SSHORT, const ULONG);
|
||||
static bool writeable(BufferDesc*);
|
||||
static bool is_writeable(BufferDesc*, const ULONG);
|
||||
static int write_buffer(thread_db*, BufferDesc*, const PageNumber, const bool, ISC_STATUS* const,
|
||||
static int write_buffer(thread_db*, BufferDesc*, const PageNumber, const bool, FbStatusVector* const,
|
||||
const bool);
|
||||
static bool write_page(thread_db*, BufferDesc*, ISC_STATUS* const, const bool);
|
||||
static bool write_page(thread_db*, BufferDesc*, FbStatusVector* const, const bool);
|
||||
static bool set_diff_page(thread_db*, BufferDesc*);
|
||||
static void set_dirty_flag(thread_db*, BufferDesc*);
|
||||
static void clear_dirty_flag(thread_db*, BufferDesc*);
|
||||
@ -749,7 +749,7 @@ void CCH_fetch_page(thread_db* tdbb, WIN* window, const bool read_shadow)
|
||||
BufferDesc* bdb = window->win_bdb;
|
||||
BufferControl* bcb = bdb->bdb_bcb;
|
||||
|
||||
ISC_STATUS* const status = tdbb->tdbb_status_vector;
|
||||
FbStatusVector* const status = tdbb->tdbb_status_vector;
|
||||
|
||||
pag* page = bdb->bdb_buffer;
|
||||
bdb->bdb_incarnation = ++bcb->bcb_page_incarnation;
|
||||
@ -2187,7 +2187,7 @@ bool CCH_validate(WIN* window)
|
||||
|
||||
|
||||
bool CCH_write_all_shadows(thread_db* tdbb, Shadow* shadow, BufferDesc* bdb,
|
||||
ISC_STATUS* status, const bool inAst)
|
||||
FbStatusVector* status, const bool inAst)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2469,8 +2469,8 @@ static int blocking_ast_bdb(void* ast_object)
|
||||
if (!keep_pages)
|
||||
bcb->bcb_flags &= ~BCB_keep_pages;
|
||||
|
||||
if (tdbb->tdbb_status_vector[1])
|
||||
gds__log_status(dbb->dbb_filename.c_str(), tdbb->tdbb_status_vector);
|
||||
if (tdbb->tdbb_status_vector->getState() & IStatus::STATE_ERRORS)
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), tdbb->tdbb_status_vector);
|
||||
}
|
||||
catch (const Firebird::Exception&)
|
||||
{
|
||||
@ -2532,7 +2532,7 @@ static void purgePrecedence(BufferControl* bcb, BufferDesc* bdb)
|
||||
static void flushDirty(thread_db* tdbb, SLONG transaction_mask, const bool sys_only)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
ISC_STATUS* const status = tdbb->tdbb_status_vector;
|
||||
FbStatusVector* const status = tdbb->tdbb_status_vector;
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
BufferControl* bcb = dbb->dbb_bcb;
|
||||
Firebird::HalfStaticArray<BufferDesc*, 1024> flush;
|
||||
@ -2612,7 +2612,7 @@ static void flushAll(thread_db* tdbb, USHORT flush_flag)
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
BufferControl* bcb = dbb->dbb_bcb;
|
||||
ISC_STATUS* status = tdbb->tdbb_status_vector;
|
||||
FbStatusVector* status = tdbb->tdbb_status_vector;
|
||||
Firebird::HalfStaticArray<BufferDesc*, 1024> flush(bcb->bcb_dirty_count);
|
||||
|
||||
const bool all_flag = (flush_flag & FLUSH_ALL) != 0;
|
||||
@ -2717,7 +2717,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg)
|
||||
Database* dbb = (Database*) arg;
|
||||
Database::SyncGuard dsGuard(dbb);
|
||||
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FbLocalStatus status_vector;
|
||||
|
||||
// Establish a thread context.
|
||||
ThreadContextHolder tdbb(status_vector);
|
||||
@ -2746,7 +2746,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg)
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ex.stuff_exception(status_vector);
|
||||
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2847,7 +2847,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg)
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ex.stuff_exception(status_vector);
|
||||
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2866,7 +2866,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
|
||||
* Write dirty pages to database to maintain an adequate supply of free pages.
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FbLocalStatus status_vector;
|
||||
Database* const dbb = (Database*) arg;
|
||||
BufferControl* const bcb = dbb->dbb_bcb;
|
||||
|
||||
@ -2960,7 +2960,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ex.stuff_exception(status_vector);
|
||||
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector);
|
||||
// continue execution to clean up
|
||||
}
|
||||
|
||||
@ -2973,7 +2973,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ex.stuff_exception(status_vector);
|
||||
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector);
|
||||
}
|
||||
|
||||
bcb->bcb_flags &= ~(BCB_cache_writer | BCB_writer_start);
|
||||
@ -2985,7 +2985,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ex.stuff_exception(status_vector);
|
||||
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -4094,7 +4094,7 @@ static LockState lock_buffer(thread_db* tdbb, BufferDesc* bdb, const SSHORT wait
|
||||
|
||||
// Case: a timeout was specified, or the caller didn't want to wait, return the error.
|
||||
|
||||
if ((wait == LCK_NO_WAIT) || ((wait < 0) && (tempStatus[1] == isc_lock_timeout)))
|
||||
if ((wait == LCK_NO_WAIT) || ((wait < 0) && (tempStatus->getErrors()[1] == isc_lock_timeout)))
|
||||
{
|
||||
bdb->release(tdbb, false);
|
||||
return lsLockTimeout;
|
||||
@ -4104,7 +4104,7 @@ static LockState lock_buffer(thread_db* tdbb, BufferDesc* bdb, const SSHORT wait
|
||||
// BufferDesc's in an unfortunate order. Nothing we can do about it, return the
|
||||
// error, and log it to firebird.log.
|
||||
|
||||
ISC_STATUS* const status = tempStatus.restore();
|
||||
FbStatusVector* const status = tempStatus.restore();
|
||||
|
||||
fb_msg_format(0, JRD_BUGCHK, 216, sizeof(errmsg), errmsg,
|
||||
MsgFormat::SafeArg() << bdb->bdb_page.getPageNum() << (int) page_type);
|
||||
@ -4137,7 +4137,7 @@ static LockState lock_buffer(thread_db* tdbb, BufferDesc* bdb, const SSHORT wait
|
||||
|
||||
// Case: a timeout was specified, or the caller didn't want to wait, return the error.
|
||||
|
||||
if ((wait < 0) && (tempStatus[1] == isc_lock_timeout))
|
||||
if ((wait < 0) && (tempStatus->getErrors()[1] == isc_lock_timeout))
|
||||
{
|
||||
bdb->release(tdbb, false);
|
||||
return lsLockTimeout;
|
||||
@ -4147,7 +4147,7 @@ static LockState lock_buffer(thread_db* tdbb, BufferDesc* bdb, const SSHORT wait
|
||||
// BufferDesc's in an unfortunate order. Nothing we can do about it, return the
|
||||
// error, and log it to firebird.log.
|
||||
|
||||
ISC_STATUS* const status = tempStatus.restore();
|
||||
FbStatusVector* const status = tempStatus.restore();
|
||||
|
||||
fb_msg_format(0, JRD_BUGCHK, 215, sizeof(errmsg), errmsg,
|
||||
MsgFormat::SafeArg() << bdb->bdb_page.getPageNum() << (int) page_type);
|
||||
@ -4304,7 +4304,7 @@ static void page_validation_error(thread_db* tdbb, WIN* window, SSHORT type)
|
||||
|
||||
|
||||
#ifdef CACHE_READER
|
||||
static void prefetch_epilogue(Prefetch* prefetch, ISC_STATUS* status_vector)
|
||||
static void prefetch_epilogue(Prefetch* prefetch, FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4397,7 +4397,7 @@ static void prefetch_init(Prefetch* prefetch, thread_db* tdbb)
|
||||
}
|
||||
|
||||
|
||||
static void prefetch_io(Prefetch* prefetch, ISC_STATUS* status_vector)
|
||||
static void prefetch_io(Prefetch* prefetch, FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4628,7 +4628,7 @@ static int write_buffer(thread_db* tdbb,
|
||||
BufferDesc* bdb,
|
||||
const PageNumber page,
|
||||
const bool write_thru,
|
||||
ISC_STATUS* const status, const bool write_this_page)
|
||||
FbStatusVector* const status, const bool write_this_page)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4773,7 +4773,7 @@ static int write_buffer(thread_db* tdbb,
|
||||
}
|
||||
|
||||
|
||||
static bool write_page(thread_db* tdbb, BufferDesc* bdb, ISC_STATUS* const status, const bool inAst)
|
||||
static bool write_page(thread_db* tdbb, BufferDesc* bdb, FbStatusVector* const status, const bool inAst)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
|
@ -74,7 +74,7 @@ void CCH_unwind(Jrd::thread_db*, const bool);
|
||||
bool CCH_validate(Jrd::win*);
|
||||
void CCH_flush_ast(Jrd::thread_db*);
|
||||
bool CCH_write_all_shadows(Jrd::thread_db*, Jrd::Shadow*, Jrd::BufferDesc*,
|
||||
ISC_STATUS*, const bool);
|
||||
Jrd::FbStatusVector*, const bool);
|
||||
|
||||
// macros for dealing with cache pages
|
||||
|
||||
|
@ -513,10 +513,8 @@ static void raiseRoutineInUseError(const Routine* routine)
|
||||
|
||||
static void raiseTooManyVersionsError(const int obj_type, const string& obj_name)
|
||||
{
|
||||
const ISC_STATUS err_code = getErrorCodeByObjectType(obj_type);
|
||||
|
||||
ERR_post(Arg::Gds(isc_no_meta_update) <<
|
||||
Arg::Gds(err_code) << Arg::Str(obj_name) <<
|
||||
Arg::Gds(getErrorCodeByObjectType(obj_type)) << Arg::Str(obj_name) <<
|
||||
Arg::Gds(isc_version_err));
|
||||
}
|
||||
|
||||
@ -1300,7 +1298,7 @@ void DFW_perform_work(thread_db* tdbb, jrd_tra* transaction)
|
||||
bool dump_shadow = false;
|
||||
SSHORT phase = 1;
|
||||
bool more;
|
||||
ISC_STATUS_ARRAY err_status = {0};
|
||||
FbLocalStatus err_status;
|
||||
|
||||
do
|
||||
{
|
||||
@ -1326,7 +1324,7 @@ void DFW_perform_work(thread_db* tdbb, jrd_tra* transaction)
|
||||
}
|
||||
if (!phase)
|
||||
{
|
||||
Firebird::makePermanentVector(tdbb->tdbb_status_vector, err_status);
|
||||
fb_utils::copyStatus(tdbb->tdbb_status_vector, err_status);
|
||||
ERR_punt();
|
||||
}
|
||||
++phase;
|
||||
@ -2636,11 +2634,10 @@ static void check_dependencies(thread_db* tdbb,
|
||||
}
|
||||
else
|
||||
{
|
||||
const ISC_STATUS obj_type = getErrorCodeByObjectType(dpdo_type);
|
||||
|
||||
ERR_post(Arg::Gds(isc_no_meta_update) <<
|
||||
Arg::Gds(isc_no_delete) << // can not delete
|
||||
Arg::Gds(obj_type) << Arg::Str(QualifiedName(dpdo_name, packageName).toString()) <<
|
||||
Arg::Gds(getErrorCodeByObjectType(dpdo_type)) <<
|
||||
Arg::Str(QualifiedName(dpdo_name, packageName).toString()) <<
|
||||
Arg::Gds(isc_dependency) << Arg::Num(total)); // there are %ld dependencies
|
||||
}
|
||||
}
|
||||
|
197
src/jrd/err.cpp
197
src/jrd/err.cpp
@ -43,6 +43,7 @@
|
||||
#include "../jrd/met_proto.h"
|
||||
#include "../jrd/err_proto.h"
|
||||
#include "../yvalve/gds_proto.h"
|
||||
#include "../common/isc_proto.h"
|
||||
#include "../common/config/config.h"
|
||||
#include "../common/utils_proto.h"
|
||||
|
||||
@ -54,7 +55,6 @@ using namespace Firebird;
|
||||
|
||||
|
||||
static void internal_error(ISC_STATUS status, int number, const TEXT* file = NULL, int line = 0);
|
||||
static void internal_post(const ISC_STATUS* status_vector);
|
||||
|
||||
|
||||
void ERR_bugcheck(int number, const TEXT* file, int line)
|
||||
@ -174,7 +174,7 @@ void ERR_log(int facility, int number, const TEXT* message)
|
||||
}
|
||||
|
||||
|
||||
bool ERR_post_warning(const Arg::StatusVector& v)
|
||||
void ERR_post_warning(const Arg::StatusVector& v)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -188,39 +188,14 @@ bool ERR_post_warning(const Arg::StatusVector& v)
|
||||
**************************************/
|
||||
fb_assert(v.value()[0] == isc_arg_warning);
|
||||
|
||||
FB_SIZE_T indx = 0, warning_indx = 0;
|
||||
ISC_STATUS* const status_vector = JRD_get_thread_data()->tdbb_status_vector;
|
||||
|
||||
if (status_vector[0] != isc_arg_gds ||
|
||||
(status_vector[0] == isc_arg_gds && status_vector[1] == 0 &&
|
||||
status_vector[2] != isc_arg_warning))
|
||||
{
|
||||
// this is a blank status vector
|
||||
fb_utils::init_status(status_vector);
|
||||
indx = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// find end of a status vector
|
||||
PARSE_STATUS(status_vector, indx, warning_indx);
|
||||
if (indx)
|
||||
--indx;
|
||||
}
|
||||
|
||||
// stuff the warning
|
||||
if (indx + v.length() + 1 < ISC_STATUS_LENGTH)
|
||||
{
|
||||
memcpy(&status_vector[indx], v.value(), sizeof(ISC_STATUS) * (v.length() + 1));
|
||||
ERR_make_permanent(&status_vector[indx]);
|
||||
return true;
|
||||
}
|
||||
|
||||
// not enough free space
|
||||
return false;
|
||||
FbStatusVector* const status_vector = JRD_get_thread_data()->tdbb_status_vector;
|
||||
Arg::StatusVector warnings(status_vector->getWarnings());
|
||||
warnings << v;
|
||||
status_vector->setWarnings(warnings.value());
|
||||
}
|
||||
|
||||
|
||||
void ERR_post_nothrow(const Arg::StatusVector& v)
|
||||
void ERR_post_nothrow(const Arg::StatusVector& v, FbStatusVector* statusVector)
|
||||
/**************************************
|
||||
*
|
||||
* E R R _ p o s t _ n o t h r o w
|
||||
@ -228,47 +203,40 @@ void ERR_post_nothrow(const Arg::StatusVector& v)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Create a status vector.
|
||||
* Populate a status vector.
|
||||
*
|
||||
**************************************/
|
||||
{
|
||||
fb_assert(v.value()[0] == isc_arg_gds);
|
||||
ISC_STATUS_ARRAY vector;
|
||||
v.copyTo(vector);
|
||||
ERR_make_permanent(vector);
|
||||
internal_post(vector);
|
||||
}
|
||||
// calculate length of the status
|
||||
unsigned lenToAdd = v.length();
|
||||
if (lenToAdd == 0) // nothing to do
|
||||
return;
|
||||
const ISC_STATUS* toAdd = v.value();
|
||||
fb_assert(toAdd[0] == isc_arg_gds);
|
||||
|
||||
// Use default from tdbb when no vector specified
|
||||
if (!statusVector)
|
||||
statusVector = JRD_get_thread_data()->tdbb_status_vector;
|
||||
|
||||
void ERR_make_permanent(ISC_STATUS* s)
|
||||
/**************************************
|
||||
*
|
||||
* E R R _ m a k e _ p e r m a n e n t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Make strings in vector permanent
|
||||
*
|
||||
**************************************/
|
||||
{
|
||||
makePermanentVector(s);
|
||||
}
|
||||
if (!(statusVector->getState() & FbStatusVector::STATE_ERRORS))
|
||||
{
|
||||
// this is a blank status vector just stuff the status
|
||||
statusVector->setErrors2(lenToAdd, toAdd);
|
||||
return;
|
||||
}
|
||||
|
||||
const ISC_STATUS* oldVector = statusVector->getErrors();
|
||||
unsigned lenOld = fb_utils::statusLength(oldVector);
|
||||
|
||||
void ERR_make_permanent(Arg::StatusVector& v)
|
||||
/**************************************
|
||||
*
|
||||
* E R R _ m a k e _ p e r m a n e n t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Make strings in vector permanent
|
||||
*
|
||||
**************************************/
|
||||
{
|
||||
ERR_make_permanent(const_cast<ISC_STATUS*>(v.value()));
|
||||
// check for duplicated error code
|
||||
if (fb_utils::subStatus(oldVector, lenOld, toAdd, lenToAdd) != ~0u)
|
||||
return;
|
||||
|
||||
// copy memory from/to
|
||||
SimpleStatusVector<> tmp;
|
||||
tmp.assign(oldVector, lenOld);
|
||||
tmp.append(toAdd, lenToAdd);
|
||||
statusVector->setErrors2(tmp.getCount(), tmp.begin());
|
||||
}
|
||||
|
||||
|
||||
@ -291,89 +259,6 @@ void ERR_post(const Arg::StatusVector& v)
|
||||
}
|
||||
|
||||
|
||||
static void internal_post(const ISC_STATUS* tmp_status)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* i n t e r n a l _ p o s t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Append status vector with new values.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
// calculate length of the status
|
||||
FB_SIZE_T tmp_status_len = 0, warning_indx = 0;
|
||||
PARSE_STATUS(tmp_status, tmp_status_len, warning_indx);
|
||||
fb_assert(warning_indx == 0);
|
||||
|
||||
ISC_STATUS* const status_vector = JRD_get_thread_data()->tdbb_status_vector;
|
||||
|
||||
if (status_vector[0] != isc_arg_gds ||
|
||||
(status_vector[0] == isc_arg_gds && status_vector[1] == 0 &&
|
||||
status_vector[2] != isc_arg_warning))
|
||||
{
|
||||
// this is a blank status vector just stuff the status
|
||||
memcpy(status_vector, tmp_status, sizeof(ISC_STATUS) * tmp_status_len);
|
||||
return;
|
||||
}
|
||||
|
||||
FB_SIZE_T status_len = 0;
|
||||
PARSE_STATUS(status_vector, status_len, warning_indx);
|
||||
if (status_len)
|
||||
--status_len;
|
||||
|
||||
// check for duplicated error code
|
||||
size_t i;
|
||||
for (i = 0; i < ISC_STATUS_LENGTH; i++)
|
||||
{
|
||||
if (status_vector[i] == isc_arg_end && i == status_len)
|
||||
break; // end of argument list
|
||||
|
||||
if (i && i == warning_indx)
|
||||
break; // vector has no more errors
|
||||
|
||||
if (status_vector[i] == tmp_status[1] && i && status_vector[i - 1] != isc_arg_warning &&
|
||||
i + tmp_status_len - 2 < ISC_STATUS_LENGTH &&
|
||||
(memcmp(&status_vector[i], &tmp_status[1], sizeof(ISC_STATUS) * (tmp_status_len - 2)) == 0))
|
||||
{
|
||||
// duplicate found
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if the status_vector has only warnings then adjust err_status_len
|
||||
size_t err_status_len = i;
|
||||
if (err_status_len == 2 && warning_indx)
|
||||
err_status_len = 0;
|
||||
|
||||
ISC_STATUS_ARRAY warning_status;
|
||||
FB_SIZE_T warning_count = 0;
|
||||
if (warning_indx)
|
||||
{
|
||||
// copy current warning(s) to a temp buffer
|
||||
MOVE_CLEAR(warning_status, sizeof(warning_status));
|
||||
memcpy(warning_status, &status_vector[warning_indx],
|
||||
sizeof(ISC_STATUS) * (ISC_STATUS_LENGTH - warning_indx));
|
||||
PARSE_STATUS(warning_status, warning_count, warning_indx);
|
||||
}
|
||||
|
||||
// add the status into a real buffer right in between last error and first warning
|
||||
|
||||
if ((i = err_status_len + tmp_status_len) < ISC_STATUS_LENGTH)
|
||||
{
|
||||
memcpy(&status_vector[err_status_len], tmp_status, sizeof(ISC_STATUS) * tmp_status_len);
|
||||
// copy current warning(s) to the status_vector
|
||||
if (warning_count && i + warning_count - 1 < ISC_STATUS_LENGTH) {
|
||||
memcpy(&status_vector[i - 1], warning_status, sizeof(ISC_STATUS) * warning_count);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void ERR_punt()
|
||||
{
|
||||
/**************************************
|
||||
@ -392,14 +277,13 @@ void ERR_punt()
|
||||
|
||||
if (dbb && (dbb->dbb_flags & DBB_bugcheck))
|
||||
{
|
||||
gds__log_status(dbb->dbb_filename.nullStr(), tdbb->tdbb_status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.nullStr(), tdbb->tdbb_status_vector);
|
||||
if (Config::getBugcheckAbort())
|
||||
{
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
ERR_make_permanent(tdbb->tdbb_status_vector);
|
||||
status_exception::raise(tdbb->tdbb_status_vector);
|
||||
}
|
||||
|
||||
@ -421,16 +305,15 @@ void ERR_warning(const Arg::StatusVector& v)
|
||||
*
|
||||
**************************************/
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
ISC_STATUS* s = tdbb->tdbb_status_vector;
|
||||
FbStatusVector* s = tdbb->tdbb_status_vector;
|
||||
|
||||
v.copyTo(s);
|
||||
ERR_make_permanent(s);
|
||||
DEBUG;
|
||||
tdbb->getRequest()->req_flags |= req_warning;
|
||||
}
|
||||
|
||||
|
||||
void ERR_append_status(ISC_STATUS* status_vector, const Arg::StatusVector& v)
|
||||
void ERR_append_status(FbStatusVector* status_vector, const Arg::StatusVector& v)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -450,11 +333,10 @@ void ERR_append_status(ISC_STATUS* status_vector, const Arg::StatusVector& v)
|
||||
|
||||
// Return the result
|
||||
passed.copyTo(status_vector);
|
||||
ERR_make_permanent(status_vector);
|
||||
}
|
||||
|
||||
|
||||
void ERR_build_status(ISC_STATUS* status_vector, const Arg::StatusVector& v)
|
||||
void ERR_build_status(FbStatusVector* status_vector, const Arg::StatusVector& v)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -463,11 +345,10 @@ void ERR_build_status(ISC_STATUS* status_vector, const Arg::StatusVector& v)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Append the given status vector with the passed arguments.
|
||||
* Set the given status vector to the passed arguments.
|
||||
*
|
||||
**************************************/
|
||||
v.copyTo(status_vector);
|
||||
ERR_make_permanent(status_vector);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,20 +46,18 @@ enum idx_e {
|
||||
|
||||
} //namespace Jrd
|
||||
|
||||
bool ERR_post_warning(const Firebird::Arg::StatusVector& v);
|
||||
void ERR_post_warning(const Firebird::Arg::StatusVector& v);
|
||||
void ERR_assert(const TEXT*, int);
|
||||
void ERR_bugcheck(int, const TEXT* = NULL, int = 0);
|
||||
void ERR_bugcheck_msg(const TEXT*);
|
||||
void ERR_corrupt(int);
|
||||
void ERR_error(int);
|
||||
void ERR_post(const Firebird::Arg::StatusVector& v);
|
||||
void ERR_post_nothrow(const Firebird::Arg::StatusVector& v);
|
||||
void ERR_post_nothrow(const Firebird::Arg::StatusVector& v, Jrd::FbStatusVector* statusVector = NULL);
|
||||
void ERR_punt();
|
||||
void ERR_warning(const Firebird::Arg::StatusVector& v);
|
||||
void ERR_log(int, int, const TEXT*);
|
||||
void ERR_make_permanent(ISC_STATUS* s);
|
||||
void ERR_make_permanent(Firebird::Arg::StatusVector& v);
|
||||
void ERR_append_status(ISC_STATUS*, const Firebird::Arg::StatusVector& v);
|
||||
void ERR_build_status(ISC_STATUS*, const Firebird::Arg::StatusVector& v);
|
||||
void ERR_append_status(Jrd::FbStatusVector*, const Firebird::Arg::StatusVector& v);
|
||||
void ERR_build_status(Jrd::FbStatusVector*, const Firebird::Arg::StatusVector& v);
|
||||
|
||||
#endif // JRD_ERR_PROTO_H
|
||||
|
@ -158,37 +158,37 @@ StatusXcp::StatusXcp()
|
||||
|
||||
void StatusXcp::clear()
|
||||
{
|
||||
fb_utils::init_status(status);
|
||||
status->init();
|
||||
}
|
||||
|
||||
void StatusXcp::init(const ISC_STATUS* vector)
|
||||
void StatusXcp::init(const FbStatusVector* vector)
|
||||
{
|
||||
memcpy(status, vector, sizeof(ISC_STATUS_ARRAY));
|
||||
fb_utils::copyStatus(status, vector);
|
||||
}
|
||||
|
||||
void StatusXcp::copyTo(ISC_STATUS* vector) const
|
||||
void StatusXcp::copyTo(FbStatusVector* vector) const
|
||||
{
|
||||
memcpy(vector, status, sizeof(ISC_STATUS_ARRAY));
|
||||
fb_utils::copyStatus(vector, status);
|
||||
}
|
||||
|
||||
bool StatusXcp::success() const
|
||||
{
|
||||
return (status[1] == FB_SUCCESS);
|
||||
return !(status->getState() & FbStatusVector::STATE_ERRORS);
|
||||
}
|
||||
|
||||
SLONG StatusXcp::as_gdscode() const
|
||||
{
|
||||
return status[1];
|
||||
return status->getErrors()[1];
|
||||
}
|
||||
|
||||
SLONG StatusXcp::as_sqlcode() const
|
||||
{
|
||||
return gds__sqlcode(status);
|
||||
return gds__sqlcode(status->getErrors());
|
||||
}
|
||||
|
||||
void StatusXcp::as_sqlstate(char* sqlstate) const
|
||||
{
|
||||
fb_sqlstate(sqlstate, status);
|
||||
fb_sqlstate(sqlstate, status->getErrors());
|
||||
}
|
||||
|
||||
static void execute_looper(thread_db*, jrd_req*, jrd_tra*, const StmtNode*, jrd_req::req_s);
|
||||
|
@ -620,14 +620,14 @@ inline void CompilerScratch::csb_repeat::deactivate()
|
||||
|
||||
class StatusXcp
|
||||
{
|
||||
ISC_STATUS_ARRAY status;
|
||||
FbLocalStatus status;
|
||||
|
||||
public:
|
||||
StatusXcp();
|
||||
|
||||
void clear();
|
||||
void init(const ISC_STATUS*);
|
||||
void copyTo(ISC_STATUS*) const;
|
||||
void init(const Jrd::FbStatusVector*);
|
||||
void copyTo(Jrd::FbStatusVector*) const;
|
||||
bool success() const;
|
||||
SLONG as_gdscode() const;
|
||||
SLONG as_sqlcode() const;
|
||||
|
@ -512,7 +512,7 @@ Transaction* Connection::findTransaction(thread_db* tdbb, TraScope traScope) con
|
||||
return ext_tran;
|
||||
}
|
||||
|
||||
void Connection::raise(const ISC_STATUS* status, thread_db* /*tdbb*/, const char* sWhere)
|
||||
void Connection::raise(const FbStatusVector* status, thread_db* /*tdbb*/, const char* sWhere)
|
||||
{
|
||||
if (!getWrapErrors())
|
||||
{
|
||||
@ -528,15 +528,6 @@ void Connection::raise(const ISC_STATUS* status, thread_db* /*tdbb*/, const char
|
||||
Arg::Str(getDataSourceName()));
|
||||
}
|
||||
|
||||
|
||||
void Connection::raise(const Firebird::IStatus& status, thread_db* tdbb, const char* sWhere)
|
||||
{
|
||||
ISC_STATUS_ARRAY tmp;
|
||||
fb_utils::mergeStatus(tmp, FB_NELEM(tmp), &status);
|
||||
raise(tmp, tdbb, sWhere);
|
||||
}
|
||||
|
||||
|
||||
// Transaction
|
||||
|
||||
Transaction::Transaction(Connection& conn) :
|
||||
@ -590,10 +581,10 @@ void Transaction::start(thread_db* tdbb, TraScope traScope, TraModes traMode,
|
||||
ClumpletWriter tpb(ClumpletReader::Tpb, 64, isc_tpb_version3);
|
||||
generateTPB(tdbb, tpb, traMode, readOnly, wait, lockTimeout);
|
||||
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
doStart(status, tdbb, tpb);
|
||||
|
||||
if (status[1]) {
|
||||
if (status->getState() && FbStatusVector::STATE_ERRORS) {
|
||||
m_connection.raise(status, tdbb, "transaction start");
|
||||
}
|
||||
|
||||
@ -616,20 +607,20 @@ void Transaction::start(thread_db* tdbb, TraScope traScope, TraModes traMode,
|
||||
|
||||
void Transaction::prepare(thread_db* tdbb, int info_len, const char* info)
|
||||
{
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
doPrepare(status, tdbb, info_len, info);
|
||||
|
||||
if (status[1]) {
|
||||
if (status->getState() && FbStatusVector::STATE_ERRORS) {
|
||||
m_connection.raise(status, tdbb, "transaction prepare");
|
||||
}
|
||||
}
|
||||
|
||||
void Transaction::commit(thread_db* tdbb, bool retain)
|
||||
{
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
doCommit(status, tdbb, retain);
|
||||
|
||||
if (status[1]) {
|
||||
if (status->getState() && FbStatusVector::STATE_ERRORS) {
|
||||
m_connection.raise(status, tdbb, "transaction commit");
|
||||
}
|
||||
|
||||
@ -642,7 +633,7 @@ void Transaction::commit(thread_db* tdbb, bool retain)
|
||||
|
||||
void Transaction::rollback(thread_db* tdbb, bool retain)
|
||||
{
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
doRollback(status, tdbb, retain);
|
||||
|
||||
Connection& conn = m_connection;
|
||||
@ -652,7 +643,7 @@ void Transaction::rollback(thread_db* tdbb, bool retain)
|
||||
m_connection.deleteTransaction(this);
|
||||
}
|
||||
|
||||
if (status[1]) {
|
||||
if (status->getState() && FbStatusVector::STATE_ERRORS) {
|
||||
conn.raise(status, tdbb, "transaction rollback");
|
||||
}
|
||||
}
|
||||
@ -877,7 +868,7 @@ bool Statement::fetch(thread_db* tdbb, const ValueListNode* out_params)
|
||||
{
|
||||
if (doFetch(tdbb))
|
||||
{
|
||||
ISC_STATUS_ARRAY status;
|
||||
FbLocalStatus status;
|
||||
Arg::Gds(isc_sing_select_err).copyTo(status);
|
||||
raise(status, tdbb, "isc_dsql_fetch");
|
||||
}
|
||||
@ -1488,7 +1479,7 @@ void Statement::clearNames()
|
||||
}
|
||||
|
||||
|
||||
void Statement::raise(ISC_STATUS* status, thread_db* tdbb, const char* sWhere,
|
||||
void Statement::raise(FbStatusVector* status, thread_db* tdbb, const char* sWhere,
|
||||
const string* sQuery)
|
||||
{
|
||||
m_error = true;
|
||||
@ -1516,26 +1507,6 @@ void Statement::raise(ISC_STATUS* status, thread_db* tdbb, const char* sWhere,
|
||||
Arg::Str(m_connection.getDataSourceName()));
|
||||
}
|
||||
|
||||
void Statement::raise(const Firebird::IStatus& status, thread_db* /*tdbb*/, const char* sWhere,
|
||||
const string* sQuery)
|
||||
{
|
||||
m_error = true;
|
||||
|
||||
if (!m_connection.getWrapErrors())
|
||||
{
|
||||
ERR_post(Arg::StatusVector(&status));
|
||||
}
|
||||
|
||||
string rem_err;
|
||||
m_provider.getRemoteError(status.getErrors(), rem_err);
|
||||
|
||||
// Execute statement error at @1 :\n@2Statement : @3\nData source : @4
|
||||
ERR_post(Arg::Gds(isc_eds_statement) << Arg::Str(sWhere) <<
|
||||
Arg::Str(rem_err) <<
|
||||
Arg::Str(sQuery ? sQuery->substr(0, 255) : m_sql.substr(0, 255)) <<
|
||||
Arg::Str(m_connection.getDataSourceName()));
|
||||
}
|
||||
|
||||
void Statement::bindToRequest(jrd_req* request, Statement** impure)
|
||||
{
|
||||
fb_assert(!m_boundReq);
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
int getFlags() const { return m_flags; }
|
||||
|
||||
// Interprete status and put error description into passed string
|
||||
virtual void getRemoteError(const ISC_STATUS* status, Firebird::string& err) const = 0;
|
||||
virtual void getRemoteError(const Jrd::FbStatusVector* status, Firebird::string& err) const = 0;
|
||||
|
||||
static const Firebird::string* generate(const Provider* item)
|
||||
{
|
||||
@ -186,8 +186,7 @@ public:
|
||||
|
||||
// Get error description from provider and put it with additional context
|
||||
// info into locally raised exception
|
||||
void raise(const ISC_STATUS* status, Jrd::thread_db* tdbb, const char* sWhere);
|
||||
void raise(const Firebird::IStatus& status, Jrd::thread_db* tdbb, const char* sWhere);
|
||||
void raise(const Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, const char* sWhere);
|
||||
|
||||
// will we wrap external errors into our ones (isc_eds_xxx) or pass them as is
|
||||
bool getWrapErrors() const { return m_wrapErrors; }
|
||||
@ -279,10 +278,10 @@ protected:
|
||||
TraModes traMode, bool readOnly, bool wait, int lockTimeout) const;
|
||||
void detachFromJrdTran();
|
||||
|
||||
virtual void doStart(ISC_STATUS* status, Jrd::thread_db* tdbb, Firebird::ClumpletWriter& tpb) = 0;
|
||||
virtual void doPrepare(ISC_STATUS* status, Jrd::thread_db* tdbb, int info_len, const char* info) = 0;
|
||||
virtual void doCommit(ISC_STATUS* status, Jrd::thread_db* tdbb, bool retain) = 0;
|
||||
virtual void doRollback(ISC_STATUS* status, Jrd::thread_db* tdbb, bool retain) = 0;
|
||||
virtual void doStart(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, Firebird::ClumpletWriter& tpb) = 0;
|
||||
virtual void doPrepare(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, int info_len, const char* info) = 0;
|
||||
virtual void doCommit(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, bool retain) = 0;
|
||||
virtual void doRollback(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, bool retain) = 0;
|
||||
|
||||
Provider& m_provider;
|
||||
Connection& m_connection;
|
||||
@ -338,9 +337,7 @@ public:
|
||||
|
||||
// Get error description from provider and put it with additional contex
|
||||
// info into locally raised exception
|
||||
void raise(ISC_STATUS* status, Jrd::thread_db* tdbb, const char* sWhere,
|
||||
const Firebird::string* sQuery = NULL);
|
||||
void raise(const Firebird::IStatus& status, Jrd::thread_db* tdbb, const char* sWhere,
|
||||
void raise(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, const char* sWhere,
|
||||
const Firebird::string* sQuery = NULL);
|
||||
|
||||
// Active statement must be bound to parent jrd request
|
||||
|
@ -79,22 +79,21 @@ void InternalProvider::jrdAttachmentEnd(thread_db* tdbb, Jrd::Attachment* att)
|
||||
}
|
||||
}
|
||||
|
||||
void InternalProvider::getRemoteError(const ISC_STATUS* status, string& err) const
|
||||
void InternalProvider::getRemoteError(const FbStatusVector* status, string& err) const
|
||||
{
|
||||
err = "";
|
||||
|
||||
char buff[1024];
|
||||
const ISC_STATUS* p = status;
|
||||
const ISC_STATUS* end = status + ISC_STATUS_LENGTH;
|
||||
const ISC_STATUS* p = status->getErrors();
|
||||
|
||||
while (p < end)
|
||||
for (;;)
|
||||
{
|
||||
const ISC_STATUS code = *p ? p[1] : 0;
|
||||
const ISC_STATUS* code = p + 1;
|
||||
if (!fb_interpret(buff, sizeof(buff), &p))
|
||||
break;
|
||||
|
||||
string rem_err;
|
||||
rem_err.printf("%lu : %s\n", code, buff);
|
||||
rem_err.printf("%lu : %s\n", *code, buff);
|
||||
err += rem_err;
|
||||
}
|
||||
}
|
||||
@ -112,21 +111,21 @@ InternalConnection::~InternalConnection()
|
||||
}
|
||||
|
||||
// Status helper
|
||||
class IntStatus : public LocalStatus
|
||||
class IntStatus : public Jrd::FbLocalStatus
|
||||
{
|
||||
public:
|
||||
explicit IntStatus(ISC_STATUS *p)
|
||||
: LocalStatus(), v(p)
|
||||
explicit IntStatus(FbStatusVector *p)
|
||||
: FbLocalStatus(), v(p)
|
||||
{}
|
||||
|
||||
~IntStatus()
|
||||
{
|
||||
if (v)
|
||||
fb_utils::mergeStatus(v, ISC_STATUS_LENGTH, this);
|
||||
fb_utils::copyStatus(v, *this);
|
||||
}
|
||||
|
||||
private:
|
||||
ISC_STATUS *v;
|
||||
FbStatusVector *v;
|
||||
};
|
||||
|
||||
void InternalConnection::attach(thread_db* tdbb, const string& dbName,
|
||||
@ -154,18 +153,17 @@ void InternalConnection::attach(thread_db* tdbb, const string& dbName,
|
||||
m_dbName = dbb->dbb_database_name.c_str();
|
||||
generateDPB(tdbb, m_dpb, user, pwd, role);
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
RefPtr<JProvider> jInstance(JProvider::getInstance());
|
||||
jInstance->setDbCryptCallback(&statusWrapper, tdbb->getAttachment()->att_crypt_callback);
|
||||
m_attachment.assignRefNoIncr(jInstance->attachDatabase(&statusWrapper, m_dbName.c_str(),
|
||||
jInstance->setDbCryptCallback(status, tdbb->getAttachment()->att_crypt_callback);
|
||||
m_attachment.assignRefNoIncr(jInstance->attachDatabase(status, m_dbName.c_str(),
|
||||
m_dpb.getBufferLength(), m_dpb.getBuffer()));
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
raise(status, tdbb, "JProvider::attach");
|
||||
}
|
||||
|
||||
@ -183,23 +181,22 @@ void InternalConnection::doDetach(thread_db* tdbb)
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
RefPtr<JAttachment> att = m_attachment;
|
||||
m_attachment = NULL;
|
||||
|
||||
{ // scope
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
att->detach(&statusWrapper);
|
||||
att->detach(status);
|
||||
}
|
||||
|
||||
if (status.getErrors()[1] == isc_att_shutdown)
|
||||
if (status->getErrors()[1] == isc_att_shutdown)
|
||||
{
|
||||
status.init();
|
||||
status->init();
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
m_attachment = att;
|
||||
raise(status, tdbb, "JAttachment::detach");
|
||||
@ -214,11 +211,10 @@ bool InternalConnection::cancelExecution()
|
||||
if (m_isCurrent)
|
||||
return true;
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
m_attachment->cancelOperation(&statusWrapper, fb_cancel_raise);
|
||||
return !(status.getState() & IStatus::STATE_ERRORS);
|
||||
m_attachment->cancelOperation(status, fb_cancel_raise);
|
||||
return !(status->getState() & IStatus::STATE_ERRORS);
|
||||
}
|
||||
|
||||
// this internal connection instance is available for the current execution context if it
|
||||
@ -264,7 +260,7 @@ Blob* InternalConnection::createBlob()
|
||||
|
||||
// InternalTransaction()
|
||||
|
||||
void InternalTransaction::doStart(ISC_STATUS* status, thread_db* tdbb, ClumpletWriter& tpb)
|
||||
void InternalTransaction::doStart(FbStatusVector* status, thread_db* tdbb, ClumpletWriter& tpb)
|
||||
{
|
||||
fb_assert(!m_transaction);
|
||||
|
||||
@ -279,24 +275,23 @@ void InternalTransaction::doStart(ISC_STATUS* status, thread_db* tdbb, ClumpletW
|
||||
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
IntStatus s(status);
|
||||
CheckStatusWrapper statusWrapper(&s);
|
||||
|
||||
m_transaction.assignRefNoIncr(
|
||||
att->startTransaction(&statusWrapper, tpb.getBufferLength(), tpb.getBuffer()));
|
||||
att->startTransaction(s, tpb.getBufferLength(), tpb.getBuffer()));
|
||||
|
||||
if (m_transaction)
|
||||
m_transaction->getHandle()->tra_callback_count = localTran->tra_callback_count;
|
||||
}
|
||||
}
|
||||
|
||||
void InternalTransaction::doPrepare(ISC_STATUS* /*status*/, thread_db* /*tdbb*/,
|
||||
void InternalTransaction::doPrepare(FbStatusVector* /*status*/, thread_db* /*tdbb*/,
|
||||
int /*info_len*/, const char* /*info*/)
|
||||
{
|
||||
fb_assert(m_transaction);
|
||||
fb_assert(false);
|
||||
}
|
||||
|
||||
void InternalTransaction::doCommit(ISC_STATUS* status, thread_db* tdbb, bool retain)
|
||||
void InternalTransaction::doCommit(FbStatusVector* status, thread_db* tdbb, bool retain)
|
||||
{
|
||||
fb_assert(m_transaction);
|
||||
|
||||
@ -309,20 +304,19 @@ void InternalTransaction::doCommit(ISC_STATUS* status, thread_db* tdbb, bool ret
|
||||
else
|
||||
{
|
||||
IntStatus s(status);
|
||||
CheckStatusWrapper statusWrapper(&s);
|
||||
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
if (retain)
|
||||
m_transaction->commitRetaining(&statusWrapper);
|
||||
m_transaction->commitRetaining(s);
|
||||
else
|
||||
{
|
||||
m_transaction->commit(&statusWrapper);
|
||||
m_transaction->commit(s);
|
||||
m_transaction = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InternalTransaction::doRollback(ISC_STATUS* status, thread_db* tdbb, bool retain)
|
||||
void InternalTransaction::doRollback(FbStatusVector* status, thread_db* tdbb, bool retain)
|
||||
{
|
||||
fb_assert(m_transaction);
|
||||
|
||||
@ -335,22 +329,21 @@ void InternalTransaction::doRollback(ISC_STATUS* status, thread_db* tdbb, bool r
|
||||
else
|
||||
{
|
||||
IntStatus s(status);
|
||||
CheckStatusWrapper statusWrapper(&s);
|
||||
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
if (retain)
|
||||
m_transaction->rollbackRetaining(&statusWrapper);
|
||||
m_transaction->rollbackRetaining(s);
|
||||
else
|
||||
{
|
||||
m_transaction->rollback(&statusWrapper);
|
||||
m_transaction->rollback(s);
|
||||
m_transaction = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (status[1] == isc_att_shutdown && !retain)
|
||||
if (status->getErrors()[1] == isc_att_shutdown && !retain)
|
||||
{
|
||||
m_transaction = NULL;
|
||||
fb_utils::init_status(status);
|
||||
status->init();
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,8 +373,7 @@ void InternalStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
JAttachment* att = m_intConnection.getJrdAtt();
|
||||
JTransaction* tran = getIntTransaction()->getJrdTran();
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
if (m_request)
|
||||
{
|
||||
@ -424,14 +416,14 @@ void InternalStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
tran->getHandle()->tra_caller_name = CallerName();
|
||||
}
|
||||
|
||||
m_request.assignRefNoIncr(att->prepare(&statusWrapper, tran, sql.length(), sql.c_str(),
|
||||
m_request.assignRefNoIncr(att->prepare(status, tran, sql.length(), sql.c_str(),
|
||||
m_connection.getSqlDialect(), 0));
|
||||
m_allocated = (m_request != NULL);
|
||||
|
||||
tran->getHandle()->tra_caller_name = save_caller_name;
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
raise(status, tdbb, "JAttachment::prepare", &sql);
|
||||
|
||||
const DsqlCompiledStatement* statement = m_request->getHandle()->getStatement();
|
||||
@ -484,7 +476,7 @@ void InternalStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
case DsqlCompiledStatement::TYPE_COMMIT_RETAIN:
|
||||
case DsqlCompiledStatement::TYPE_ROLLBACK_RETAIN:
|
||||
case DsqlCompiledStatement::TYPE_CREATE_DB:
|
||||
Arg::Gds(isc_eds_expl_tran_ctrl).copyTo(&statusWrapper);
|
||||
Arg::Gds(isc_eds_expl_tran_ctrl).copyTo(status);
|
||||
raise(status, tdbb, "JAttachment::prepare", &sql);
|
||||
break;
|
||||
|
||||
@ -507,8 +499,7 @@ void InternalStatement::doExecute(thread_db* tdbb)
|
||||
{
|
||||
JTransaction* transaction = getIntTransaction()->getJrdTran();
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
@ -516,11 +507,11 @@ void InternalStatement::doExecute(thread_db* tdbb)
|
||||
fb_assert(m_inMetadata->getMessageLength() == m_in_buffer.getCount());
|
||||
fb_assert(m_outMetadata->getMessageLength() == m_out_buffer.getCount());
|
||||
|
||||
m_request->execute(&statusWrapper, transaction,
|
||||
m_request->execute(status, transaction,
|
||||
m_inMetadata, m_in_buffer.begin(), m_outMetadata, m_out_buffer.begin());
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
raise(status, tdbb, "JStatement::execute");
|
||||
}
|
||||
|
||||
@ -529,33 +520,31 @@ void InternalStatement::doOpen(thread_db* tdbb)
|
||||
{
|
||||
JTransaction* transaction = getIntTransaction()->getJrdTran();
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
|
||||
if (m_cursor)
|
||||
{
|
||||
m_cursor->close(&statusWrapper);
|
||||
m_cursor->close(status);
|
||||
m_cursor = NULL;
|
||||
}
|
||||
|
||||
fb_assert(m_inMetadata->getMessageLength() == m_in_buffer.getCount());
|
||||
|
||||
m_cursor.assignRefNoIncr(m_request->openCursor(&statusWrapper, transaction,
|
||||
m_cursor.assignRefNoIncr(m_request->openCursor(status, transaction,
|
||||
m_inMetadata, m_in_buffer.begin(), m_outMetadata, 0));
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
raise(status, tdbb, "JStatement::open");
|
||||
}
|
||||
|
||||
|
||||
bool InternalStatement::doFetch(thread_db* tdbb)
|
||||
{
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
bool res = true;
|
||||
|
||||
@ -564,10 +553,10 @@ bool InternalStatement::doFetch(thread_db* tdbb)
|
||||
|
||||
fb_assert(m_outMetadata->getMessageLength() == m_out_buffer.getCount());
|
||||
fb_assert(m_cursor);
|
||||
res = m_cursor->fetchNext(&statusWrapper, m_out_buffer.begin()) == IStatus::RESULT_OK;
|
||||
res = m_cursor->fetchNext(status, m_out_buffer.begin()) == IStatus::RESULT_OK;
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
raise(status, tdbb, "JResultSet::fetchNext");
|
||||
|
||||
return res;
|
||||
@ -576,17 +565,16 @@ bool InternalStatement::doFetch(thread_db* tdbb)
|
||||
|
||||
void InternalStatement::doClose(thread_db* tdbb, bool drop)
|
||||
{
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
|
||||
if (m_cursor)
|
||||
m_cursor->close(&statusWrapper);
|
||||
m_cursor->close(status);
|
||||
|
||||
m_cursor = NULL;
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
raise(status, tdbb, "JResultSet::close");
|
||||
}
|
||||
@ -594,12 +582,12 @@ void InternalStatement::doClose(thread_db* tdbb, bool drop)
|
||||
if (drop)
|
||||
{
|
||||
if (m_request)
|
||||
m_request->free(&statusWrapper);
|
||||
m_request->free(status);
|
||||
|
||||
m_allocated = false;
|
||||
m_request = NULL;
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
raise(status, tdbb, "JStatement::free");
|
||||
}
|
||||
@ -652,8 +640,7 @@ void InternalBlob::open(thread_db* tdbb, Transaction& tran, const dsc& desc, con
|
||||
JTransaction* transaction = static_cast<InternalTransaction&>(tran).getJrdTran();
|
||||
memcpy(&m_blob_id, desc.dsc_address, sizeof(m_blob_id));
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
|
||||
@ -662,10 +649,10 @@ void InternalBlob::open(thread_db* tdbb, Transaction& tran, const dsc& desc, con
|
||||
const UCHAR* bpb_buff = bpb ? bpb->begin() : NULL;
|
||||
|
||||
m_blob.assignRefNoIncr(
|
||||
att->openBlob(&statusWrapper, transaction, &m_blob_id, bpb_len, bpb_buff));
|
||||
att->openBlob(status, transaction, &m_blob_id, bpb_len, bpb_buff));
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JAttachment::openBlob");
|
||||
|
||||
fb_assert(m_blob);
|
||||
@ -680,8 +667,7 @@ void InternalBlob::create(thread_db* tdbb, Transaction& tran, dsc& desc, const U
|
||||
JTransaction* transaction = ((InternalTransaction&) tran).getJrdTran();
|
||||
memset(&m_blob_id, 0, sizeof(m_blob_id));
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
|
||||
@ -690,10 +676,10 @@ void InternalBlob::create(thread_db* tdbb, Transaction& tran, dsc& desc, const U
|
||||
const UCHAR* bpb_buff = bpb ? bpb->begin() : NULL;
|
||||
|
||||
m_blob.assignRefNoIncr(
|
||||
att->createBlob(&statusWrapper, transaction, &m_blob_id, bpb_len, bpb_buff));
|
||||
att->createBlob(status, transaction, &m_blob_id, bpb_len, bpb_buff));
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JAttachment::createBlob");
|
||||
|
||||
fb_assert(m_blob);
|
||||
@ -705,15 +691,14 @@ USHORT InternalBlob::read(thread_db* tdbb, UCHAR* buff, USHORT len)
|
||||
fb_assert(m_blob);
|
||||
|
||||
unsigned result = 0;
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
|
||||
m_blob->getSegment(&statusWrapper, len, buff, &result);
|
||||
m_blob->getSegment(status, len, buff, &result);
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JBlob::getSegment");
|
||||
|
||||
return result;
|
||||
@ -723,31 +708,29 @@ void InternalBlob::write(thread_db* tdbb, const UCHAR* buff, USHORT len)
|
||||
{
|
||||
fb_assert(m_blob);
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
|
||||
m_blob->putSegment(&statusWrapper, len, buff);
|
||||
m_blob->putSegment(status, len, buff);
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JBlob::putSegment");
|
||||
}
|
||||
|
||||
void InternalBlob::close(thread_db* tdbb)
|
||||
{
|
||||
fb_assert(m_blob);
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
|
||||
m_blob->close(&statusWrapper);
|
||||
m_blob->close(status);
|
||||
m_blob = NULL;
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JBlob::close");
|
||||
|
||||
fb_assert(!m_blob);
|
||||
@ -759,16 +742,15 @@ void InternalBlob::cancel(thread_db* tdbb)
|
||||
return;
|
||||
}
|
||||
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
FbLocalStatus status;
|
||||
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
|
||||
m_blob->cancel(&statusWrapper);
|
||||
m_blob->cancel(status);
|
||||
m_blob = NULL;
|
||||
}
|
||||
|
||||
if (status.getState() & IStatus::STATE_ERRORS)
|
||||
if (status->getState() & IStatus::STATE_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JBlob::cancel");
|
||||
|
||||
fb_assert(!m_blob);
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
|
||||
virtual void initialize() {}
|
||||
virtual void jrdAttachmentEnd(Jrd::thread_db* tdbb, Jrd::Attachment* att);
|
||||
virtual void getRemoteError(const ISC_STATUS* status, Firebird::string& err) const;
|
||||
virtual void getRemoteError(const Jrd::FbStatusVector* status, Firebird::string& err) const;
|
||||
|
||||
protected:
|
||||
virtual Connection* doCreateConnection();
|
||||
@ -110,10 +110,10 @@ public:
|
||||
Jrd::JTransaction* getJrdTran() { return m_transaction; }
|
||||
|
||||
protected:
|
||||
virtual void doStart(ISC_STATUS* status, Jrd::thread_db* tdbb, Firebird::ClumpletWriter& tpb);
|
||||
virtual void doPrepare(ISC_STATUS* status, Jrd::thread_db* tdbb, int info_len, const char* info);
|
||||
virtual void doCommit(ISC_STATUS* status, Jrd::thread_db* tdbb, bool retain);
|
||||
virtual void doRollback(ISC_STATUS* status, Jrd::thread_db* tdbb, bool retain);
|
||||
virtual void doStart(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, Firebird::ClumpletWriter& tpb);
|
||||
virtual void doPrepare(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, int info_len, const char* info);
|
||||
virtual void doCommit(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, bool retain);
|
||||
virtual void doRollback(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, bool retain);
|
||||
|
||||
InternalConnection& m_IntConnection;
|
||||
Firebird::RefPtr<Jrd::JTransaction> m_transaction;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "../exe_proto.h"
|
||||
#include "../intl_proto.h"
|
||||
#include "../mov_proto.h"
|
||||
#include "../common/utils_proto.h"
|
||||
|
||||
|
||||
using namespace Jrd;
|
||||
@ -59,13 +60,13 @@ public:
|
||||
|
||||
static RegisterFBProvider reg;
|
||||
|
||||
static bool isConnectionBrokenError(ISC_STATUS status);
|
||||
static bool isConnectionBrokenError(FbStatusVector* status);
|
||||
static void parseSQLDA(XSQLDA* xsqlda, UCharBuffer& buff, Firebird::Array<dsc>& descs);
|
||||
static UCHAR sqlTypeToDscType(SSHORT sqlType);
|
||||
|
||||
// IscProvider
|
||||
|
||||
void IscProvider::getRemoteError(const ISC_STATUS* status, string& err) const
|
||||
void IscProvider::getRemoteError(const FbStatusVector* status, string& err) const
|
||||
{
|
||||
err = "";
|
||||
|
||||
@ -76,10 +77,10 @@ void IscProvider::getRemoteError(const ISC_STATUS* status, string& err) const
|
||||
// Probably in next version we should use fb_interpret only.
|
||||
|
||||
char buff[1024];
|
||||
const ISC_STATUS* p = status;
|
||||
const ISC_STATUS* const end = status + ISC_STATUS_LENGTH;
|
||||
const ISC_STATUS* p = status->getErrors();
|
||||
const ISC_STATUS* const end = p + fb_utils::statusLength(p);
|
||||
|
||||
while (p < end)
|
||||
while (p < end - 1)
|
||||
{
|
||||
const ISC_STATUS code = *p ? p[1] : 0;
|
||||
if (!m_api.isc_interprete(buff, &p))
|
||||
@ -115,14 +116,14 @@ void IscConnection::attach(thread_db* tdbb, const string& dbName, const string&
|
||||
m_dbName = dbName;
|
||||
generateDPB(tdbb, m_dpb, user, pwd, role);
|
||||
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
m_iscProvider.isc_attach_database(status, m_dbName.length(), m_dbName.c_str(),
|
||||
&m_handle, m_dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(m_dpb.getBuffer()));
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
raise(status, tdbb, "attach");
|
||||
}
|
||||
|
||||
@ -133,7 +134,7 @@ void IscConnection::attach(thread_db* tdbb, const string& dbName, const string&
|
||||
const char info[] = {isc_info_db_sql_dialect, isc_info_end};
|
||||
m_iscProvider.isc_database_info(status, &m_handle, sizeof(info), info, sizeof(buff), buff);
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
raise(status, tdbb, "isc_database_info");
|
||||
}
|
||||
|
||||
@ -177,7 +178,7 @@ void IscConnection::attach(thread_db* tdbb, const string& dbName, const string&
|
||||
|
||||
void IscConnection::doDetach(thread_db* tdbb)
|
||||
{
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
if (m_handle)
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
@ -188,25 +189,28 @@ void IscConnection::doDetach(thread_db* tdbb)
|
||||
m_handle = h;
|
||||
}
|
||||
|
||||
if (status[1] && !isConnectionBrokenError(status[1]))
|
||||
if ((status->getState() & FbStatusVector::STATE_ERRORS) &&
|
||||
!isConnectionBrokenError(status))
|
||||
{
|
||||
raise(status, tdbb, "detach");
|
||||
}
|
||||
}
|
||||
|
||||
bool IscConnection::cancelExecution()
|
||||
{
|
||||
ISC_STATUS_ARRAY status = {0, 0, 0};
|
||||
FbLocalStatus status;
|
||||
|
||||
if (m_handle)
|
||||
{
|
||||
m_iscProvider.fb_cancel_operation(status, &m_handle, fb_cancel_raise);
|
||||
|
||||
if (m_handle && status[1] == isc_wish_list)
|
||||
if (m_handle && (status->getErrors()[1] == isc_wish_list))
|
||||
{
|
||||
fb_utils::init_status(status);
|
||||
status->init();
|
||||
m_iscProvider.fb_cancel_operation(status, &m_handle, fb_cancel_abort);
|
||||
}
|
||||
}
|
||||
return (status[1] == 0);
|
||||
return !(status->getState() & FbStatusVector::STATE_ERRORS);
|
||||
}
|
||||
|
||||
// this ISC connection instance is available for the current execution context if it
|
||||
@ -246,7 +250,7 @@ Statement* IscConnection::doCreateStatement()
|
||||
|
||||
// IscTransaction
|
||||
|
||||
void IscTransaction::doStart(ISC_STATUS* status, thread_db* tdbb, Firebird::ClumpletWriter& tpb)
|
||||
void IscTransaction::doStart(FbStatusVector* status, thread_db* tdbb, Firebird::ClumpletWriter& tpb)
|
||||
{
|
||||
fb_assert(!m_handle);
|
||||
FB_API_HANDLE& db_handle = m_iscConnection.getAPIHandle();
|
||||
@ -256,11 +260,11 @@ void IscTransaction::doStart(ISC_STATUS* status, thread_db* tdbb, Firebird::Clum
|
||||
tpb.getBufferLength(), tpb.getBuffer());
|
||||
}
|
||||
|
||||
void IscTransaction::doPrepare(ISC_STATUS* /*status*/, thread_db* /*tdbb*/, int /*info_len*/, const char* /*info*/)
|
||||
void IscTransaction::doPrepare(FbStatusVector* /*status*/, thread_db* /*tdbb*/, int /*info_len*/, const char* /*info*/)
|
||||
{
|
||||
}
|
||||
|
||||
void IscTransaction::doCommit(ISC_STATUS* status, thread_db* tdbb, bool retain)
|
||||
void IscTransaction::doCommit(FbStatusVector* status, thread_db* tdbb, bool retain)
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
if (retain)
|
||||
@ -268,10 +272,11 @@ void IscTransaction::doCommit(ISC_STATUS* status, thread_db* tdbb, bool retain)
|
||||
else
|
||||
m_iscProvider.isc_commit_transaction(status, &m_handle);
|
||||
|
||||
fb_assert(retain && m_handle || !retain && !m_handle || status[1] && m_handle);
|
||||
fb_assert(retain && m_handle || !retain && !m_handle ||
|
||||
(status->getState() && FbStatusVector::STATE_ERRORS) && m_handle);
|
||||
}
|
||||
|
||||
void IscTransaction::doRollback(ISC_STATUS* status, thread_db* tdbb, bool retain)
|
||||
void IscTransaction::doRollback(FbStatusVector* status, thread_db* tdbb, bool retain)
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
if (retain)
|
||||
@ -279,13 +284,15 @@ void IscTransaction::doRollback(ISC_STATUS* status, thread_db* tdbb, bool retain
|
||||
else
|
||||
m_iscProvider.isc_rollback_transaction(status, &m_handle);
|
||||
|
||||
if (status[1] && isConnectionBrokenError(status[1]) && !retain)
|
||||
if ((status->getState() & FbStatusVector::STATE_ERRORS) &&
|
||||
isConnectionBrokenError(status) && !retain)
|
||||
{
|
||||
m_handle = 0;
|
||||
fb_utils::init_status(status);
|
||||
}
|
||||
|
||||
fb_assert(retain && m_handle || !retain && !m_handle || status[1] && m_handle);
|
||||
fb_assert(retain && m_handle || !retain && !m_handle ||
|
||||
(status->getState() && FbStatusVector::STATE_ERRORS) && m_handle);
|
||||
}
|
||||
|
||||
|
||||
@ -312,7 +319,7 @@ void IscStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
FB_API_HANDLE& h_conn = m_iscConnection.getAPIHandle();
|
||||
FB_API_HANDLE& h_tran = getIscTransaction()->getAPIHandle();
|
||||
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
|
||||
// prepare and get output parameters
|
||||
if (!m_out_xsqlda)
|
||||
@ -465,12 +472,12 @@ void IscStatement::doExecute(thread_db* tdbb)
|
||||
{
|
||||
FB_API_HANDLE& h_tran = getIscTransaction()->getAPIHandle();
|
||||
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
m_iscProvider.isc_dsql_execute2(status, &h_tran, &m_handle, 1, m_in_xsqlda, m_out_xsqlda);
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
raise(status, tdbb, "isc_dsql_execute2");
|
||||
}
|
||||
}
|
||||
@ -478,19 +485,19 @@ void IscStatement::doExecute(thread_db* tdbb)
|
||||
void IscStatement::doOpen(thread_db* tdbb)
|
||||
{
|
||||
FB_API_HANDLE& h_tran = getIscTransaction()->getAPIHandle();
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
m_iscProvider.isc_dsql_execute(status, &h_tran, &m_handle, 1, m_in_xsqlda);
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
raise(status, tdbb, "isc_dsql_execute");
|
||||
}
|
||||
}
|
||||
|
||||
bool IscStatement::doFetch(thread_db* tdbb)
|
||||
{
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
const ISC_STATUS res = m_iscProvider.isc_dsql_fetch(status, &m_handle, 1, m_out_xsqlda);
|
||||
@ -498,7 +505,7 @@ bool IscStatement::doFetch(thread_db* tdbb)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
raise(status, tdbb, "isc_dsql_fetch");
|
||||
}
|
||||
return true;
|
||||
@ -507,13 +514,13 @@ bool IscStatement::doFetch(thread_db* tdbb)
|
||||
void IscStatement::doClose(thread_db* tdbb, bool drop)
|
||||
{
|
||||
fb_assert(m_handle);
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
m_iscProvider.isc_dsql_free_statement(status, &m_handle, drop ? DSQL_drop : DSQL_close);
|
||||
m_allocated = (m_handle != 0);
|
||||
}
|
||||
if (status[1])
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS)
|
||||
{
|
||||
// we can do nothing else with this statement after this point
|
||||
m_allocated = m_handle = 0;
|
||||
@ -566,7 +573,7 @@ void IscBlob::open(thread_db* tdbb, Transaction& tran, const dsc& desc, const UC
|
||||
|
||||
memcpy(&m_blob_id, desc.dsc_address, sizeof(m_blob_id));
|
||||
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION);
|
||||
|
||||
@ -576,7 +583,7 @@ void IscBlob::open(thread_db* tdbb, Transaction& tran, const dsc& desc, const UC
|
||||
m_iscProvider.isc_open_blob2(status, &h_db, &h_tran, &m_handle, &m_blob_id,
|
||||
bpb_len, bpb_buff);
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
m_iscConnection.raise(status, tdbb, "isc_open_blob2");
|
||||
}
|
||||
fb_assert(m_handle);
|
||||
@ -590,7 +597,7 @@ void IscBlob::create(thread_db* tdbb, Transaction& tran, dsc& desc, const UCharB
|
||||
FB_API_HANDLE& h_db = m_iscConnection.getAPIHandle();
|
||||
FB_API_HANDLE& h_tran = ((IscTransaction&) tran).getAPIHandle();
|
||||
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION);
|
||||
|
||||
@ -601,7 +608,7 @@ void IscBlob::create(thread_db* tdbb, Transaction& tran, dsc& desc, const UCharB
|
||||
bpb_len, bpb_buff);
|
||||
memcpy(desc.dsc_address, &m_blob_id, sizeof(m_blob_id));
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
m_iscConnection.raise(status, tdbb, "isc_create_blob2");
|
||||
}
|
||||
fb_assert(m_handle);
|
||||
@ -612,12 +619,12 @@ USHORT IscBlob::read(thread_db* tdbb, UCHAR* buff, USHORT len)
|
||||
fb_assert(m_handle);
|
||||
|
||||
USHORT result = 0;
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION);
|
||||
m_iscProvider.isc_get_segment(status, &m_handle, &result, len, reinterpret_cast<SCHAR*>(buff));
|
||||
}
|
||||
switch (status[1])
|
||||
switch (status->getErrors()[1])
|
||||
{
|
||||
case isc_segstr_eof:
|
||||
fb_assert(result == 0);
|
||||
@ -636,12 +643,12 @@ void IscBlob::write(thread_db* tdbb, const UCHAR* buff, USHORT len)
|
||||
{
|
||||
fb_assert(m_handle);
|
||||
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION);
|
||||
m_iscProvider.isc_put_segment(status, &m_handle, len, reinterpret_cast<const SCHAR*>(buff));
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
m_iscConnection.raise(status, tdbb, "isc_put_segment");
|
||||
}
|
||||
}
|
||||
@ -649,12 +656,12 @@ void IscBlob::write(thread_db* tdbb, const UCHAR* buff, USHORT len)
|
||||
void IscBlob::close(thread_db* tdbb)
|
||||
{
|
||||
fb_assert(m_handle);
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION);
|
||||
m_iscProvider.isc_close_blob(status, &m_handle);
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
m_iscConnection.raise(status, tdbb, "isc_close_blob");
|
||||
}
|
||||
fb_assert(!m_handle);
|
||||
@ -666,12 +673,12 @@ void IscBlob::cancel(thread_db* tdbb)
|
||||
if (!m_handle)
|
||||
return;
|
||||
|
||||
ISC_STATUS_ARRAY status = {0};
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION);
|
||||
m_iscProvider.isc_cancel_blob(status, &m_handle);
|
||||
}
|
||||
if (status[1]) {
|
||||
if (status->getState() & FbStatusVector::STATE_ERRORS) {
|
||||
m_iscConnection.raise(status, tdbb, "isc_close_blob");
|
||||
}
|
||||
fb_assert(!m_handle);
|
||||
@ -681,31 +688,57 @@ void IscBlob::cancel(thread_db* tdbb)
|
||||
// IscProvider
|
||||
// isc api
|
||||
|
||||
ISC_STATUS IscProvider::notImplemented(ISC_STATUS* status) const
|
||||
class IscStatus
|
||||
{
|
||||
public:
|
||||
IscStatus(FbStatusVector* pStatus)
|
||||
: iStatus(pStatus)
|
||||
{
|
||||
fb_utils::init_status(aStatus);
|
||||
}
|
||||
|
||||
~IscStatus()
|
||||
{
|
||||
Arg::StatusVector tmp(aStatus);
|
||||
tmp.copyTo(iStatus);
|
||||
}
|
||||
|
||||
operator ISC_STATUS*()
|
||||
{
|
||||
return aStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
FbStatusVector* iStatus;
|
||||
ISC_STATUS_ARRAY aStatus;
|
||||
};
|
||||
|
||||
|
||||
ISC_STATUS IscProvider::notImplemented(FbStatusVector* status) const
|
||||
{
|
||||
Arg::Gds(isc_unavailable).copyTo(status);
|
||||
|
||||
return status[1];
|
||||
return status->getErrors()[1];
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_attach_database(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_attach_database(FbStatusVector* user_status,
|
||||
short file_length, const char* file_name, isc_db_handle* public_handle,
|
||||
short dpb_length, const char* dpb)
|
||||
{
|
||||
if (!m_api.isc_attach_database)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_attach_database) (user_status, file_length, file_name,
|
||||
return (*m_api.isc_attach_database) (IscStatus(user_status), file_length, file_name,
|
||||
public_handle, dpb_length, dpb);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_gen_sdl(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_gen_sdl(FbStatusVector* user_status,
|
||||
const ISC_ARRAY_DESC*, short*, char*, short*)
|
||||
{
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_get_slice(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_get_slice(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
ISC_QUAD *,
|
||||
@ -716,7 +749,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_array_get_slice(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_lookup_bounds(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_lookup_bounds(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
const char*,
|
||||
@ -726,7 +759,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_array_lookup_bounds(ISC_STATUS* user_stat
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_lookup_desc(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_lookup_desc(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
const char*,
|
||||
@ -736,7 +769,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_array_lookup_desc(ISC_STATUS* user_status
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_set_desc(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_set_desc(FbStatusVector* user_status,
|
||||
const char*,
|
||||
const char*,
|
||||
const short*,
|
||||
@ -747,7 +780,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_array_set_desc(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_put_slice(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_array_put_slice(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
ISC_QUAD *,
|
||||
@ -765,7 +798,7 @@ void ISC_EXPORT IscProvider::isc_blob_default_desc(ISC_BLOB_DESC *,
|
||||
return;
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_blob_gen_bpb(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_blob_gen_bpb(FbStatusVector* user_status,
|
||||
const ISC_BLOB_DESC*,
|
||||
const ISC_BLOB_DESC*,
|
||||
unsigned short,
|
||||
@ -775,7 +808,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_blob_gen_bpb(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_blob_info(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_blob_info(FbStatusVector* user_status,
|
||||
isc_blob_handle* blob_handle,
|
||||
short item_length,
|
||||
const char* items,
|
||||
@ -785,11 +818,11 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_blob_info(ISC_STATUS* user_status,
|
||||
if (!m_api.isc_blob_info)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_blob_info) (user_status, blob_handle,
|
||||
return (*m_api.isc_blob_info) (IscStatus(user_status), blob_handle,
|
||||
item_length, items, buffer_length, buffer);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_blob_lookup_desc(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_blob_lookup_desc(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
const unsigned char*,
|
||||
@ -800,7 +833,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_blob_lookup_desc(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_blob_set_desc(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_blob_set_desc(FbStatusVector* user_status,
|
||||
const unsigned char*,
|
||||
const unsigned char*,
|
||||
short,
|
||||
@ -811,50 +844,50 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_blob_set_desc(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_cancel_blob(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_cancel_blob(FbStatusVector* user_status,
|
||||
isc_blob_handle* blob_handle)
|
||||
{
|
||||
if (!m_api.isc_cancel_blob)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_cancel_blob) (user_status, blob_handle);
|
||||
return (*m_api.isc_cancel_blob) (IscStatus(user_status), blob_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_cancel_events(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_cancel_events(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
ISC_LONG *)
|
||||
{
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_close_blob(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_close_blob(FbStatusVector* user_status,
|
||||
isc_blob_handle* blob_handle)
|
||||
{
|
||||
if (!m_api.isc_close_blob)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_close_blob) (user_status, blob_handle);
|
||||
return (*m_api.isc_close_blob) (IscStatus(user_status), blob_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_commit_retaining(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_commit_retaining(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle)
|
||||
{
|
||||
if (!m_api.isc_commit_retaining)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_commit_retaining) (user_status, tra_handle);
|
||||
return (*m_api.isc_commit_retaining) (IscStatus(user_status), tra_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_commit_transaction(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_commit_transaction(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle)
|
||||
{
|
||||
if (!m_api.isc_commit_transaction)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_commit_transaction) (user_status, tra_handle);
|
||||
return (*m_api.isc_commit_transaction) (IscStatus(user_status), tra_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_create_blob(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_create_blob(FbStatusVector* user_status,
|
||||
isc_db_handle* db_handle,
|
||||
isc_tr_handle* tr_handle,
|
||||
isc_blob_handle* blob_handle,
|
||||
@ -863,11 +896,11 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_create_blob(ISC_STATUS* user_status,
|
||||
if (!m_api.isc_create_blob)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_create_blob) (user_status, db_handle, tr_handle,
|
||||
return (*m_api.isc_create_blob) (IscStatus(user_status), db_handle, tr_handle,
|
||||
blob_handle, blob_id);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_create_blob2(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_create_blob2(FbStatusVector* user_status,
|
||||
isc_db_handle* db_handle,
|
||||
isc_tr_handle* tr_handle,
|
||||
isc_blob_handle* blob_handle,
|
||||
@ -878,11 +911,11 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_create_blob2(ISC_STATUS* user_status,
|
||||
if (!m_api.isc_create_blob2)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_create_blob2) (user_status, db_handle, tr_handle,
|
||||
return (*m_api.isc_create_blob2) (IscStatus(user_status), db_handle, tr_handle,
|
||||
blob_handle, blob_id, bpb_length, bpb);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_create_database(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_create_database(FbStatusVector* user_status,
|
||||
short,
|
||||
const char*,
|
||||
isc_db_handle *,
|
||||
@ -893,7 +926,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_create_database(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_database_info(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_database_info(FbStatusVector* user_status,
|
||||
isc_db_handle* db_handle,
|
||||
short info_len,
|
||||
const char* info,
|
||||
@ -903,7 +936,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_database_info(ISC_STATUS* user_status,
|
||||
if (!m_api.isc_database_info)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_database_info) (user_status, db_handle,
|
||||
return (*m_api.isc_database_info) (IscStatus(user_status), db_handle,
|
||||
info_len, info, res_len, res);
|
||||
}
|
||||
|
||||
@ -931,58 +964,58 @@ void ISC_EXPORT IscProvider::isc_decode_timestamp(const ISC_TIMESTAMP*,
|
||||
return;
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_detach_database(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_detach_database(FbStatusVector* user_status,
|
||||
isc_db_handle* public_handle)
|
||||
{
|
||||
if (!m_api.isc_detach_database)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_detach_database) (user_status, public_handle);
|
||||
return (*m_api.isc_detach_database) (IscStatus(user_status), public_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_drop_database(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_drop_database(FbStatusVector* user_status,
|
||||
isc_db_handle *)
|
||||
{
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_allocate_statement(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_allocate_statement(FbStatusVector* user_status,
|
||||
isc_db_handle* db_handle, isc_stmt_handle* stmt_handle)
|
||||
{
|
||||
if (!m_api.isc_dsql_allocate_statement)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_allocate_statement) (user_status, db_handle, stmt_handle);
|
||||
return (*m_api.isc_dsql_allocate_statement) (IscStatus(user_status), db_handle, stmt_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_alloc_statement2(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_alloc_statement2(FbStatusVector* user_status,
|
||||
isc_db_handle* db_handle, isc_stmt_handle* stmt_handle)
|
||||
{
|
||||
if (!m_api.isc_dsql_alloc_statement2)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_alloc_statement2) (user_status, db_handle, stmt_handle);
|
||||
return (*m_api.isc_dsql_alloc_statement2) (IscStatus(user_status), db_handle, stmt_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_describe(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_describe(FbStatusVector* user_status,
|
||||
isc_stmt_handle* stmt_handle, unsigned short dialect, XSQLDA* sqlda)
|
||||
{
|
||||
if (!m_api.isc_dsql_describe)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_describe) (user_status, stmt_handle, dialect, sqlda);
|
||||
return (*m_api.isc_dsql_describe) (IscStatus(user_status), stmt_handle, dialect, sqlda);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_describe_bind(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_describe_bind(FbStatusVector* user_status,
|
||||
isc_stmt_handle* stmt_handle, unsigned short dialect, XSQLDA* sqlda)
|
||||
{
|
||||
if (!m_api.isc_dsql_describe_bind)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_describe_bind) (user_status, stmt_handle, dialect, sqlda);
|
||||
return (*m_api.isc_dsql_describe_bind) (IscStatus(user_status), stmt_handle, dialect, sqlda);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_exec_immed2(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_exec_immed2(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
unsigned short,
|
||||
@ -994,28 +1027,28 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_exec_immed2(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle, isc_stmt_handle* stmt_handle, unsigned short dialect,
|
||||
const XSQLDA* sqlda)
|
||||
{
|
||||
if (!m_api.isc_dsql_execute)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_execute) (user_status, tra_handle, stmt_handle, dialect, sqlda);
|
||||
return (*m_api.isc_dsql_execute) (IscStatus(user_status), tra_handle, stmt_handle, dialect, sqlda);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute2(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute2(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle, isc_stmt_handle* stmt_handle, unsigned short dialect,
|
||||
const XSQLDA* in_sqlda, const XSQLDA* out_sqlda)
|
||||
{
|
||||
if (!m_api.isc_dsql_execute2)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_execute2) (user_status, tra_handle, stmt_handle, dialect,
|
||||
return (*m_api.isc_dsql_execute2) (IscStatus(user_status), tra_handle, stmt_handle, dialect,
|
||||
in_sqlda, out_sqlda);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute_immediate(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute_immediate(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
unsigned short,
|
||||
@ -1026,13 +1059,13 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute_immediate(ISC_STATUS* user_s
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_fetch(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_fetch(FbStatusVector* user_status,
|
||||
isc_stmt_handle* stmt_handle, unsigned short da_version, const XSQLDA* sqlda)
|
||||
{
|
||||
if (!m_api.isc_dsql_fetch)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_fetch) (user_status, stmt_handle, da_version, sqlda);
|
||||
return (*m_api.isc_dsql_fetch) (IscStatus(user_status), stmt_handle, da_version, sqlda);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_finish(isc_db_handle *)
|
||||
@ -1040,16 +1073,16 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_finish(isc_db_handle *)
|
||||
return isc_unavailable;
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_free_statement(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_free_statement(FbStatusVector* user_status,
|
||||
isc_stmt_handle* stmt_handle, unsigned short option)
|
||||
{
|
||||
if (!m_api.isc_dsql_free_statement)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_free_statement) (user_status, stmt_handle, option);
|
||||
return (*m_api.isc_dsql_free_statement) (IscStatus(user_status), stmt_handle, option);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_insert(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_insert(FbStatusVector* user_status,
|
||||
isc_stmt_handle *,
|
||||
unsigned short,
|
||||
XSQLDA *)
|
||||
@ -1057,18 +1090,18 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_insert(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_prepare(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_prepare(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle, isc_stmt_handle* stmt_handle, unsigned short length,
|
||||
const char* str, unsigned short dialect, XSQLDA* sqlda)
|
||||
{
|
||||
if (!m_api.isc_dsql_prepare)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_prepare) (user_status, tra_handle, stmt_handle,
|
||||
return (*m_api.isc_dsql_prepare) (IscStatus(user_status), tra_handle, stmt_handle,
|
||||
length, str, dialect, sqlda);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_set_cursor_name(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_set_cursor_name(FbStatusVector* user_status,
|
||||
isc_stmt_handle *,
|
||||
const char*,
|
||||
unsigned short)
|
||||
@ -1076,14 +1109,14 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_set_cursor_name(ISC_STATUS* user_sta
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_sql_info(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_sql_info(FbStatusVector* user_status,
|
||||
isc_stmt_handle* stmt_handle, short items_len, const char* items,
|
||||
short buffer_len, char* buffer)
|
||||
{
|
||||
if (!m_api.isc_dsql_sql_info)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_dsql_sql_info) (user_status, stmt_handle, items_len, items,
|
||||
return (*m_api.isc_dsql_sql_info) (IscStatus(user_status), stmt_handle, items_len, items,
|
||||
buffer_len, buffer);
|
||||
}
|
||||
|
||||
@ -1147,7 +1180,7 @@ ISC_LONG ISC_EXPORT IscProvider::isc_free(char *)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_get_segment(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_get_segment(FbStatusVector* user_status,
|
||||
isc_blob_handle* blob_handle,
|
||||
unsigned short* length,
|
||||
unsigned short buffer_length,
|
||||
@ -1156,11 +1189,11 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_get_segment(ISC_STATUS* user_status,
|
||||
if (!m_api.isc_get_segment)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_get_segment) (user_status, blob_handle, length,
|
||||
return (*m_api.isc_get_segment) (IscStatus(user_status), blob_handle, length,
|
||||
buffer_length, buffer);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_get_slice(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_get_slice(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
ISC_QUAD *,
|
||||
@ -1176,12 +1209,12 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_get_slice(ISC_STATUS* user_status,
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_interprete(char *,
|
||||
const ISC_STATUS * *)
|
||||
const FbStatusVector * *)
|
||||
{
|
||||
return isc_unavailable;
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_open_blob(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_open_blob(FbStatusVector* user_status,
|
||||
isc_db_handle* db_handle,
|
||||
isc_tr_handle* tr_handle,
|
||||
isc_blob_handle* blob_handle,
|
||||
@ -1190,11 +1223,11 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_open_blob(ISC_STATUS* user_status,
|
||||
if (!m_api.isc_open_blob)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_open_blob) (user_status, db_handle, tr_handle,
|
||||
return (*m_api.isc_open_blob) (IscStatus(user_status), db_handle, tr_handle,
|
||||
blob_handle, blob_id);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_open_blob2(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_open_blob2(FbStatusVector* user_status,
|
||||
isc_db_handle* db_handle,
|
||||
isc_tr_handle* tr_handle,
|
||||
isc_blob_handle* blob_handle,
|
||||
@ -1205,11 +1238,11 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_open_blob2(ISC_STATUS* user_status,
|
||||
if (!m_api.isc_open_blob2)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_open_blob2) (user_status, db_handle, tr_handle,
|
||||
return (*m_api.isc_open_blob2) (IscStatus(user_status), db_handle, tr_handle,
|
||||
blob_handle, blob_id, bpb_length, bpb);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_prepare_transaction2(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_prepare_transaction2(FbStatusVector* user_status,
|
||||
isc_tr_handle *,
|
||||
ISC_USHORT,
|
||||
const ISC_UCHAR*)
|
||||
@ -1218,17 +1251,17 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_prepare_transaction2(ISC_STATUS* user_sta
|
||||
}
|
||||
|
||||
void ISC_EXPORT IscProvider::isc_print_sqlerror(ISC_SHORT,
|
||||
const ISC_STATUS*)
|
||||
const FbStatusVector*)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_print_status(const ISC_STATUS*)
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_print_status(const FbStatusVector*)
|
||||
{
|
||||
return isc_unavailable;
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_put_segment(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_put_segment(FbStatusVector* user_status,
|
||||
isc_blob_handle* blob_handle,
|
||||
unsigned short buffer_length,
|
||||
const char* buffer)
|
||||
@ -1236,11 +1269,11 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_put_segment(ISC_STATUS* user_status,
|
||||
if (!m_api.isc_put_segment)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_put_segment) (user_status, blob_handle,
|
||||
return (*m_api.isc_put_segment) (IscStatus(user_status), blob_handle,
|
||||
buffer_length, buffer);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_put_slice(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_put_slice(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
ISC_QUAD *,
|
||||
@ -1254,7 +1287,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_put_slice(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_que_events(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_que_events(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
ISC_LONG *,
|
||||
ISC_USHORT,
|
||||
@ -1265,31 +1298,31 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_que_events(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_rollback_retaining(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_rollback_retaining(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle)
|
||||
{
|
||||
if (!m_api.isc_rollback_retaining)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_rollback_retaining) (user_status, tra_handle);
|
||||
return (*m_api.isc_rollback_retaining) (IscStatus(user_status), tra_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_rollback_transaction(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_rollback_transaction(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle)
|
||||
{
|
||||
if (!m_api.isc_rollback_transaction)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_rollback_transaction) (user_status, tra_handle);
|
||||
return (*m_api.isc_rollback_transaction) (IscStatus(user_status), tra_handle);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_start_multiple(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_start_multiple(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle, short count, void* vec)
|
||||
{
|
||||
if (!m_api.isc_start_multiple)
|
||||
return notImplemented(user_status);
|
||||
|
||||
return (*m_api.isc_start_multiple) (user_status, tra_handle, count, vec);
|
||||
return (*m_api.isc_start_multiple) (IscStatus(user_status), tra_handle, count, vec);
|
||||
}
|
||||
|
||||
|
||||
@ -1300,7 +1333,7 @@ struct why_teb
|
||||
const UCHAR* teb_tpb;
|
||||
};
|
||||
|
||||
ISC_STATUS ISC_EXPORT_VARARG IscProvider::isc_start_transaction(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT_VARARG IscProvider::isc_start_transaction(FbStatusVector* user_status,
|
||||
isc_tr_handle* tra_handle,
|
||||
short count, ...)
|
||||
{
|
||||
@ -1322,10 +1355,10 @@ ISC_STATUS ISC_EXPORT_VARARG IscProvider::isc_start_transaction(ISC_STATUS* user
|
||||
}
|
||||
va_end(ptr);
|
||||
|
||||
return (*m_api.isc_start_multiple) (user_status, tra_handle, count, teb);
|
||||
return (*m_api.isc_start_multiple) (IscStatus(user_status), tra_handle, count, teb);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT_VARARG IscProvider::isc_reconnect_transaction(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT_VARARG IscProvider::isc_reconnect_transaction(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
short,
|
||||
@ -1334,7 +1367,7 @@ ISC_STATUS ISC_EXPORT_VARARG IscProvider::isc_reconnect_transaction(ISC_STATUS*
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_LONG ISC_EXPORT IscProvider::isc_sqlcode(const ISC_STATUS*)
|
||||
ISC_LONG ISC_EXPORT IscProvider::isc_sqlcode(const FbStatusVector* user_status)
|
||||
{
|
||||
return isc_unavailable;
|
||||
}
|
||||
@ -1346,7 +1379,7 @@ void ISC_EXPORT IscProvider::isc_sql_interprete(short,
|
||||
return;
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_transaction_info(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_transaction_info(FbStatusVector* user_status,
|
||||
isc_tr_handle *,
|
||||
short,
|
||||
const char*,
|
||||
@ -1356,7 +1389,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_transaction_info(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_transact_request(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_transact_request(FbStatusVector* user_status,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
unsigned short,
|
||||
@ -1379,7 +1412,7 @@ ISC_INT64 ISC_EXPORT IscProvider::isc_portable_integer(const unsigned char* p, s
|
||||
return ::isc_portable_integer(p, len);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_seek_blob(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_seek_blob(FbStatusVector* user_status,
|
||||
isc_blob_handle *,
|
||||
short,
|
||||
ISC_LONG,
|
||||
@ -1388,7 +1421,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_seek_blob(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_service_attach(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_service_attach(FbStatusVector* user_status,
|
||||
unsigned short,
|
||||
const char*,
|
||||
isc_svc_handle *,
|
||||
@ -1398,13 +1431,13 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_service_attach(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_service_detach(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_service_detach(FbStatusVector* user_status,
|
||||
isc_svc_handle *)
|
||||
{
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_service_query(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_service_query(FbStatusVector* user_status,
|
||||
isc_svc_handle *,
|
||||
isc_resv_handle *,
|
||||
unsigned short,
|
||||
@ -1417,7 +1450,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_service_query(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_service_start(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::isc_service_start(FbStatusVector* user_status,
|
||||
isc_svc_handle *,
|
||||
isc_resv_handle *,
|
||||
unsigned short,
|
||||
@ -1426,19 +1459,19 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_service_start(ISC_STATUS* user_status,
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
ISC_STATUS ISC_EXPORT IscProvider::fb_cancel_operation(ISC_STATUS* user_status,
|
||||
ISC_STATUS ISC_EXPORT IscProvider::fb_cancel_operation(FbStatusVector* user_status,
|
||||
isc_db_handle* db_handle,
|
||||
USHORT option)
|
||||
{
|
||||
if (m_api.fb_cancel_operation)
|
||||
return m_api.fb_cancel_operation(user_status, db_handle, option);
|
||||
return m_api.fb_cancel_operation(IscStatus(user_status), db_handle, option);
|
||||
|
||||
return notImplemented(user_status);
|
||||
}
|
||||
|
||||
void IscProvider::loadAPI()
|
||||
{
|
||||
ISC_STATUS_ARRAY status;
|
||||
FbLocalStatus status;
|
||||
notImplemented(status);
|
||||
status_exception::raise(status);
|
||||
}
|
||||
@ -1538,9 +1571,9 @@ void FBProvider::loadAPI()
|
||||
}
|
||||
|
||||
|
||||
static bool isConnectionBrokenError(ISC_STATUS status)
|
||||
static bool isConnectionBrokenError(FbStatusVector* status)
|
||||
{
|
||||
switch (status)
|
||||
switch (status->getErrors()[1])
|
||||
{
|
||||
case isc_att_shutdown:
|
||||
case isc_network_error:
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "ExtDS.h"
|
||||
#include "fb_api_proto.h"
|
||||
#include "../jrd/status.h"
|
||||
|
||||
|
||||
namespace EDS {
|
||||
@ -49,10 +50,10 @@ public:
|
||||
}
|
||||
|
||||
virtual void jrdAttachmentEnd(Jrd::thread_db* /*tdbb*/, Jrd::Attachment* /*att*/) {}
|
||||
virtual void getRemoteError(const ISC_STATUS* status, Firebird::string& err) const;
|
||||
virtual void getRemoteError(const Jrd::FbStatusVector* status, Firebird::string& err) const;
|
||||
|
||||
protected:
|
||||
ISC_STATUS notImplemented(ISC_STATUS*) const;
|
||||
ISC_STATUS notImplemented(Jrd::FbStatusVector*) const;
|
||||
virtual void loadAPI();
|
||||
virtual Connection* doCreateConnection();
|
||||
|
||||
@ -60,20 +61,20 @@ protected:
|
||||
bool m_api_loaded;
|
||||
|
||||
public:
|
||||
virtual ISC_STATUS ISC_EXPORT isc_attach_database(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_attach_database(Jrd::FbStatusVector *,
|
||||
short,
|
||||
const char*,
|
||||
isc_db_handle *,
|
||||
short,
|
||||
const char*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_gen_sdl(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_gen_sdl(Jrd::FbStatusVector *,
|
||||
const ISC_ARRAY_DESC*,
|
||||
short *,
|
||||
char *,
|
||||
short *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_get_slice(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_get_slice(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
ISC_QUAD *,
|
||||
@ -81,21 +82,21 @@ public:
|
||||
void *,
|
||||
ISC_LONG *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_lookup_bounds(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_lookup_bounds(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
const char*,
|
||||
const char*,
|
||||
ISC_ARRAY_DESC *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_lookup_desc(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_lookup_desc(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
const char*,
|
||||
const char*,
|
||||
ISC_ARRAY_DESC *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_set_desc(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_set_desc(Jrd::FbStatusVector *,
|
||||
const char*,
|
||||
const char*,
|
||||
const short*,
|
||||
@ -103,7 +104,7 @@ public:
|
||||
const short*,
|
||||
ISC_ARRAY_DESC *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_put_slice(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_array_put_slice(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
ISC_QUAD *,
|
||||
@ -115,21 +116,21 @@ public:
|
||||
const unsigned char*,
|
||||
const unsigned char*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_blob_gen_bpb(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_blob_gen_bpb(Jrd::FbStatusVector *,
|
||||
const ISC_BLOB_DESC*,
|
||||
const ISC_BLOB_DESC*,
|
||||
unsigned short,
|
||||
unsigned char *,
|
||||
unsigned short *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_blob_info(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_blob_info(Jrd::FbStatusVector *,
|
||||
isc_blob_handle *,
|
||||
short,
|
||||
const char*,
|
||||
short,
|
||||
char *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_blob_lookup_desc(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_blob_lookup_desc(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
const unsigned char*,
|
||||
@ -137,7 +138,7 @@ public:
|
||||
ISC_BLOB_DESC *,
|
||||
unsigned char *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_blob_set_desc(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_blob_set_desc(Jrd::FbStatusVector *,
|
||||
const unsigned char*,
|
||||
const unsigned char*,
|
||||
short,
|
||||
@ -145,29 +146,29 @@ public:
|
||||
short,
|
||||
ISC_BLOB_DESC *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_cancel_blob(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_cancel_blob(Jrd::FbStatusVector *,
|
||||
isc_blob_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_cancel_events(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_cancel_events(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
ISC_LONG *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_close_blob(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_close_blob(Jrd::FbStatusVector *,
|
||||
isc_blob_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_commit_retaining(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_commit_retaining(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_commit_transaction(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_commit_transaction(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_create_blob(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_create_blob(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
isc_blob_handle *,
|
||||
ISC_QUAD *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_create_blob2(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_create_blob2(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
isc_blob_handle *,
|
||||
@ -175,7 +176,7 @@ public:
|
||||
short,
|
||||
const char*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_create_database(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_create_database(Jrd::FbStatusVector *,
|
||||
short,
|
||||
const char*,
|
||||
isc_db_handle *,
|
||||
@ -183,7 +184,7 @@ public:
|
||||
const char*,
|
||||
short);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_database_info(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_database_info(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
short,
|
||||
const char*,
|
||||
@ -202,31 +203,31 @@ public:
|
||||
virtual void ISC_EXPORT isc_decode_timestamp(const ISC_TIMESTAMP*,
|
||||
void *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_detach_database(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_detach_database(Jrd::FbStatusVector *,
|
||||
isc_db_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_drop_database(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_drop_database(Jrd::FbStatusVector *,
|
||||
isc_db_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_allocate_statement(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_allocate_statement(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_stmt_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_alloc_statement2(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_alloc_statement2(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_stmt_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_describe(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_describe(Jrd::FbStatusVector *,
|
||||
isc_stmt_handle *,
|
||||
unsigned short,
|
||||
XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_describe_bind(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_describe_bind(Jrd::FbStatusVector *,
|
||||
isc_stmt_handle *,
|
||||
unsigned short,
|
||||
XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_exec_immed2(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_exec_immed2(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
unsigned short,
|
||||
@ -235,20 +236,20 @@ public:
|
||||
const XSQLDA *,
|
||||
const XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *,
|
||||
isc_stmt_handle *,
|
||||
unsigned short,
|
||||
const XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute2(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute2(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *,
|
||||
isc_stmt_handle *,
|
||||
unsigned short,
|
||||
const XSQLDA *,
|
||||
const XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
unsigned short,
|
||||
@ -256,23 +257,23 @@ public:
|
||||
unsigned short,
|
||||
const XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_fetch(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_fetch(Jrd::FbStatusVector *,
|
||||
isc_stmt_handle *,
|
||||
unsigned short,
|
||||
const XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_finish(isc_db_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_free_statement(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_free_statement(Jrd::FbStatusVector *,
|
||||
isc_stmt_handle *,
|
||||
unsigned short);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_insert(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_insert(Jrd::FbStatusVector *,
|
||||
isc_stmt_handle *,
|
||||
unsigned short,
|
||||
XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_prepare(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_prepare(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *,
|
||||
isc_stmt_handle *,
|
||||
unsigned short,
|
||||
@ -280,12 +281,12 @@ public:
|
||||
unsigned short,
|
||||
XSQLDA *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_set_cursor_name(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_set_cursor_name(Jrd::FbStatusVector *,
|
||||
isc_stmt_handle *,
|
||||
const char*,
|
||||
unsigned short);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_sql_info(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_dsql_sql_info(Jrd::FbStatusVector *,
|
||||
isc_stmt_handle *,
|
||||
short,
|
||||
const char*,
|
||||
@ -325,13 +326,13 @@ public:
|
||||
|
||||
virtual ISC_LONG ISC_EXPORT isc_free(char *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_get_segment(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_get_segment(Jrd::FbStatusVector *,
|
||||
isc_blob_handle *,
|
||||
unsigned short *,
|
||||
unsigned short,
|
||||
char *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_get_slice(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_get_slice(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
ISC_QUAD *,
|
||||
@ -344,15 +345,15 @@ public:
|
||||
ISC_LONG *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_interprete(char *,
|
||||
const ISC_STATUS * *);
|
||||
const Jrd::FbStatusVector * *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_open_blob(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_open_blob(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
isc_blob_handle *,
|
||||
ISC_QUAD *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_open_blob2(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_open_blob2(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
isc_blob_handle *,
|
||||
@ -360,22 +361,22 @@ public:
|
||||
ISC_USHORT,
|
||||
const ISC_UCHAR*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_prepare_transaction2(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_prepare_transaction2(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *,
|
||||
ISC_USHORT,
|
||||
const ISC_UCHAR*);
|
||||
|
||||
virtual void ISC_EXPORT isc_print_sqlerror(ISC_SHORT,
|
||||
const ISC_STATUS*);
|
||||
const Jrd::FbStatusVector*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_print_status(const ISC_STATUS*);
|
||||
virtual ISC_STATUS ISC_EXPORT isc_print_status(const Jrd::FbStatusVector*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_put_segment(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_put_segment(Jrd::FbStatusVector *,
|
||||
isc_blob_handle *,
|
||||
unsigned short,
|
||||
const char*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_put_slice(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_put_slice(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
ISC_QUAD *,
|
||||
@ -386,7 +387,7 @@ public:
|
||||
ISC_LONG,
|
||||
void *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_que_events(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_que_events(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
ISC_LONG *,
|
||||
ISC_USHORT,
|
||||
@ -394,41 +395,41 @@ public:
|
||||
isc_callback,
|
||||
void *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_rollback_retaining(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_rollback_retaining(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_rollback_transaction(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_rollback_transaction(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_start_multiple(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_start_multiple(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *,
|
||||
short,
|
||||
void *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT_VARARG isc_start_transaction(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT_VARARG isc_start_transaction(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *,
|
||||
short, ...);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT_VARARG isc_reconnect_transaction(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT_VARARG isc_reconnect_transaction(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
short,
|
||||
const char*);
|
||||
|
||||
virtual ISC_LONG ISC_EXPORT isc_sqlcode(const ISC_STATUS*);
|
||||
virtual ISC_LONG ISC_EXPORT isc_sqlcode(const Jrd::FbStatusVector*);
|
||||
|
||||
virtual void ISC_EXPORT isc_sql_interprete(short,
|
||||
char *,
|
||||
short);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_transaction_info(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_transaction_info(Jrd::FbStatusVector *,
|
||||
isc_tr_handle *,
|
||||
short,
|
||||
const char*,
|
||||
short,
|
||||
char *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_transact_request(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_transact_request(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
isc_tr_handle *,
|
||||
unsigned short,
|
||||
@ -444,7 +445,7 @@ public:
|
||||
virtual ISC_INT64 ISC_EXPORT isc_portable_integer(const unsigned char*,
|
||||
short);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_seek_blob(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_seek_blob(Jrd::FbStatusVector *,
|
||||
isc_blob_handle *,
|
||||
short,
|
||||
ISC_LONG,
|
||||
@ -452,17 +453,17 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_service_attach(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_service_attach(Jrd::FbStatusVector *,
|
||||
unsigned short,
|
||||
const char*,
|
||||
isc_svc_handle *,
|
||||
unsigned short,
|
||||
const char*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_service_detach(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_service_detach(Jrd::FbStatusVector *,
|
||||
isc_svc_handle *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_service_query(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_service_query(Jrd::FbStatusVector *,
|
||||
isc_svc_handle *,
|
||||
isc_resv_handle *,
|
||||
unsigned short,
|
||||
@ -472,13 +473,13 @@ public:
|
||||
unsigned short,
|
||||
char *);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT isc_service_start(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT isc_service_start(Jrd::FbStatusVector *,
|
||||
isc_svc_handle *,
|
||||
isc_resv_handle *,
|
||||
unsigned short,
|
||||
const char*);
|
||||
|
||||
virtual ISC_STATUS ISC_EXPORT fb_cancel_operation(ISC_STATUS *,
|
||||
virtual ISC_STATUS ISC_EXPORT fb_cancel_operation(Jrd::FbStatusVector *,
|
||||
isc_db_handle *,
|
||||
USHORT);
|
||||
};
|
||||
@ -548,10 +549,10 @@ protected:
|
||||
|
||||
virtual ~IscTransaction() {}
|
||||
|
||||
virtual void doStart(ISC_STATUS* status, Jrd::thread_db* tdbb, Firebird::ClumpletWriter& tpb);
|
||||
virtual void doPrepare(ISC_STATUS* status, Jrd::thread_db* tdbb, int info_len, const char* info);
|
||||
virtual void doCommit(ISC_STATUS* status, Jrd::thread_db* tdbb, bool retain);
|
||||
virtual void doRollback(ISC_STATUS* status, Jrd::thread_db* tdbb, bool retain);
|
||||
virtual void doStart(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, Firebird::ClumpletWriter& tpb);
|
||||
virtual void doPrepare(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, int info_len, const char* info);
|
||||
virtual void doCommit(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, bool retain);
|
||||
virtual void doRollback(Jrd::FbStatusVector* status, Jrd::thread_db* tdbb, bool retain);
|
||||
|
||||
IscProvider& m_iscProvider;
|
||||
IscConnection& m_iscConnection;
|
||||
|
@ -713,7 +713,8 @@ void FUN_evaluate(thread_db* tdbb, const Function* function, const NestValueArra
|
||||
|
||||
invoke(tdbb, function, return_ptr, value, args, return_blob_struct, result_was_null, udfError);
|
||||
|
||||
if (tempStatus[0] == isc_arg_gds && tempStatus[1] != FB_SUCCESS)
|
||||
const ISC_STATUS* status = tdbb->tdbb_status_vector->getErrors();
|
||||
if (status[0] == isc_arg_gds && status[1] != FB_SUCCESS)
|
||||
ERR_post(Arg::StatusVector(tempStatus));
|
||||
}
|
||||
|
||||
|
@ -1043,7 +1043,7 @@ static idx_e check_duplicates(thread_db* tdbb,
|
||||
Firebird::HalfStaticArray<UCHAR, 256> tmp;
|
||||
RecordBitmap::Accessor accessor(insertion->iib_duplicates);
|
||||
|
||||
fb_assert(tdbb->tdbb_status_vector[1] == 0);
|
||||
fb_assert(!(tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_ERRORS));
|
||||
|
||||
if (accessor.getFirst())
|
||||
do {
|
||||
|
@ -1012,9 +1012,9 @@ static void handle_error(Firebird::CheckStatusWrapper*, ISC_STATUS);
|
||||
namespace {
|
||||
enum VdnResult {VDN_FAIL, VDN_OK/*, VDN_SECURITY*/};
|
||||
}
|
||||
static VdnResult verifyDatabaseName(const PathName&, ISC_STATUS*, bool);
|
||||
static VdnResult verifyDatabaseName(const PathName&, FbStatusVector*, bool);
|
||||
|
||||
static void unwindAttach(thread_db* tdbb, const Exception& ex, Firebird::IStatus* userStatus,
|
||||
static void unwindAttach(thread_db* tdbb, const Exception& ex, FbStatusVector* userStatus,
|
||||
Jrd::Attachment* attachment, Database* dbb, unsigned internalFlags);
|
||||
static JAttachment* initAttachment(thread_db*, const PathName&, const PathName&, RefPtr<Config>, bool,
|
||||
const DatabaseOptions&, RefMutexUnlock&, IPluginConfig*);
|
||||
@ -1131,16 +1131,16 @@ static void makeRoleName(Database* dbb, string& userIdRole, DatabaseOptions& opt
|
||||
|
||||
|
||||
// Stuff exception transliterated to the client charset.
|
||||
ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, IStatus* vector,
|
||||
ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, FbStatusVector* vector,
|
||||
const char* func) throw()
|
||||
{
|
||||
ex.stuffException(vector);
|
||||
ex.stuff_exception(vector);
|
||||
|
||||
Jrd::Attachment* attachment = tdbb->getAttachment();
|
||||
if (func && attachment && attachment->att_trace_manager->needs(ITraceFactory::TRACE_EVENT_ERROR))
|
||||
{
|
||||
TraceConnectionImpl conn(attachment);
|
||||
TraceStatusVectorImpl traceStatus(vector->getErrors());
|
||||
TraceStatusVectorImpl traceStatus(vector, TraceStatusVectorImpl::TS_ERRORS);
|
||||
|
||||
attachment->att_trace_manager->event_error(&conn, &traceStatus, func);
|
||||
}
|
||||
@ -1156,7 +1156,7 @@ ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, IStatus*
|
||||
const ISC_STATUS* const vectorStart = vector->getErrors();
|
||||
const ISC_STATUS* status = vectorStart;
|
||||
SimpleStatusVector<> newVector;
|
||||
Array<UCHAR*> buffers;
|
||||
ObjectsArray<UCharBuffer> buffers;
|
||||
|
||||
try
|
||||
{
|
||||
@ -1180,8 +1180,8 @@ ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, IStatus*
|
||||
|
||||
try
|
||||
{
|
||||
UCHAR* p = new UCHAR[len + 1];
|
||||
buffers.add(p);
|
||||
UCharBuffer& b(buffers.add());
|
||||
UCHAR* p = b.getBuffer(len + 1);
|
||||
len = INTL_convert_bytes(tdbb, charSet, p, len, CS_METADATA, str, len, ERR_post);
|
||||
p[len] = '\0';
|
||||
str = p;
|
||||
@ -1202,8 +1202,8 @@ ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, IStatus*
|
||||
|
||||
try
|
||||
{
|
||||
UCHAR* p = new UCHAR[len + 1];
|
||||
buffers.add(p);
|
||||
UCharBuffer& b(buffers.add());
|
||||
UCHAR* p = b.getBuffer(len + 1);
|
||||
len = INTL_convert_bytes(tdbb, charSet, p, len, CS_METADATA, str, len, ERR_post);
|
||||
p[len] = '\0';
|
||||
str = p;
|
||||
@ -1228,9 +1228,6 @@ ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, IStatus*
|
||||
|
||||
vector->setErrors2(newVector.getCount() - 1, newVector.begin());
|
||||
|
||||
for (Array<UCHAR*>::iterator i = buffers.begin(); i != buffers.end(); ++i)
|
||||
delete [] *i;
|
||||
|
||||
return vectorStart[1];
|
||||
}
|
||||
|
||||
@ -1241,7 +1238,7 @@ const char DBL_QUOTE = '\042';
|
||||
const char SINGLE_QUOTE = '\'';
|
||||
|
||||
|
||||
static void trace_warning(thread_db* tdbb, IStatus* userStatus, const char* func)
|
||||
static void trace_warning(thread_db* tdbb, FbStatusVector* userStatus, const char* func)
|
||||
{
|
||||
Jrd::Attachment* att = tdbb->getAttachment();
|
||||
if (!att)
|
||||
@ -1249,7 +1246,7 @@ static void trace_warning(thread_db* tdbb, IStatus* userStatus, const char* func
|
||||
|
||||
if (att->att_trace_manager->needs(ITraceFactory::TRACE_EVENT_ERROR))
|
||||
{
|
||||
TraceStatusVectorImpl traceStatus(userStatus->getWarnings());
|
||||
TraceStatusVectorImpl traceStatus(userStatus, TraceStatusVectorImpl::TS_WARNINGS);
|
||||
|
||||
if (traceStatus.hasWarning())
|
||||
{
|
||||
@ -1261,7 +1258,7 @@ static void trace_warning(thread_db* tdbb, IStatus* userStatus, const char* func
|
||||
|
||||
|
||||
static void trace_failed_attach(TraceManager* traceManager, const char* filename,
|
||||
const DatabaseOptions& options, bool create, const ISC_STATUS* status)
|
||||
const DatabaseOptions& options, bool create, FbStatusVector* status)
|
||||
{
|
||||
// Report to Trace API that attachment has not been created
|
||||
const char* origFilename = filename;
|
||||
@ -1269,9 +1266,10 @@ static void trace_failed_attach(TraceManager* traceManager, const char* filename
|
||||
origFilename = options.dpb_org_filename.c_str();
|
||||
|
||||
TraceFailedConnection conn(origFilename, &options);
|
||||
TraceStatusVectorImpl traceStatus(status);
|
||||
TraceStatusVectorImpl traceStatus(status, TraceStatusVectorImpl::TS_ERRORS);
|
||||
|
||||
const ntrace_result_t result = (status[1] == isc_login || status[1] == isc_no_priv) ?
|
||||
ISC_STATUS s = status->getErrors()[1];
|
||||
const ntrace_result_t result = (s == isc_login || s == isc_no_priv) ?
|
||||
ITracePlugin::RESULT_UNAUTHORIZED : ITracePlugin::RESULT_FAILED;
|
||||
const char* func = create ? "JProvider::createDatabase" : "JProvider::attachDatabase";
|
||||
|
||||
@ -1464,7 +1462,7 @@ JAttachment* JProvider::internalAttach(CheckStatusWrapper* user_status, const ch
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
trace_failed_attach(NULL, filename, options, false, user_status->getErrors());
|
||||
trace_failed_attach(NULL, filename, options, false, user_status);
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -1919,7 +1917,7 @@ JAttachment* JProvider::internalAttach(CheckStatusWrapper* user_status, const ch
|
||||
{
|
||||
TraceManager* traceManager = attachment->att_trace_manager;
|
||||
TraceConnectionImpl conn(attachment);
|
||||
TraceStatusVectorImpl traceStatus(user_status->getErrors());
|
||||
TraceStatusVectorImpl traceStatus(user_status, TraceStatusVectorImpl::TS_ERRORS);
|
||||
|
||||
if (traceManager->needs(ITraceFactory::TRACE_EVENT_ERROR))
|
||||
traceManager->event_error(&conn, &traceStatus, "JProvider::attachDatabase");
|
||||
@ -1930,7 +1928,7 @@ JAttachment* JProvider::internalAttach(CheckStatusWrapper* user_status, const ch
|
||||
else
|
||||
{
|
||||
trace_failed_attach(attachment ? attachment->att_trace_manager : NULL,
|
||||
filename, options, false, user_status->getErrors());
|
||||
filename, options, false, user_status);
|
||||
}
|
||||
|
||||
unwindAttach(tdbb, ex, user_status, attachment, dbb, internal_flags);
|
||||
@ -2492,7 +2490,7 @@ JAttachment* JProvider::createDatabase(CheckStatusWrapper* user_status, const ch
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
trace_failed_attach(NULL, filename, options, true, user_status->getErrors());
|
||||
trace_failed_attach(NULL, filename, options, true, user_status);
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -2783,7 +2781,7 @@ JAttachment* JProvider::createDatabase(CheckStatusWrapper* user_status, const ch
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
trace_failed_attach(attachment ? attachment->att_trace_manager : NULL,
|
||||
filename, options, true, user_status->getErrors());
|
||||
filename, options, true, user_status);
|
||||
|
||||
unwindAttach(tdbb, ex, user_status, attachment, dbb, 0);
|
||||
}
|
||||
@ -3879,12 +3877,10 @@ void JService::query(CheckStatusWrapper* user_status,
|
||||
receiveItems, bufferLength, buffer);
|
||||
|
||||
// If there is a status vector from a service thread, copy it into the thread status
|
||||
FB_SIZE_T len, warning;
|
||||
PARSE_STATUS(svc->getStatus(), len, warning);
|
||||
|
||||
if (len)
|
||||
const FbStatusVector* from = svc->getStatus();
|
||||
if (from->getState())
|
||||
{
|
||||
fb_utils::setIStatus(user_status, svc->getStatus());
|
||||
fb_utils::copyStatus(user_status, from);
|
||||
// Empty out the service status vector
|
||||
svc->initStatus();
|
||||
return;
|
||||
@ -3926,9 +3922,9 @@ void JService::start(CheckStatusWrapper* user_status, unsigned int spbLength, co
|
||||
|
||||
svc->start(spbLength, spb);
|
||||
|
||||
if (svc->getStatus()[1])
|
||||
if (svc->getStatus()->getState() & CheckStatusWrapper::STATE_ERRORS)
|
||||
{
|
||||
fb_utils::setIStatus(user_status, svc->getStatus());
|
||||
fb_utils::copyStatus(user_status, svc->getStatus());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -5519,9 +5515,7 @@ static bool drop_files(const jrd_file* file)
|
||||
* drop a linked list of files
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS_ARRAY status;
|
||||
|
||||
status[1] = FB_SUCCESS;
|
||||
FbLocalStatus status;
|
||||
|
||||
for (; file; file = file->fil_next)
|
||||
{
|
||||
@ -5532,11 +5526,11 @@ static bool drop_files(const jrd_file* file)
|
||||
Arg::Gds(isc_io_delete_err) << SYS_ERR(errno));
|
||||
Database* dbb = GET_DBB();
|
||||
PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
|
||||
gds__log_status(pageSpace->file->fil_string, status);
|
||||
iscDbLogStatus(pageSpace->file->fil_string, status);
|
||||
}
|
||||
}
|
||||
|
||||
return status[1] ? true : false;
|
||||
return status->getState() & FbStatusVector::STATE_ERRORS ? true : false;
|
||||
}
|
||||
|
||||
|
||||
@ -6508,7 +6502,7 @@ static void setEngineReleaseDelay(Database* dbb)
|
||||
|
||||
++maxLinger; // avoid rounding errors
|
||||
time_t t = time(NULL);
|
||||
LocalStatus s;
|
||||
FbLocalStatus s;
|
||||
dbb->dbb_plugin_config->setReleaseDelay(&s, maxLinger > t ? (maxLinger - t) * 1000 * 1000 : 0);
|
||||
check(&s);
|
||||
}
|
||||
@ -7109,7 +7103,7 @@ static jrd_req* verify_request_synchronization(JrdStatement* statement, USHORT l
|
||||
@param status
|
||||
|
||||
**/
|
||||
static VdnResult verifyDatabaseName(const PathName& name, ISC_STATUS* status, bool is_alias)
|
||||
static VdnResult verifyDatabaseName(const PathName& name, FbStatusVector* status, bool is_alias)
|
||||
{
|
||||
// Check for securityX.fdb
|
||||
static GlobalPtr<PathName> securityNameBuffer, expandedSecurityNameBuffer;
|
||||
@ -7251,7 +7245,7 @@ static void getUserInfo(UserId& user, const DatabaseOptions& options,
|
||||
}
|
||||
}
|
||||
|
||||
static void unwindAttach(thread_db* tdbb, const Exception& ex, IStatus* userStatus,
|
||||
static void unwindAttach(thread_db* tdbb, const Exception& ex, FbStatusVector* userStatus,
|
||||
Jrd::Attachment* attachment, Database* dbb, unsigned internalFlags)
|
||||
{
|
||||
RefDeb(DEB_RLS_JATT, "unwindAttach");
|
||||
@ -7836,9 +7830,9 @@ static void start_transaction(thread_db* tdbb, bool transliterate, jrd_tra** tra
|
||||
{
|
||||
if (transliterate)
|
||||
{
|
||||
LocalStatus tempStatus;
|
||||
transliterateException(tdbb, ex, &tempStatus, "startTransaction");
|
||||
status_exception::raise(&tempStatus);
|
||||
FbLocalStatus tempStatus;
|
||||
transliterateException(tdbb, ex, tempStatus, "startTransaction");
|
||||
status_exception::raise(tempStatus);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "../jrd/jrd_proto.h"
|
||||
#include "../jrd/obj.h"
|
||||
#include "../jrd/val.h"
|
||||
#include "../jrd/status.h"
|
||||
|
||||
#include "../common/classes/fb_atomic.h"
|
||||
#include "../common/classes/fb_string.h"
|
||||
@ -351,7 +352,7 @@ private:
|
||||
thread_db *priorThread, *nextThread;
|
||||
|
||||
public:
|
||||
explicit thread_db(ISC_STATUS* status)
|
||||
explicit thread_db(FbStatusVector* status)
|
||||
: ThreadData(ThreadData::tddDBB),
|
||||
defaultPool(NULL),
|
||||
database(NULL),
|
||||
@ -383,7 +384,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
ISC_STATUS* tdbb_status_vector;
|
||||
FbStatusVector* tdbb_status_vector;
|
||||
SSHORT tdbb_quantum; // Cycles remaining until voluntary schedule
|
||||
USHORT tdbb_flags;
|
||||
|
||||
@ -585,39 +586,27 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ThreadContextHolder
|
||||
{
|
||||
public:
|
||||
explicit ThreadContextHolder(ISC_STATUS* status = NULL)
|
||||
: context(status ? status : local_status), externStatus(NULL)
|
||||
explicit ThreadContextHolder(Firebird::CheckStatusWrapper* status = NULL)
|
||||
: currentStatus(status ? status : localStatus), context(currentStatus)
|
||||
{
|
||||
context.putSpecific();
|
||||
currentStatus->init();
|
||||
}
|
||||
|
||||
explicit ThreadContextHolder(Firebird::CheckStatusWrapper* status)
|
||||
: context(local_status), externStatus(status)
|
||||
{
|
||||
context.putSpecific();
|
||||
externStatus->init();
|
||||
}
|
||||
|
||||
ThreadContextHolder(Database* dbb, Jrd::Attachment* att, ISC_STATUS* status = NULL)
|
||||
: context(status ? status : local_status), externStatus(NULL)
|
||||
ThreadContextHolder(Database* dbb, Jrd::Attachment* att, FbStatusVector* status = NULL)
|
||||
: currentStatus(status ? status : localStatus), context(currentStatus)
|
||||
{
|
||||
context.putSpecific();
|
||||
context.setDatabase(dbb);
|
||||
context.setAttachment(att);
|
||||
currentStatus->init();
|
||||
}
|
||||
|
||||
~ThreadContextHolder()
|
||||
{
|
||||
unsigned l = fb_utils::statusLength(context.tdbb_status_vector);
|
||||
if (externStatus && (!(externStatus->getState() & Firebird::IStatus::STATE_ERRORS)) &&
|
||||
(l > 2 || context.tdbb_status_vector[1]))
|
||||
{
|
||||
fb_utils::setIStatus(externStatus, context.tdbb_status_vector);
|
||||
}
|
||||
Firebird::ThreadData::restoreSpecific();
|
||||
}
|
||||
|
||||
@ -636,9 +625,9 @@ private:
|
||||
ThreadContextHolder(const ThreadContextHolder&);
|
||||
ThreadContextHolder& operator= (const ThreadContextHolder&);
|
||||
|
||||
ISC_STATUS_ARRAY local_status;
|
||||
FbLocalStatus localStatus;
|
||||
FbStatusVector* currentStatus;
|
||||
thread_db context;
|
||||
Firebird::IStatus* externStatus;
|
||||
};
|
||||
|
||||
|
||||
@ -650,7 +639,6 @@ public:
|
||||
explicit ThreadStatusGuard(thread_db* tdbb)
|
||||
: m_tdbb(tdbb), m_old_status(tdbb->tdbb_status_vector)
|
||||
{
|
||||
fb_utils::init_status(m_local_status);
|
||||
m_tdbb->tdbb_status_vector = m_local_status;
|
||||
}
|
||||
|
||||
@ -659,23 +647,27 @@ public:
|
||||
m_tdbb->tdbb_status_vector = m_old_status;
|
||||
}
|
||||
|
||||
ISC_STATUS* restore()
|
||||
FbStatusVector* restore()
|
||||
{
|
||||
m_tdbb->tdbb_status_vector = m_old_status;
|
||||
return m_old_status;
|
||||
}
|
||||
|
||||
operator ISC_STATUS*() { return m_local_status; }
|
||||
operator FbStatusVector*() { return m_local_status; }
|
||||
FbStatusVector* operator->() { return m_local_status; }
|
||||
|
||||
operator const FbStatusVector*() const { return m_local_status; }
|
||||
const FbStatusVector* operator->() const { return m_local_status; }
|
||||
|
||||
void copyToOriginal()
|
||||
{
|
||||
memcpy(m_old_status, m_local_status, sizeof(ISC_STATUS_ARRAY));
|
||||
fb_utils::copyStatus(m_old_status, m_local_status);
|
||||
}
|
||||
|
||||
private:
|
||||
FbLocalStatus m_local_status;
|
||||
thread_db* const m_tdbb;
|
||||
ISC_STATUS* const m_old_status;
|
||||
ISC_STATUS_ARRAY m_local_status;
|
||||
FbStatusVector* const m_old_status;
|
||||
|
||||
// copying is prohibited
|
||||
ThreadStatusGuard(const ThreadStatusGuard&);
|
||||
@ -842,7 +834,7 @@ namespace Jrd {
|
||||
public Jrd::Attachment::SyncGuard
|
||||
{
|
||||
public:
|
||||
BackgroundContextHolder(Database* dbb, Jrd::Attachment* att, ISC_STATUS* status, const char* f)
|
||||
BackgroundContextHolder(Database* dbb, Jrd::Attachment* att, FbStatusVector* status, const char* f)
|
||||
: ThreadContextHolder(dbb, att, status),
|
||||
DatabaseContextHolder(operator thread_db*()),
|
||||
Jrd::Attachment::SyncGuard(att, f)
|
||||
|
@ -359,7 +359,7 @@ ULONG BackupManager::getPageCount()
|
||||
{
|
||||
temp_bdb.bdb_buffer = buf;
|
||||
temp_bdb.bdb_page = pageNum;
|
||||
ISC_STATUS_ARRAY status;
|
||||
FbLocalStatus status;
|
||||
// It's PIP - therefore no need to try to decrypt
|
||||
if (!PIO_read(pageSpace->file, &temp_bdb, temp_bdb.bdb_buffer, status))
|
||||
{
|
||||
@ -625,7 +625,7 @@ bool BackupManager::actualizeAlloc(thread_db* tdbb, bool haveGlobalLock)
|
||||
// to difference file pages.
|
||||
const size_t PAGES_PER_ALLOC_PAGE = database->dbb_page_size / sizeof(ULONG) - 1;
|
||||
|
||||
ISC_STATUS *status_vector = tdbb->tdbb_status_vector;
|
||||
FbStatusVector *status_vector = tdbb->tdbb_status_vector;
|
||||
try {
|
||||
NBAK_TRACE(("actualize_alloc last_allocated_page=%d alloc_table=%p",
|
||||
last_allocated_page, alloc_table));
|
||||
@ -737,7 +737,7 @@ ULONG BackupManager::allocateDifferencePage(thread_db* tdbb, ULONG db_page)
|
||||
NBAK_TRACE(("allocate_difference_page"));
|
||||
fb_assert(last_allocated_page % (database->dbb_page_size / sizeof(ULONG)) == alloc_buffer[0]);
|
||||
|
||||
ISC_STATUS* status_vector = tdbb->tdbb_status_vector;
|
||||
FbStatusVector* status_vector = tdbb->tdbb_status_vector;
|
||||
// Grow file first. This is done in such order to keep difference
|
||||
// file consistent in case of write error. We should always be able
|
||||
// to read next alloc page when previous one is full.
|
||||
@ -792,7 +792,7 @@ ULONG BackupManager::allocateDifferencePage(thread_db* tdbb, ULONG db_page)
|
||||
return last_allocated_page;
|
||||
}
|
||||
|
||||
bool BackupManager::writeDifference(ISC_STATUS* status, ULONG diff_page, Ods::pag* page)
|
||||
bool BackupManager::writeDifference(FbStatusVector* status, ULONG diff_page, Ods::pag* page)
|
||||
{
|
||||
if (!diff_page)
|
||||
{
|
||||
@ -911,7 +911,7 @@ bool BackupManager::actualizeState(thread_db* tdbb)
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
ISC_STATUS *status = tdbb->tdbb_status_vector;
|
||||
FbStatusVector *status = tdbb->tdbb_status_vector;
|
||||
|
||||
// Read original page from database file or shadows.
|
||||
SSHORT retryCount = 0;
|
||||
|
@ -417,10 +417,10 @@ public:
|
||||
// Return next page index in the difference file to be allocated
|
||||
ULONG allocateDifferencePage(thread_db* tdbb, ULONG db_page);
|
||||
|
||||
// Must have ISC_STATUS because it is called from write_page
|
||||
// Must have FbStatusVector because it is called from write_page
|
||||
void openDelta();
|
||||
void closeDelta();
|
||||
bool writeDifference(ISC_STATUS* status, ULONG diff_page, Ods::pag* page);
|
||||
bool writeDifference(FbStatusVector* status, ULONG diff_page, Ods::pag* page);
|
||||
bool readDifference(thread_db* tdbb, ULONG diff_page, Ods::pag* page);
|
||||
void flushDifference();
|
||||
void setForcedWrites(const bool forceWrite, const bool notUseFSCache);
|
||||
|
@ -46,22 +46,22 @@ void PIO_flush(Jrd::Database*, Jrd::jrd_file*);
|
||||
void PIO_force_write(Jrd::jrd_file*, const bool, const bool);
|
||||
ULONG PIO_get_number_of_pages(const Jrd::jrd_file*, const USHORT);
|
||||
void PIO_header(Jrd::Database*, SCHAR*, int);
|
||||
USHORT PIO_init_data(Jrd::Database*, Jrd::jrd_file*, ISC_STATUS*, ULONG, USHORT);
|
||||
USHORT PIO_init_data(Jrd::Database*, Jrd::jrd_file*, Jrd::FbStatusVector*, ULONG, USHORT);
|
||||
Jrd::jrd_file* PIO_open(Jrd::Database*, const Firebird::PathName&,
|
||||
const Firebird::PathName&);
|
||||
bool PIO_read(Jrd::jrd_file*, Jrd::BufferDesc*, Ods::pag*, ISC_STATUS*);
|
||||
bool PIO_read(Jrd::jrd_file*, Jrd::BufferDesc*, Ods::pag*, Jrd::FbStatusVector*);
|
||||
|
||||
#ifdef SUPERSERVER_V2
|
||||
bool PIO_read_ahead(Jrd::Database*, SLONG, SCHAR*, SLONG,
|
||||
struct Jrd::phys_io_blk*, ISC_STATUS*);
|
||||
bool PIO_status(Jrd::Database*, struct Jrd::phys_io_blk*, ISC_STATUS*);
|
||||
struct Jrd::phys_io_blk*, Jrd::FbStatusVector*);
|
||||
bool PIO_status(Jrd::Database*, struct Jrd::phys_io_blk*, Jrd::FbStatusVector*);
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_RAW_DEVICES
|
||||
bool PIO_on_raw_device(const Firebird::PathName&);
|
||||
int PIO_unlink(const Firebird::PathName&);
|
||||
#endif
|
||||
bool PIO_write(Jrd::jrd_file*, Jrd::BufferDesc*, Ods::pag*, ISC_STATUS*);
|
||||
bool PIO_write(Jrd::jrd_file*, Jrd::BufferDesc*, Ods::pag*, Jrd::FbStatusVector*);
|
||||
|
||||
#endif // JRD_PIO_PROTO_H
|
||||
|
||||
|
@ -110,10 +110,10 @@ using namespace Firebird;
|
||||
static const mode_t MASK = 0660;
|
||||
|
||||
#define FCNTL_BROKEN
|
||||
static jrd_file* seek_file(jrd_file*, BufferDesc*, FB_UINT64*, ISC_STATUS*);
|
||||
static jrd_file* seek_file(jrd_file*, BufferDesc*, FB_UINT64*, FbStatusVector*);
|
||||
static jrd_file* setup_file(Database*, const PathName&, const int, const bool, const bool);
|
||||
static bool lockDatabaseFile(int desc, const bool shareMode, const bool temporary = false);
|
||||
static bool unix_error(const TEXT*, const jrd_file*, ISC_STATUS, ISC_STATUS* = NULL);
|
||||
static bool unix_error(const TEXT*, const jrd_file*, ISC_STATUS, FbStatusVector* = NULL);
|
||||
#if !(defined HAVE_PREAD && defined HAVE_PWRITE)
|
||||
static SLONG pread(int, SCHAR*, SLONG, SLONG);
|
||||
static SLONG pwrite(int, SCHAR*, SLONG, SLONG);
|
||||
@ -545,7 +545,7 @@ void PIO_header(Database* dbb, SCHAR* address, int length)
|
||||
static Firebird::InitInstance<ZeroBuffer> zeros;
|
||||
|
||||
|
||||
USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vector,
|
||||
USHORT PIO_init_data(Database* dbb, jrd_file* main_file, FbStatusVector* status_vector,
|
||||
ULONG startPage, USHORT initPages)
|
||||
{
|
||||
/**************************************
|
||||
@ -690,7 +690,7 @@ jrd_file* PIO_open(Database* dbb,
|
||||
}
|
||||
|
||||
|
||||
bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* status_vector)
|
||||
bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -749,7 +749,7 @@ bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* statu
|
||||
}
|
||||
|
||||
|
||||
bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* status_vector)
|
||||
bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -791,7 +791,7 @@ bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* stat
|
||||
|
||||
|
||||
static jrd_file* seek_file(jrd_file* file, BufferDesc* bdb, FB_UINT64* offset,
|
||||
ISC_STATUS* status_vector)
|
||||
FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -946,7 +946,7 @@ static bool lockDatabaseFile(int desc, const bool share, const bool temporary)
|
||||
|
||||
static bool unix_error(const TEXT* string,
|
||||
const jrd_file* file, ISC_STATUS operation,
|
||||
ISC_STATUS* status_vector)
|
||||
FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -959,17 +959,17 @@ static bool unix_error(const TEXT* string,
|
||||
* to do something about it. Harumph!
|
||||
*
|
||||
**************************************/
|
||||
Arg::Gds err(isc_io_error);
|
||||
err << string << file->fil_string <<
|
||||
Arg::Gds(operation) << Arg::Unix(errno);
|
||||
|
||||
if (!status_vector)
|
||||
{
|
||||
ERR_post(Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) <<
|
||||
Arg::Gds(operation) << Arg::Unix(errno));
|
||||
ERR_post(err);
|
||||
}
|
||||
|
||||
ERR_build_status(status_vector,
|
||||
Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) <<
|
||||
Arg::Gds(operation) << Arg::Unix(errno));
|
||||
|
||||
gds__log_status(0, status_vector);
|
||||
ERR_build_status(status_vector, err);
|
||||
iscLogStatus(NULL, status_vector);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -113,9 +113,9 @@ using namespace Firebird;
|
||||
static void release_io_event(jrd_file*, OVERLAPPED*);
|
||||
#endif
|
||||
static bool maybeCloseFile(HANDLE&);
|
||||
static jrd_file* seek_file(jrd_file*, BufferDesc*, ISC_STATUS*, OVERLAPPED*, OVERLAPPED**);
|
||||
static jrd_file* seek_file(jrd_file*, BufferDesc*, FbStatusVector*, OVERLAPPED*, OVERLAPPED**);
|
||||
static jrd_file* setup_file(Database*, const Firebird::PathName&, HANDLE, bool, bool);
|
||||
static bool nt_error(const TEXT*, const jrd_file*, ISC_STATUS, ISC_STATUS* const);
|
||||
static bool nt_error(const TEXT*, const jrd_file*, FbStatusVector, FbStatusVector* const);
|
||||
static void adjustFileSystemCacheSize();
|
||||
|
||||
struct AdjustFsCache
|
||||
@ -460,7 +460,7 @@ void PIO_header(Database* dbb, SCHAR* address, int length)
|
||||
static Firebird::InitInstance<ZeroBuffer> zeros;
|
||||
|
||||
|
||||
USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vector,
|
||||
USHORT PIO_init_data(Database* dbb, jrd_file* main_file, FbStatusVector* status_vector,
|
||||
ULONG startPage, USHORT initPages)
|
||||
{
|
||||
/**************************************
|
||||
@ -590,7 +590,7 @@ jrd_file* PIO_open(Database* dbb,
|
||||
}
|
||||
|
||||
|
||||
bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* status_vector)
|
||||
bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -645,7 +645,7 @@ bool PIO_read_ahead(Database* dbb,
|
||||
SCHAR* buffer,
|
||||
SLONG pages,
|
||||
phys_io_blk* piob,
|
||||
ISC_STATUS* status_vector)
|
||||
FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -737,7 +737,7 @@ bool PIO_read_ahead(Database* dbb,
|
||||
|
||||
|
||||
#ifdef SUPERSERVER_V2
|
||||
bool PIO_status(Database* dbb, phys_io_blk* piob, ISC_STATUS* status_vector)
|
||||
bool PIO_status(Database* dbb, phys_io_blk* piob, FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -775,7 +775,7 @@ bool PIO_status(Database* dbb, phys_io_blk* piob, ISC_STATUS* status_vector)
|
||||
#endif
|
||||
|
||||
|
||||
bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* status_vector)
|
||||
bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, FbStatusVector* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -889,7 +889,7 @@ static void release_io_event(jrd_file* file, OVERLAPPED* overlapped)
|
||||
|
||||
static jrd_file* seek_file(jrd_file* file,
|
||||
BufferDesc* bdb,
|
||||
ISC_STATUS* /*status_vector*/,
|
||||
FbStatusVector* /*status_vector*/,
|
||||
OVERLAPPED* overlapped,
|
||||
OVERLAPPED** overlapped_ptr)
|
||||
{
|
||||
@ -1036,8 +1036,8 @@ static bool maybeCloseFile(HANDLE& hFile)
|
||||
}
|
||||
|
||||
static bool nt_error(const TEXT* string,
|
||||
const jrd_file* file, ISC_STATUS operation,
|
||||
ISC_STATUS* const status_vector)
|
||||
const jrd_file* file, FbStatusVector operation,
|
||||
FbStatusVector* const status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
|
@ -781,7 +781,7 @@ static ULONG ensureDiskSpace(thread_db* tdbb, WIN* pip_window, const PageNumber
|
||||
|
||||
next_init_pages = init_pages;
|
||||
|
||||
ISC_STATUS_ARRAY status;
|
||||
FbLocalStatus status;
|
||||
const ULONG start = sequence * pageMgr.pagesPerPIP + pip_page->pip_used;
|
||||
|
||||
init_pages = PIO_init_data(dbb, pageSpace->file, status, start, init_pages);
|
||||
@ -1359,7 +1359,7 @@ void PAG_init2(thread_db* tdbb, USHORT shadow_number)
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
Database* const dbb = tdbb->getDatabase();
|
||||
ISC_STATUS* status = tdbb->tdbb_status_vector;
|
||||
FbStatusVector* status = tdbb->tdbb_status_vector;
|
||||
|
||||
// allocate a spare buffer which is large enough,
|
||||
// and set up to release it in case of error. Align
|
||||
|
@ -748,8 +748,6 @@ static void par_error(BlrReader& blrReader, const Arg::StatusVector& v, bool isS
|
||||
else
|
||||
v.copyTo(tdbb->tdbb_status_vector);
|
||||
|
||||
ERR_make_permanent(tdbb->tdbb_status_vector);
|
||||
|
||||
// Give up whatever we were doing and return to the user.
|
||||
ERR_punt();
|
||||
}
|
||||
@ -1682,7 +1680,6 @@ void PAR_warning(const Arg::StatusVector& v)
|
||||
|
||||
// Save into tdbb
|
||||
p.copyTo(tdbb->tdbb_status_vector);
|
||||
ERR_make_permanent(tdbb->tdbb_status_vector);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: Firebird exceptions classes
|
||||
* MODULE: status.cpp
|
||||
* DESCRIPTION: Status vector filling and parsing.
|
||||
*
|
||||
* The contents of this file are subject to the Initial
|
||||
* Developer's Public License Version 1.0 (the "License");
|
||||
* you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
||||
*
|
||||
* Software distributed under the License is distributed AS IS,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing rights
|
||||
* and limitations under the License.
|
||||
*
|
||||
* The Original Code was created by Mike Nordell
|
||||
* for the Firebird Open Source RDBMS project.
|
||||
*
|
||||
* Copyright (c) 2001 Mike Nordell <tamlin at algonet.se>
|
||||
* and all contributors signed below.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
* 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "MPEXL" port
|
||||
*
|
||||
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "firebird.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../jrd/status.h"
|
||||
#include "../common/gdsassert.h"
|
||||
#include "gen/iberror.h"
|
||||
#include "../yvalve/gds_proto.h"
|
||||
|
||||
|
||||
/** Check that we never overrun the status vector. The status
|
||||
* vector is 20 elements. The maximum is 3 entries for a
|
||||
* type. So check for 17 or less
|
||||
*/
|
||||
|
||||
void PARSE_STATUS(const ISC_STATUS* status_vector, FB_SIZE_T& length, FB_SIZE_T& warning)
|
||||
{
|
||||
warning = 0;
|
||||
length = 0;
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (; status_vector[i] != isc_arg_end; i++, length++)
|
||||
{
|
||||
switch (status_vector[i])
|
||||
{
|
||||
case isc_arg_warning:
|
||||
if (!warning)
|
||||
warning = i; // find the very first
|
||||
// fallthrought intended
|
||||
case isc_arg_gds:
|
||||
case isc_arg_string:
|
||||
case isc_arg_number:
|
||||
case isc_arg_interpreted:
|
||||
case isc_arg_sql_state:
|
||||
case isc_arg_vms:
|
||||
case isc_arg_unix:
|
||||
case isc_arg_win32:
|
||||
i++;
|
||||
length++;
|
||||
break;
|
||||
|
||||
case isc_arg_cstring:
|
||||
i += 2;
|
||||
length += 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
fb_assert(FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i) {
|
||||
length++; // isc_arg_end is counted
|
||||
}
|
||||
}
|
@ -26,12 +26,64 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FB_MISC_STATUS_H
|
||||
#define FB_MISC_STATUS_H
|
||||
#ifndef FB_MFbStatusVector_H
|
||||
#define FB_MFbStatusVector_H
|
||||
|
||||
#include "../common/StatusHolder.h"
|
||||
|
||||
const int MAX_ERRMSG_LEN = 128;
|
||||
const int MAX_ERRSTR_LEN = 1024;
|
||||
|
||||
void PARSE_STATUS(const ISC_STATUS* status_vector, FB_SIZE_T& length, FB_SIZE_T& warning);
|
||||
namespace Jrd
|
||||
{
|
||||
typedef Firebird::CheckStatusWrapper FbStatusVector;
|
||||
|
||||
#endif // FB_MISC_STATUS_H
|
||||
class FbLocalStatus
|
||||
{
|
||||
public:
|
||||
FbLocalStatus()
|
||||
: localStatusVector(&localStatus)
|
||||
{ }
|
||||
|
||||
operator FbStatusVector*()
|
||||
{
|
||||
return &localStatusVector;
|
||||
}
|
||||
|
||||
FbStatusVector* operator->()
|
||||
{
|
||||
return &localStatusVector;
|
||||
}
|
||||
|
||||
FbStatusVector* operator&()
|
||||
{
|
||||
return &localStatusVector;
|
||||
}
|
||||
|
||||
operator const FbStatusVector*() const
|
||||
{
|
||||
return &localStatusVector;
|
||||
}
|
||||
|
||||
const FbStatusVector* operator->() const
|
||||
{
|
||||
return &localStatusVector;
|
||||
}
|
||||
|
||||
void check()
|
||||
{
|
||||
if (localStatusVector.isDirty())
|
||||
{
|
||||
if (localStatus.getState() && FbStatusVector::STATE_ERRORS)
|
||||
Firebird::status_exception::raise(&localStatus);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Firebird::LocalStatus localStatus;
|
||||
FbStatusVector localStatusVector;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // FB_MFbStatusVector_H
|
||||
|
170
src/jrd/svc.cpp
170
src/jrd/svc.cpp
@ -127,27 +127,6 @@ const char* const SPB_SEC_USERNAME = "isc_spb_sec_username";
|
||||
|
||||
namespace {
|
||||
|
||||
// Thread ID holder (may be generic, but needed only here now)
|
||||
class ThreadIdHolder
|
||||
{
|
||||
public:
|
||||
explicit ThreadIdHolder(Jrd::Service::StatusStringsHelper& p)
|
||||
: strHelper(&p)
|
||||
{
|
||||
MutexLockGuard guard(strHelper->mtx, FB_FUNCTION);
|
||||
strHelper->workerThread = getThreadId();
|
||||
}
|
||||
|
||||
~ThreadIdHolder()
|
||||
{
|
||||
MutexLockGuard guard(strHelper->mtx, FB_FUNCTION);
|
||||
strHelper->workerThread = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
Jrd::Service::StatusStringsHelper* strHelper;
|
||||
};
|
||||
|
||||
// Generic mutex to synchronize services
|
||||
GlobalPtr<Mutex> globalServicesMutex;
|
||||
|
||||
@ -156,7 +135,7 @@ namespace {
|
||||
GlobalPtr<AllServices> allServices; // protected by globalServicesMutex
|
||||
volatile bool svcShutdown = false;
|
||||
|
||||
void put_status_arg(ISC_STATUS*& status, const MsgFormat::safe_cell& value)
|
||||
void put_status_arg(Arg::StatusVector& status, const MsgFormat::safe_cell& value)
|
||||
{
|
||||
using MsgFormat::safe_cell;
|
||||
|
||||
@ -164,12 +143,10 @@ namespace {
|
||||
{
|
||||
case safe_cell::at_int64:
|
||||
case safe_cell::at_uint64:
|
||||
*status++ = isc_arg_number;
|
||||
*status++ = static_cast<SLONG>(value.i_value); // May truncate number!
|
||||
status << Arg::Num(static_cast<SLONG>(value.i_value)); // May truncate number!
|
||||
break;
|
||||
case safe_cell::at_str:
|
||||
*status++ = isc_arg_string;
|
||||
*status++ = (ISC_STATUS) (IPTR) value.st_value.s_string;
|
||||
status << value.st_value.s_string;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -502,21 +479,6 @@ void Service::putBytes(const UCHAR* bytes, FB_SIZE_T len)
|
||||
enqueue(bytes, len);
|
||||
}
|
||||
|
||||
void Service::makePermanentStatusVector() throw()
|
||||
{
|
||||
// This mutex avoids modification of workerThread
|
||||
MutexLockGuard guard(svc_thread_strings.mtx, FB_FUNCTION);
|
||||
|
||||
if (svc_thread_strings.workerThread)
|
||||
{
|
||||
makePermanentVector(svc_status, svc_thread_strings.workerThread);
|
||||
}
|
||||
else
|
||||
{
|
||||
makePermanentVector(svc_status);
|
||||
}
|
||||
}
|
||||
|
||||
void Service::setServiceStatus(const ISC_STATUS* status_vector)
|
||||
{
|
||||
if (checkForShutdown())
|
||||
@ -524,17 +486,8 @@ void Service::setServiceStatus(const ISC_STATUS* status_vector)
|
||||
return;
|
||||
}
|
||||
|
||||
if (status_vector != svc_status)
|
||||
{
|
||||
Arg::StatusVector svc(svc_status);
|
||||
Arg::StatusVector passed(status_vector);
|
||||
if (svc != passed)
|
||||
{
|
||||
svc.append(passed);
|
||||
svc.copyTo(svc_status);
|
||||
makePermanentStatusVector();
|
||||
}
|
||||
}
|
||||
Arg::StatusVector passed(status_vector);
|
||||
ERR_post_nothrow(passed, svc_status);
|
||||
}
|
||||
|
||||
void Service::setServiceStatus(const USHORT facility, const USHORT errcode,
|
||||
@ -546,94 +499,18 @@ void Service::setServiceStatus(const USHORT facility, const USHORT errcode,
|
||||
}
|
||||
|
||||
// Append error codes to the status vector
|
||||
Arg::StatusVector status;
|
||||
|
||||
ISC_STATUS_ARRAY tmp_status;
|
||||
// stuff the error code
|
||||
status << Arg::Gds(ENCODE_ISC_MSG(errcode, facility));
|
||||
|
||||
// stuff the status into temp buffer
|
||||
MOVE_CLEAR(tmp_status, sizeof(tmp_status));
|
||||
ISC_STATUS* status = tmp_status;
|
||||
*status++ = isc_arg_gds;
|
||||
*status++ = ENCODE_ISC_MSG(errcode, facility);
|
||||
size_t tmp_status_len = 3;
|
||||
|
||||
// We preserve the five params of the old code.
|
||||
// Don't want to overflow the status vector.
|
||||
for (unsigned int loop = 0; loop < 5 && loop < args.getCount(); ++loop)
|
||||
// stuff params
|
||||
for (unsigned int loop = 0; loop < args.getCount(); ++loop)
|
||||
{
|
||||
put_status_arg(status, args.getCell(loop));
|
||||
tmp_status_len += 2;
|
||||
}
|
||||
|
||||
*status++ = isc_arg_end;
|
||||
|
||||
if (svc_status[0] != isc_arg_gds ||
|
||||
(svc_status[0] == isc_arg_gds && svc_status[1] == 0 && svc_status[2] != isc_arg_warning))
|
||||
{
|
||||
memcpy(svc_status, tmp_status, sizeof(ISC_STATUS) * tmp_status_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
FB_SIZE_T status_len = 0, warning_indx = 0;
|
||||
PARSE_STATUS(svc_status, status_len, warning_indx);
|
||||
if (status_len)
|
||||
--status_len;
|
||||
|
||||
// check for duplicated error code
|
||||
bool duplicate = false;
|
||||
size_t i;
|
||||
for (i = 0; i < ISC_STATUS_LENGTH; i++)
|
||||
{
|
||||
if (svc_status[i] == isc_arg_end && i == status_len)
|
||||
break; // end of argument list
|
||||
|
||||
if (i && i == warning_indx)
|
||||
break; // vector has no more errors
|
||||
|
||||
if (svc_status[i] == tmp_status[1] && i != 0 &&
|
||||
svc_status[i - 1] != isc_arg_warning &&
|
||||
i + tmp_status_len - 2 < ISC_STATUS_LENGTH &&
|
||||
(memcmp(&svc_status[i], &tmp_status[1],
|
||||
sizeof(ISC_STATUS) * (tmp_status_len - 2)) == 0))
|
||||
{
|
||||
// duplicate found
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!duplicate)
|
||||
{
|
||||
// if the status_vector has only warnings then adjust err_status_len
|
||||
size_t err_status_len = i;
|
||||
if (err_status_len == 2 && warning_indx != 0)
|
||||
err_status_len = 0;
|
||||
|
||||
ISC_STATUS_ARRAY warning_status;
|
||||
FB_SIZE_T warning_count = 0;
|
||||
if (warning_indx)
|
||||
{
|
||||
// copy current warning(s) to a temp buffer
|
||||
MOVE_CLEAR(warning_status, sizeof(warning_status));
|
||||
memcpy(warning_status, &svc_status[warning_indx],
|
||||
sizeof(ISC_STATUS) * (ISC_STATUS_LENGTH - warning_indx));
|
||||
PARSE_STATUS(warning_status, warning_count, warning_indx);
|
||||
}
|
||||
|
||||
// add the status into a real buffer right in between last error and first warning
|
||||
i = err_status_len + tmp_status_len;
|
||||
if (i < ISC_STATUS_LENGTH)
|
||||
{
|
||||
memcpy(&svc_status[err_status_len], tmp_status, sizeof(ISC_STATUS) * tmp_status_len);
|
||||
// copy current warning(s) to the status_vector
|
||||
if (warning_count && i + warning_count - 1 < ISC_STATUS_LENGTH)
|
||||
{
|
||||
memcpy(&svc_status[i - 1], warning_status, sizeof(ISC_STATUS) * warning_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
makePermanentStatusVector();
|
||||
ERR_post_nothrow(status, svc_status);
|
||||
}
|
||||
|
||||
void Service::hidePasswd(ArgvType&, int)
|
||||
@ -641,7 +518,7 @@ void Service::hidePasswd(ArgvType&, int)
|
||||
// no action
|
||||
}
|
||||
|
||||
const ISC_STATUS* Service::getStatus()
|
||||
const FbStatusVector* Service::getStatus()
|
||||
{
|
||||
return svc_status;
|
||||
}
|
||||
@ -677,9 +554,10 @@ void Service::fillDpb(ClumpletWriter& dpb)
|
||||
if (svc_crypt_callback)
|
||||
{
|
||||
// That's not DPB-related, but anyway should be done before attach/create DB
|
||||
if (fb_database_crypt_callback(svc_status, svc_crypt_callback) != 0)
|
||||
ISC_STATUS_ARRAY status;
|
||||
if (fb_database_crypt_callback(status, svc_crypt_callback) != 0)
|
||||
{
|
||||
status_exception::raise(svc_status);
|
||||
status_exception::raise(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -753,7 +631,6 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d
|
||||
svc_stdin_preload_requested(0), svc_stdin_user_size(0)
|
||||
{
|
||||
initStatus();
|
||||
ThreadIdHolder holdId(svc_thread_strings);
|
||||
|
||||
{ // scope
|
||||
// Account service block in global array
|
||||
@ -871,7 +748,7 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
TraceManager* trace_manager = NULL;
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FbLocalStatus status_vector;
|
||||
|
||||
try
|
||||
{
|
||||
@ -1067,7 +944,7 @@ void Service::shutdownServices()
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS Service::query2(thread_db* /*tdbb*/,
|
||||
FbStatusVector Service::query2(thread_db* /*tdbb*/,
|
||||
USHORT send_item_length,
|
||||
const UCHAR* send_items,
|
||||
USHORT recv_item_length,
|
||||
@ -1088,8 +965,6 @@ ISC_STATUS Service::query2(thread_db* /*tdbb*/,
|
||||
USHORT l, length, get_flags;
|
||||
UCHAR* stdin_request_notification = NULL;
|
||||
|
||||
ThreadIdHolder holdId(svc_thread_strings);
|
||||
|
||||
// Setup the status vector
|
||||
Arg::StatusVector status;
|
||||
|
||||
@ -1572,7 +1447,7 @@ ISC_STATUS Service::query2(thread_db* /*tdbb*/,
|
||||
} // try
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FbLocalStatus status_vector;
|
||||
|
||||
if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_QUERY))
|
||||
{
|
||||
@ -1955,7 +1830,7 @@ void Service::query(USHORT send_item_length,
|
||||
} // try
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FbLocalStatus status_vector;
|
||||
|
||||
if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_QUERY))
|
||||
{
|
||||
@ -2017,8 +1892,6 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data)
|
||||
Arg::Gds(isc_bad_svc_handle).raise();
|
||||
}
|
||||
|
||||
ThreadIdHolder holdId(svc_thread_strings);
|
||||
|
||||
try
|
||||
{
|
||||
ClumpletReader spb(ClumpletReader::SpbStart, spb_data, spb_length);
|
||||
@ -2178,7 +2051,7 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data)
|
||||
{
|
||||
if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_START))
|
||||
{
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FbLocalStatus status_vector;
|
||||
const ISC_STATUS exc = ex.stuff_exception(status_vector);
|
||||
const bool no_priv = (exc == isc_login || exc == isc_no_priv);
|
||||
|
||||
@ -2195,7 +2068,8 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data)
|
||||
TraceServiceImpl service(this);
|
||||
this->svc_trace_manager->event_service_start(&service,
|
||||
this->svc_switches.length(), this->svc_switches.c_str(),
|
||||
this->svc_status[1] ? ITracePlugin::RESULT_FAILED : ITracePlugin::RESULT_SUCCESS);
|
||||
this->svc_status->getState() & FbStatusVector::STATE_ERRORS ?
|
||||
ITracePlugin::RESULT_FAILED : ITracePlugin::RESULT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "../common/classes/ClumpletReader.h"
|
||||
#include "../common/classes/RefMutex.h"
|
||||
#include "../burp/split/spit.h"
|
||||
#include "../jrd/status.h"
|
||||
|
||||
// forward decl.
|
||||
|
||||
@ -130,7 +131,7 @@ public: // utilities interface with service
|
||||
// no-op for services
|
||||
virtual void hidePasswd(ArgvType&, int);
|
||||
// return service status
|
||||
virtual const ISC_STATUS* getStatus();
|
||||
virtual const FbStatusVector* getStatus();
|
||||
// reset service status
|
||||
virtual void initStatus();
|
||||
// no-op for services
|
||||
@ -163,7 +164,7 @@ public: // external interface with service
|
||||
// Query service state (v. 1 & 2)
|
||||
void query(USHORT send_item_length, const UCHAR* send_items, USHORT recv_item_length,
|
||||
const UCHAR* recv_items, USHORT buffer_length, UCHAR* info);
|
||||
ISC_STATUS query2(thread_db* tdbb, USHORT send_item_length, const UCHAR* send_items,
|
||||
FbStatusVector query2(thread_db* tdbb, USHORT send_item_length, const UCHAR* send_items,
|
||||
USHORT recv_item_length, const UCHAR* recv_items, USHORT buffer_length, UCHAR* info);
|
||||
// Detach from service
|
||||
void detach();
|
||||
@ -262,14 +263,14 @@ private:
|
||||
static THREAD_ENTRY_DECLARE run(THREAD_ENTRY_PARAM arg);
|
||||
|
||||
private:
|
||||
ISC_STATUS_ARRAY svc_status; // status vector for running service
|
||||
Firebird::string svc_parsed_sw; // Here point elements of argv
|
||||
FbLocalStatus svc_status; // status vector for running service
|
||||
Firebird::string svc_parsed_sw; // Here point elements of argv
|
||||
ULONG svc_stdout_head;
|
||||
ULONG svc_stdout_tail;
|
||||
UCHAR svc_stdout[SVC_STDOUT_BUFFER_SIZE]; // output from service
|
||||
Firebird::Semaphore svcStart;
|
||||
const serv_entry* svc_service; // attached service's entry
|
||||
const serv_entry* svc_service_run; // running service's entry
|
||||
const serv_entry* svc_service; // attached service's entry
|
||||
const serv_entry* svc_service_run; // running service's entry
|
||||
Firebird::Array<UCHAR> svc_resp_alloc;
|
||||
UCHAR* svc_resp_buf;
|
||||
const UCHAR* svc_resp_ptr;
|
||||
@ -302,12 +303,6 @@ private:
|
||||
Firebird::ICryptKeyCallback* svc_crypt_callback;
|
||||
|
||||
public:
|
||||
struct StatusStringsHelper
|
||||
{
|
||||
ThreadId workerThread;
|
||||
Firebird::Mutex mtx;
|
||||
};
|
||||
|
||||
Firebird::Semaphore svc_detach_sem;
|
||||
|
||||
class SvcMutex : public Firebird::RefMutex
|
||||
@ -323,8 +318,6 @@ public:
|
||||
Firebird::RefPtr<SvcMutex> svc_existence;
|
||||
|
||||
private:
|
||||
StatusStringsHelper svc_thread_strings;
|
||||
|
||||
Firebird::Semaphore svc_sem_empty, svc_sem_full;
|
||||
|
||||
class Validate
|
||||
|
@ -380,11 +380,12 @@ void TRA_commit(thread_db* tdbb, jrd_tra* transaction, const bool retaining_flag
|
||||
SecDbContext* secContext = transaction->getSecDbContext();
|
||||
if (secContext && secContext->tra)
|
||||
{
|
||||
LocalStatus s;
|
||||
secContext->tra->commit(&s);
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
secContext->tra->commit(&st);
|
||||
|
||||
if (s.getState() & IStatus::STATE_ERRORS)
|
||||
status_exception::raise(&s);
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
status_exception::raise(&st);
|
||||
|
||||
secContext->tra = NULL;
|
||||
clearMap(tdbb->getDatabase()->dbb_config->getSecurityDatabase());
|
||||
@ -985,10 +986,11 @@ void TRA_prepare(thread_db* tdbb, jrd_tra* transaction, USHORT length, const UCH
|
||||
SecDbContext* secContext = transaction->getSecDbContext();
|
||||
if (secContext && secContext->tra)
|
||||
{
|
||||
LocalStatus s;
|
||||
secContext->tra->prepare(&s, length, msg);
|
||||
if (s.getState() & IStatus::STATE_ERRORS)
|
||||
status_exception::raise(&s);
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
secContext->tra->prepare(&st, length, msg);
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
status_exception::raise(&st);
|
||||
}
|
||||
|
||||
// Perform any meta data work deferred
|
||||
@ -3614,15 +3616,16 @@ SecDbContext::SecDbContext(IAttachment* a, ITransaction* t)
|
||||
|
||||
SecDbContext::~SecDbContext()
|
||||
{
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
if (tra)
|
||||
{
|
||||
tra->rollback(&s);
|
||||
tra->rollback(&st);
|
||||
tra = NULL;
|
||||
}
|
||||
if (att)
|
||||
{
|
||||
att->detach(&s);
|
||||
att->detach(&st);
|
||||
att = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -275,9 +275,7 @@ void ConfigStorage::checkFile()
|
||||
}
|
||||
catch(const Exception& ex)
|
||||
{
|
||||
ISC_STATUS_ARRAY temp;
|
||||
ex.stuff_exception(temp);
|
||||
iscLogStatus("Cannot open audit configuration file", temp);
|
||||
iscLogException("Cannot open audit configuration file", ex);
|
||||
}
|
||||
|
||||
if (cfgFile) {
|
||||
@ -580,7 +578,7 @@ bool ConfigStorage::getItemLength(ITEM& tag, ULONG& len)
|
||||
void ConfigStorage::TouchFile::handler()
|
||||
{
|
||||
os_utils::touchFile(fileName);
|
||||
LocalStatus s;
|
||||
FbLocalStatus s;
|
||||
TimerInterfacePtr()->start(&s, this, TOUCH_INTERVAL * 1000 * 1000);
|
||||
// ignore error in handler
|
||||
}
|
||||
@ -588,14 +586,14 @@ void ConfigStorage::TouchFile::handler()
|
||||
void ConfigStorage::TouchFile::start(const char* fName)
|
||||
{
|
||||
fileName = fName;
|
||||
LocalStatus s;
|
||||
FbLocalStatus s;
|
||||
TimerInterfacePtr()->start(&s, this, TOUCH_INTERVAL * 1000 * 1000);
|
||||
check(&s);
|
||||
}
|
||||
|
||||
void ConfigStorage::TouchFile::stop()
|
||||
{
|
||||
LocalStatus s;
|
||||
FbLocalStatus s;
|
||||
TimerInterfacePtr()->stop(&s, this);
|
||||
// ignore error in stop timer
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ void TraceManager::update_session(const TraceSession& session)
|
||||
for (FactoryInfo* info = factories->begin(); info != factories->end(); ++info)
|
||||
{
|
||||
TraceInitInfoImpl attachInfo(session, attachment, filename);
|
||||
LocalStatus status;
|
||||
FbLocalStatus status;
|
||||
ITracePlugin* plugin = info->factory->trace_create(&status, &attachInfo);
|
||||
|
||||
if (plugin)
|
||||
@ -257,7 +257,7 @@ void TraceManager::update_session(const TraceSession& session)
|
||||
|
||||
trace_needs |= info->factory->trace_needs();
|
||||
}
|
||||
else if (status.getState() & IStatus::STATE_ERRORS)
|
||||
else if (status->getState() & IStatus::STATE_ERRORS)
|
||||
{
|
||||
string header;
|
||||
header.printf("Trace plugin %s returned error on call trace_create.", info->name);
|
||||
|
@ -592,11 +592,11 @@ SINT64 TraceRuntimeStats::m_dummy_counts[RuntimeStatistics::TOTAL_ITEMS] = {0};
|
||||
|
||||
const char* TraceStatusVectorImpl::getText()
|
||||
{
|
||||
if (m_error.isEmpty() && (hasError() || hasWarning()))
|
||||
if (m_error.isEmpty() && (kind == TS_ERRORS ? hasError() : hasWarning()))
|
||||
{
|
||||
char buff[1024];
|
||||
const ISC_STATUS* p = m_status;
|
||||
const ISC_STATUS* end = m_status + ISC_STATUS_LENGTH;
|
||||
const ISC_STATUS* p = kind == TS_ERRORS ? m_status->getErrors() : m_status->getWarnings();
|
||||
const ISC_STATUS* end = p + fb_utils::statusLength(p);
|
||||
|
||||
while (p < end - 1)
|
||||
{
|
||||
@ -606,12 +606,12 @@ const char* TraceStatusVectorImpl::getText()
|
||||
continue;
|
||||
}
|
||||
|
||||
const ISC_STATUS code = *p ? p[1] : 0;
|
||||
const ISC_STATUS* code = p + 1;
|
||||
if (!fb_interpret(buff, sizeof(buff), &p))
|
||||
break;
|
||||
|
||||
string s;
|
||||
s.printf("%9lu : %s\n", code, buff);
|
||||
s.printf("%9lu : %s\n", *code, buff);
|
||||
m_error += s;
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "../../jrd/req.h"
|
||||
#include "../../jrd/svc.h"
|
||||
#include "../../jrd/tra.h"
|
||||
#include "../../jrd/status.h"
|
||||
#include "../../jrd/Function.h"
|
||||
#include "../../jrd/RuntimeStatistics.h"
|
||||
#include "../../jrd/trace/TraceSession.h"
|
||||
@ -562,22 +563,24 @@ class TraceStatusVectorImpl :
|
||||
public Firebird::AutoIface<Firebird::ITraceStatusVectorImpl<TraceStatusVectorImpl, Firebird::CheckStatusWrapper> >
|
||||
{
|
||||
public:
|
||||
explicit TraceStatusVectorImpl(const ISC_STATUS* status) :
|
||||
m_status(status)
|
||||
enum Kind {TS_ERRORS, TS_WARNINGS};
|
||||
|
||||
TraceStatusVectorImpl(FbStatusVector* status, Kind k) :
|
||||
m_status(status), kind(k)
|
||||
{
|
||||
}
|
||||
|
||||
FB_BOOLEAN hasError()
|
||||
{
|
||||
return m_status && (m_status[1] != 0);
|
||||
return m_status->getState() && Firebird::IStatus::STATE_ERRORS;
|
||||
}
|
||||
|
||||
FB_BOOLEAN hasWarning()
|
||||
{
|
||||
return m_status && (m_status[1] == 0) && (m_status[2] == isc_arg_warning);
|
||||
return m_status->getState() && Firebird::IStatus::STATE_WARNINGS;
|
||||
}
|
||||
|
||||
const ISC_STATUS* getStatus()
|
||||
Firebird::IStatus* getStatus()
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
@ -585,8 +588,9 @@ public:
|
||||
const char* getText();
|
||||
|
||||
private:
|
||||
const ISC_STATUS* m_status;
|
||||
Firebird::string m_error;
|
||||
FbStatusVector* m_status;
|
||||
Kind kind;
|
||||
};
|
||||
|
||||
class TraceSweepImpl :
|
||||
|
@ -558,6 +558,7 @@ VI. ADDITIONAL NOTES
|
||||
#include "../jrd/err_proto.h"
|
||||
#include "../jrd/jrd_proto.h"
|
||||
#include "../yvalve/gds_proto.h"
|
||||
#include "../common/isc_proto.h"
|
||||
#include "../jrd/met_proto.h"
|
||||
#include "../jrd/tra_proto.h"
|
||||
#include "../jrd/val_proto.h"
|
||||
@ -760,7 +761,7 @@ bool Validation::run(thread_db* tdbb, USHORT switches)
|
||||
|
||||
Firebird::string err;
|
||||
err.printf("Database: %s\n\tValidation aborted", fileName.c_str());
|
||||
gds__log_status(err.c_str(), tdbb->tdbb_status_vector);
|
||||
iscLogStatus(err.c_str(), tdbb->tdbb_status_vector);
|
||||
|
||||
cleanup();
|
||||
dbb->deletePool(val_pool);
|
||||
|
@ -73,6 +73,7 @@
|
||||
#include "../yvalve/gds_proto.h"
|
||||
#include "../jrd/idx_proto.h"
|
||||
#include "../common/isc_s_proto.h"
|
||||
#include "../common/isc_proto.h"
|
||||
#include "../jrd/jrd_proto.h"
|
||||
#include "../jrd/ini_proto.h"
|
||||
#include "../jrd/lck_proto.h"
|
||||
@ -4523,7 +4524,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
|
||||
* improve query response time and throughput.
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FbLocalStatus status_vector;
|
||||
Database* const dbb = (Database*) arg;
|
||||
|
||||
try
|
||||
@ -4730,7 +4731,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ex.stuff_exception(status_vector);
|
||||
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector);
|
||||
|
||||
if (relation && relation->rel_sweep_count)
|
||||
--relation->rel_sweep_count;
|
||||
@ -4754,7 +4755,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ex.stuff_exception(status_vector);
|
||||
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector);
|
||||
}
|
||||
|
||||
dbb->dbb_flags &= ~(DBB_garbage_collector | DBB_gc_active | DBB_gc_pending);
|
||||
@ -4767,7 +4768,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
ex.stuff_exception(status_vector);
|
||||
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
|
||||
iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -55,7 +55,8 @@ public:
|
||||
procedures(getPool()),
|
||||
triggers(getPool())
|
||||
{
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
RefPtr<IConfig> defaultConfig(REF_NO_INCR, par->getDefaultConfig(&s));
|
||||
check(&s);
|
||||
|
||||
|
@ -64,7 +64,8 @@ void BlrFromMessage::buildBlr(IMessageMetadata* metadata)
|
||||
if (!metadata)
|
||||
return;
|
||||
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
|
||||
expectedMessageLength = metadata->getMessageLength(&st);
|
||||
check(&st);
|
||||
|
@ -172,7 +172,8 @@ int Blob::release()
|
||||
|
||||
if (blob)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
freeClientData(&status, true);
|
||||
}
|
||||
delete this;
|
||||
@ -236,7 +237,8 @@ int Transaction::release()
|
||||
|
||||
if (transaction)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
freeClientData(&status, true); // ASF: Rollback - is this correct for reconnected transactions?
|
||||
}
|
||||
delete this;
|
||||
@ -286,7 +288,8 @@ int ResultSet::release()
|
||||
|
||||
if (stmt)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
freeClientData(&status, true);
|
||||
}
|
||||
delete this;
|
||||
@ -359,7 +362,8 @@ int Statement::release()
|
||||
|
||||
if (statement)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
freeClientData(&status, true);
|
||||
}
|
||||
delete this;
|
||||
@ -406,7 +410,8 @@ int Request::release()
|
||||
|
||||
if (rq)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
freeClientData(&status, true);
|
||||
}
|
||||
delete this;
|
||||
@ -447,7 +452,8 @@ int Events::release()
|
||||
|
||||
if (rvnt)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
freeClientData(&status, true);
|
||||
}
|
||||
delete this;
|
||||
@ -534,7 +540,8 @@ int Attachment::release()
|
||||
|
||||
if (rdb)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
freeClientData(&status, true);
|
||||
}
|
||||
delete this;
|
||||
@ -570,7 +577,8 @@ int Service::release()
|
||||
|
||||
if (rdb)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
freeClientData(&status, true);
|
||||
}
|
||||
delete this;
|
||||
@ -5297,7 +5305,9 @@ static void add_working_directory(ClumpletWriter& dpb, const PathName& node_name
|
||||
|
||||
static void authenticateStep0(ClntAuthBlock& cBlock)
|
||||
{
|
||||
for (LocalStatus s; cBlock.plugins.hasData(); cBlock.plugins.next())
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
for (; cBlock.plugins.hasData(); cBlock.plugins.next())
|
||||
{
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authenticateStep0(%s)\n", cBlock.plugins.name()));
|
||||
switch(cBlock.plugins.plugin()->authenticate(&s, &cBlock))
|
||||
@ -5336,7 +5346,8 @@ static void secureAuthentication(ClntAuthBlock& cBlock, rem_port* port)
|
||||
|
||||
if (packet->p_operation == op_cond_accept)
|
||||
{
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
authReceiveResponse(true, cBlock, port, rdb, &st, packet, true);
|
||||
|
||||
if (st.getState() & Firebird::IStatus::STATE_ERRORS)
|
||||
@ -5568,7 +5579,8 @@ static void batch_dsql_fetch(rem_port* port,
|
||||
statement->rsr_flags.set(Rsr::FETCHED);
|
||||
while (true)
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
|
||||
// Swallow up data. If a buffer isn't available, allocate another.
|
||||
|
||||
@ -5757,7 +5769,8 @@ static void batch_gds_receive(rem_port* port,
|
||||
--tail->rrq_batch_count;
|
||||
try
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
REMOTE_check_response(&status, rdb, packet);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "End of batch. rows pending = %d\n", tail->rrq_rows_pending);
|
||||
@ -6106,7 +6119,8 @@ static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb,
|
||||
if (cBlock.authComplete)
|
||||
return; // Already authenticated
|
||||
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
|
||||
cBlock.resetDataFromPlugin();
|
||||
|
||||
@ -6178,7 +6192,8 @@ static void REMOTE_free_string(CSTRING* tmp)
|
||||
static void authReceiveResponse(bool havePacket, ClntAuthBlock& cBlock, rem_port* port,
|
||||
Rdb* rdb, IStatus* status, PACKET* packet, bool checkKeys)
|
||||
{
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -6511,7 +6526,8 @@ static void receive_after_start(Rrq* request, USHORT msg_type)
|
||||
{
|
||||
try
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
REMOTE_check_response(&status, rdb, packet);
|
||||
request->saveStatus(&status);
|
||||
}
|
||||
@ -6677,7 +6693,8 @@ static void receive_packet_noqueue(rem_port* port, PACKET* packet)
|
||||
bool bAssign = true;
|
||||
try
|
||||
{
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
REMOTE_check_response(&status, rdb, &p->packet);
|
||||
statement->saveException(&status, false);
|
||||
}
|
||||
@ -7113,7 +7130,8 @@ static void send_cancel_event(Rvnt* event)
|
||||
|
||||
try
|
||||
{
|
||||
LocalStatus dummy;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper dummy(&ls);
|
||||
send_packet(rdb->rdb_port, packet);
|
||||
receive_response(&dummy, rdb, packet);
|
||||
}
|
||||
@ -7405,7 +7423,8 @@ Transaction* Attachment::remoteTransactionInterface(ITransaction* apiTra)
|
||||
if (!apiTra)
|
||||
return NULL;
|
||||
|
||||
LocalStatus dummy;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper dummy(&ls);
|
||||
ITransaction* valid = apiTra->validate(&dummy, this);
|
||||
if (!valid)
|
||||
return NULL;
|
||||
|
@ -2695,7 +2695,8 @@ static bool packet_receive(rem_port* port, UCHAR* buffer, SSHORT buffer_length,
|
||||
|
||||
int n = 0;
|
||||
int inetErrNo;
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -2854,7 +2855,8 @@ static bool packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_leng
|
||||
HalfStaticArray<char, BUFFER_TINY> b;
|
||||
if (port->port_crypt_plugin && port->port_crypt_complete)
|
||||
{
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
|
||||
char* d = b.getBuffer(buffer_length);
|
||||
port->port_crypt_plugin->encrypt(&st, buffer_length, data, d);
|
||||
|
@ -402,7 +402,8 @@ public:
|
||||
}
|
||||
|
||||
bool working = true;
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
|
||||
authPort->port_srv_auth_block->createPluginsItr();
|
||||
authItr = authPort->port_srv_auth_block->plugins;
|
||||
@ -786,7 +787,8 @@ public:
|
||||
explicit CryptKeyTypeManager(MemoryPool& p)
|
||||
: PermanentStorage(p), knownTypes(getPool())
|
||||
{
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
for (GetPlugins<IWireCryptPlugin> cpItr(IPluginManager::TYPE_WIRE_CRYPT); cpItr.hasData(); cpItr.next())
|
||||
{
|
||||
const char* list = cpItr.plugin()->getKnownTypes(&st);
|
||||
@ -1084,7 +1086,8 @@ void SRVR_enum_attachments(ULONG& att_cnt, ULONG& dbs_cnt, ULONG& svc_cnt)
|
||||
isc_spb_user_name, 6, 'S', 'Y', 'S', 'D', 'B', 'A'
|
||||
};
|
||||
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
ServService iface(provider->attachServiceManager(&status, "service_mgr",
|
||||
sizeof(spb_attach), spb_attach));
|
||||
|
||||
@ -1492,7 +1495,8 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
|
||||
catch (const Exception& e)
|
||||
{
|
||||
gds__log("SRVR_multi_thread: shutting down due to unhandled exception");
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
e.stuffException(&status_vector);
|
||||
iscLogStatus(NULL, &status_vector);
|
||||
|
||||
@ -1753,7 +1757,8 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
|
||||
}
|
||||
|
||||
// We are going to try authentication handshake
|
||||
LocalStatus status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status(&ls);
|
||||
bool returnData = false;
|
||||
if (accepted && version >= PROTOCOL_VERSION13)
|
||||
{
|
||||
@ -1923,7 +1928,8 @@ static ISC_STATUS allocate_statement( rem_port* port, /*P_RLSE* allocate,*/ PACK
|
||||
* Allocate a statement handle.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = port->port_context;
|
||||
|
||||
@ -2187,7 +2193,8 @@ void DatabaseAuth::accept(PACKET* send, Auth::WriterImplementation* authBlock)
|
||||
authPort->port_server_crypt_callback = new ServerCallback(authPort);
|
||||
}
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
provider->setDbCryptCallback(&status_vector, authPort->port_server_crypt_callback->getInterface());
|
||||
|
||||
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS))
|
||||
@ -2231,7 +2238,8 @@ static void aux_request( rem_port* port, /*P_REQ* request,*/ PACKET* send)
|
||||
|
||||
try
|
||||
{
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* const rdb = port->port_context;
|
||||
if (bad_db(&status_vector, rdb))
|
||||
@ -2319,7 +2327,8 @@ static ISC_STATUS cancel_events( rem_port* port, P_EVENT * stuff, PACKET* send)
|
||||
* Cancel events.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
// Which database ?
|
||||
|
||||
@ -2377,7 +2386,8 @@ static void cancel_operation(rem_port* port, USHORT kind)
|
||||
|
||||
if (rdb->rdb_iface)
|
||||
{
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
rdb->rdb_iface->cancelOperation(&status_vector, kind);
|
||||
}
|
||||
}
|
||||
@ -2418,7 +2428,8 @@ static USHORT check_statement_type( Rsr* statement)
|
||||
*
|
||||
**************************************/
|
||||
UCHAR buffer[16];
|
||||
LocalStatus local_status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper local_status(&ls);
|
||||
USHORT ret = 0;
|
||||
bool done = false;
|
||||
|
||||
@ -2478,7 +2489,8 @@ ISC_STATUS rem_port::compile(P_CMPL* compileL, PACKET* sendL)
|
||||
* Compile and request.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_db(&status_vector, rdb))
|
||||
@ -2558,7 +2570,8 @@ ISC_STATUS rem_port::ddl(P_DDL* ddlL, PACKET* sendL)
|
||||
* Execute isc_ddl call.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
Rtr* transaction;
|
||||
|
||||
getHandle(transaction, ddlL->p_ddl_transaction);
|
||||
@ -2630,7 +2643,8 @@ void rem_port::disconnect(PACKET* sendL, PACKET* receiveL)
|
||||
this->port_async->port_flags |= PORT_disconnect;
|
||||
}
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
if (rdb->rdb_iface)
|
||||
{
|
||||
// Prevent a pending or spurious cancel from aborting
|
||||
@ -2728,7 +2742,8 @@ void rem_port::drop_database(P_RLSE* /*release*/, PACKET* sendL)
|
||||
* End a request.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_db(&status_vector, rdb))
|
||||
@ -2781,7 +2796,8 @@ ISC_STATUS rem_port::end_blob(P_OP operation, P_RLSE * release, PACKET* sendL)
|
||||
*
|
||||
**************************************/
|
||||
Rbl* blob;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
getHandle(blob, release->p_rlse_object);
|
||||
|
||||
@ -2809,7 +2825,8 @@ ISC_STATUS rem_port::end_database(P_RLSE* /*release*/, PACKET* sendL)
|
||||
* End a request.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_db(&status_vector, rdb))
|
||||
@ -2855,7 +2872,8 @@ ISC_STATUS rem_port::end_request(P_RLSE * release, PACKET* sendL)
|
||||
*
|
||||
**************************************/
|
||||
Rrq* requestL;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
getHandle(requestL, release->p_rlse_object);
|
||||
|
||||
@ -2881,7 +2899,8 @@ ISC_STATUS rem_port::end_statement(P_SQLFREE* free_stmt, PACKET* sendL)
|
||||
*
|
||||
*****************************************/
|
||||
Rsr* statement;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
getHandle(statement, free_stmt->p_sqlfree_statement);
|
||||
|
||||
@ -2952,7 +2971,8 @@ ISC_STATUS rem_port::end_transaction(P_OP operation, P_RLSE * release, PACKET* s
|
||||
*
|
||||
**************************************/
|
||||
Rtr* transaction;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
getHandle(transaction, release->p_rlse_object);
|
||||
|
||||
@ -3007,7 +3027,8 @@ ISC_STATUS rem_port::execute_immediate(P_OP op, P_SQLST * exnow, PACKET* sendL)
|
||||
*
|
||||
*****************************************/
|
||||
Rtr* transaction = NULL;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_db(&status_vector, rdb))
|
||||
@ -3135,7 +3156,8 @@ ISC_STATUS rem_port::execute_statement(P_OP op, P_SQLDATA* sqldata, PACKET* send
|
||||
getHandle(transaction, sqldata->p_sqldata_transaction);
|
||||
}
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
Rsr* statement;
|
||||
getHandle(statement, sqldata->p_sqldata_statement);
|
||||
USHORT out_msg_type = (op == op_execute2) ? sqldata->p_sqldata_out_message_number : 0;
|
||||
@ -3261,7 +3283,8 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL)
|
||||
* Fetch next record from a dynamic SQL cursor.
|
||||
*
|
||||
*****************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
Rsr* statement;
|
||||
getHandle(statement, sqldata->p_sqldata_statement);
|
||||
|
||||
@ -3478,7 +3501,8 @@ static bool get_next_msg_no(Rrq* request, USHORT incarnation, USHORT * msg_numbe
|
||||
* in the request.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
UCHAR info_buffer[128];
|
||||
|
||||
request->rrq_iface->getInfo(&status_vector, incarnation,
|
||||
@ -3552,7 +3576,8 @@ ISC_STATUS rem_port::get_segment(P_SGMT* segment, PACKET* sendL)
|
||||
|
||||
// Gobble up a buffer's worth of segments
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
UCHAR* p = buffer;
|
||||
int state = 0;
|
||||
@ -3606,7 +3631,8 @@ ISC_STATUS rem_port::get_slice(P_SLC * stuff, PACKET* sendL)
|
||||
*
|
||||
**************************************/
|
||||
Rtr* transaction;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_db(&status_vector, rdb))
|
||||
@ -3665,7 +3691,8 @@ void rem_port::info(P_OP op, P_INFO* stuff, PACKET* sendL)
|
||||
* statement, or transaction.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if ((op == op_service_info) ? bad_service(&status_vector, rdb) : bad_db(&status_vector, rdb))
|
||||
@ -3832,7 +3859,8 @@ static void ping_connection(rem_port* port, PACKET* send)
|
||||
* Check the connection for persistent errors.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = port->port_context;
|
||||
if (!bad_db(&status_vector, rdb))
|
||||
@ -3855,7 +3883,8 @@ ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL)
|
||||
*
|
||||
**************************************/
|
||||
Rtr* transaction;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
getHandle(transaction, stuff->p_blob_transaction);
|
||||
|
||||
@ -3921,7 +3950,8 @@ ISC_STATUS rem_port::prepare(P_PREP * stuff, PACKET* sendL)
|
||||
*
|
||||
**************************************/
|
||||
Rtr* transaction;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
getHandle(transaction, stuff->p_prep_transaction);
|
||||
|
||||
@ -3972,7 +4002,8 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL)
|
||||
if (transaction)
|
||||
iface = transaction->rtr_iface;
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
if (statement->rsr_iface)
|
||||
{
|
||||
@ -4003,7 +4034,8 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
}
|
||||
|
||||
LocalStatus s2;
|
||||
LocalStatus ls2;
|
||||
CheckStatusWrapper s2(&ls2);
|
||||
statement->rsr_iface->getInfo(&s2, infoLength, info, prepareL->p_sqlst_buffer_length, buffer);
|
||||
if (s2.getState() & Firebird::IStatus::STATE_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &s2, false);
|
||||
@ -4342,7 +4374,8 @@ static bool process_packet(rem_port* port, PACKET* sendL, PACKET* receive, rem_p
|
||||
catch (const status_exception& ex)
|
||||
{
|
||||
// typical case like bad interface passed
|
||||
LocalStatus local_status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper local_status(&ls);
|
||||
|
||||
ex.stuffException(&local_status);
|
||||
|
||||
@ -4352,7 +4385,8 @@ static bool process_packet(rem_port* port, PACKET* sendL, PACKET* receive, rem_p
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
// something more serious happened
|
||||
LocalStatus local_status;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper local_status(&ls);
|
||||
|
||||
// Log the error to the user.
|
||||
ex.stuffException(&local_status);
|
||||
@ -4460,7 +4494,8 @@ ISC_STATUS rem_port::put_segment(P_OP op, P_SGMT * segment, PACKET* sendL)
|
||||
|
||||
// Do the signal segment version. If it failed, just pass on the bad news.
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
if (op == op_put_segment)
|
||||
{
|
||||
@ -4500,7 +4535,8 @@ ISC_STATUS rem_port::put_slice(P_SLC * stuff, PACKET* sendL)
|
||||
*
|
||||
**************************************/
|
||||
Rtr* transaction;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
getHandle(transaction, stuff->p_slc_transaction);
|
||||
|
||||
@ -4530,7 +4566,8 @@ ISC_STATUS rem_port::que_events(P_EVENT * stuff, PACKET* sendL)
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_db(&status_vector, rdb))
|
||||
@ -4599,7 +4636,7 @@ ISC_STATUS rem_port::receive_after_start(P_DATA* data, PACKET* sendL, IStatus* s
|
||||
if (!sendL->p_resp.p_resp_status_vector)
|
||||
sendL->p_resp.p_resp_status_vector = FB_NEW(*getDefaultMemoryPool()) Firebird::DynamicStatusVector();
|
||||
|
||||
sendL->p_resp.p_resp_status_vector->merge(status_vector);
|
||||
sendL->p_resp.p_resp_status_vector->load(status_vector);
|
||||
|
||||
this->send_partial(sendL);
|
||||
|
||||
@ -4643,7 +4680,8 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL)
|
||||
USHORT count, count2;
|
||||
count2 = count = data->p_data_messages;
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
if (msg_number > requestL->rrq_max_msg)
|
||||
{
|
||||
@ -4988,7 +5026,8 @@ ISC_STATUS rem_port::seek_blob(P_SEEK* seek, PACKET* sendL)
|
||||
const SSHORT mode = seek->p_seek_mode;
|
||||
const SLONG offset = seek->p_seek_offset;
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
SLONG result = blob->rbl_iface->seek(&status_vector, mode, offset);
|
||||
|
||||
sendL->p_resp.p_resp_blob_id.gds_quad_low = result;
|
||||
@ -5009,7 +5048,8 @@ ISC_STATUS rem_port::send_msg(P_DATA * data, PACKET* sendL)
|
||||
* Handle a isc_send operation.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rrq* requestL;
|
||||
getHandle(requestL, data->p_data_request);
|
||||
@ -5035,9 +5075,9 @@ ISC_STATUS rem_port::send_msg(P_DATA * data, PACKET* sendL)
|
||||
|
||||
ISC_STATUS rem_port::send_response(PACKET* p, OBJCT obj, ULONG length, const Firebird::IStatus* status, bool defer_flag)
|
||||
{
|
||||
ISC_STATUS_BIG_ARRAY tmp;
|
||||
fb_utils::mergeStatus(tmp, FB_NELEM(tmp), status);
|
||||
return send_response(p, obj, length, tmp, defer_flag);
|
||||
SimpleStatusVector<> tmp;
|
||||
tmp.mergeStatus(status);
|
||||
return send_response(p, obj, length, tmp.begin(), defer_flag);
|
||||
}
|
||||
|
||||
|
||||
@ -5161,7 +5201,8 @@ ISC_STATUS rem_port::send_response( PACKET* sendL,
|
||||
// Maybe this can be a member of rem_port?
|
||||
static void send_error(rem_port* port, PACKET* apacket, ISC_STATUS errcode)
|
||||
{
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
(Arg::Gds(errcode)).copyTo(&status_vector);
|
||||
port->send_response(apacket, 0, 0, &status_vector, false);
|
||||
}
|
||||
@ -5169,7 +5210,8 @@ static void send_error(rem_port* port, PACKET* apacket, ISC_STATUS errcode)
|
||||
// Maybe this can be a member of rem_port?
|
||||
static void send_error(rem_port* port, PACKET* apacket, const Firebird::Arg::StatusVector& err)
|
||||
{
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
err.copyTo(&status_vector);
|
||||
port->send_response(apacket, 0, 0, &status_vector, false);
|
||||
}
|
||||
@ -5258,7 +5300,8 @@ ISC_STATUS rem_port::service_attach(const char* service_name,
|
||||
}
|
||||
|
||||
DispatcherPtr provider;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
provider->setDbCryptCallback(&status_vector, port_server_crypt_callback->getInterface());
|
||||
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS))
|
||||
@ -5298,7 +5341,8 @@ ISC_STATUS rem_port::service_end(P_RLSE* /*release*/, PACKET* sendL)
|
||||
* Close down a service.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_service(&status_vector, rdb))
|
||||
@ -5328,7 +5372,8 @@ void rem_port::service_start(P_INFO * stuff, PACKET* sendL)
|
||||
* Start a service on the server
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_service(&status_vector, rdb))
|
||||
@ -5357,7 +5402,8 @@ ISC_STATUS rem_port::set_cursor(P_SQLCUR * sqlcur, PACKET* sendL)
|
||||
*
|
||||
*****************************************/
|
||||
Rsr* statement;
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
const char* name = reinterpret_cast<const char*>(sqlcur->p_sqlcur_cursor_name.cstr_address);
|
||||
|
||||
getHandle(statement, sqlcur->p_sqlcur_statement);
|
||||
@ -5438,7 +5484,8 @@ void rem_port::start_crypt(P_CRYPT * crypt, PACKET* sendL)
|
||||
}
|
||||
|
||||
// Initialize crypt key
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
cp.plugin()->setKey(&st, key);
|
||||
check(&st);
|
||||
|
||||
@ -5512,7 +5559,8 @@ ISC_STATUS rem_port::start(P_OP operation, P_DATA * data, PACKET* sendL)
|
||||
requestL = REMOTE_find_request(requestL, data->p_data_incarnation);
|
||||
REMOTE_reset_request(requestL, 0);
|
||||
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
requestL->rrq_iface->start(&status_vector, transaction->rtr_iface, data->p_data_incarnation);
|
||||
|
||||
@ -5538,7 +5586,8 @@ ISC_STATUS rem_port::start_and_send(P_OP operation, P_DATA* data, PACKET* sendL)
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
Rtr* transaction;
|
||||
getHandle(transaction, data->p_data_transaction);
|
||||
|
||||
@ -5585,7 +5634,8 @@ ISC_STATUS rem_port::start_transaction(P_OP operation, P_STTR * stuff, PACKET* s
|
||||
* Start a transaction.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
|
||||
Rdb* rdb = this->port_context;
|
||||
if (bad_db(&status_vector, rdb))
|
||||
@ -5928,7 +5978,8 @@ ISC_STATUS rem_port::transact_request(P_TRRQ* trrq, PACKET* sendL)
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus status_vector;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
Rtr* transaction;
|
||||
|
||||
getHandle(transaction, trrq->p_trrq_transaction);
|
||||
|
@ -267,7 +267,8 @@ namespace
|
||||
|
||||
IConfig* findDefConfig(ConfigFile* defaultConfig, const PathName& confName)
|
||||
{
|
||||
Firebird::LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
if (defaultConfig)
|
||||
{
|
||||
const ConfigFile::Parameter* p = defaultConfig->findParameter("Config");
|
||||
@ -588,7 +589,8 @@ namespace
|
||||
fprintf(stderr, "~FactoryParameter places configuredPlugin %s in unload query for %d seconds\n",
|
||||
configuredPlugin->getPlugName(), configuredPlugin->getReleaseDelay() / 1000000);
|
||||
#endif
|
||||
LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
TimerInterfacePtr()->start(&s, configuredPlugin, configuredPlugin->getReleaseDelay());
|
||||
// errors are ignored here - configuredPlugin will be released at once
|
||||
}
|
||||
@ -602,7 +604,8 @@ namespace
|
||||
FactoryParameter* par = new FactoryParameter(this, firebirdConf);
|
||||
par->addRef();
|
||||
|
||||
Firebird::LocalStatus s;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper s(&ls);
|
||||
IPluginBase* plugin = module->getPlugin(regPlugin).factory->createPlugin(&s, par);
|
||||
|
||||
if (!(s.getState() & Firebird::IStatus::STATE_ERRORS))
|
||||
|
@ -185,7 +185,8 @@ void load(CheckStatusWrapper* status, ISC_QUAD* blobId, IAttachment* att, ITrans
|
||||
* Load a blob from a file.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus temp;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper temp(&ls);
|
||||
|
||||
// Open the blob. If it failed, what the hell -- just return failure
|
||||
IBlob* blob = att->createBlob(status, tra, blobId, 0, NULL);
|
||||
@ -267,7 +268,8 @@ void dump(CheckStatusWrapper* status, ISC_QUAD* blobId, IAttachment* att, ITrans
|
||||
|
||||
// Close the blob
|
||||
|
||||
LocalStatus temp;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper temp(&ls);
|
||||
blob->close(&temp);
|
||||
}
|
||||
|
||||
@ -1559,7 +1561,8 @@ int API_ROUTINE isc_version(FB_API_HANDLE* handle, FPTR_VERSION_CALLBACK routine
|
||||
if (!routine)
|
||||
routine = print_version;
|
||||
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
RefPtr<IAttachment> att(REF_NO_INCR, handleToIAttachment(&st, handle));
|
||||
if (st.getState() & IStatus::STATE_ERRORS)
|
||||
return FB_FAILURE;
|
||||
@ -1799,7 +1802,8 @@ static int any_text_dump(ISC_QUAD* blob_id,
|
||||
* Dump a blob into a file.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
RefPtr<IAttachment> att(REF_NO_INCR, handleToIAttachment(&st, &database));
|
||||
if (st.getState() & Firebird::IStatus::STATE_ERRORS)
|
||||
return FB_FAILURE;
|
||||
@ -2015,7 +2019,8 @@ static int any_text_load(ISC_QUAD* blob_id,
|
||||
* Return TRUE is successful.
|
||||
*
|
||||
**************************************/
|
||||
LocalStatus st;
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper st(&ls);
|
||||
RefPtr<IAttachment> att(REF_NO_INCR, handleToIAttachment(&st, &database));
|
||||
if (st.getState() & Firebird::IStatus::STATE_ERRORS)
|
||||
return FB_FAILURE;
|
||||
|
Loading…
Reference in New Issue
Block a user