mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 18:43:02 +01:00
Divide IStatus information into 3 parts: errors, warnings and completion code.
Errors and warnings are processed in IStatus independently. Completion code is moved away from IStatus and returned directly by appropriate functions. Replaced isSuccess() with more generic function getStatus(), which sets appropriate bits in returned value when errors/warnings are present. Also use same style when returning bytes' array and it's length in different interfaces.
This commit is contained in:
parent
733e3e22f3
commit
d513daa574
@ -197,7 +197,7 @@ void CryptKeyHolder::noKeyError(IStatus* status)
|
||||
vector[2] = isc_arg_string;
|
||||
vector[3] = (ISC_STATUS) "Key not set";
|
||||
vector[4] = isc_arg_end;
|
||||
status->set(vector);
|
||||
status->setErrors(vector);
|
||||
}
|
||||
|
||||
int FB_CARG CryptKeyHolder::keyCallback(IStatus* status, ICryptKeyCallback* callback)
|
||||
@ -208,12 +208,12 @@ int FB_CARG CryptKeyHolder::keyCallback(IStatus* status, ICryptKeyCallback* call
|
||||
return 1;
|
||||
|
||||
IConfig* def = config->getDefaultConfig(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return 1;
|
||||
|
||||
IConfigEntry* confEntry = def->find(status, "Auto");
|
||||
def->release();
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return 1;
|
||||
|
||||
if (confEntry)
|
||||
|
@ -152,7 +152,7 @@ void DbCrypt::noKeyError(IStatus* status)
|
||||
vector[2] = isc_arg_string;
|
||||
vector[3] = (ISC_STATUS)"Key not set";
|
||||
vector[4] = isc_arg_end;
|
||||
status->set(vector);
|
||||
status->setErrors(vector);
|
||||
}
|
||||
|
||||
void FB_CARG DbCrypt::encrypt(IStatus* status, unsigned int length, const void* from, void* to)
|
||||
@ -201,11 +201,11 @@ void FB_CARG DbCrypt::setKey(IStatus* status, unsigned int length, IKeyHolderPlu
|
||||
return;
|
||||
|
||||
IConfig* def = config->getDefaultConfig(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
IConfigEntry* confEntry = def->find(status, "Auto");
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
def->release();
|
||||
return;
|
||||
@ -238,7 +238,7 @@ void FB_CARG DbCrypt::setKey(IStatus* status, unsigned int length, IKeyHolderPlu
|
||||
for (unsigned n = 0; n < length; ++n)
|
||||
{
|
||||
ICryptKeyCallback* callback = sources[n]->keyHandle(status, "sample");
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
if (callback && callback->callback(0, NULL, 1, &key) == 1)
|
||||
|
@ -49,7 +49,7 @@ static IMaster* master = fb_get_master_interface();
|
||||
// Probably not best way of error processing, but it's OK for a sample
|
||||
static void check(IStatus* s, const char* text)
|
||||
{
|
||||
if (!s->isSuccess())
|
||||
if (s->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
throw text;
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ int main()
|
||||
rc = 1;
|
||||
fprintf(stderr, "%s:\n", text);
|
||||
if (st)
|
||||
isc_print_status(st->get());
|
||||
isc_print_status(st->getErrors());
|
||||
}
|
||||
|
||||
// release interfaces after error caught
|
||||
|
@ -55,7 +55,7 @@ int Input_ptr = 0;
|
||||
|
||||
static void check(IStatus* s, const char* text)
|
||||
{
|
||||
if (!s->isSuccess())
|
||||
if (s->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
throw text;
|
||||
}
|
||||
|
||||
@ -152,9 +152,9 @@ int main()
|
||||
|
||||
// Update the budget.
|
||||
stmt->execute(st, tra, meta, buffer, NULL, NULL);
|
||||
if (!st->isSuccess())
|
||||
if (st->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
int sqlcode = isc_sqlcode(st->get());
|
||||
int sqlcode = isc_sqlcode(st->getErrors());
|
||||
// Don't save the update, if the new budget exceeds the limit.
|
||||
if (sqlcode == -625)
|
||||
{
|
||||
@ -198,7 +198,7 @@ int main()
|
||||
rc = 1;
|
||||
fprintf(stderr, "%s:\n", text);
|
||||
if (st)
|
||||
isc_print_status(st->get());
|
||||
isc_print_status(st->getErrors());
|
||||
}
|
||||
|
||||
// release interfaces after error caught
|
||||
|
@ -46,7 +46,7 @@ static IMaster* master = fb_get_master_interface();
|
||||
|
||||
static void check(IStatus* s, const char* text)
|
||||
{
|
||||
if (!s->isSuccess())
|
||||
if (s->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
throw text;
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ int main()
|
||||
unsigned char* buffer = new unsigned char[l];
|
||||
|
||||
// fetch records from cursor and print them
|
||||
while (curs->fetchNext(st, buffer))
|
||||
while (curs->fetchNext(st, buffer) == IStatus::FB_OK)
|
||||
{
|
||||
for (unsigned j = 0; j < cols; ++j)
|
||||
{
|
||||
@ -196,7 +196,7 @@ int main()
|
||||
rc = 1;
|
||||
fprintf(stderr, "%s:\n", text);
|
||||
if (st)
|
||||
isc_print_status(st->get());
|
||||
isc_print_status(st->getErrors());
|
||||
}
|
||||
|
||||
// release interfaces after error caught
|
||||
|
@ -45,7 +45,7 @@ static IMaster* master = fb_get_master_interface();
|
||||
|
||||
static void check(IStatus* s, const char* text)
|
||||
{
|
||||
if (!s->isSuccess())
|
||||
if (s->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
throw text;
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ int main()
|
||||
unsigned char* buffer = new unsigned char[l];
|
||||
|
||||
// fetch records from cursor
|
||||
while (curs->fetchNext(st, buffer))
|
||||
while (curs->fetchNext(st, buffer) == IStatus::FB_OK)
|
||||
{
|
||||
for (unsigned j = 0; j < f; ++j)
|
||||
{
|
||||
@ -190,7 +190,7 @@ int main()
|
||||
fflush(stdout);
|
||||
fprintf(stderr, " %s:\n", text);
|
||||
if (st)
|
||||
isc_print_status(st->get());
|
||||
isc_print_status(st->getErrors());
|
||||
}
|
||||
|
||||
if (meta)
|
||||
@ -260,15 +260,14 @@ void MyField::print(IStatus* st, IAttachment* att, ITransaction* tra, unsigned c
|
||||
char segbuf[16];
|
||||
unsigned len;
|
||||
// read data segment by segment
|
||||
while ( (len = blob->getSegment(st, sizeof(segbuf), segbuf)) )
|
||||
for(;;)
|
||||
{
|
||||
// to be reviewed after A1 - need better segment/eof handling
|
||||
if (st->get()[1] != isc_segment)
|
||||
check(st, "getSegment");
|
||||
int cc = blob->getSegment(st, sizeof(segbuf), segbuf, &len);
|
||||
if (cc != IStatus::FB_OK && cc != IStatus::FB_SEGMENT)
|
||||
break;
|
||||
fwrite(segbuf, sizeof(char), len, stdout);
|
||||
}
|
||||
if (st->get()[1] != isc_segstr_eof)
|
||||
check(st, "getSegment");
|
||||
check(st, "getSegment");
|
||||
|
||||
// close BLOB after receiving all data
|
||||
blob->close(st);
|
||||
|
@ -676,7 +676,7 @@ FB_UDR_BEGIN_TRIGGER(replicate)
|
||||
|
||||
// This will not work if the table has computed fields.
|
||||
stmt->execute(status, transaction, triggerMetadata, newFields, NULL, NULL);
|
||||
StatusException::check(status->get());
|
||||
StatusException::check(status->getErrors());
|
||||
}
|
||||
|
||||
AutoRelease<IMessageMetadata> triggerMetadata;
|
||||
@ -785,7 +785,7 @@ FB_UDR_BEGIN_TRIGGER(replicate_persons)
|
||||
ITransaction* transaction = StatusException::check(status, context->getTransaction(status));
|
||||
|
||||
stmt->execute(status, transaction, triggerMetadata, newFields, NULL, NULL);
|
||||
StatusException::check(status->get());
|
||||
StatusException::check(status->getErrors());
|
||||
}
|
||||
|
||||
AutoRelease<IMessageMetadata> triggerMetadata;
|
||||
|
@ -86,7 +86,7 @@ int FB_CARG DebugServer::authenticate(Firebird::IStatus* status, IServerBlock* s
|
||||
fprintf(stderr, "DebugServer::authenticate1: %s\n", str.c_str());
|
||||
#endif
|
||||
sb->putData(status, str.length(), str.c_str());
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
@ -167,7 +167,7 @@ int FB_CARG DebugClient::authenticate(Firebird::IStatus* status, IClientBlock* c
|
||||
fprintf(stderr, "DebugClient::authenticate: sending %s\n", str.c_str());
|
||||
#endif
|
||||
cb->putData(status, str.length(), str.c_str());
|
||||
if (! status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ public:
|
||||
{
|
||||
Firebird::LocalStatus st;
|
||||
Firebird::IMessageMetadata* m = out ? stmt->getOutputMetadata(&st) : stmt->getInputMetadata(&st);
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
Firebird::status_exception::raise(st.get());
|
||||
Firebird::status_exception::raise(&st);
|
||||
}
|
||||
assignRefNoIncr(m);
|
||||
}
|
||||
@ -171,13 +171,13 @@ public:
|
||||
|
||||
static void check(Firebird::IStatus* status)
|
||||
{
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
#ifdef INTERNAL_FIREBIRD
|
||||
Firebird::status_exception::raise(status->get());
|
||||
Firebird::status_exception::raise(status);
|
||||
#else
|
||||
char s[100];
|
||||
const ISC_STATUS* st = status->get();
|
||||
const ISC_STATUS* st = status->getErrors();
|
||||
fb_interpret(s, sizeof(s), &st);
|
||||
fatalErrorHandler(s);
|
||||
#endif
|
||||
|
@ -75,7 +75,7 @@ int SrpClient::authenticate(IStatus* status, IClientBlock* cb)
|
||||
client->genClientKey(data);
|
||||
dumpIt("Clnt: clientPubKey", data);
|
||||
cb->putData(status, data.length(), data.begin());
|
||||
return status->isSuccess() ? AUTH_MORE_DATA : AUTH_FAILED;
|
||||
return status->getStatus() & IStatus::FB_HAS_ERRORS ? AUTH_FAILED : AUTH_MORE_DATA;
|
||||
}
|
||||
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: SRP phase2\n"));
|
||||
@ -125,7 +125,7 @@ int SrpClient::authenticate(IStatus* status, IClientBlock* cb)
|
||||
cProof.getText(data);
|
||||
|
||||
cb->putData(status, data.length(), data.c_str());
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
@ -133,7 +133,7 @@ int SrpClient::authenticate(IStatus* status, IClientBlock* cb)
|
||||
// output the key
|
||||
FbCryptKey cKey = {"Symmetric", sessionKey.begin(), NULL, sessionKey.getCount(), 0};
|
||||
cb->putKey(status, &cKey);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ private:
|
||||
selGrantor.c_str(), SQL_DIALECT_V6, NULL, NULL, out.getMetadata(), NULL);
|
||||
check(&s);
|
||||
|
||||
bool hasGrant = curs->fetchNext(&s, out.getBuffer());
|
||||
bool hasGrant = curs->fetchNext(&s, out.getBuffer()) == Firebird::IStatus::FB_OK;
|
||||
curs->close(&s);
|
||||
check(&s);
|
||||
|
||||
@ -212,8 +212,8 @@ public:
|
||||
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
|
||||
dpb.insertByte(isc_dpb_sec_attach, TRUE);
|
||||
|
||||
const unsigned char* authBlock;
|
||||
unsigned int authBlockSize = logonInfo->authBlock(&authBlock);
|
||||
unsigned int authBlockSize;
|
||||
const unsigned char* authBlock = logonInfo->authBlock(&authBlockSize);
|
||||
|
||||
const char* str = logonInfo->role();
|
||||
if (str && str[0])
|
||||
@ -297,16 +297,16 @@ public:
|
||||
for (unsigned repeat = 0; ; ++repeat)
|
||||
{
|
||||
stmt = att->prepare(status, tra, 0, insert, SQL_DIALECT_V6, Firebird::IStatement::PREPARE_PREFETCH_METADATA);
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (repeat > 0)
|
||||
{
|
||||
Firebird::status_exception::raise(status->get());
|
||||
Firebird::status_exception::raise(status);
|
||||
}
|
||||
|
||||
if (fb_utils::containsErrorCode(status->get(), isc_dsql_relation_err))
|
||||
if (fb_utils::containsErrorCode(status->getErrors(), isc_dsql_relation_err))
|
||||
{
|
||||
prepareDataStructures();
|
||||
tra->commit(status);
|
||||
@ -562,7 +562,7 @@ public:
|
||||
(par ? par->getBuffer() : NULL), om);
|
||||
check(status);
|
||||
|
||||
while (rs->fetchNext(status, di.getBuffer()))
|
||||
while (rs->fetchNext(status, di.getBuffer()) == Firebird::IStatus::FB_OK)
|
||||
{
|
||||
listField(user->userName(), login);
|
||||
listField(user->firstName(), first);
|
||||
@ -613,7 +613,7 @@ public:
|
||||
if (tra)
|
||||
{
|
||||
tra->commit(status);
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
tra = NULL;
|
||||
}
|
||||
@ -625,7 +625,7 @@ public:
|
||||
if (tra)
|
||||
{
|
||||
tra->rollback(status);
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
tra = NULL;
|
||||
}
|
||||
@ -641,7 +641,7 @@ public:
|
||||
if (att)
|
||||
{
|
||||
att->detach(&status);
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
att = NULL;
|
||||
}
|
||||
@ -690,10 +690,10 @@ private:
|
||||
|
||||
static void check(Firebird::IStatus* status)
|
||||
{
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
checkStatusVectorForMissingTable(status->get());
|
||||
Firebird::status_exception::raise(status->get());
|
||||
checkStatusVectorForMissingTable(status->getErrors());
|
||||
Firebird::status_exception::raise(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -841,14 +841,14 @@ private:
|
||||
|
||||
char segbuf[256];
|
||||
unsigned len;
|
||||
while ( (len = blob->getSegment(&st, sizeof(segbuf), segbuf)) )
|
||||
for (;;)
|
||||
{
|
||||
if (st.get()[1] != isc_segment)
|
||||
check(&st);
|
||||
int cc = blob->getSegment(&st, sizeof(segbuf), segbuf, &len);
|
||||
check(&st);
|
||||
if (cc == Firebird::IStatus::FB_EOF)
|
||||
break;
|
||||
s.append(segbuf, len);
|
||||
}
|
||||
if (st.get()[1] != isc_segstr_eof)
|
||||
check(&st);
|
||||
|
||||
blob->close(&st);
|
||||
check(&st);
|
||||
|
@ -133,10 +133,7 @@ int SrpServer::authenticate(IStatus* status, IServerBlock* sb, IWriter* writerIn
|
||||
const char* providers = "Providers=" CURRENT_ENGINE;
|
||||
dpb.insertString(isc_dpb_config, providers, fb_strlen(providers));
|
||||
att = p->attachDatabase(status, secDbName, dpb.getBufferLength(), dpb.getBuffer());
|
||||
if (!status->isSuccess())
|
||||
{
|
||||
status_exception::raise(status->get());
|
||||
}
|
||||
check(status);
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "Srv SRP: attached sec db %s\n", secDbName));
|
||||
|
||||
const UCHAR tpb[] =
|
||||
@ -148,19 +145,16 @@ int SrpServer::authenticate(IStatus* status, IServerBlock* sb, IWriter* writerIn
|
||||
isc_tpb_wait
|
||||
};
|
||||
tra = att->startTransaction(status, sizeof(tpb), tpb);
|
||||
if (!status->isSuccess())
|
||||
{
|
||||
status_exception::raise(status->get());
|
||||
}
|
||||
check(status);
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: SRP1: started transaction\n"));
|
||||
|
||||
const char* sql =
|
||||
"SELECT PLG$VERIFIER, PLG$SALT FROM PLG$SRP WHERE PLG$USER_NAME = ? AND PLG$ACTIVE";
|
||||
stmt = att->prepare(status, tra, 0, sql, 3, IStatement::PREPARE_PREFETCH_METADATA);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
checkStatusVectorForMissingTable(status->get());
|
||||
status_exception::raise(status->get());
|
||||
checkStatusVectorForMissingTable(status->getErrors());
|
||||
status_exception::raise(status);
|
||||
}
|
||||
|
||||
Meta im(stmt, false);
|
||||
@ -170,20 +164,14 @@ int SrpServer::authenticate(IStatus* status, IServerBlock* sb, IWriter* writerIn
|
||||
|
||||
Meta om(stmt, true);
|
||||
Message dat(om);
|
||||
if (!status->isSuccess())
|
||||
{
|
||||
status_exception::raise(status->get());
|
||||
}
|
||||
check(status);
|
||||
Field<Varying> verify(dat);
|
||||
Field<Varying> slt(dat);
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: SRP1: Ready to run statement with login '%s'\n", account.c_str()));
|
||||
|
||||
stmt->execute(status, tra, par.getMetadata(), par.getBuffer(),
|
||||
dat.getMetadata(), dat.getBuffer());
|
||||
if (!status->isSuccess())
|
||||
{
|
||||
status_exception::raise(status->get());
|
||||
}
|
||||
check(status);
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: SRP1: Executed statement\n"));
|
||||
|
||||
verifier.assign(reinterpret_cast<const UCHAR*>((const char*) verify), RemotePassword::SRP_VERIFIER_SIZE);
|
||||
@ -194,24 +182,15 @@ int SrpServer::authenticate(IStatus* status, IServerBlock* sb, IWriter* writerIn
|
||||
dumpIt("Srv: salt", salt);
|
||||
|
||||
stmt->free(status);
|
||||
if (!status->isSuccess())
|
||||
{
|
||||
status_exception::raise(status->get());
|
||||
}
|
||||
check(status);
|
||||
stmt = NULL;
|
||||
|
||||
tra->rollback(status);
|
||||
if (!status->isSuccess())
|
||||
{
|
||||
status_exception::raise(status->get());
|
||||
}
|
||||
check(status);
|
||||
tra = NULL;
|
||||
|
||||
att->detach(status);
|
||||
if (!status->isSuccess())
|
||||
{
|
||||
status_exception::raise(status->get());
|
||||
}
|
||||
check(status);
|
||||
att = NULL;
|
||||
}
|
||||
catch(const Exception&)
|
||||
@ -241,7 +220,7 @@ int SrpServer::authenticate(IStatus* status, IServerBlock* sb, IWriter* writerIn
|
||||
dumpIt("Srv: serverPubKey", serverPubKey);
|
||||
dumpBin("Srv: data", data);
|
||||
sb->putData(status, data.length(), data.c_str());
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
@ -252,7 +231,7 @@ int SrpServer::authenticate(IStatus* status, IServerBlock* sb, IWriter* writerIn
|
||||
// output the key
|
||||
FbCryptKey cKey = {"Symmetric", sessionKey.begin(), NULL, sessionKey.getCount(), 0};
|
||||
sb->putKey(status, &cKey);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
@ -271,12 +250,12 @@ int SrpServer::authenticate(IStatus* status, IServerBlock* sb, IWriter* writerIn
|
||||
{
|
||||
MasterInterfacePtr()->upgradeInterface(writerInterface, FB_AUTH_WRITER_VERSION, upInfo);
|
||||
writerInterface->add(status, account.c_str());
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
writerInterface->setDb(status, secDbName);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ int SecurityDatabaseClient::authenticate(Firebird::IStatus* status, IClientBlock
|
||||
TEXT pwt[Auth::MAX_LEGACY_PASSWORD_LENGTH + 2];
|
||||
ENC_crypt(pwt, sizeof pwt, cb->getPassword(), Auth::LEGACY_PASSWORD_SALT);
|
||||
cb->putData(status, static_cast<unsigned>(strlen(&pwt[2])), &pwt[2]);
|
||||
if (! status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ void FB_CARG SecurityDatabaseManagement::start(Firebird::IStatus* st, ILogonInfo
|
||||
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
|
||||
dpb.insertByte(isc_dpb_sec_attach, TRUE);
|
||||
|
||||
const unsigned char* authBlock;
|
||||
unsigned int authBlockSize = logonInfo->authBlock(&authBlock);
|
||||
unsigned int authBlockSize;
|
||||
const unsigned char* authBlock = logonInfo->authBlock(&authBlockSize);
|
||||
|
||||
if (authBlockSize)
|
||||
dpb.insertBytes(isc_dpb_auth_block, authBlock, authBlockSize);
|
||||
@ -747,7 +747,7 @@ int FB_CARG SecurityDatabaseManagement::execute(Firebird::IStatus* st, IUser* us
|
||||
}
|
||||
}
|
||||
|
||||
st->set(isc_status);
|
||||
fb_utils::setIStatus(st, isc_status);
|
||||
}
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
|
@ -509,7 +509,7 @@ int SecurityDatabaseServer::authenticate(Firebird::IStatus* status, IServerBlock
|
||||
#ifdef USE_ATT_RQ_CACHE
|
||||
LocalStatus s;
|
||||
TimerInterfacePtr()->start(&s, instance, 10 * 1000 * 1000);
|
||||
if (!s.isSuccess())
|
||||
if (s.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
instance->handler();
|
||||
#else
|
||||
instance->handler();
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "../common/BigInteger.h"
|
||||
#include "../common/os/guid.h"
|
||||
#include "../common/StatusArg.h"
|
||||
|
||||
#define CHECK_MP(a) check(a, #a)
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "iberror.h"
|
||||
#include "../common/classes/array.h"
|
||||
#include "../common/StatusArg.h"
|
||||
|
||||
|
||||
namespace Jrd {
|
||||
|
@ -267,8 +267,8 @@ public:
|
||||
private:
|
||||
void raiseIndexError(IStatus* status, unsigned index, const char* method) const
|
||||
{
|
||||
status->set((Arg::Gds(isc_invalid_index_val) <<
|
||||
Arg::Num(index) << (string("IMessageMetadata::") + method)).value());
|
||||
(Arg::Gds(isc_invalid_index_val) <<
|
||||
Arg::Num(index) << (string("IMessageMetadata::") + method)).copyTo(status);
|
||||
}
|
||||
|
||||
void assign(IMessageMetadata* from);
|
||||
|
@ -53,7 +53,7 @@ namespace Firebird {
|
||||
|
||||
namespace Arg {
|
||||
|
||||
Base::Base(ISC_STATUS k, ISC_STATUS c) :
|
||||
Base::Base(ISC_STATUS k, ISC_STATUS c) throw(Firebird::BadAlloc) :
|
||||
implementation(FB_NEW(*getDefaultMemoryPool()) ImplBase(k, c))
|
||||
{
|
||||
}
|
||||
@ -70,18 +70,36 @@ StatusVector::ImplStatusVector::ImplStatusVector(const ISC_STATUS* s) throw() :
|
||||
}
|
||||
}
|
||||
|
||||
StatusVector::StatusVector(ISC_STATUS k, ISC_STATUS c) :
|
||||
StatusVector::ImplStatusVector::ImplStatusVector(const IStatus* s) throw() : Base::ImplBase(0, 0)
|
||||
{
|
||||
fb_assert(s);
|
||||
|
||||
clear();
|
||||
// special case - empty IStatus
|
||||
if (s->getStatus() != 0)
|
||||
{
|
||||
append(s->getErrors(), FB_NELEM(m_status_vector) - 1);
|
||||
append(s->getWarnings(), FB_NELEM(m_status_vector) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
StatusVector::StatusVector(ISC_STATUS k, ISC_STATUS c) throw(Firebird::BadAlloc) :
|
||||
Base(FB_NEW(*getDefaultMemoryPool()) ImplStatusVector(k, c))
|
||||
{
|
||||
operator<<(*(static_cast<Base*>(this)));
|
||||
}
|
||||
|
||||
StatusVector::StatusVector(const ISC_STATUS* s) :
|
||||
StatusVector::StatusVector(const ISC_STATUS* s) throw(Firebird::BadAlloc) :
|
||||
Base(FB_NEW(*getDefaultMemoryPool()) ImplStatusVector(s))
|
||||
{
|
||||
}
|
||||
|
||||
StatusVector::StatusVector() :
|
||||
StatusVector::StatusVector(const IStatus* s) throw(Firebird::BadAlloc) :
|
||||
Base(FB_NEW(*getDefaultMemoryPool()) ImplStatusVector(s))
|
||||
{
|
||||
}
|
||||
|
||||
StatusVector::StatusVector() throw(Firebird::BadAlloc) :
|
||||
Base(FB_NEW(*getDefaultMemoryPool()) ImplStatusVector(0, 0))
|
||||
{
|
||||
}
|
||||
@ -150,6 +168,19 @@ bool StatusVector::ImplStatusVector::append(const ISC_STATUS* const from, const
|
||||
fb_utils::copyStatus(&m_status_vector[m_length], FB_NELEM(m_status_vector) - m_length, from, count);
|
||||
m_length += copied;
|
||||
|
||||
if (!m_warning)
|
||||
{
|
||||
for (unsigned n = 0; n < m_length; )
|
||||
{
|
||||
if (m_status_vector[n] == isc_arg_warning)
|
||||
{
|
||||
m_warning = n;
|
||||
break;
|
||||
}
|
||||
n += (m_status_vector[n] == isc_arg_cstring) ? 3 : 2;
|
||||
}
|
||||
}
|
||||
|
||||
return copied == count;
|
||||
}
|
||||
|
||||
@ -212,16 +243,23 @@ ISC_STATUS StatusVector::ImplStatusVector::copyTo(ISC_STATUS* dest) const throw(
|
||||
|
||||
ISC_STATUS StatusVector::ImplStatusVector::copyTo(IStatus* dest) const throw()
|
||||
{
|
||||
dest->init();
|
||||
if (hasData())
|
||||
{
|
||||
dest->set(length() + 1u, value());
|
||||
const ISC_STATUS* v = m_status_vector;
|
||||
unsigned int length = m_length;
|
||||
unsigned int warning = m_warning;
|
||||
|
||||
if (v[warning] == isc_arg_warning)
|
||||
{
|
||||
dest->setWarnings(length - warning, &v[warning]);
|
||||
if (warning)
|
||||
dest->setErrors(warning, v);
|
||||
}
|
||||
else
|
||||
dest->setErrors(length, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
ISC_STATUS t[3] = {isc_arg_gds, FB_SUCCESS, isc_arg_end};
|
||||
dest->set(3, t);
|
||||
}
|
||||
return dest->get()[1];
|
||||
return m_status_vector[1];
|
||||
}
|
||||
|
||||
Gds::Gds(ISC_STATUS s) throw() :
|
||||
|
@ -29,6 +29,8 @@
|
||||
#ifndef FB_STATUS_ARG
|
||||
#define FB_STATUS_ARG
|
||||
|
||||
#include "fb_exception.h"
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
class IStatus;
|
||||
@ -82,9 +84,9 @@ protected:
|
||||
virtual ~ImplBase() { }
|
||||
};
|
||||
|
||||
Base(ISC_STATUS k, ISC_STATUS c);// : implementation(new ImplBase(k, c)) { }
|
||||
Base(ISC_STATUS k, ISC_STATUS c) throw(Firebird::BadAlloc);
|
||||
explicit Base(ImplBase* i) throw() : implementation(i) { }
|
||||
~Base() { delete implementation; }
|
||||
~Base() throw() { delete implementation; }
|
||||
|
||||
ImplBase* const implementation;
|
||||
|
||||
@ -130,13 +132,15 @@ protected:
|
||||
}
|
||||
|
||||
explicit ImplStatusVector(const ISC_STATUS* s) throw();
|
||||
explicit ImplStatusVector(const IStatus* s) throw();
|
||||
};
|
||||
|
||||
StatusVector(ISC_STATUS k, ISC_STATUS v);
|
||||
StatusVector(ISC_STATUS k, ISC_STATUS v) throw(Firebird::BadAlloc);
|
||||
|
||||
public:
|
||||
explicit StatusVector(const ISC_STATUS* s);
|
||||
StatusVector();
|
||||
explicit StatusVector(const ISC_STATUS* s) throw(Firebird::BadAlloc);
|
||||
explicit StatusVector(const IStatus* s) throw(Firebird::BadAlloc);
|
||||
StatusVector() throw(Firebird::BadAlloc);
|
||||
~StatusVector() { }
|
||||
|
||||
const ISC_STATUS* value() const throw() { return implementation->value(); }
|
||||
|
@ -90,6 +90,13 @@ ISC_STATUS DynamicStatusVector::save(const ISC_STATUS* status)
|
||||
return m_status_vector[1];
|
||||
}
|
||||
|
||||
ISC_STATUS DynamicStatusVector::save(const IStatus* status)
|
||||
{
|
||||
ISC_STATUS_ARRAY tmp;
|
||||
fb_utils::mergeStatus(tmp, FB_NELEM(tmp), status);
|
||||
return save(tmp);
|
||||
}
|
||||
|
||||
void DynamicStatusVector::clear()
|
||||
{
|
||||
ISC_STATUS *ptr = m_status_vector.begin();
|
||||
@ -129,7 +136,7 @@ void DynamicStatusVector::clear()
|
||||
fb_utils::init_status(m_status_vector.begin());
|
||||
}
|
||||
|
||||
ISC_STATUS StatusHolder::save(const ISC_STATUS* status)
|
||||
ISC_STATUS StatusHolder::save(IStatus* status)
|
||||
{
|
||||
fb_assert(isSuccess() || m_raised);
|
||||
if (m_raised)
|
||||
@ -137,12 +144,15 @@ ISC_STATUS StatusHolder::save(const ISC_STATUS* status)
|
||||
clear();
|
||||
}
|
||||
|
||||
return m_status_vector.save(status);
|
||||
m_error.save(status->getErrors());
|
||||
m_warning.save(status->getWarnings());
|
||||
return m_error.value()[1];
|
||||
}
|
||||
|
||||
void StatusHolder::clear()
|
||||
{
|
||||
m_status_vector.clear();
|
||||
m_error.clear();
|
||||
m_warning.clear();
|
||||
m_raised = false;
|
||||
}
|
||||
|
||||
@ -150,8 +160,10 @@ void StatusHolder::raise()
|
||||
{
|
||||
if (getError())
|
||||
{
|
||||
Arg::StatusVector tmp(m_error.value());
|
||||
tmp << Arg::StatusVector(m_warning.value());
|
||||
m_raised = true;
|
||||
status_exception::raise(m_status_vector.value());
|
||||
tmp.raise();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,45 +40,93 @@ class BaseStatus : public IStatus
|
||||
{
|
||||
public:
|
||||
// IStatus implementation
|
||||
virtual void FB_CARG set(const ISC_STATUS* value)
|
||||
{
|
||||
set(fb_utils::statusLength(value), value);
|
||||
}
|
||||
|
||||
virtual void FB_CARG set(unsigned int length, const ISC_STATUS* value)
|
||||
{
|
||||
fb_utils::copyStatus(vector, FB_NELEM(vector), value, length);
|
||||
}
|
||||
|
||||
virtual void FB_CARG init()
|
||||
{
|
||||
fb_utils::init_status(vector);
|
||||
errors.init();
|
||||
warnings.init();
|
||||
}
|
||||
|
||||
virtual const ISC_STATUS* FB_CARG get() const
|
||||
virtual void FB_CARG setErrors(const ISC_STATUS* value)
|
||||
{
|
||||
return vector;
|
||||
errors.set(fb_utils::statusLength(value), value);
|
||||
}
|
||||
|
||||
virtual int FB_CARG isSuccess() const
|
||||
virtual void FB_CARG setErrors(unsigned int length, const ISC_STATUS* value)
|
||||
{
|
||||
return vector[1] == 0;
|
||||
errors.set(length, value);
|
||||
}
|
||||
|
||||
virtual void FB_CARG setWarnings(const ISC_STATUS* value)
|
||||
{
|
||||
warnings.set(fb_utils::statusLength(value), value);
|
||||
}
|
||||
|
||||
virtual void FB_CARG setWarnings(unsigned int length, const ISC_STATUS* value)
|
||||
{
|
||||
warnings.set(length, value);
|
||||
}
|
||||
|
||||
virtual const ISC_STATUS* FB_CARG getErrors() const
|
||||
{
|
||||
return errors.get();
|
||||
}
|
||||
|
||||
virtual const ISC_STATUS* FB_CARG getWarnings() const
|
||||
{
|
||||
return warnings.get();
|
||||
}
|
||||
|
||||
virtual unsigned FB_CARG getStatus() const
|
||||
{
|
||||
return (errors.vector[1] ? FB_HAS_ERRORS : 0) |
|
||||
(warnings.vector[1] ? FB_HAS_WARNINGS : 0);
|
||||
}
|
||||
|
||||
public:
|
||||
BaseStatus()
|
||||
{
|
||||
init();
|
||||
}
|
||||
{ }
|
||||
|
||||
void check()
|
||||
{
|
||||
if (!isSuccess())
|
||||
status_exception::raise(get());
|
||||
errors.check();
|
||||
}
|
||||
|
||||
private:
|
||||
ISC_STATUS vector[40]; // FixMe - may be a kind of dynamic storage will be better?
|
||||
class ErrorVector
|
||||
{
|
||||
public:
|
||||
ErrorVector()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
~ErrorVector() { }
|
||||
|
||||
void set(unsigned int length, const ISC_STATUS* value)
|
||||
{
|
||||
fb_utils::copyStatus(vector, FB_NELEM(vector), value, length);
|
||||
}
|
||||
|
||||
virtual const ISC_STATUS* FB_CARG get() const
|
||||
{
|
||||
return vector;
|
||||
}
|
||||
|
||||
virtual void FB_CARG init()
|
||||
{
|
||||
fb_utils::init_status(vector);
|
||||
}
|
||||
|
||||
void check()
|
||||
{
|
||||
if (vector[1])
|
||||
status_exception::raise(get());
|
||||
}
|
||||
|
||||
ISC_STATUS vector[40]; // FixMe - may be a kind of dynamic storage will be better?
|
||||
};
|
||||
|
||||
ErrorVector errors, warnings;
|
||||
};
|
||||
|
||||
class LocalStatus : public AutoIface<BaseStatus, FB_STATUS_VERSION>
|
||||
@ -97,16 +145,11 @@ typedef HalfStaticArray<ISC_STATUS, ISC_STATUS_LENGTH> SimpleStatusVector;
|
||||
class DynamicStatusVector
|
||||
{
|
||||
public:
|
||||
explicit DynamicStatusVector(const ISC_STATUS* status = NULL)
|
||||
DynamicStatusVector()
|
||||
: m_status_vector(*getDefaultMemoryPool())
|
||||
{
|
||||
ISC_STATUS* s = m_status_vector.getBuffer(ISC_STATUS_LENGTH);
|
||||
fb_utils::init_status(s);
|
||||
|
||||
if (status)
|
||||
{
|
||||
save(status);
|
||||
}
|
||||
}
|
||||
|
||||
~DynamicStatusVector()
|
||||
@ -115,8 +158,10 @@ public:
|
||||
}
|
||||
|
||||
ISC_STATUS save(const ISC_STATUS* status);
|
||||
ISC_STATUS save(const IStatus* status);
|
||||
void clear();
|
||||
|
||||
|
||||
ISC_STATUS getError() const
|
||||
{
|
||||
return value()[1];
|
||||
@ -145,25 +190,29 @@ private:
|
||||
class StatusHolder
|
||||
{
|
||||
public:
|
||||
explicit StatusHolder(const ISC_STATUS* status = NULL)
|
||||
: m_status_vector(status), m_raised(false)
|
||||
StatusHolder()
|
||||
: m_raised(false)
|
||||
{ }
|
||||
|
||||
ISC_STATUS save(const ISC_STATUS* status);
|
||||
ISC_STATUS save(IStatus* status);
|
||||
void clear();
|
||||
void raise();
|
||||
|
||||
ISC_STATUS getError()
|
||||
{
|
||||
return value()[1];
|
||||
return value()->getErrors()[1];
|
||||
}
|
||||
|
||||
const ISC_STATUS* value()
|
||||
const IStatus* value()
|
||||
{
|
||||
if (m_raised) {
|
||||
clear();
|
||||
}
|
||||
return m_status_vector.value();
|
||||
|
||||
m_rc.init();
|
||||
m_rc.setErrors(m_error.value());
|
||||
m_rc.setWarnings(m_warning.value());
|
||||
return &m_rc;
|
||||
}
|
||||
|
||||
bool isSuccess()
|
||||
@ -171,8 +220,17 @@ public:
|
||||
return getError() == 0;
|
||||
}
|
||||
|
||||
const StatusHolder& operator=(const StatusHolder& val)
|
||||
{
|
||||
m_error.save(val.m_error.value());
|
||||
m_warning.save(val.m_warning.value());
|
||||
m_raised = val.m_raised;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
DynamicStatusVector m_status_vector;
|
||||
DynamicStatusVector m_error, m_warning;
|
||||
LocalStatus m_rc;
|
||||
bool m_raised;
|
||||
};
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "firebird.h"
|
||||
#include "../common/UtilSvc.h"
|
||||
#include "../common/classes/alloc.h"
|
||||
#include "../common/StatusArg.h"
|
||||
#include "iberror.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -334,7 +334,7 @@ static void setAttr(IStatus* status, Auth::UserData* u)
|
||||
setAttr(attr, "Uid", &u->u);
|
||||
setAttr(attr, "Gid", &u->g);
|
||||
u->attributes()->set(status, attr.c_str());
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() && IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
u->attributes()->setEntered(status, attr.hasData());
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define COMMON_CLASSES_BLR_READER_H
|
||||
|
||||
#include "iberror.h"
|
||||
#include "../common/StatusArg.h"
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "../common/classes/init.h"
|
||||
#include "../common/classes/auto.h"
|
||||
#include "../common/classes/RefCounted.h"
|
||||
#include "../common/StatusArg.h"
|
||||
#include "consts_pub.h"
|
||||
|
||||
namespace Firebird {
|
||||
@ -368,9 +369,9 @@ private:
|
||||
// Generic status checker
|
||||
inline void check(IStatus* status)
|
||||
{
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
status_exception::raise(status->get());
|
||||
status_exception::raise(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "../common/classes/FpeControl.h"
|
||||
#include "../common/dsc_proto.h"
|
||||
#include "../common/utils_proto.h"
|
||||
#include "../common/StatusArg.h"
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "../common/utils_proto.h"
|
||||
#include "../common/classes/Hash.h"
|
||||
#include "../common/isc_f_proto.h"
|
||||
#include "../common/StatusArg.h"
|
||||
#include <ctype.h>
|
||||
|
||||
using namespace Firebird;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "../yvalve/gds_proto.h"
|
||||
#include "../common/gdsassert.h"
|
||||
#include "../common/dsc_proto.h"
|
||||
#include "../common/StatusArg.h"
|
||||
|
||||
using namespace Firebird;
|
||||
|
||||
|
@ -85,8 +85,7 @@ ISC_STATUS Exception::stuff_exception(ISC_STATUS* const status_vector) const thr
|
||||
{
|
||||
LocalStatus status;
|
||||
stuffException(&status);
|
||||
const ISC_STATUS* s = status.get();
|
||||
fb_utils::copyStatus(status_vector, ISC_STATUS_LENGTH, s, fb_utils::statusLength(s));
|
||||
fb_utils::mergeStatus(status_vector, ISC_STATUS_LENGTH, &status);
|
||||
|
||||
return status_vector[1];
|
||||
}
|
||||
@ -129,6 +128,13 @@ void status_exception::raise(const ISC_STATUS *status_vector)
|
||||
throw status_exception(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);
|
||||
}
|
||||
|
||||
void status_exception::raise(const Arg::StatusVector& statusVector)
|
||||
{
|
||||
throw status_exception(statusVector.value());
|
||||
@ -138,7 +144,7 @@ ISC_STATUS status_exception::stuffException(IStatus* status) const throw()
|
||||
{
|
||||
if (status)
|
||||
{
|
||||
status->set(value());
|
||||
fb_utils::setIStatus(status, value());
|
||||
}
|
||||
|
||||
return value()[1];
|
||||
@ -157,7 +163,7 @@ ISC_STATUS BadAlloc::stuffException(IStatus* status) const throw()
|
||||
|
||||
if (status)
|
||||
{
|
||||
status->set(FB_NELEM(sv), sv);
|
||||
status->setErrors(FB_NELEM(sv), sv);
|
||||
}
|
||||
|
||||
return sv[1];
|
||||
@ -181,7 +187,7 @@ ISC_STATUS LongJump::stuffException(IStatus* status) const throw()
|
||||
|
||||
if (status)
|
||||
{
|
||||
status->set(FB_NELEM(sv), sv);
|
||||
status->setErrors(FB_NELEM(sv), sv);
|
||||
}
|
||||
|
||||
return sv[1];
|
||||
|
@ -583,6 +583,14 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
void iscLogException(const char* text, const Firebird::Exception& e)
|
||||
{
|
||||
/**************************************
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define JRD_ISC_PROTO_H
|
||||
|
||||
#include "../common/classes/fb_string.h"
|
||||
#include "firebird/Interface.h"
|
||||
|
||||
bool ISC_check_process_existence(SLONG);
|
||||
TEXT* ISC_get_host(TEXT *, USHORT);
|
||||
@ -34,6 +35,7 @@ SLONG ISC_set_prefix(const TEXT*, const TEXT*);
|
||||
|
||||
// Does not add word "Database" in the beginning like gds__log_status
|
||||
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);
|
||||
|
||||
#ifdef WIN9X_SUPPORT
|
||||
|
@ -33,6 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include "../common/classes/fb_string.h"
|
||||
#include "../common/StatusArg.h"
|
||||
|
||||
namespace os_utils
|
||||
{
|
||||
|
@ -1141,10 +1141,10 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()
|
||||
}
|
||||
}
|
||||
|
||||
if (!lastError.isSuccess())
|
||||
if (lastError.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
(Arg::Gds(isc_random) << "Could not find acceptable ICU library"
|
||||
<< Arg::StatusVector(lastError.get())).raise();
|
||||
<< Arg::StatusVector(lastError.getErrors())).raise();
|
||||
}
|
||||
else
|
||||
(Arg::Gds(isc_random) << "Could not find acceptable ICU library").raise();
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "../jrd/align.h"
|
||||
#include "../common/os/path_utils.h"
|
||||
#include "../common/os/fbsyslog.h"
|
||||
#include "../common/StatusArg.h"
|
||||
|
||||
#ifdef WIN_NT
|
||||
#include <direct.h>
|
||||
@ -1129,6 +1130,47 @@ unsigned int copyStatus(ISC_STATUS* const to, const unsigned int space,
|
||||
return copied;
|
||||
}
|
||||
|
||||
unsigned int mergeStatus(ISC_STATUS* to, unsigned int space,
|
||||
const Firebird::IStatus* from) throw()
|
||||
{
|
||||
const ISC_STATUS* s;
|
||||
unsigned int copied = 0;
|
||||
int state = from->getStatus();
|
||||
|
||||
if (state & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
s = from->getErrors();
|
||||
copied = copyStatus(to, space, s, statusLength(s));
|
||||
|
||||
to += copied;
|
||||
space -= copied;
|
||||
}
|
||||
|
||||
if (state & Firebird::IStatus::FB_HAS_WARNINGS)
|
||||
{
|
||||
s = from->getWarnings();
|
||||
copied += copyStatus(to, space, s, statusLength(s));
|
||||
}
|
||||
|
||||
if (!copied)
|
||||
init_status(to);
|
||||
|
||||
return copied;
|
||||
}
|
||||
|
||||
void setIStatus(Firebird::IStatus* to, const ISC_STATUS* from) throw()
|
||||
{
|
||||
try
|
||||
{
|
||||
Firebird::Arg::StatusVector sv(from);
|
||||
sv.copyTo(to);
|
||||
}
|
||||
catch(const Firebird::BadAlloc& ex)
|
||||
{
|
||||
ex.stuffException(to);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int statusLength(const ISC_STATUS* const status) throw()
|
||||
{
|
||||
unsigned int l = 0;
|
||||
|
@ -123,6 +123,10 @@ namespace fb_utils
|
||||
unsigned int copyStatus(ISC_STATUS* const to, const unsigned int space,
|
||||
const ISC_STATUS* const from, const unsigned int count) throw();
|
||||
|
||||
unsigned int mergeStatus(ISC_STATUS* 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();
|
||||
|
||||
enum FetchPassResult {
|
||||
|
@ -9669,15 +9669,6 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
||||
LocalStatus st;
|
||||
LocalStatus s2; // we will use it in DDL case and remember
|
||||
IStatus* s = &st;
|
||||
class Check
|
||||
{
|
||||
public:
|
||||
static void status(IStatus* s)
|
||||
{
|
||||
if (!s->isSuccess())
|
||||
status_exception::raise(s->get());
|
||||
}
|
||||
};
|
||||
|
||||
SecDbContext* secDbContext = transaction->getSecDbContext();
|
||||
if (!secDbContext)
|
||||
@ -9688,10 +9679,10 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
||||
tdbb->getAttachment()->att_user->populateDpb(dpb);
|
||||
IAttachment* att = DispatcherPtr()->attachDatabase(s, secDb,
|
||||
dpb.getBufferLength(), dpb.getBuffer());
|
||||
Check::status(s);
|
||||
check(s);
|
||||
|
||||
ITransaction* tra = att->startTransaction(s, 0, NULL);
|
||||
Check::status(s);
|
||||
check(s);
|
||||
|
||||
secDbContext = transaction->setSecDbContext(att, tra);
|
||||
}
|
||||
@ -9701,7 +9692,7 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
||||
savePoint.printf("GLOBALMAP%d", secDbContext->savePoint++);
|
||||
secDbContext->att->execute(s, secDbContext->tra, 0, ("SAVEPOINT " + savePoint).c_str(),
|
||||
SQL_DIALECT_V6, NULL, NULL, NULL, NULL);
|
||||
Check::status(s);
|
||||
check(s);
|
||||
|
||||
try
|
||||
{
|
||||
@ -9786,13 +9777,13 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
||||
secDbContext->att->execute(&s2, secDbContext->tra, 0, ddl.c_str(), SQL_DIALECT_V6,
|
||||
NULL, NULL, NULL, NULL);
|
||||
|
||||
if (!s2.isSuccess())
|
||||
if (s2.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
// try direct access to rdb$auth_mapping table in secure db
|
||||
|
||||
// check presence of such record in the table
|
||||
Message check;
|
||||
Field<Varying> nm(check, 1);
|
||||
Message msgCheck;
|
||||
Field<Varying> nm(msgCheck, 1);
|
||||
nm = name.c_str();
|
||||
|
||||
Message result;
|
||||
@ -9801,8 +9792,8 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
||||
const char* checkSql = "select count(*) from RDB$AUTH_MAPPING where RDB$MAP_NAME = ?";
|
||||
|
||||
secDbContext->att->execute(s, secDbContext->tra, 0, checkSql, SQL_DIALECT_V6,
|
||||
check.getMetadata(), check.getBuffer(), result.getMetadata(), result.getBuffer());
|
||||
Check::status(s);
|
||||
msgCheck.getMetadata(), msgCheck.getBuffer(), result.getMetadata(), result.getBuffer());
|
||||
check(s);
|
||||
|
||||
if (cnt > 1 && op != MAP_DROP)
|
||||
ERRD_bugcheck("Database mapping misconfigured");
|
||||
@ -9870,7 +9861,7 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
||||
break;
|
||||
case MAP_DROP:
|
||||
sql = "delete from RDBAUTH_MAPPING where RDB$MAP_NAME = ?";
|
||||
msg = ✓
|
||||
msg = &msgCheck;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -9878,12 +9869,12 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
||||
fb_assert(sql && msg);
|
||||
secDbContext->att->execute(s, secDbContext->tra, 0, sql, SQL_DIALECT_V6,
|
||||
msg->getMetadata(), msg->getBuffer(), NULL, NULL);
|
||||
Check::status(s);
|
||||
check(s);
|
||||
|
||||
secDbContext->att->execute(s, secDbContext->tra, 0, ("RELEASE SAVEPOINT " + savePoint).c_str(),
|
||||
SQL_DIALECT_V6, NULL, NULL, NULL, NULL);
|
||||
savePoint.erase();
|
||||
Check::status(s);
|
||||
check(s);
|
||||
}
|
||||
}
|
||||
catch (const Exception&)
|
||||
@ -9894,11 +9885,11 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
||||
SQL_DIALECT_V6, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (!s2.isSuccess())
|
||||
if (s2.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
const ISC_STATUS* stat2 = s2.get();
|
||||
const ISC_STATUS* stat2 = s2.getErrors();
|
||||
if (stat2[1] != isc_dsql_token_unk_err)
|
||||
status_exception::raise(stat2);
|
||||
status_exception::raise(&s2);
|
||||
}
|
||||
|
||||
throw;
|
||||
|
@ -1362,9 +1362,9 @@ static USHORT parse_metadata(dsql_req* request, IMessageMetadata* meta,
|
||||
// raise error if one present
|
||||
static void checkD(IStatus* st)
|
||||
{
|
||||
if (!st->isSuccess())
|
||||
if (st->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
ERRD_post(Arg::StatusVector(st->get()));
|
||||
ERRD_post(Arg::StatusVector(st));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,16 @@ static inline void endp(const int column)
|
||||
printa(column, "}");
|
||||
}
|
||||
|
||||
static inline void success(const int column, bool ok, const char* status_name, const char* post = "")
|
||||
{
|
||||
printa(column, "if (%s%s->getStatus() & Firebird::IStatus::FB_HAS_ERRORS%s)%s",
|
||||
ok ? "!(" : "", global_status_name, ok ? ")" : "", post);
|
||||
}
|
||||
|
||||
static inline void set_sqlcode(const act* action, const int column)
|
||||
{
|
||||
if (action->act_flags & ACT_sql)
|
||||
printa(column, "SQLCODE = isc_sqlcode(%s->get());", global_status_name);
|
||||
printa(column, "SQLCODE = isc_sqlcode(%s->getErrors());", global_status_name);
|
||||
}
|
||||
|
||||
static inline void ObjectNotImplemented()
|
||||
@ -985,7 +991,7 @@ static void gen_blob_end( const act* action, USHORT column)
|
||||
static void gen_blob_for( const act* action, USHORT column)
|
||||
{
|
||||
PAT args;
|
||||
const TEXT* pattern1 = "%IFif (%S1->isSuccess()) {\n\
|
||||
const TEXT* pattern1 = "%IFif (!(%S1->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)) {\n\
|
||||
%ENwhile (1)\n\
|
||||
{";
|
||||
|
||||
@ -995,8 +1001,8 @@ static void gen_blob_for( const act* action, USHORT column)
|
||||
PATTERN_expand(column, pattern1, &args);
|
||||
column += INDENT;
|
||||
gen_get_segment(action, column);
|
||||
printa(column, "if ((!%s->isSuccess()) && (%s->get()[1] != isc_segment)) break;",
|
||||
global_status_name, global_status_name);
|
||||
printa(column, "if (fbIStatus == Firebird::IStatus::FB_ERROR || "
|
||||
"fbIStatus == Firebird::IStatus::FB_EOF) break;");
|
||||
}
|
||||
|
||||
|
||||
@ -1299,7 +1305,7 @@ static void gen_create_database( const act* action, int column)
|
||||
}
|
||||
|
||||
request = action->act_request;
|
||||
printa(column, "if (%s->isSuccess())", global_status_name);
|
||||
success(column, true, global_status_name);
|
||||
column += INDENT;
|
||||
begin(column);
|
||||
printa(column,
|
||||
@ -1312,10 +1318,10 @@ static void gen_create_database( const act* action, int column)
|
||||
request->req_database->dbb_name->sym_string, status_vector(action),
|
||||
trname, request->req_length, request->req_ident);
|
||||
column -= INDENT;
|
||||
printa(column, "if (%s->isSuccess())", global_status_name);
|
||||
success(column, true, global_status_name);
|
||||
printa(column + INDENT, "%s->commit(%s);",
|
||||
trname, status_vector(action));
|
||||
printa(column, "if (!%s->isSuccess())", global_status_name);
|
||||
success(column, false, global_status_name);
|
||||
printa(column + INDENT, "%s->rollback(%s);",
|
||||
trname, status_vector(NULL));
|
||||
set_sqlcode(action, column);
|
||||
@ -1472,6 +1478,7 @@ static void gen_database(int column)
|
||||
scope, global_status_name, all_extern ? "" : " = fbMaster->getStatus();");
|
||||
printa(column, "%sFirebird::IStatus* %s2%s;\t/* status vector */",
|
||||
scope, global_status_name, all_extern ? "" : " = fbMaster->getStatus();");
|
||||
printa(column, "%sint fbIStatus;\t/* last completion code */", scope);
|
||||
|
||||
for (db = gpreGlob.isc_databases; db; db = db->dbb_next)
|
||||
for (const tpb* tpb_iterator = db->dbb_tpbs; tpb_iterator;
|
||||
@ -1550,10 +1557,10 @@ static void gen_ddl( const act* action, int column)
|
||||
if (gpreGlob.sw_auto)
|
||||
{
|
||||
column -= INDENT;
|
||||
printa(column, "if (%s->isSuccess())", global_status_name);
|
||||
success(column, true, global_status_name);
|
||||
printa(column + INDENT, "%s->commit(%s);",
|
||||
gpreGlob.transaction_name, status_vector(action));
|
||||
printa(column, "if (!%s->isSuccess())", global_status_name);
|
||||
success(column, false, global_status_name);
|
||||
printa(column + INDENT, "%s->rollback(%s);",
|
||||
gpreGlob.transaction_name, status_vector(NULL));
|
||||
}
|
||||
@ -2221,7 +2228,7 @@ static void gen_finish( const act* action, int column)
|
||||
{
|
||||
if ((action->act_error || (action->act_flags & ACT_sql)) && db != gpreGlob.isc_databases)
|
||||
{
|
||||
printa(column, "if (%s && %s->isSuccess()) ", db->dbb_name->sym_string, global_status_name);
|
||||
printa(column, "if (%s && !(%s->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)) ", db->dbb_name->sym_string, global_status_name);
|
||||
}
|
||||
else
|
||||
printa(column, "if (%s)", db->dbb_name->sym_string);
|
||||
@ -2245,7 +2252,7 @@ static void gen_for( const act* action, int column)
|
||||
const gpre_req* request = action->act_request;
|
||||
|
||||
if (action->act_error || (action->act_flags & ACT_sql))
|
||||
printa(column, "if (%s->isSuccess()) {", global_status_name);
|
||||
success(column, true, global_status_name, " {");
|
||||
|
||||
printa(column, "while (1)");
|
||||
column += INDENT;
|
||||
@ -2254,7 +2261,7 @@ static void gen_for( const act* action, int column)
|
||||
|
||||
TEXT s[MAX_REF_SIZE];
|
||||
if (action->act_error || (action->act_flags & ACT_sql))
|
||||
printa(column, "if (!%s || (!%s->isSuccess())) break;",
|
||||
printa(column, "if (!%s || (%s->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)) break;",
|
||||
gen_name(s, request->req_eof, true), global_status_name);
|
||||
else
|
||||
printa(column, "if (!%s) break;", gen_name(s, request->req_eof, true));
|
||||
@ -2444,7 +2451,7 @@ static void gen_get_segment( const act* action, int column)
|
||||
{
|
||||
ObjectNotImplemented();
|
||||
const TEXT* pattern1 =
|
||||
"%IF%S1 [1] = %ENisc_get_segment (%V1, &%BH, &%I1, (short) sizeof(%I2), %I2);";
|
||||
"fbIStatus = %BH->getSegment(%V1, sizeof(%I2), %I2, &%I1);";
|
||||
|
||||
if (action->act_error && (action->act_type != ACT_blob_for))
|
||||
begin(column);
|
||||
@ -2468,7 +2475,7 @@ static void gen_get_segment( const act* action, int column)
|
||||
{
|
||||
const ref* into = action->act_object;
|
||||
set_sqlcode(action, column);
|
||||
printa(column, "if (!SQLCODE || SQLCODE == 101)");
|
||||
printa(column, "if (fbIStatus == Firebird::IStatus::FB_OK || fbIStatus == Firebird::IStatus::FB_SEGMENT)");
|
||||
column += INDENT;
|
||||
begin(column);
|
||||
align(column);
|
||||
@ -2538,19 +2545,7 @@ static TEXT* gen_name(char* const string, const ref* reference, bool as_blob)
|
||||
|
||||
static void gen_on_error( const act* action, USHORT column)
|
||||
{
|
||||
const act* err_action = (const act*) action->act_object;
|
||||
switch (err_action->act_type)
|
||||
{
|
||||
case ACT_get_segment:
|
||||
case ACT_put_segment:
|
||||
case ACT_endblob:
|
||||
printa(column,
|
||||
"if ((!%s->isSuccess()) && (%s->get()[1] != isc_segment) && (%s->get()[1] != isc_segstr_eof))",
|
||||
global_status_name, global_status_name, global_status_name);
|
||||
break;
|
||||
default:
|
||||
printa(column, "if (!%s->isSuccess())", global_status_name);
|
||||
}
|
||||
success(column, false, global_status_name);
|
||||
column += INDENT;
|
||||
begin(column);
|
||||
}
|
||||
@ -2709,7 +2704,7 @@ static void gen_ready( const act* action, int column)
|
||||
if ((action->act_error || (action->act_flags & ACT_sql)) &&
|
||||
ready != (rdy*) action->act_object)
|
||||
{
|
||||
printa(column, "if (%s->isSuccess()) {", global_status_name);
|
||||
success(column, true, global_status_name, " {");
|
||||
}
|
||||
make_ready(db, filename, vector, (USHORT) column, ready->rdy_request);
|
||||
if ((action->act_error || (action->act_flags & ACT_sql)) &&
|
||||
@ -3045,7 +3040,7 @@ static void gen_s_start( const act* action, int column)
|
||||
if (action->act_error || (action->act_flags & ACT_sql))
|
||||
column -= INDENT;
|
||||
|
||||
const TEXT* pattern1 = "if (%V1->get()[1] == isc_bad_req_handle) { %RH->release(); %RH = NULL; }";
|
||||
const TEXT* pattern1 = "if (%V1->getErrors()[1] == isc_bad_req_handle) { %RH->release(); %RH = NULL; }";
|
||||
PAT args;
|
||||
args.pat_request = action->act_request;
|
||||
args.pat_vector1 = status_vector(action);
|
||||
@ -3933,7 +3928,7 @@ static void t_start_auto(const act* action,
|
||||
align(column);
|
||||
fprintf(gpreGlob.out_file, "if (!%s", db->dbb_name->sym_string);
|
||||
if (stat && buffer[0])
|
||||
fprintf(gpreGlob.out_file, " && %s->isSuccess()", vector);
|
||||
fprintf(gpreGlob.out_file, " && !(%s->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)", vector);
|
||||
fprintf(gpreGlob.out_file, ")");
|
||||
make_ready(db, filename, vector, (USHORT) (column + INDENT), 0);
|
||||
if (buffer[0])
|
||||
|
@ -42,7 +42,6 @@
|
||||
#endif
|
||||
|
||||
#include "fb_types.h"
|
||||
#include "../common/StatusArg.h"
|
||||
#include "../common/ThreadStart.h"
|
||||
|
||||
namespace Firebird
|
||||
@ -106,6 +105,7 @@ public:
|
||||
|
||||
static void raise(const ISC_STATUS *status_vector);
|
||||
static void raise(const Arg::StatusVector& statusVector);
|
||||
static void raise(const IStatus* status);
|
||||
|
||||
protected:
|
||||
// Create exception with undefined status vector, this constructor allows
|
||||
|
@ -156,4 +156,7 @@ 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 */
|
||||
|
@ -152,7 +152,7 @@ public:
|
||||
virtual const char* FB_CARG role() = 0;
|
||||
virtual const char* FB_CARG networkProtocol() = 0;
|
||||
virtual const char* FB_CARG remoteAddress() = 0;
|
||||
virtual unsigned int FB_CARG authBlock(const unsigned char** bytes) = 0;
|
||||
virtual const unsigned char* FB_CARG authBlock(unsigned* length) = 0;
|
||||
};
|
||||
#define FB_AUTH_LOGON_INFO_VERSION (FB_VERSIONED_VERSION + 5)
|
||||
|
||||
|
@ -72,19 +72,29 @@ public:
|
||||
#define FB_DISPOSABLE_VERSION (FB_VERSIONED_VERSION + 1)
|
||||
|
||||
// Interface to work with status vector
|
||||
// Created by master interface by request
|
||||
// Also may be implemented on stack by internal FB code
|
||||
class IStatus : public IDisposable
|
||||
{
|
||||
public:
|
||||
virtual void FB_CARG set(unsigned int length, const ISC_STATUS* value) = 0;
|
||||
virtual void FB_CARG set(const ISC_STATUS* value) = 0;
|
||||
virtual void FB_CARG init() = 0;
|
||||
static const unsigned FB_HAS_WARNINGS = 0x01;
|
||||
static const unsigned FB_HAS_ERRORS = 0x02;
|
||||
|
||||
virtual const ISC_STATUS* FB_CARG get() const = 0;
|
||||
virtual int FB_CARG isSuccess() const = 0;
|
||||
static const int FB_ERROR = -1;
|
||||
static const int FB_OK = 0;
|
||||
static const int FB_EOF = 1;
|
||||
static const int FB_SEGMENT = 2;
|
||||
|
||||
virtual void FB_CARG init() = 0;
|
||||
virtual unsigned FB_CARG getStatus() const = 0;
|
||||
|
||||
virtual void FB_CARG setErrors(unsigned int length, const ISC_STATUS* value) = 0;
|
||||
virtual void FB_CARG setWarnings(unsigned int length, const ISC_STATUS* value) = 0;
|
||||
virtual void FB_CARG setErrors(const ISC_STATUS* value) = 0;
|
||||
virtual void FB_CARG setWarnings(const ISC_STATUS* value) = 0;
|
||||
|
||||
virtual const ISC_STATUS* FB_CARG getErrors() const = 0;
|
||||
virtual const ISC_STATUS* FB_CARG getWarnings() const = 0;
|
||||
};
|
||||
#define FB_STATUS_VERSION (FB_DISPOSABLE_VERSION + 5)
|
||||
#define FB_STATUS_VERSION (FB_DISPOSABLE_VERSION + 8)
|
||||
|
||||
class IProvider;
|
||||
class IUtl;
|
||||
|
@ -53,8 +53,8 @@ public:
|
||||
virtual void FB_CARG getInfo(IStatus* status,
|
||||
unsigned int itemsLength, const unsigned char* items,
|
||||
unsigned int bufferLength, unsigned char* buffer) = 0;
|
||||
virtual unsigned int FB_CARG getSegment(IStatus* status, unsigned int length,
|
||||
void* buffer) = 0; // returns real length
|
||||
virtual int FB_CARG getSegment(IStatus* status, unsigned int bufferLength,
|
||||
void* buffer, unsigned int* segmentLength) = 0;
|
||||
virtual void FB_CARG putSegment(IStatus* status, unsigned int length,
|
||||
const void* buffer) = 0;
|
||||
virtual void FB_CARG cancel(IStatus* status) = 0;
|
||||
@ -132,12 +132,12 @@ static IMessageMetadata* const DELAYED_OUT_FORMAT = (IMessageMetadata*)(1);
|
||||
class IResultSet : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual FB_BOOLEAN FB_CARG fetchNext(IStatus* status, void* message) = 0;
|
||||
virtual FB_BOOLEAN FB_CARG fetchPrior(IStatus* status, void* message) = 0;
|
||||
virtual FB_BOOLEAN FB_CARG fetchFirst(IStatus* status, void* message) = 0;
|
||||
virtual FB_BOOLEAN FB_CARG fetchLast(IStatus* status, void* message) = 0;
|
||||
virtual FB_BOOLEAN FB_CARG fetchAbsolute(IStatus* status, unsigned int position, void* message) = 0;
|
||||
virtual FB_BOOLEAN FB_CARG fetchRelative(IStatus* status, int offset, void* message) = 0;
|
||||
virtual int FB_CARG fetchNext(IStatus* status, void* message) = 0;
|
||||
virtual int FB_CARG fetchPrior(IStatus* status, void* message) = 0;
|
||||
virtual int FB_CARG fetchFirst(IStatus* status, void* message) = 0;
|
||||
virtual int FB_CARG fetchLast(IStatus* status, void* message) = 0;
|
||||
virtual int FB_CARG fetchAbsolute(IStatus* status, unsigned int position, void* message) = 0;
|
||||
virtual int FB_CARG fetchRelative(IStatus* status, int offset, void* message) = 0;
|
||||
virtual FB_BOOLEAN FB_CARG isEof(IStatus* status) = 0;
|
||||
virtual FB_BOOLEAN FB_CARG isBof(IStatus* status) = 0;
|
||||
virtual IMessageMetadata* FB_CARG getMetadata(IStatus* status) = 0;
|
||||
|
@ -195,7 +195,7 @@ namespace Firebird
|
||||
ISC_STATUS statusVector[] = { \
|
||||
isc_arg_gds, isc_random, isc_arg_string, (ISC_STATUS) "Unrecognized C++ exception", \
|
||||
isc_arg_end}; \
|
||||
status->set(statusVector); \
|
||||
status->setErrors(statusVector); \
|
||||
}
|
||||
|
||||
|
||||
@ -258,7 +258,8 @@ public:
|
||||
template <typename T>
|
||||
static T check(IStatus* status, T value)
|
||||
{
|
||||
check(status->get());
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
StatusException::check(status->getErrors()); // !!! loose warnings!
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -270,7 +271,7 @@ public:
|
||||
|
||||
void stuff(IStatus* status) const
|
||||
{
|
||||
status->set(statusVector);
|
||||
status->setErrors(statusVector);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -282,7 +283,7 @@ class StatusImpl : public IStatus
|
||||
public:
|
||||
StatusImpl(IMaster* master)
|
||||
: delegate(master->getStatus()),
|
||||
success(true)
|
||||
state(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -302,44 +303,61 @@ public:
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void FB_CARG set(unsigned int length, const ISC_STATUS* value)
|
||||
virtual void FB_CARG setErrors(const ISC_STATUS* value)
|
||||
{
|
||||
delegate->set(length, value);
|
||||
success = delegate->isSuccess();
|
||||
delegate->setErrors(value);
|
||||
state = delegate->getStatus();
|
||||
}
|
||||
|
||||
virtual void FB_CARG set(const ISC_STATUS* value)
|
||||
virtual void FB_CARG setWarnings(const ISC_STATUS* value)
|
||||
{
|
||||
delegate->set(value);
|
||||
success = delegate->isSuccess();
|
||||
delegate->setWarnings(value);
|
||||
state = delegate->getStatus();
|
||||
}
|
||||
|
||||
virtual void FB_CARG setErrors(unsigned length, const ISC_STATUS* value)
|
||||
{
|
||||
delegate->setErrors(length, value);
|
||||
state = delegate->getStatus();
|
||||
}
|
||||
|
||||
virtual void FB_CARG setWarnings(unsigned length, const ISC_STATUS* value)
|
||||
{
|
||||
delegate->setWarnings(length, value);
|
||||
state = delegate->getStatus();
|
||||
}
|
||||
|
||||
virtual void FB_CARG init()
|
||||
{
|
||||
delegate->init();
|
||||
success = true;
|
||||
state = 0;
|
||||
}
|
||||
|
||||
virtual const ISC_STATUS* FB_CARG get() const
|
||||
virtual const ISC_STATUS* FB_CARG getErrors() const
|
||||
{
|
||||
return delegate->get();
|
||||
return delegate->getErrors();
|
||||
}
|
||||
|
||||
virtual int FB_CARG isSuccess() const
|
||||
virtual const ISC_STATUS* FB_CARG getWarnings() const
|
||||
{
|
||||
return success;
|
||||
return delegate->getWarnings();
|
||||
}
|
||||
|
||||
virtual unsigned FB_CARG getStatus() const
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
public:
|
||||
void check()
|
||||
{
|
||||
if (!success)
|
||||
StatusException::check(delegate->get());
|
||||
if (state & IStatus::FB_HAS_ERRORS)
|
||||
StatusException::check(delegate->getErrors());
|
||||
}
|
||||
|
||||
private:
|
||||
IStatus* delegate;
|
||||
bool success;
|
||||
unsigned state;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1471,7 +1471,7 @@ static void list_procedure_bodies()
|
||||
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
IUTILS_msg_get(GEN_ERR, msg, SafeArg() << isc_sqlcode(fbStatus->get()));
|
||||
IUTILS_msg_get(GEN_ERR, msg, SafeArg() << isc_sqlcode(fbStatus->getErrors()));
|
||||
STDERROUT(msg); // Statement failed, SQLCODE = %d\n\n
|
||||
ISQL_errmsg(fbStatus);
|
||||
return;
|
||||
@ -2805,7 +2805,7 @@ static void list_functions_ods12_bodies()
|
||||
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
IUTILS_msg_get(GEN_ERR, msg, SafeArg() << isc_sqlcode(fbStatus->get()));
|
||||
IUTILS_msg_get(GEN_ERR, msg, SafeArg() << isc_sqlcode(fbStatus->getErrors()));
|
||||
STDERROUT(msg); // Statement failed, SQLCODE = %d\n\n
|
||||
ISQL_errmsg(fbStatus);
|
||||
return;
|
||||
|
@ -276,7 +276,7 @@ static inline bool commit_trans(Firebird::ITransaction** x)
|
||||
if (ISQL_errmsg (fbStatus))
|
||||
{
|
||||
(*x)->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (!(fbStatus->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
*x = NULL;
|
||||
}
|
||||
@ -954,17 +954,19 @@ bool ISQL_errmsg(Firebird::IStatus* st)
|
||||
* Report error conditions
|
||||
* Simulate isc_print_status exactly, to control stderr
|
||||
**************************************/
|
||||
const ISC_STATUS* status = st->get();
|
||||
TEXT errbuf[MSG_LENGTH];
|
||||
const ISC_STATUS* const status = st->getErrors();
|
||||
|
||||
if (Quiet && !st->isSuccess())
|
||||
const unsigned state = st->getStatus();
|
||||
if (Quiet && (state & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
Exit_value = FINI_ERROR;
|
||||
//else
|
||||
{
|
||||
const ISC_STATUS* vec = status;
|
||||
if (vec[0] != isc_arg_gds ||
|
||||
(vec[0] == isc_arg_gds && vec[1] == 0 && vec[2] != isc_arg_warning) ||
|
||||
(vec[0] == isc_arg_gds && vec[1] == 0 && vec[2] == isc_arg_warning && !setValues.Warnings))
|
||||
if (vec[0] != isc_arg_gds)
|
||||
return false;
|
||||
|
||||
if ((!(state & Firebird::IStatus::FB_HAS_ERRORS)) && ((!(state & Firebird::IStatus::FB_HAS_WARNINGS)) || !setValues.Warnings))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -972,19 +974,35 @@ bool ISQL_errmsg(Firebird::IStatus* st)
|
||||
fb_sqlstate(sqlstate, status);
|
||||
IUTILS_msg_get(GEN_ERR, errbuf, SafeArg() << sqlstate);
|
||||
STDERROUT(errbuf);
|
||||
if (fb_interpret(errbuf, sizeof(errbuf), &vec))
|
||||
TEXT* err = errbuf;
|
||||
unsigned es = sizeof(errbuf);
|
||||
if (fb_interpret(err, es, &vec))
|
||||
{
|
||||
STDERROUT(errbuf);
|
||||
|
||||
// Continuation of error
|
||||
errbuf[0] = '-';
|
||||
while (fb_interpret(errbuf + 1, sizeof(errbuf) - 1, &vec)) {
|
||||
*err++ = '-';
|
||||
--es;
|
||||
while (fb_interpret(err, es, &vec)) {
|
||||
STDERROUT(errbuf);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (state & Firebird::IStatus::FB_HAS_WARNINGS)
|
||||
{
|
||||
const ISC_STATUS* w = st->getWarnings();
|
||||
while (fb_interpret(err, es, &w)) {
|
||||
STDERROUT(errbuf);
|
||||
if (err == errbuf)
|
||||
{
|
||||
*err++ = '-';
|
||||
--es;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (Input_file)
|
||||
{
|
||||
//const char* s = 0;
|
||||
int linenum = -1;
|
||||
if (status[0] == isc_arg_gds && status[1] == isc_dsql_error &&
|
||||
status[2] == isc_arg_gds && status[3] == isc_sqlerr && vec > &status[9])
|
||||
@ -1041,7 +1059,7 @@ bool ISQL_errmsg(Firebird::IStatus* st)
|
||||
}
|
||||
}
|
||||
|
||||
return !st->isSuccess();
|
||||
return (state & Firebird::IStatus::FB_HAS_ERRORS);
|
||||
}
|
||||
|
||||
|
||||
@ -1058,17 +1076,9 @@ void ISQL_warning(Firebird::IStatus* st)
|
||||
* Simulate isc_print_status exactly, to control stderr
|
||||
**************************************/
|
||||
|
||||
const ISC_STATUS* vec = st->get();
|
||||
fb_assert(vec[1] == 0); // shouldn't be any errors
|
||||
|
||||
//if (!Quiet)
|
||||
if ((st->getStatus() & Firebird::IStatus::FB_HAS_WARNINGS) && setValues.Warnings)
|
||||
{
|
||||
if (vec[0] != isc_arg_gds ||
|
||||
vec[2] != isc_arg_warning ||
|
||||
(vec[2] == isc_arg_warning && !setValues.Warnings))
|
||||
{
|
||||
return;
|
||||
}
|
||||
const ISC_STATUS* vec = st->getWarnings();
|
||||
TEXT buf[MSG_LENGTH];
|
||||
if (fb_interpret(buf, sizeof(buf), &vec))
|
||||
{
|
||||
@ -1259,26 +1269,38 @@ void ISQL_get_character_sets(SSHORT char_set_id, SSHORT collation, bool collate_
|
||||
}
|
||||
|
||||
|
||||
inline static bool failed()
|
||||
{
|
||||
return (fbStatus->getStatus() & Firebird::IStatus::FB_HAS_ERRORS);
|
||||
}
|
||||
|
||||
|
||||
inline static bool succeeded()
|
||||
{
|
||||
return !failed();
|
||||
}
|
||||
|
||||
|
||||
processing_state ISQL_fill_var(IsqlVar* var,
|
||||
Firebird::IMessageMetadata* msg,
|
||||
unsigned index,
|
||||
UCHAR* buf)
|
||||
{
|
||||
var->field = msg->getField(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->relation = msg->getRelation(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->owner = msg->getOwner(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->alias = msg->getAlias(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->subType = msg->getSubType(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->scale = msg->getScale(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->type = msg->getType(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->length = msg->getLength(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->charSet = msg->getCharSet(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->nullable = msg->isNullable(fbStatus, index); if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->field = msg->getField(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->relation = msg->getRelation(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->owner = msg->getOwner(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->alias = msg->getAlias(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->subType = msg->getSubType(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->scale = msg->getScale(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->type = msg->getType(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->length = msg->getLength(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->charSet = msg->getCharSet(fbStatus, index); if (failed()) return ps_ERR;
|
||||
var->nullable = msg->isNullable(fbStatus, index); if (failed()) return ps_ERR;
|
||||
|
||||
if (buf)
|
||||
{
|
||||
var->nullInd = (short*) &buf[msg->getNullOffset(fbStatus, index)]; if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->value.setPtr = &buf[msg->getOffset(fbStatus, index)]; if (!fbStatus->isSuccess()) return ps_ERR;
|
||||
var->nullInd = (short*) &buf[msg->getNullOffset(fbStatus, index)]; if (failed()) return ps_ERR;
|
||||
var->value.setPtr = &buf[msg->getOffset(fbStatus, index)]; if (failed()) return ps_ERR;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1666,7 +1688,7 @@ void ISQL_disconnect_database(bool nQuietMode)
|
||||
if (DB && fbTrans)
|
||||
{
|
||||
fbTrans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
fbTrans = NULL;
|
||||
}
|
||||
|
||||
@ -1674,7 +1696,7 @@ void ISQL_disconnect_database(bool nQuietMode)
|
||||
if (global_Stmt)
|
||||
{
|
||||
global_Stmt->free(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
global_Stmt = NULL;
|
||||
}
|
||||
|
||||
@ -1682,7 +1704,7 @@ void ISQL_disconnect_database(bool nQuietMode)
|
||||
if (DB)
|
||||
{
|
||||
DB->detach(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
DB = NULL;
|
||||
}
|
||||
|
||||
@ -1854,8 +1876,9 @@ void ISQL_print_validation(FILE* fp,
|
||||
|
||||
do
|
||||
{
|
||||
size_t length = blob->getSegment(fbStatus, sizeof(buffer) - 1, buffer);
|
||||
if (!fbStatus->isSuccess() && fbStatus->get()[1] != isc_segment)
|
||||
unsigned int length;
|
||||
int cc = blob->getSegment(fbStatus, sizeof(buffer) - 1, buffer, &length);
|
||||
if (cc == Firebird::IStatus::FB_EOF || cc == Firebird::IStatus::FB_ERROR)
|
||||
break;
|
||||
|
||||
buffer[length] = 0;
|
||||
@ -1892,7 +1915,7 @@ void ISQL_print_validation(FILE* fp,
|
||||
if (!issql)
|
||||
IUTILS_printf2(fp, "%s", (isComputedField ? " */" : ")"));
|
||||
|
||||
if ((!fbStatus->isSuccess()) && (fbStatus->get()[1] != isc_segstr_eof))
|
||||
if (failed())
|
||||
ISQL_errmsg(fbStatus);
|
||||
|
||||
blob->close(fbStatus);
|
||||
@ -2181,7 +2204,7 @@ static processing_state add_row(TEXT* tabname)
|
||||
Firebird::UtlInterfacePtr()->loadBlob(fbStatus, blobid, DB, M__trans,
|
||||
ftmp.c_str(), FB_TRUE);
|
||||
unlink(ftmp.c_str());
|
||||
res = fbStatus->isSuccess();
|
||||
res = succeeded();
|
||||
}
|
||||
}
|
||||
else // Otherwise just load the named file
|
||||
@ -2192,7 +2215,7 @@ static processing_state add_row(TEXT* tabname)
|
||||
// the database, not updating existing info
|
||||
Firebird::UtlInterfacePtr()->loadBlob(fbStatus, blobid, DB, M__trans,
|
||||
lastInputLine, FB_FALSE);
|
||||
res = fbStatus->isSuccess();
|
||||
res = succeeded();
|
||||
}
|
||||
|
||||
if (!res)
|
||||
@ -2574,7 +2597,7 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
global_Stmt = DB->prepare(fbStatus, setValues.Autocommit ? D__trans : M__trans, 0, command,
|
||||
isqlGlob.SQL_dialect, Firebird::IStatement::PREPARE_PREFETCH_METADATA |
|
||||
(setValues.Plan ? Firebird::IStatement::PREPARE_PREFETCH_DETAILED_PLAN : 0));
|
||||
if (!fbStatus->isSuccess())
|
||||
if (failed())
|
||||
{
|
||||
if (isqlGlob.SQL_dialect == SQL_DIALECT_V6_TRANSITION && Input_file)
|
||||
{
|
||||
@ -2591,8 +2614,7 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
}
|
||||
|
||||
// check for warnings
|
||||
if (fbStatus->get()[2] == isc_arg_warning)
|
||||
ISQL_warning(fbStatus);
|
||||
ISQL_warning(fbStatus);
|
||||
|
||||
// Find out what kind of statement this is
|
||||
const int statement_type = process_request_type();
|
||||
@ -2649,8 +2671,8 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
IUTILS_msg_get(CON_PROMPT, con_prompt);
|
||||
|
||||
TEXT msg[MSG_LENGTH];
|
||||
bool commit_failureM = false;
|
||||
bool commit_failureD = false;
|
||||
bool commit_failedM = false;
|
||||
bool commit_failedD = false;
|
||||
bool done = false; // This is mostly "done with errors".
|
||||
while (!done)
|
||||
{
|
||||
@ -2677,13 +2699,13 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
|
||||
if (!commit_trans(&M__trans))
|
||||
{
|
||||
commit_failureM = true;
|
||||
commit_failedM = true;
|
||||
break; // We failed to commit, quit the bulk insertion.
|
||||
}
|
||||
|
||||
if (!M_Transaction())
|
||||
{
|
||||
commit_failureM = false;
|
||||
commit_failedM = false;
|
||||
break; // We failed to start transaction, quit the bulk insertion.
|
||||
}
|
||||
|
||||
@ -2692,13 +2714,13 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
{
|
||||
if (!commit_trans(&D__trans))
|
||||
{
|
||||
commit_failureD = true;
|
||||
commit_failedD = true;
|
||||
break; // We failed to commit, quit the bulk insertion.
|
||||
}
|
||||
|
||||
if (!D_Transaction())
|
||||
{
|
||||
commit_failureD = false;
|
||||
commit_failedD = false;
|
||||
break; // We failed to commit, quit the bulk insertion.
|
||||
}
|
||||
}
|
||||
@ -2921,7 +2943,7 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
|
||||
{ // scope
|
||||
Firebird::IBlob* bs = DB->createBlob(fbStatus, M__trans, blobid);
|
||||
if (!fbStatus->isSuccess())
|
||||
if (failed())
|
||||
{
|
||||
STDERROUT("Unable to create blob");
|
||||
ISQL_errmsg(fbStatus);
|
||||
@ -2930,14 +2952,14 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
}
|
||||
|
||||
bs->putSegment(fbStatus, length, lastPos);
|
||||
if (!fbStatus->isSuccess())
|
||||
if (failed())
|
||||
{
|
||||
STDERROUT("Unable to write to blob");
|
||||
ISQL_errmsg(fbStatus);
|
||||
done = true;
|
||||
}
|
||||
bs->close(fbStatus);
|
||||
if (!fbStatus->isSuccess())
|
||||
if (failed())
|
||||
{
|
||||
STDERROUT("Unable to close blob");
|
||||
ISQL_errmsg(fbStatus);
|
||||
@ -3242,20 +3264,19 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
}
|
||||
|
||||
// Check for warnings.
|
||||
if (fbStatus->get()[2] == isc_arg_warning)
|
||||
ISQL_warning(fbStatus);
|
||||
ISQL_warning(fbStatus);
|
||||
}
|
||||
} // while (!done)
|
||||
|
||||
if (done)
|
||||
{
|
||||
// Save whatever we were able to pump, except when the failure was the commit itself.
|
||||
// Save whatever we were able to pump, except when the failed was the commit itself.
|
||||
if (M__trans)
|
||||
{
|
||||
if (commit_failureM)
|
||||
if (commit_failedM)
|
||||
{
|
||||
M__trans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
M__trans = NULL;
|
||||
}
|
||||
else
|
||||
@ -3264,10 +3285,10 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
|
||||
if (D__trans)
|
||||
{
|
||||
if (commit_failureD)
|
||||
if (commit_failedD)
|
||||
{
|
||||
D__trans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
D__trans = NULL;
|
||||
}
|
||||
else
|
||||
@ -3288,7 +3309,7 @@ static processing_state bulk_insert_hack(const char* command)
|
||||
|
||||
// Get rid of the statement handle.
|
||||
global_Stmt->free(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
global_Stmt = NULL;
|
||||
|
||||
// Statistics printed here upon request
|
||||
@ -4063,21 +4084,21 @@ static void do_isql()
|
||||
if (D__trans)
|
||||
{
|
||||
D__trans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
D__trans = NULL;
|
||||
}
|
||||
|
||||
if (M__trans)
|
||||
{
|
||||
M__trans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
M__trans = NULL;
|
||||
}
|
||||
|
||||
if (fbTrans)
|
||||
{
|
||||
fbTrans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
fbTrans = NULL;
|
||||
}
|
||||
|
||||
@ -4085,14 +4106,14 @@ static void do_isql()
|
||||
if (global_Stmt)
|
||||
{
|
||||
global_Stmt->free(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
global_Stmt = NULL;
|
||||
}
|
||||
|
||||
if (DB)
|
||||
{
|
||||
DB->detach(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
DB = NULL;
|
||||
}
|
||||
|
||||
@ -4155,21 +4176,21 @@ static void do_isql()
|
||||
if (D__trans)
|
||||
{
|
||||
D__trans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
D__trans = NULL;
|
||||
}
|
||||
|
||||
if (M__trans)
|
||||
{
|
||||
M__trans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
M__trans = NULL;
|
||||
}
|
||||
|
||||
if (fbTrans)
|
||||
{
|
||||
fbTrans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
fbTrans = NULL;
|
||||
}
|
||||
}
|
||||
@ -4188,14 +4209,14 @@ static void do_isql()
|
||||
if (global_Stmt)
|
||||
{
|
||||
global_Stmt->free(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
global_Stmt = NULL;
|
||||
}
|
||||
|
||||
if (DB)
|
||||
{
|
||||
DB->detach(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
DB = NULL;
|
||||
}
|
||||
|
||||
@ -4206,21 +4227,21 @@ static void do_isql()
|
||||
if (D__trans)
|
||||
{
|
||||
D__trans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
D__trans = NULL;
|
||||
}
|
||||
|
||||
if (M__trans)
|
||||
{
|
||||
M__trans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
M__trans = NULL;
|
||||
}
|
||||
|
||||
if (fbTrans)
|
||||
{
|
||||
fbTrans->rollback(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
fbTrans = NULL;
|
||||
}
|
||||
|
||||
@ -4228,14 +4249,14 @@ static void do_isql()
|
||||
if (global_Stmt)
|
||||
{
|
||||
global_Stmt->free(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
global_Stmt = NULL;
|
||||
}
|
||||
|
||||
if (DB)
|
||||
{
|
||||
DB->detach(fbStatus);
|
||||
if (fbStatus->isSuccess())
|
||||
if (succeeded())
|
||||
DB = NULL;
|
||||
}
|
||||
|
||||
@ -4408,7 +4429,7 @@ static processing_state edit(const TEXT* const* cmd)
|
||||
Ofp.close();
|
||||
PathName tmpfile = Ofp.fileName(false);
|
||||
gds__edit(tmpfile.c_str(), 0);
|
||||
Ofp.init(fopen(tmpfile.c_str(), "r+"), tmpfile.c_str(), tmpfile.c_str()); // We don't check for failure.
|
||||
Ofp.init(fopen(tmpfile.c_str(), "r+"), tmpfile.c_str(), tmpfile.c_str()); // We don't check for failed.
|
||||
Filelist->Ifp().init(Ofp);
|
||||
Input_file = true;
|
||||
getColumn = -1;
|
||||
@ -4431,7 +4452,7 @@ static processing_state end_trans()
|
||||
* either commit or rollback
|
||||
*
|
||||
* Called by newtrans, createdb, newdb;
|
||||
* Returns success or failure.
|
||||
* Returns success or failed.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
@ -7621,8 +7642,9 @@ processing_state ISQL_print_item_blob(FILE* fp, const IsqlVar* var, Firebird::IT
|
||||
|
||||
do
|
||||
{
|
||||
size_t length = blob->getSegment(fbStatus, sizeof(buffer) - 1, buffer);
|
||||
if (!fbStatus->isSuccess() && fbStatus->get()[1] != isc_segment)
|
||||
unsigned int length;
|
||||
int cc = blob->getSegment(fbStatus, sizeof(buffer) - 1, buffer, &length);
|
||||
if (cc == Firebird::IStatus::FB_EOF || cc == Firebird::IStatus::FB_ERROR)
|
||||
break;
|
||||
|
||||
// Special displays for blr or acl subtypes
|
||||
@ -7646,7 +7668,7 @@ processing_state ISQL_print_item_blob(FILE* fp, const IsqlVar* var, Firebird::IT
|
||||
}
|
||||
} while (true);
|
||||
|
||||
if ((!fbStatus->isSuccess()) && (fbStatus->get()[1] != isc_segstr_eof))
|
||||
if (failed())
|
||||
{
|
||||
ISQL_errmsg(fbStatus);
|
||||
blob->close(fbStatus);
|
||||
@ -7956,7 +7978,7 @@ static void process_header(Firebird::IMessageMetadata* msg, const unsigned pad[]
|
||||
// p r o c e s s _ p l a n
|
||||
// ***********************
|
||||
// Retrieve and show the server's execution plan.
|
||||
// We don't consider critical a failure to get the plan, so we don't return
|
||||
// We don't consider critical a failed to get the plan, so we don't return
|
||||
// any result to the caller.
|
||||
static void process_plan()
|
||||
{
|
||||
@ -8088,7 +8110,7 @@ static SLONG process_record_count(const int statement_type)
|
||||
// p r o c e s s _ r e q u e s t _ t y p e
|
||||
// ***************************************
|
||||
// Retrieve the statement type according to the DSQL layer.
|
||||
// A failure is indicated by returning zero.
|
||||
// A failed is indicated by returning zero.
|
||||
static int process_request_type()
|
||||
{
|
||||
if (!global_Stmt)
|
||||
@ -8322,7 +8344,7 @@ static processing_state process_statement(const TEXT* str2)
|
||||
|
||||
global_Stmt = DB->prepare(fbStatus, prepare_trans, 0, str2, isqlGlob.SQL_dialect,
|
||||
Firebird::IStatement::PREPARE_PREFETCH_METADATA);
|
||||
if (!fbStatus->isSuccess())
|
||||
if (failed())
|
||||
{
|
||||
if (isqlGlob.SQL_dialect == SQL_DIALECT_V6_TRANSITION && Input_file)
|
||||
{
|
||||
@ -8339,8 +8361,7 @@ static processing_state process_statement(const TEXT* str2)
|
||||
}
|
||||
|
||||
// check for warnings
|
||||
if (fbStatus->get()[2] == isc_arg_warning)
|
||||
ISQL_warning(fbStatus);
|
||||
ISQL_warning(fbStatus);
|
||||
|
||||
// Find out what kind of statement this is
|
||||
const int statement_type = process_request_type();
|
||||
@ -8368,8 +8389,7 @@ static processing_state process_statement(const TEXT* str2)
|
||||
}
|
||||
|
||||
// check for warnings
|
||||
if (fbStatus->get()[2] == isc_arg_warning)
|
||||
ISQL_warning(fbStatus);
|
||||
ISQL_warning(fbStatus);
|
||||
|
||||
print_message(input, "IN");
|
||||
}
|
||||
@ -8410,7 +8430,7 @@ static processing_state process_statement(const TEXT* str2)
|
||||
{
|
||||
ret = ps_ERR;
|
||||
}
|
||||
else if (fbStatus->get()[2] == isc_arg_warning)
|
||||
else
|
||||
{
|
||||
// check for warnings
|
||||
ISQL_warning(fbStatus);
|
||||
@ -8423,8 +8443,7 @@ static processing_state process_statement(const TEXT* str2)
|
||||
ret = ps_ERR;
|
||||
|
||||
// check for warnings from COMMIT
|
||||
if (fbStatus->get()[2] == isc_arg_warning)
|
||||
ISQL_warning(fbStatus);
|
||||
ISQL_warning(fbStatus);
|
||||
|
||||
if (setValues.Stats && (print_performance(perf_before) == ps_ERR))
|
||||
ret = ps_ERR;
|
||||
@ -8457,8 +8476,7 @@ static processing_state process_statement(const TEXT* str2)
|
||||
}
|
||||
|
||||
// check for warnings
|
||||
if (fbStatus->get()[2] == isc_arg_warning)
|
||||
ISQL_warning(fbStatus);
|
||||
ISQL_warning(fbStatus);
|
||||
|
||||
// We are executing a commit or rollback, commit default trans
|
||||
|
||||
@ -8497,8 +8515,7 @@ static processing_state process_statement(const TEXT* str2)
|
||||
}
|
||||
|
||||
// check for warnings
|
||||
if (fbStatus->get()[2] == isc_arg_warning)
|
||||
ISQL_warning(fbStatus);
|
||||
ISQL_warning(fbStatus);
|
||||
|
||||
const unsigned n_cols = message->getCount(fbStatus);
|
||||
if (ISQL_errmsg(fbStatus))
|
||||
@ -8588,8 +8605,7 @@ static processing_state process_statement(const TEXT* str2)
|
||||
}
|
||||
|
||||
// check for warnings
|
||||
if (fbStatus->get()[2] == isc_arg_warning)
|
||||
ISQL_warning(fbStatus);
|
||||
ISQL_warning(fbStatus);
|
||||
|
||||
// Now fetch and print records until EOF
|
||||
|
||||
@ -8617,12 +8633,9 @@ static processing_state process_statement(const TEXT* str2)
|
||||
|
||||
// Fetch the current cursor
|
||||
|
||||
if (!curs->fetchNext(fbStatus, buffer))
|
||||
if (curs->fetchNext(fbStatus, buffer) == Firebird::IStatus::FB_EOF)
|
||||
{
|
||||
if (fbStatus->isSuccess())
|
||||
{
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Print the header every Pagelength number of lines for
|
||||
@ -8723,7 +8736,7 @@ static int query_abort(const int reason, const int, void*)
|
||||
{
|
||||
Firebird::LocalStatus status;
|
||||
DB->cancelOperation(&status, fb_cancel_raise);
|
||||
flag = status.isSuccess();
|
||||
flag = !(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS);
|
||||
}
|
||||
|
||||
if (flag)
|
||||
|
@ -1563,8 +1563,9 @@ void SHOW_print_metadata_text_blob(FILE* fp, ISC_QUAD* blobid, bool escape_squot
|
||||
|
||||
while (true)
|
||||
{
|
||||
size_t length = blob->getSegment(fbStatus, sizeof(buffer) - 1, buffer);
|
||||
if (!fbStatus->isSuccess() && fbStatus->get()[1] != isc_segment)
|
||||
unsigned int length;
|
||||
int cc = blob->getSegment(fbStatus, sizeof(buffer) - 1, buffer, &length);
|
||||
if (cc == Firebird::IStatus::FB_EOF || cc == Firebird::IStatus::FB_ERROR)
|
||||
break;
|
||||
|
||||
// ASF: In Windows, \n characters are printed as \r\n in text mode.
|
||||
@ -1607,7 +1608,7 @@ void SHOW_print_metadata_text_blob(FILE* fp, ISC_QUAD* blobid, bool escape_squot
|
||||
if (endedWithCr)
|
||||
fputc('\r', fp);
|
||||
|
||||
if ((!fbStatus->isSuccess()) && fbStatus->get()[1] != isc_segstr_eof)
|
||||
if (fbStatus->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
ISQL_errmsg(fbStatus);
|
||||
|
||||
blob->close(fbStatus);
|
||||
@ -1723,7 +1724,7 @@ processing_state SHOW_metadata(const SCHAR* const* cmd, SCHAR** lcmd)
|
||||
isqlGlob.printf("Server version:%s", NEWLINE);
|
||||
VersionCallback callback;
|
||||
Firebird::UtlInterfacePtr()->getFbVersion(fbStatus, DB, &callback);
|
||||
if (!fbStatus->isSuccess())
|
||||
if (fbStatus->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
IUTILS_msg_get(CANNOT_GET_SRV_VER, msg_string);
|
||||
STDERROUT(msg_string);
|
||||
|
@ -112,7 +112,7 @@ namespace {
|
||||
public:
|
||||
virtual void FB_CARG noEntrypoint(IStatus* s)
|
||||
{
|
||||
s->set(Arg::Gds(isc_wish_list).value());
|
||||
Arg::Gds(isc_wish_list).copyTo(s);
|
||||
}
|
||||
};
|
||||
|
||||
@ -567,9 +567,9 @@ namespace Jrd {
|
||||
|
||||
LocalStatus status;
|
||||
cryptPlugin->decrypt(&status, dbb.dbb_page_size - sizeof(Ods::pag), &page[1], &page[1]);
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
memcpy(sv, status.get(), sizeof(ISC_STATUS_ARRAY));
|
||||
fb_utils::mergeStatus(sv, FB_NELEM(sv), &status);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -595,9 +595,9 @@ namespace Jrd {
|
||||
|
||||
LocalStatus status;
|
||||
cryptPlugin->encrypt(&status, dbb.dbb_page_size - sizeof(Ods::pag), &from[1], &to[1]);
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
memcpy(sv, status.get(), sizeof(ISC_STATUS_ARRAY));
|
||||
fb_utils::mergeStatus(sv, FB_NELEM(sv), &status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -707,9 +707,9 @@ namespace Jrd {
|
||||
ha->registerAttachment(att);
|
||||
break; // Do not need >1 key from attachment to single DB
|
||||
}
|
||||
else if (!st.isSuccess())
|
||||
else if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
status_exception::raise(st.get());
|
||||
status_exception::raise(&st);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -742,9 +742,9 @@ namespace Jrd {
|
||||
|
||||
LocalStatus st;
|
||||
crypt->setKey(&st, length, vector);
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
status_exception::raise(st.get());
|
||||
status_exception::raise(&st);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ namespace Jrd
|
||||
{
|
||||
Firebird::LocalStatus s;
|
||||
TimerInterfacePtr()->stop(&s, this);
|
||||
if (s.isSuccess())
|
||||
if (!(s.getStatus() & IStatus::FB_HAS_ERRORS))
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,8 @@ public:
|
||||
virtual void FB_CARG getInfo(Firebird::IStatus* status,
|
||||
unsigned int itemsLength, const unsigned char* items,
|
||||
unsigned int bufferLength, unsigned char* buffer);
|
||||
virtual unsigned int FB_CARG getSegment(Firebird::IStatus* status, unsigned int length, void* buffer); // returns real length
|
||||
virtual int FB_CARG getSegment(Firebird::IStatus* status, unsigned int length, void* buffer,
|
||||
unsigned int* segmentLength);
|
||||
virtual void FB_CARG putSegment(Firebird::IStatus* status, unsigned int length, const void* buffer);
|
||||
virtual void FB_CARG cancel(Firebird::IStatus* status);
|
||||
virtual void FB_CARG close(Firebird::IStatus* status);
|
||||
@ -142,12 +143,12 @@ class JResultSet FB_FINAL : public Firebird::RefCntIface<Firebird::IResultSet, F
|
||||
public:
|
||||
// IResultSet implementation
|
||||
virtual int FB_CARG release();
|
||||
virtual FB_BOOLEAN FB_CARG fetchNext(Firebird::IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchPrior(Firebird::IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchFirst(Firebird::IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchLast(Firebird::IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchAbsolute(Firebird::IStatus* status, unsigned int position, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchRelative(Firebird::IStatus* status, int offset, void* message);
|
||||
virtual int FB_CARG fetchNext(Firebird::IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchPrior(Firebird::IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchFirst(Firebird::IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchLast(Firebird::IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchAbsolute(Firebird::IStatus* status, unsigned int position, void* message);
|
||||
virtual int FB_CARG fetchRelative(Firebird::IStatus* status, int offset, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG isEof(Firebird::IStatus* status);
|
||||
virtual FB_BOOLEAN FB_CARG isBof(Firebird::IStatus* status);
|
||||
virtual Firebird::IMessageMetadata* FB_CARG getMetadata(Firebird::IStatus* status);
|
||||
|
@ -72,10 +72,10 @@ const char* TYPE_SEEN = "Seen";
|
||||
|
||||
void check(const char* s, IStatus* st)
|
||||
{
|
||||
if (st->isSuccess())
|
||||
if (!(st->getStatus() & IStatus::FB_HAS_ERRORS))
|
||||
return;
|
||||
|
||||
Arg::StatusVector newStatus(st->get());
|
||||
Arg::StatusVector newStatus(st);
|
||||
newStatus << Arg::Gds(isc_map_load) << s;
|
||||
newStatus.raise();
|
||||
}
|
||||
@ -280,9 +280,9 @@ public:
|
||||
" RDB$MAP_FROM, RDB$MAP_TO_TYPE, RDB$MAP_TO "
|
||||
"FROM RDB$AUTH_MAPPING",
|
||||
3, NULL, NULL, mMap.getMetadata(), NULL);
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
if (fb_utils::containsErrorCode(st.get(), 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
|
||||
@ -293,7 +293,7 @@ public:
|
||||
check("IAttachment::openCursor", &st);
|
||||
}
|
||||
|
||||
while (curs->fetchNext(&st, mMap.getBuffer()))
|
||||
while (curs->fetchNext(&st, mMap.getBuffer()) == IStatus::FB_OK)
|
||||
{
|
||||
const char* expandedDb = "*";
|
||||
PathName target;
|
||||
@ -920,9 +920,9 @@ void mapUser(string& name, string& trusted_role, Firebird::string* auth_method,
|
||||
{
|
||||
iSec = prov->attachDatabase(&st, securityAlias,
|
||||
embeddedSysdba.getBufferLength(), embeddedSysdba.getBuffer());
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.get(), 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
|
||||
@ -941,9 +941,9 @@ void mapUser(string& name, string& trusted_role, Firebird::string* auth_method,
|
||||
embeddedSysdba.getBufferLength(), embeddedSysdba.getBuffer());
|
||||
}
|
||||
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.get(), 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
|
||||
@ -1162,9 +1162,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.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.get(), 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
|
||||
@ -1195,9 +1195,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);
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
if (!fb_utils::containsErrorCode(st.get(), 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
|
||||
@ -1215,7 +1215,7 @@ RecordBuffer* MappingList::getList(thread_db* tdbb, jrd_rel* relation)
|
||||
buffer = makeBuffer(tdbb);
|
||||
Record* record = buffer->getTempRecord();
|
||||
|
||||
while (curs->fetchNext(&st, mMap.getBuffer()))
|
||||
while (curs->fetchNext(&st, mMap.getBuffer()) == IStatus::FB_OK)
|
||||
{
|
||||
int charset = CS_METADATA;
|
||||
record->nullify();
|
||||
|
@ -98,11 +98,11 @@ UserManagement::UserManagement(jrd_tra* tra)
|
||||
return att->att_remote_address.c_str();
|
||||
}
|
||||
|
||||
unsigned int FB_CARG authBlock(const unsigned char** bytes)
|
||||
const unsigned char* FB_CARG authBlock(unsigned* length)
|
||||
{
|
||||
const Auth::UserData::AuthenticationBlock& aBlock = att->att_user->usr_auth_block;
|
||||
*bytes = aBlock.getCount() ? aBlock.begin() : NULL;
|
||||
return aBlock.getCount();
|
||||
*length = aBlock.getCount();
|
||||
return aBlock.getCount() ? aBlock.begin() : NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -113,9 +113,9 @@ UserManagement::UserManagement(jrd_tra* tra)
|
||||
UserIdInfo idInfo(att);
|
||||
manager->start(&status, &idInfo);
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
status_exception::raise(status.get());
|
||||
status_exception::raise(&status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,9 +134,9 @@ UserManagement::~UserManagement()
|
||||
PluginManagerInterfacePtr()->releasePlugin(manager);
|
||||
manager = NULL;
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
status_exception::raise(status.get());
|
||||
status_exception::raise(&status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -148,9 +148,9 @@ void UserManagement::commit()
|
||||
LocalStatus status;
|
||||
manager->commit(&status);
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
status_exception::raise(status.get());
|
||||
status_exception::raise(&status);
|
||||
}
|
||||
|
||||
PluginManagerInterfacePtr()->releasePlugin(manager);
|
||||
@ -183,7 +183,7 @@ void UserManagement::checkSecurityResult(int errcode, Firebird::IStatus* status,
|
||||
{
|
||||
tmp << userName;
|
||||
}
|
||||
tmp.append(Arg::StatusVector(status->get()));
|
||||
tmp.append(Arg::StatusVector(status));
|
||||
|
||||
tmp.raise();
|
||||
}
|
||||
|
@ -532,7 +532,9 @@ void Connection::raise(const ISC_STATUS* status, thread_db* /*tdbb*/, const char
|
||||
|
||||
void Connection::raise(const Firebird::IStatus& status, thread_db* tdbb, const char* sWhere)
|
||||
{
|
||||
raise(status.get(), tdbb, sWhere);
|
||||
ISC_STATUS_ARRAY tmp;
|
||||
fb_utils::mergeStatus(tmp, FB_NELEM(tmp), &status);
|
||||
raise(tmp, tdbb, sWhere);
|
||||
}
|
||||
|
||||
|
||||
@ -1522,11 +1524,11 @@ void Statement::raise(const Firebird::IStatus& status, thread_db* /*tdbb*/, cons
|
||||
|
||||
if (!m_connection.getWrapErrors())
|
||||
{
|
||||
ERR_post(Arg::StatusVector(status.get()));
|
||||
ERR_post(Arg::StatusVector(&status));
|
||||
}
|
||||
|
||||
string rem_err;
|
||||
m_provider.getRemoteError(status.get(), 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) <<
|
||||
|
@ -122,10 +122,7 @@ public:
|
||||
~IntStatus()
|
||||
{
|
||||
if (v)
|
||||
{
|
||||
const ISC_STATUS *s = get();
|
||||
fb_utils::copyStatus(v, ISC_STATUS_LENGTH, s, fb_utils::statusLength(s));
|
||||
}
|
||||
fb_utils::mergeStatus(v, ISC_STATUS_LENGTH, this);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -166,7 +163,7 @@ void InternalConnection::attach(thread_db* tdbb, const Firebird::string& dbName,
|
||||
m_dpb.getBufferLength(), m_dpb.getBuffer());
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
raise(status, tdbb, "JProvider::attach");
|
||||
}
|
||||
|
||||
@ -193,12 +190,12 @@ void InternalConnection::doDetach(thread_db* tdbb)
|
||||
att->detach(&status);
|
||||
}
|
||||
|
||||
if (status.get()[1] == isc_att_shutdown)
|
||||
if (status.getErrors()[1] == isc_att_shutdown)
|
||||
{
|
||||
status.init();
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
m_attachment = att;
|
||||
raise(status, tdbb, "JAttachment::detach");
|
||||
@ -215,7 +212,7 @@ bool InternalConnection::cancelExecution()
|
||||
|
||||
LocalStatus status;
|
||||
m_attachment->cancelOperation(&status, fb_cancel_raise);
|
||||
return (status.isSuccess());
|
||||
return !(status.getStatus() & IStatus::FB_HAS_ERRORS);
|
||||
}
|
||||
|
||||
// this internal connection instance is available for the current execution context if it
|
||||
@ -412,7 +409,7 @@ void InternalStatement::doPrepare(thread_db* tdbb, const string& sql)
|
||||
tran->getHandle()->tra_caller_name = save_caller_name;
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
raise(status, tdbb, "JAttachment::prepare", &sql);
|
||||
|
||||
const DsqlCompiledStatement* statement = m_request->getHandle()->getStatement();
|
||||
@ -465,7 +462,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:
|
||||
status.set(Arg::Gds(isc_eds_expl_tran_ctrl).value());
|
||||
Arg::Gds(isc_eds_expl_tran_ctrl).copyTo(&status);
|
||||
raise(status, tdbb, "JAttachment::prepare", &sql);
|
||||
break;
|
||||
|
||||
@ -499,7 +496,7 @@ void InternalStatement::doExecute(thread_db* tdbb)
|
||||
m_inMetadata, m_in_buffer.begin(), m_outMetadata, m_out_buffer.begin());
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
raise(status, tdbb, "JStatement::execute");
|
||||
}
|
||||
|
||||
@ -524,7 +521,7 @@ void InternalStatement::doOpen(thread_db* tdbb)
|
||||
m_inMetadata, m_in_buffer.begin(), m_outMetadata);
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
raise(status, tdbb, "JStatement::open");
|
||||
}
|
||||
|
||||
@ -539,10 +536,10 @@ bool InternalStatement::doFetch(thread_db* tdbb)
|
||||
|
||||
fb_assert(m_outMetadata->getMessageLength() == m_out_buffer.getCount());
|
||||
fb_assert(m_cursor);
|
||||
res = m_cursor->fetchNext(&status, m_out_buffer.begin());
|
||||
res = m_cursor->fetchNext(&status, m_out_buffer.begin()) == IStatus::FB_OK;
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
raise(status, tdbb, "JResultSet::fetch");
|
||||
|
||||
return res;
|
||||
@ -559,7 +556,7 @@ void InternalStatement::doClose(thread_db* tdbb, bool drop)
|
||||
m_cursor->close(&status);
|
||||
|
||||
m_cursor = NULL;
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
raise(status, tdbb, "JResultSet::close");
|
||||
}
|
||||
@ -572,7 +569,7 @@ void InternalStatement::doClose(thread_db* tdbb, bool drop)
|
||||
m_allocated = false;
|
||||
m_request = NULL;
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
raise(status, tdbb, "JStatement::free");
|
||||
}
|
||||
@ -635,7 +632,7 @@ void InternalBlob::open(thread_db* tdbb, Transaction& tran, const dsc& desc, con
|
||||
m_blob = att->openBlob(&status, transaction, &m_blob_id, bpb_len, bpb_buff);
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JAttachment::openBlob");
|
||||
|
||||
fb_assert(m_blob);
|
||||
@ -661,7 +658,7 @@ void InternalBlob::create(thread_db* tdbb, Transaction& tran, dsc& desc, const U
|
||||
memcpy(desc.dsc_address, &m_blob_id, sizeof(m_blob_id));
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JAttachment::createBlob");
|
||||
|
||||
fb_assert(m_blob);
|
||||
@ -671,24 +668,15 @@ USHORT InternalBlob::read(thread_db* tdbb, UCHAR* buff, USHORT len)
|
||||
{
|
||||
fb_assert(m_blob);
|
||||
|
||||
USHORT result = 0;
|
||||
unsigned result = 0;
|
||||
LocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
|
||||
result = m_blob->getSegment(&status, len, buff);
|
||||
m_blob->getSegment(&status, len, buff, &result);
|
||||
}
|
||||
|
||||
switch (status.get()[1])
|
||||
{
|
||||
case isc_segstr_eof:
|
||||
fb_assert(result == 0);
|
||||
break;
|
||||
case isc_segment:
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JBlob::getSegment");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -703,7 +691,7 @@ void InternalBlob::write(thread_db* tdbb, const UCHAR* buff, USHORT len)
|
||||
m_blob->putSegment(&status, len, buff);
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JBlob::putSegment");
|
||||
}
|
||||
|
||||
@ -716,7 +704,7 @@ void InternalBlob::close(thread_db* tdbb)
|
||||
m_blob->close(&status);
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JBlob::close");
|
||||
|
||||
fb_assert(!m_blob);
|
||||
@ -734,7 +722,7 @@ void InternalBlob::cancel(thread_db* tdbb)
|
||||
m_blob->cancel(&status);
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
m_connection.raise(status, tdbb, "JBlob::cancel");
|
||||
|
||||
fb_assert(!m_blob);
|
||||
|
116
src/jrd/jrd.cpp
116
src/jrd/jrd.cpp
@ -1045,22 +1045,15 @@ static void successful_completion(IStatus* s, ISC_STATUS acceptCode = 0)
|
||||
{
|
||||
fb_assert(s);
|
||||
|
||||
const ISC_STATUS* status = s->get();
|
||||
const ISC_STATUS* status = s->getErrors();
|
||||
|
||||
// This assert validates whether we really have a successful status vector
|
||||
fb_assert(status[0] != isc_arg_gds || status[1] == FB_SUCCESS || status[1] == acceptCode);
|
||||
|
||||
// Clear the status vector if it doesn't contain a warning
|
||||
if (status[0] != isc_arg_gds || status[1] != FB_SUCCESS || status[2] != isc_arg_warning)
|
||||
if (status[0] != isc_arg_gds || status[1] != FB_SUCCESS || !(s->getStatus() & IStatus::FB_HAS_WARNINGS))
|
||||
{
|
||||
/*if (return_code != FB_SUCCESS)
|
||||
{
|
||||
s->set(Arg::Gds(return_code).value());
|
||||
}
|
||||
else
|
||||
{*/
|
||||
s->init();
|
||||
//}
|
||||
s->init();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1075,7 +1068,7 @@ ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, IStatus*
|
||||
if (func && attachment && attachment->att_trace_manager->needs(TRACE_EVENT_ERROR))
|
||||
{
|
||||
TraceConnectionImpl conn(attachment);
|
||||
TraceStatusVectorImpl traceStatus(vector->get());
|
||||
TraceStatusVectorImpl traceStatus(vector->getErrors());
|
||||
|
||||
attachment->att_trace_manager->event_error(&conn, &traceStatus, func);
|
||||
}
|
||||
@ -1085,13 +1078,13 @@ ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, IStatus*
|
||||
if (!attachment || (charSet = attachment->att_client_charset) == CS_METADATA ||
|
||||
charSet == CS_NONE)
|
||||
{
|
||||
return vector->get()[1];
|
||||
return vector->getErrors()[1];
|
||||
}
|
||||
|
||||
// OK as long as we do not change vectors length
|
||||
// for current way of keeping strings in vector!
|
||||
|
||||
ISC_STATUS* const vectorStart = const_cast<ISC_STATUS*>(vector->get());
|
||||
ISC_STATUS* const vectorStart = const_cast<ISC_STATUS*>(vector->getErrors());
|
||||
ISC_STATUS* status = vectorStart;
|
||||
Array<UCHAR*> buffers;
|
||||
|
||||
@ -1187,7 +1180,7 @@ static void trace_warning(thread_db* tdbb, IStatus* userStatus, const char* func
|
||||
|
||||
if (att->att_trace_manager->needs(TRACE_EVENT_ERROR))
|
||||
{
|
||||
TraceStatusVectorImpl traceStatus(userStatus->get());
|
||||
TraceStatusVectorImpl traceStatus(userStatus->getWarnings());
|
||||
|
||||
if (traceStatus.hasWarning())
|
||||
{
|
||||
@ -1246,8 +1239,8 @@ JTransaction* JAttachment::getTransactionInterface(IStatus* status, ITransaction
|
||||
// If validation is successfull, this means that this attachment and valid transaction
|
||||
// use same provider. I.e. the following cast is safe.
|
||||
JTransaction* jt = static_cast<JTransaction*>(tra->validate(status, this));
|
||||
if (!status->isSuccess())
|
||||
status_exception::raise(status->get());
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(status);
|
||||
if (!jt)
|
||||
Arg::Gds(isc_bad_trans_handle).raise();
|
||||
|
||||
@ -1426,7 +1419,7 @@ JAttachment* FB_CARG JProvider::attachDatabase(IStatus* user_status, const char*
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
trace_failed_attach(NULL, filename, options, false, user_status->get());
|
||||
trace_failed_attach(NULL, filename, options, false, user_status->getErrors());
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -1865,7 +1858,7 @@ JAttachment* FB_CARG JProvider::attachDatabase(IStatus* user_status, const char*
|
||||
{
|
||||
TraceManager* traceManager = attachment->att_trace_manager;
|
||||
TraceConnectionImpl conn(attachment);
|
||||
TraceStatusVectorImpl traceStatus(user_status->get());
|
||||
TraceStatusVectorImpl traceStatus(user_status->getErrors());
|
||||
|
||||
if (traceManager->needs(TRACE_EVENT_ERROR))
|
||||
traceManager->event_error(&conn, &traceStatus, "JProvider::attachDatabase");
|
||||
@ -1876,7 +1869,7 @@ JAttachment* FB_CARG JProvider::attachDatabase(IStatus* user_status, const char*
|
||||
else
|
||||
{
|
||||
trace_failed_attach(attachment ? attachment->att_trace_manager : NULL,
|
||||
filename, options, false, user_status->get());
|
||||
filename, options, false, user_status->getErrors());
|
||||
}
|
||||
|
||||
unwindAttach(tdbb, ex, user_status, attachment, dbb);
|
||||
@ -2439,7 +2432,7 @@ JAttachment* FB_CARG JProvider::createDatabase(IStatus* user_status, const char*
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
trace_failed_attach(NULL, filename, options, true, user_status->get());
|
||||
trace_failed_attach(NULL, filename, options, true, user_status->getErrors());
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -2552,7 +2545,7 @@ JAttachment* FB_CARG JProvider::createDatabase(IStatus* user_status, const char*
|
||||
OverwriteHolder overwriteCheckHolder(dbb);
|
||||
|
||||
JAttachment* attachment2 = attachDatabase(user_status, filename, dpb_length, dpb);
|
||||
if (user_status->get()[1] == isc_adm_task_denied)
|
||||
if (user_status->getErrors()[1] == isc_adm_task_denied)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@ -2721,7 +2714,7 @@ JAttachment* FB_CARG JProvider::createDatabase(IStatus* user_status, const char*
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
trace_failed_attach(attachment ? attachment->att_trace_manager : NULL,
|
||||
filename, options, true, user_status->get());
|
||||
filename, options, true, user_status->getErrors());
|
||||
|
||||
unwindAttach(tdbb, ex, user_status, attachment, dbb);
|
||||
}
|
||||
@ -2785,7 +2778,7 @@ void JAttachment::executeDyn(IStatus* status, ITransaction* /*tra*/, unsigned in
|
||||
* This function is deprecated and "removed".
|
||||
*
|
||||
**************************************/
|
||||
status->set((Arg::Gds(isc_feature_removed) << Arg::Str("isc_ddl")).value());
|
||||
(Arg::Gds(isc_feature_removed) << Arg::Str("isc_ddl")).copyTo(status);
|
||||
}
|
||||
|
||||
|
||||
@ -2995,7 +2988,7 @@ void JAttachment::dropDatabase(IStatus* user_status)
|
||||
|
||||
if (err)
|
||||
{
|
||||
user_status->set(Arg::Gds(isc_drdb_completed_with_errs).value());
|
||||
Arg::Gds(isc_drdb_completed_with_errs).copyTo(user_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3015,7 +3008,8 @@ void JAttachment::dropDatabase(IStatus* user_status)
|
||||
}
|
||||
|
||||
|
||||
unsigned int JBlob::getSegment(IStatus* user_status, unsigned int buffer_length, void* buffer)
|
||||
int JBlob::getSegment(IStatus* user_status, unsigned int buffer_length, void* buffer,
|
||||
unsigned int* segment_length)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3028,6 +3022,7 @@ unsigned int JBlob::getSegment(IStatus* user_status, unsigned int buffer_length,
|
||||
*
|
||||
**************************************/
|
||||
unsigned int len = 0;
|
||||
int cc = IStatus::FB_ERROR;
|
||||
|
||||
try
|
||||
{
|
||||
@ -3041,25 +3036,26 @@ unsigned int JBlob::getSegment(IStatus* user_status, unsigned int buffer_length,
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
transliterateException(tdbb, ex, user_status, "JBlob::getSegment");
|
||||
return len;
|
||||
return cc;
|
||||
}
|
||||
|
||||
// Don't trace errors below as it is not real errors but kind of return value
|
||||
|
||||
if (getHandle()->blb_flags & BLB_eof)
|
||||
status_exception::raise(Arg::Gds(isc_segstr_eof));
|
||||
cc = IStatus::FB_EOF;
|
||||
else if (getHandle()->getFragmentSize())
|
||||
status_exception::raise(Arg::Gds(isc_segment));
|
||||
cc = IStatus::FB_SEGMENT;
|
||||
else
|
||||
cc = IStatus::FB_OK;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
return len;
|
||||
return cc;
|
||||
}
|
||||
|
||||
successful_completion(user_status);
|
||||
|
||||
return len;
|
||||
if (segment_length)
|
||||
*segment_length = len;
|
||||
return cc;
|
||||
}
|
||||
|
||||
|
||||
@ -3817,7 +3813,7 @@ void JService::query(IStatus* user_status,
|
||||
|
||||
if (len)
|
||||
{
|
||||
user_status->set(len, svc->getStatus());
|
||||
fb_utils::setIStatus(user_status, svc->getStatus());
|
||||
// Empty out the service status vector
|
||||
svc->initStatus();
|
||||
return;
|
||||
@ -3861,7 +3857,7 @@ void JService::start(IStatus* user_status, unsigned int spbLength, const unsigne
|
||||
|
||||
if (svc->getStatus()[1])
|
||||
{
|
||||
user_status->set(svc->getStatus());
|
||||
fb_utils::setIStatus(user_status, svc->getStatus());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -4072,7 +4068,7 @@ void JProvider::shutdown(IStatus* status, unsigned int timeout, const int reason
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(status);
|
||||
gds__log_status(NULL, status->get());
|
||||
iscLogStatus("JProvider::shutdown:", status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4478,7 +4474,7 @@ IResultSet* JAttachment::openCursor(IStatus* user_status, ITransaction* apiTra,
|
||||
{
|
||||
IStatement* tmpStatement = prepare(user_status, apiTra, length, string, dialect,
|
||||
(outMetadata ? 0 : IStatement::PREPARE_PREFETCH_OUTPUT_PARAMETERS));
|
||||
if (!user_status->isSuccess())
|
||||
if (user_status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -4486,7 +4482,7 @@ IResultSet* JAttachment::openCursor(IStatus* user_status, ITransaction* apiTra,
|
||||
if (cursorName)
|
||||
{
|
||||
tmpStatement->setCursorName(user_status, cursorName);
|
||||
if (!user_status->isSuccess())
|
||||
if (user_status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
tmpStatement->release();
|
||||
return NULL;
|
||||
@ -4562,7 +4558,7 @@ ITransaction* JAttachment::execute(IStatus* user_status, ITransaction* apiTra,
|
||||
}
|
||||
|
||||
|
||||
FB_BOOLEAN JResultSet::fetchNext(IStatus* user_status, void* buffer)
|
||||
int JResultSet::fetchNext(IStatus* user_status, void* buffer)
|
||||
{
|
||||
bool hasMessage = false;
|
||||
|
||||
@ -4584,22 +4580,24 @@ FB_BOOLEAN JResultSet::fetchNext(IStatus* user_status, void* buffer)
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
transliterateException(tdbb, ex, user_status, "JStatement::fetch");
|
||||
return 0;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
trace_warning(tdbb, user_status, "JResultSet::fetch");
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
return 0;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
|
||||
successful_completion(user_status);
|
||||
|
||||
return hasMessage ? FB_TRUE : FB_FALSE;
|
||||
if (hasMessage)
|
||||
return IStatus::FB_OK;
|
||||
return IStatus::FB_EOF;
|
||||
}
|
||||
|
||||
FB_BOOLEAN JResultSet::fetchPrior(IStatus* user_status, void* buffer)
|
||||
int JResultSet::fetchPrior(IStatus* user_status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4608,15 +4606,15 @@ FB_BOOLEAN JResultSet::fetchPrior(IStatus* user_status, void* buffer)
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
return FB_FALSE;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
|
||||
successful_completion(user_status);
|
||||
|
||||
return FB_TRUE;
|
||||
return IStatus::FB_OK;
|
||||
}
|
||||
|
||||
FB_BOOLEAN JResultSet::fetchFirst(IStatus* user_status, void* buffer)
|
||||
int JResultSet::fetchFirst(IStatus* user_status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4625,15 +4623,15 @@ FB_BOOLEAN JResultSet::fetchFirst(IStatus* user_status, void* buffer)
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
return FB_FALSE;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
|
||||
successful_completion(user_status);
|
||||
|
||||
return FB_TRUE;
|
||||
return IStatus::FB_OK;
|
||||
}
|
||||
|
||||
FB_BOOLEAN JResultSet::fetchLast(IStatus* user_status, void* buffer)
|
||||
int JResultSet::fetchLast(IStatus* user_status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4642,15 +4640,15 @@ FB_BOOLEAN JResultSet::fetchLast(IStatus* user_status, void* buffer)
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
return FB_FALSE;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
|
||||
successful_completion(user_status);
|
||||
|
||||
return FB_TRUE;
|
||||
return IStatus::FB_OK;
|
||||
}
|
||||
|
||||
FB_BOOLEAN JResultSet::fetchAbsolute(IStatus* user_status, unsigned position, void* buffer)
|
||||
int JResultSet::fetchAbsolute(IStatus* user_status, unsigned position, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4659,15 +4657,15 @@ FB_BOOLEAN JResultSet::fetchAbsolute(IStatus* user_status, unsigned position, vo
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
return FB_FALSE;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
|
||||
successful_completion(user_status);
|
||||
|
||||
return FB_TRUE;
|
||||
return IStatus::FB_OK;
|
||||
}
|
||||
|
||||
FB_BOOLEAN JResultSet::fetchRelative(IStatus* user_status, int offset, void* buffer)
|
||||
int JResultSet::fetchRelative(IStatus* user_status, int offset, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4676,12 +4674,12 @@ FB_BOOLEAN JResultSet::fetchRelative(IStatus* user_status, int offset, void* buf
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(user_status);
|
||||
return FB_FALSE;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
|
||||
successful_completion(user_status);
|
||||
|
||||
return FB_TRUE;
|
||||
return IStatus::FB_OK;
|
||||
}
|
||||
|
||||
int JResultSet::release()
|
||||
@ -5887,7 +5885,7 @@ static void handle_error(IStatus* user_status, ISC_STATUS code)
|
||||
**************************************/
|
||||
if (user_status)
|
||||
{
|
||||
user_status->set(Arg::Gds(code).value());
|
||||
Arg::Gds(code).copyTo(user_status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7745,7 +7743,7 @@ static void start_transaction(thread_db* tdbb, bool transliterate, jrd_tra** tra
|
||||
{
|
||||
LocalStatus tempStatus;
|
||||
transliterateException(tdbb, ex, &tempStatus, "startTransaction");
|
||||
status_exception::raise(tempStatus.get());
|
||||
status_exception::raise(&tempStatus);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
@ -637,9 +637,10 @@ public:
|
||||
~ThreadContextHolder()
|
||||
{
|
||||
unsigned l = fb_utils::statusLength(context.tdbb_status_vector);
|
||||
if (externStatus && externStatus->isSuccess() && (l > 2 || context.tdbb_status_vector[1]))
|
||||
if (externStatus && (!(externStatus->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)) &&
|
||||
(l > 2 || context.tdbb_status_vector[1]))
|
||||
{
|
||||
externStatus->set(l, context.tdbb_status_vector);
|
||||
fb_utils::setIStatus(externStatus, context.tdbb_status_vector);
|
||||
}
|
||||
Firebird::ThreadData::restoreSpecific();
|
||||
}
|
||||
|
@ -383,8 +383,8 @@ void TRA_commit(thread_db* tdbb, jrd_tra* transaction, const bool retaining_flag
|
||||
LocalStatus s;
|
||||
secContext->tra->commit(&s);
|
||||
|
||||
if (!s.isSuccess())
|
||||
status_exception::raise(s.get());
|
||||
if (s.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(&s);
|
||||
|
||||
secContext->tra = NULL;
|
||||
clearMap(tdbb->getDatabase()->dbb_config->getSecurityDatabase());
|
||||
@ -982,8 +982,8 @@ void TRA_prepare(thread_db* tdbb, jrd_tra* transaction, USHORT length, const UCH
|
||||
{
|
||||
LocalStatus s;
|
||||
secContext->tra->prepare(&s, length, msg);
|
||||
if (!s.isSuccess())
|
||||
status_exception::raise(s.get());
|
||||
if (s.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(&s);
|
||||
}
|
||||
|
||||
// Perform any meta data work deferred
|
||||
|
@ -282,11 +282,11 @@ void TraceManager::update_session(const TraceSession& session)
|
||||
|
||||
trace_needs |= info->factory->trace_needs();
|
||||
}
|
||||
else if (!status.isSuccess())
|
||||
else if (status.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
string header;
|
||||
header.printf("Trace plugin %s returned error on call trace_create.", info->name);
|
||||
iscLogStatus(header.c_str(), status.get());
|
||||
iscLogStatus(header.c_str(), &status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ void Engine::loadModule(const IRoutineMetadata* metadata, PathName* moduleName,
|
||||
{
|
||||
LocalStatus status;
|
||||
const string str(metadata->getEntryPoint(&status));
|
||||
StatusException::check(status.get());
|
||||
StatusException::check(status.getErrors());
|
||||
|
||||
const string::size_type pos = str.find('!');
|
||||
if (pos == string::npos)
|
||||
|
@ -143,7 +143,8 @@ public:
|
||||
virtual void FB_CARG getInfo(IStatus* status,
|
||||
unsigned int itemsLength, const unsigned char* items,
|
||||
unsigned int bufferLength, unsigned char* buffer);
|
||||
virtual unsigned int FB_CARG getSegment(IStatus* status, unsigned int length, void* buffer); // returns real length
|
||||
virtual int FB_CARG getSegment(IStatus* status, unsigned int bufferLength,
|
||||
void* buffer, unsigned int* segmentLength);
|
||||
virtual void FB_CARG putSegment(IStatus* status, unsigned int length, const void* buffer);
|
||||
virtual void FB_CARG cancel(IStatus* status);
|
||||
virtual void FB_CARG close(IStatus* status);
|
||||
@ -244,12 +245,12 @@ class ResultSet FB_FINAL : public Firebird::RefCntIface<Firebird::IResultSet, FB
|
||||
public:
|
||||
// IResultSet implementation
|
||||
virtual int FB_CARG release();
|
||||
virtual FB_BOOLEAN FB_CARG fetchNext(IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchPrior(IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchFirst(IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchLast(IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchAbsolute(IStatus* status, unsigned int position, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchRelative(IStatus* status, int offset, void* message);
|
||||
virtual int FB_CARG fetchNext(IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchPrior(IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchFirst(IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchLast(IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchAbsolute(IStatus* status, unsigned int position, void* message);
|
||||
virtual int FB_CARG fetchRelative(IStatus* status, int offset, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG isEof(IStatus* status);
|
||||
virtual FB_BOOLEAN FB_CARG isBof(IStatus* status);
|
||||
virtual IMessageMetadata* FB_CARG getMetadata(IStatus* status);
|
||||
@ -1543,7 +1544,7 @@ void Attachment::freeClientData(IStatus* status, bool force)
|
||||
// telling the user that an unrecoverable network error occurred and that
|
||||
// if there was any uncommitted work, its gone...... Oh well....
|
||||
ex.stuffException(status);
|
||||
if ((status->get()[1] != isc_network_error) && (!force))
|
||||
if ((status->getErrors()[1] != isc_network_error) && (!force))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1568,10 +1569,10 @@ void Attachment::freeClientData(IStatus* status, bool force)
|
||||
// free the packet and disconnect the port. Put something into firebird.log
|
||||
// informing the user of the following.
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
iscLogStatus("REMOTE INTERFACE/gds__detach: Unsuccesful detach from "
|
||||
"database.\n\tUncommitted work may have been lost.", status->get());
|
||||
"database.\n\tUncommitted work may have been lost.", status);
|
||||
reset(status);
|
||||
}
|
||||
|
||||
@ -1879,7 +1880,7 @@ ResultSet* Statement::openCursor(IStatus* status, Firebird::ITransaction* apiTra
|
||||
if (!outFormat)
|
||||
{
|
||||
defaultOutputFormat.assignRefNoIncr(this->getOutputMetadata(status));
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -1992,13 +1993,13 @@ IResultSet* FB_CARG Attachment::openCursor(IStatus* status, ITransaction* transa
|
||||
{
|
||||
Statement* stmt = prepare(status, transaction, stmtLength, sqlStmt, dialect,
|
||||
(outMetadata ? 0 : IStatement::PREPARE_PREFETCH_OUTPUT_PARAMETERS));
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ResultSet* rc = stmt->openCursor(status, transaction, inMetadata, inBuffer, outMetadata);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
stmt->release();
|
||||
return NULL;
|
||||
@ -2007,7 +2008,7 @@ IResultSet* FB_CARG Attachment::openCursor(IStatus* status, ITransaction* transa
|
||||
if (cursorName)
|
||||
{
|
||||
stmt->setCursorName(status, cursorName);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
rc->release();
|
||||
stmt->release();
|
||||
@ -2483,7 +2484,7 @@ Statement* Attachment::prepare(IStatus* status, ITransaction* apiTra,
|
||||
}
|
||||
response->p_resp_data = temp;
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
return stmt;
|
||||
}
|
||||
@ -2743,7 +2744,7 @@ void ResultSet::setDelayedOutputFormat(IStatus* status, IMessageMetadata* format
|
||||
}
|
||||
|
||||
|
||||
FB_BOOLEAN ResultSet::fetchNext(IStatus* status, void* buffer)
|
||||
int ResultSet::fetchNext(IStatus* status, void* buffer)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2955,7 +2956,7 @@ FB_BOOLEAN ResultSet::fetchNext(IStatus* status, void* buffer)
|
||||
//statement->rsr_flags.clear(Rsr::EOF_SET);
|
||||
statement->rsr_flags.set(Rsr::PAST_EOF);
|
||||
|
||||
return FB_FALSE;
|
||||
return IStatus::FB_EOF;
|
||||
}
|
||||
|
||||
if (statement->rsr_flags.test(Rsr::STREAM_ERR))
|
||||
@ -2993,17 +2994,17 @@ FB_BOOLEAN ResultSet::fetchNext(IStatus* status, void* buffer)
|
||||
}
|
||||
|
||||
message->msg_address = NULL;
|
||||
return FB_TRUE;
|
||||
return IStatus::FB_OK;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(status);
|
||||
}
|
||||
return FB_FALSE;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
|
||||
|
||||
FB_BOOLEAN ResultSet::fetchPrior(IStatus* user_status, void* buffer)
|
||||
int ResultSet::fetchPrior(IStatus* user_status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -3019,7 +3020,7 @@ FB_BOOLEAN ResultSet::fetchPrior(IStatus* user_status, void* buffer)
|
||||
}
|
||||
|
||||
|
||||
FB_BOOLEAN ResultSet::fetchFirst(IStatus* user_status, void* buffer)
|
||||
int ResultSet::fetchFirst(IStatus* user_status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -3035,7 +3036,7 @@ FB_BOOLEAN ResultSet::fetchFirst(IStatus* user_status, void* buffer)
|
||||
}
|
||||
|
||||
|
||||
FB_BOOLEAN ResultSet::fetchLast(IStatus* user_status, void* buffer)
|
||||
int ResultSet::fetchLast(IStatus* user_status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -3051,7 +3052,7 @@ FB_BOOLEAN ResultSet::fetchLast(IStatus* user_status, void* buffer)
|
||||
}
|
||||
|
||||
|
||||
FB_BOOLEAN ResultSet::fetchAbsolute(IStatus* user_status, unsigned position, void* buffer)
|
||||
int ResultSet::fetchAbsolute(IStatus* user_status, unsigned position, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -3067,7 +3068,7 @@ FB_BOOLEAN ResultSet::fetchAbsolute(IStatus* user_status, unsigned position, voi
|
||||
}
|
||||
|
||||
|
||||
FB_BOOLEAN ResultSet::fetchRelative(IStatus* user_status, int offset, void* buffer)
|
||||
int ResultSet::fetchRelative(IStatus* user_status, int offset, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -3210,7 +3211,7 @@ IMessageMetadata* ResultSet::getMetadata(IStatus* status)
|
||||
{
|
||||
if (!outputFormat)
|
||||
{
|
||||
status->set(Arg::Gds(isc_no_output_format).value());
|
||||
status->setErrors(Arg::Gds(isc_no_output_format).value());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -3326,7 +3327,8 @@ void ResultSet::releaseStatement()
|
||||
}
|
||||
|
||||
|
||||
unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void* buffer)
|
||||
int Blob::getSegment(IStatus* status, unsigned int bufferLength, void* buffer,
|
||||
unsigned int* segmentLength)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3367,11 +3369,11 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
if (blob->rbl_flags & Rbl::CREATE)
|
||||
{
|
||||
packet->p_operation = op_get_segment;
|
||||
segment->p_sgmt_length = buffer_length;
|
||||
segment->p_sgmt_length = bufferLength;
|
||||
segment->p_sgmt_blob = blob->rbl_id;
|
||||
segment->p_sgmt_segment.cstr_length = 0;
|
||||
send_packet(port, packet);
|
||||
response->p_resp_data.cstr_allocated = buffer_length;
|
||||
response->p_resp_data.cstr_allocated = bufferLength;
|
||||
response->p_resp_data.cstr_address = bufferPtr;
|
||||
|
||||
try
|
||||
@ -3385,7 +3387,9 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
}
|
||||
|
||||
response->p_resp_data = temp;
|
||||
return response->p_resp_data.cstr_length;
|
||||
if (segmentLength)
|
||||
*segmentLength = response->p_resp_data.cstr_length;
|
||||
return IStatus::FB_OK;
|
||||
}
|
||||
|
||||
// New protocol -- ask for a 1K chunk of blob and
|
||||
@ -3398,14 +3402,14 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
|
||||
if (blob->rbl_flags & Rbl::EOF_SET)
|
||||
{
|
||||
Arg::Gds(isc_segstr_eof).raise();
|
||||
return IStatus::FB_EOF;
|
||||
}
|
||||
|
||||
// Here's the loop, passing out data from our basket & refilling it.
|
||||
// Our buffer (described by the structure blob) is counted strings
|
||||
// <count word> <string> <count word> <string>...
|
||||
|
||||
ISC_STATUS code = 0;
|
||||
int code = IStatus::FB_OK;
|
||||
unsigned int length = 0;
|
||||
while (true)
|
||||
{
|
||||
@ -3432,20 +3436,20 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
// Now check that what we've got fits.
|
||||
// If not, set up the fragment pointer and set the status vector
|
||||
|
||||
if (l > buffer_length)
|
||||
if (l > bufferLength)
|
||||
{
|
||||
blob->rbl_fragment_length = l - buffer_length;
|
||||
l = buffer_length;
|
||||
code = isc_segment;
|
||||
blob->rbl_fragment_length = l - bufferLength;
|
||||
l = bufferLength;
|
||||
code = IStatus::FB_SEGMENT;
|
||||
}
|
||||
|
||||
// and, just for yucks, see if we're exactly using up the fragment
|
||||
// part of a previous incomplete read - if so mark this as an
|
||||
// incomplete read
|
||||
|
||||
if (l == buffer_length && l == blob->rbl_length && (blob->rbl_flags & Rbl::SEGMENT))
|
||||
if (l == bufferLength && l == blob->rbl_length && (blob->rbl_flags & Rbl::SEGMENT))
|
||||
{
|
||||
code = isc_segment;
|
||||
code = IStatus::FB_SEGMENT;
|
||||
}
|
||||
|
||||
// finally set up the return length, decrement the current length,
|
||||
@ -3454,7 +3458,7 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
length += l;
|
||||
blob->rbl_length -= l;
|
||||
blob->rbl_offset += l;
|
||||
buffer_length -= l;
|
||||
bufferLength -= l;
|
||||
|
||||
if (l) {
|
||||
memcpy(bufferPtr, p, l);
|
||||
@ -3466,7 +3470,7 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
|
||||
// return if we've filled up the caller's buffer, or completed a segment
|
||||
|
||||
if (!buffer_length || blob->rbl_length || !(blob->rbl_flags & Rbl::SEGMENT))
|
||||
if (!bufferLength || blob->rbl_length || !(blob->rbl_flags & Rbl::SEGMENT))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -3477,7 +3481,7 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
if (blob->rbl_flags & Rbl::EOF_PENDING)
|
||||
{
|
||||
blob->rbl_flags |= Rbl::EOF_SET;
|
||||
code = isc_segstr_eof;
|
||||
code = IStatus::FB_EOF;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3491,13 +3495,13 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
// Do not go into this loop if we already have a buffer
|
||||
// of size 65535 or 65534.
|
||||
|
||||
if (buffer_length > blob->rbl_buffer_length - sizeof(USHORT) &&
|
||||
if (bufferLength > blob->rbl_buffer_length - sizeof(USHORT) &&
|
||||
blob->rbl_buffer_length <= MAX_USHORT - sizeof(USHORT))
|
||||
{
|
||||
ULONG new_size = buffer_length + sizeof(USHORT);
|
||||
ULONG new_size = bufferLength + sizeof(USHORT);
|
||||
|
||||
if (new_size > MAX_USHORT) // Check if we've overflown
|
||||
new_size = buffer_length;
|
||||
new_size = bufferLength;
|
||||
blob->rbl_ptr = blob->rbl_buffer = blob->rbl_data.getBuffer(new_size);
|
||||
blob->rbl_buffer_length = (USHORT) new_size;
|
||||
}
|
||||
@ -3534,19 +3538,16 @@ unsigned int Blob::getSegment(IStatus* status, unsigned int buffer_length, void*
|
||||
|
||||
response->p_resp_data = temp;
|
||||
|
||||
if (code)
|
||||
{
|
||||
status->set(Arg::Gds(code).value());
|
||||
}
|
||||
|
||||
return length;
|
||||
if (segmentLength)
|
||||
*segmentLength = length;
|
||||
return code;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
ex.stuffException(status);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return IStatus::FB_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -5328,13 +5329,13 @@ static void authenticateStep0(ClntAuthBlock& cBlock)
|
||||
case Auth::AUTH_MORE_DATA:
|
||||
return;
|
||||
case Auth::AUTH_FAILED:
|
||||
if (s.get()[1] != FB_SUCCESS)
|
||||
if (s.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
gds__log_status("Authentication, client plugin:", s.get());
|
||||
iscLogStatus("Authentication, client plugin:", &s);
|
||||
}
|
||||
(Arg::Gds(isc_login)
|
||||
#ifdef DEV_BUILD
|
||||
<< Arg::StatusVector(s.get())
|
||||
<< Arg::StatusVector(&s)
|
||||
#endif
|
||||
).raise();
|
||||
break; // compiler silencer
|
||||
@ -5361,8 +5362,8 @@ static void secureAuthentication(ClntAuthBlock& cBlock, rem_port* port)
|
||||
LocalStatus st;
|
||||
authReceiveResponse(true, cBlock, port, rdb, &st, packet, true);
|
||||
|
||||
if (!st.isSuccess())
|
||||
status_exception::raise(st.get());
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(&st);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5627,7 +5628,7 @@ static void batch_dsql_fetch(rem_port* port,
|
||||
try
|
||||
{
|
||||
REMOTE_check_response(&status, rdb, packet);
|
||||
statement->saveException(status.get(), false);
|
||||
statement->saveException(&status, false);
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -6149,7 +6150,7 @@ static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb,
|
||||
case Auth::AUTH_FAILED:
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s FAILED\n",
|
||||
cBlock.plugins.name()));
|
||||
(Arg::Gds(isc_login) << Arg::StatusVector(s.get())).raise();
|
||||
(Arg::Gds(isc_login) << Arg::StatusVector(&s)).raise();
|
||||
break; // compiler silencer
|
||||
}
|
||||
}
|
||||
@ -6313,7 +6314,7 @@ static void authReceiveResponse(bool havePacket, ClntAuthBlock& cBlock, rem_port
|
||||
}
|
||||
|
||||
// If we have exited from the cycle, this mean auth failed
|
||||
(Arg::Gds(isc_login) << Arg::StatusVector(s.get())).raise();
|
||||
(Arg::Gds(isc_login) << Arg::StatusVector(&s)).raise();
|
||||
}
|
||||
|
||||
static void init(IStatus* status, ClntAuthBlock& cBlock, rem_port* port, P_OP op, PathName& file_name,
|
||||
@ -6689,7 +6690,7 @@ static void receive_packet_noqueue(rem_port* port, PACKET* packet)
|
||||
{
|
||||
LocalStatus status;
|
||||
REMOTE_check_response(&status, rdb, &p->packet);
|
||||
statement->saveException(status.get(), false);
|
||||
statement->saveException(&status, false);
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
|
@ -2927,9 +2927,9 @@ static bool packet_receive(rem_port* port, UCHAR* buffer, SSHORT buffer_length,
|
||||
if (n > 0 && port->port_crypt_plugin)
|
||||
{
|
||||
port->port_crypt_plugin->decrypt(&st, n, buffer, buffer);
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
status_exception::raise(st.get());
|
||||
status_exception::raise(&st);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3007,9 +3007,9 @@ static bool packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_leng
|
||||
|
||||
char* d = b.getBuffer(buffer_length);
|
||||
port->port_crypt_plugin->encrypt(&st, buffer_length, data, d);
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
status_exception::raise(st.get());
|
||||
status_exception::raise(&st);
|
||||
}
|
||||
|
||||
data = d;
|
||||
|
@ -932,17 +932,17 @@ void Rrq::saveStatus(const Firebird::Exception& ex) throw()
|
||||
{
|
||||
if (rrqStatus.isSuccess())
|
||||
{
|
||||
ISC_STATUS_ARRAY tmp;
|
||||
ex.stuff_exception(tmp);
|
||||
rrqStatus.save(tmp);
|
||||
Firebird::LocalStatus tmp;
|
||||
ex.stuffException(&tmp);
|
||||
rrqStatus.save(&tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void Rrq::saveStatus(const Firebird::IStatus* v) throw()
|
||||
void Rrq::saveStatus(Firebird::IStatus* v) throw()
|
||||
{
|
||||
if (rrqStatus.isSuccess())
|
||||
{
|
||||
rrqStatus.save(v->get());
|
||||
rrqStatus.save(v);
|
||||
}
|
||||
}
|
||||
|
||||
@ -954,9 +954,9 @@ void Rsr::saveException(const Firebird::Exception& ex, bool overwrite)
|
||||
|
||||
if (overwrite || !rsr_status->getError())
|
||||
{
|
||||
ISC_STATUS_ARRAY temp;
|
||||
ex.stuff_exception(temp);
|
||||
rsr_status->save(temp);
|
||||
Firebird::LocalStatus temp;
|
||||
ex.stuffException(&temp);
|
||||
rsr_status->save(&temp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1265,7 +1265,8 @@ void rem_port::checkResponse(Firebird::IStatus* warning, PACKET* packet, bool ch
|
||||
if ((packet->p_operation == op_response || packet->p_operation == op_response_piggyback) &&
|
||||
!vector[1])
|
||||
{
|
||||
warning->set(vector);
|
||||
Firebird::Arg::StatusVector s(vector);
|
||||
s.copyTo(warning);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1366,9 +1367,9 @@ bool rem_port::tryKeyType(const KnownServerKey& srvKey, InternalCryptKey* cryptK
|
||||
|
||||
// Pass key to plugin
|
||||
port_crypt_plugin->setKey(&st, cryptKey);
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
Firebird::status_exception::raise(st.get());
|
||||
Firebird::status_exception::raise(&st);
|
||||
}
|
||||
|
||||
// Now it's time to notify server about choice done
|
||||
|
@ -87,6 +87,7 @@ namespace Firebird {
|
||||
class Exception;
|
||||
class IEventCallback;
|
||||
class ICryptKeyCallback;
|
||||
class IStatus;
|
||||
}
|
||||
|
||||
struct rem_port;
|
||||
@ -329,7 +330,7 @@ public:
|
||||
explicit Rrq(FB_SIZE_T rpt) :
|
||||
rrq_rdb(0), rrq_rtr(0), rrq_next(0), rrq_levels(0),
|
||||
rrq_iface(NULL), rrq_id(0), rrq_max_msg(0), rrq_level(0),
|
||||
rrqStatus(0), rrq_rpt(getPool(), rpt)
|
||||
rrq_rpt(getPool(), rpt)
|
||||
{
|
||||
//memset(rrq_status_vector, 0, sizeof rrq_status_vector);
|
||||
rrq_rpt.grow(rpt);
|
||||
@ -347,7 +348,7 @@ public:
|
||||
static ISC_STATUS badHandle() { return isc_bad_req_handle; }
|
||||
|
||||
void saveStatus(const Firebird::Exception& ex) throw();
|
||||
void saveStatus(const Firebird::IStatus* ex) throw();
|
||||
void saveStatus(Firebird::IStatus* ex) throw();
|
||||
};
|
||||
|
||||
|
||||
@ -442,7 +443,7 @@ public:
|
||||
rsr_cursor_name(getPool()), rsr_delayed_format(false)
|
||||
{ }
|
||||
|
||||
void saveException(const ISC_STATUS* status, bool overwrite);
|
||||
void saveException(Firebird::IStatus* status, bool overwrite);
|
||||
void saveException(const Firebird::Exception& ex, bool overwrite);
|
||||
void clearException();
|
||||
ISC_STATUS haveException();
|
||||
@ -498,7 +499,7 @@ public:
|
||||
|
||||
|
||||
|
||||
inline void Rsr::saveException(const ISC_STATUS* status, bool overwrite)
|
||||
inline void Rsr::saveException(Firebird::IStatus* status, bool overwrite)
|
||||
{
|
||||
if (!rsr_status) {
|
||||
rsr_status = new Firebird::StatusHolder();
|
||||
@ -1081,10 +1082,7 @@ public:
|
||||
ISC_STATUS seek_blob(P_SEEK*, PACKET*);
|
||||
ISC_STATUS send_msg(P_DATA*, PACKET*);
|
||||
ISC_STATUS send_response(PACKET*, OBJCT, ULONG, const ISC_STATUS*, bool);
|
||||
ISC_STATUS send_response(PACKET* p, OBJCT obj, ULONG length, Firebird::IStatus* status, bool defer_flag)
|
||||
{
|
||||
return send_response(p, obj, length, status->get(), defer_flag);
|
||||
}
|
||||
ISC_STATUS send_response(PACKET* p, OBJCT obj, ULONG length, const Firebird::IStatus* status, bool defer_flag);
|
||||
ISC_STATUS service_attach(const char*, Firebird::ClumpletWriter*, PACKET*);
|
||||
ISC_STATUS service_end(P_RLSE*, PACKET*);
|
||||
void service_start(P_INFO*, PACKET*);
|
||||
|
@ -508,7 +508,7 @@ public:
|
||||
|
||||
case Auth::AUTH_FAILED:
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: authenticate: No luck today - status:\n"));
|
||||
HANDSHAKE_DEBUG(isc_print_status(st.get()));
|
||||
HANDSHAKE_DEBUG(isc_print_status(st.getErrors()));
|
||||
authServer = NULL;
|
||||
working = false;
|
||||
break;
|
||||
@ -520,10 +520,10 @@ public:
|
||||
|
||||
Arg::Gds loginError(isc_login);
|
||||
#ifndef DEV_BUILD
|
||||
if (st.get()[1] == isc_missing_data_structures)
|
||||
if (st.getErrors()[1] == isc_missing_data_structures)
|
||||
#endif
|
||||
{
|
||||
loginError << Arg::StatusVector(st.get());
|
||||
loginError << Arg::StatusVector(&st);
|
||||
}
|
||||
status_exception::raise(loginError.value());
|
||||
return false; // compiler warning silencer
|
||||
@ -795,10 +795,7 @@ public:
|
||||
upInfo); cpItr.hasData(); cpItr.next())
|
||||
{
|
||||
const char* list = cpItr.plugin()->getKnownTypes(&st);
|
||||
if (! st.isSuccess())
|
||||
{
|
||||
status_exception::raise(st.get());
|
||||
}
|
||||
check(&st);
|
||||
|
||||
fb_assert(list);
|
||||
Remote::ParsedList newTypes;
|
||||
@ -1104,7 +1101,7 @@ void SRVR_enum_attachments(ULONG& att_cnt, ULONG& dbs_cnt, ULONG& svc_cnt)
|
||||
iface->query(&status, 0, NULL, sizeof(spb_query), spb_query, sizeof(buffer), buffer);
|
||||
const UCHAR* p = buffer;
|
||||
|
||||
if (status.isSuccess() && *p++ == isc_info_svc_svr_db_info)
|
||||
if ((!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)) && *p++ == isc_info_svc_svr_db_info)
|
||||
{
|
||||
while (*p != isc_info_flag_end)
|
||||
{
|
||||
@ -1502,7 +1499,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
|
||||
gds__log("SRVR_multi_thread: shutting down due to unhandled exception");
|
||||
LocalStatus status_vector;
|
||||
e.stuffException(&status_vector);
|
||||
gds__log_status(0, status_vector.get());
|
||||
iscLogStatus(NULL, &status_vector);
|
||||
|
||||
// If we got as far as having a port allocated before the error, disconnect it
|
||||
// gracefully.
|
||||
@ -1626,12 +1623,12 @@ static void setErrorStatus(IStatus* status)
|
||||
{
|
||||
Arg::Gds loginError(isc_login);
|
||||
#ifndef DEV_BUILD
|
||||
if (status->get()[1] == isc_missing_data_structures)
|
||||
if (status->getErrors()[1] == isc_missing_data_structures)
|
||||
#endif
|
||||
{
|
||||
loginError << Arg::StatusVector(status->get());
|
||||
loginError << Arg::StatusVector(status->getErrors());
|
||||
}
|
||||
status->set(loginError.value());
|
||||
status->setErrors(loginError.value());
|
||||
}
|
||||
|
||||
static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
|
||||
@ -1851,8 +1848,8 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
|
||||
if (!accepted)
|
||||
{
|
||||
HANDSHAKE_DEBUG(fprintf(stderr, "!accepted, sending reject\n"));
|
||||
if (!status.isSuccess())
|
||||
port->send_response(send, 0, 0, status.get(), false);
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
port->send_response(send, 0, 0, &status, false);
|
||||
else
|
||||
port->send(send);
|
||||
return false;
|
||||
@ -2193,13 +2190,13 @@ void DatabaseAuth::accept(PACKET* send, Auth::WriterImplementation* authBlock)
|
||||
LocalStatus status_vector;
|
||||
provider->setDbCryptCallback(&status_vector, authPort->port_server_crypt_callback->getInterface());
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
ServAttachment iface(operation == op_attach ?
|
||||
provider->attachDatabase(&status_vector, dbName.c_str(), dl, dpb) :
|
||||
provider->createDatabase(&status_vector, dbName.c_str(), dl, dpb));
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
Rdb* rdb = new Rdb;
|
||||
|
||||
@ -2258,7 +2255,7 @@ static void aux_request( rem_port* port, /*P_REQ* request,*/ PACKET* send)
|
||||
port->send_response(send, rdb->rdb_id, send->p_resp.p_resp_data.cstr_length,
|
||||
&status_vector, false);
|
||||
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -2430,7 +2427,7 @@ static USHORT check_statement_type( Rsr* statement)
|
||||
|
||||
statement->rsr_iface->getInfo(&local_status, sizeof(sql_info), sql_info, sizeof(buffer), buffer);
|
||||
|
||||
if (local_status.isSuccess())
|
||||
if (!(local_status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
for (const UCHAR* info = buffer; (*info != isc_info_end) && !done;)
|
||||
{
|
||||
@ -2494,7 +2491,7 @@ ISC_STATUS rem_port::compile(P_CMPL* compileL, PACKET* sendL)
|
||||
|
||||
ServRequest iface(rdb->rdb_iface->compileRequest(&status_vector, blr_length, blr));
|
||||
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
|
||||
// Parse the request to find the messages
|
||||
@ -2742,7 +2739,8 @@ void rem_port::drop_database(P_RLSE* /*release*/, PACKET* sendL)
|
||||
|
||||
rdb->rdb_iface->dropDatabase(&status_vector);
|
||||
|
||||
if (!status_vector.isSuccess() && (status_vector.get()[1] != isc_drdb_completed_with_errs))
|
||||
if ((status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS) &&
|
||||
(status_vector.getErrors()[1] != isc_drdb_completed_with_errs))
|
||||
{
|
||||
this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
return;
|
||||
@ -2792,7 +2790,7 @@ ISC_STATUS rem_port::end_blob(P_OP operation, P_RLSE * release, PACKET* sendL)
|
||||
else
|
||||
blob->rbl_iface->cancel(&status_vector);
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
release_blob(blob);
|
||||
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
@ -2819,7 +2817,7 @@ ISC_STATUS rem_port::end_database(P_RLSE* /*release*/, PACKET* sendL)
|
||||
|
||||
rdb->rdb_iface->detach(&status_vector);
|
||||
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
|
||||
port_flags |= PORT_detached;
|
||||
@ -2863,7 +2861,7 @@ ISC_STATUS rem_port::end_request(P_RLSE * release, PACKET* sendL)
|
||||
|
||||
requestL->rrq_iface->free(&status_vector);
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
release_request(requestL);
|
||||
|
||||
return this->send_response(sendL, 0, 0, &status_vector, true);
|
||||
@ -2892,7 +2890,7 @@ ISC_STATUS rem_port::end_statement(P_SQLFREE* free_stmt, PACKET* sendL)
|
||||
if (statement->rsr_cursor)
|
||||
{
|
||||
statement->rsr_cursor->close(&status_vector);
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return this->send_response(sendL, 0, 0, &status_vector, true);
|
||||
}
|
||||
@ -2915,7 +2913,7 @@ ISC_STATUS rem_port::end_statement(P_SQLFREE* free_stmt, PACKET* sendL)
|
||||
if (statement->rsr_iface)
|
||||
{
|
||||
statement->rsr_iface->free(&status_vector);
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return this->send_response(sendL, 0, 0, &status_vector, true);
|
||||
}
|
||||
@ -2978,12 +2976,12 @@ ISC_STATUS rem_port::end_transaction(P_OP operation, P_RLSE * release, PACKET* s
|
||||
|
||||
case op_prepare:
|
||||
transaction->rtr_iface->prepare(&status_vector);
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
transaction->rtr_limbo = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
if (operation == op_commit || operation == op_rollback)
|
||||
{
|
||||
@ -3108,11 +3106,12 @@ ISC_STATUS rem_port::execute_immediate(P_OP op, P_SQLST * exnow, PACKET* sendL)
|
||||
this->port_statement->rsr_format = this->port_statement->rsr_select_format;
|
||||
|
||||
sendL->p_operation = op_sql_response;
|
||||
sendL->p_sqldata.p_sqldata_messages = (status_vector.get()[1] || !out_msg) ? 0 : 1;
|
||||
sendL->p_sqldata.p_sqldata_messages =
|
||||
((status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS) || !out_msg) ? 0 : 1;
|
||||
this->send_partial(sendL);
|
||||
}
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
if (transaction && !newTra)
|
||||
{
|
||||
@ -3213,10 +3212,7 @@ ISC_STATUS rem_port::execute_statement(P_OP op, P_SQLDATA* sqldata, PACKET* send
|
||||
ITransaction* newTra = tra;
|
||||
|
||||
unsigned flags = statement->rsr_iface->getFlags(&status_vector);
|
||||
if (!status_vector.isSuccess())
|
||||
{
|
||||
status_exception::raise(status_vector.get());
|
||||
}
|
||||
check(&status_vector);
|
||||
|
||||
if ((flags & IStatement::FLAG_HAS_CURSOR) && (out_msg_length == 0))
|
||||
{
|
||||
@ -3224,7 +3220,7 @@ ISC_STATUS rem_port::execute_statement(P_OP op, P_SQLDATA* sqldata, PACKET* send
|
||||
statement->rsr_iface->openCursor(&status_vector, tra,
|
||||
iMsgBuffer.metadata, iMsgBuffer.buffer,
|
||||
(out_blr_length ? oMsgBuffer.metadata : DELAYED_OUT_FORMAT));
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
transaction->rtr_cursors.add(statement);
|
||||
statement->rsr_delayed_format = !out_blr_length;
|
||||
@ -3241,11 +3237,11 @@ ISC_STATUS rem_port::execute_statement(P_OP op, P_SQLDATA* sqldata, PACKET* send
|
||||
this->port_statement->rsr_format = this->port_statement->rsr_select_format;
|
||||
|
||||
sendL->p_operation = op_sql_response;
|
||||
sendL->p_sqldata.p_sqldata_messages = (!status_vector.isSuccess() || !out_msg) ? 0 : 1;
|
||||
sendL->p_sqldata.p_sqldata_messages = (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS || !out_msg) ? 0 : 1;
|
||||
this->send_partial(sendL);
|
||||
}
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
if (transaction && !newTra)
|
||||
{
|
||||
@ -3327,8 +3323,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL)
|
||||
Arg::Gds(isc_dsql_cursor_open_err).raise();
|
||||
|
||||
statement->rsr_cursor->setDelayedOutputFormat(&status_vector, msgBuffer.metadata);
|
||||
if (!status_vector.isSuccess())
|
||||
status_exception::raise(status_vector.get());
|
||||
check(&status_vector);
|
||||
|
||||
statement->rsr_delayed_format = false;
|
||||
}
|
||||
@ -3379,10 +3374,10 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL)
|
||||
{
|
||||
fb_assert(statement->rsr_msgs_waiting == 0);
|
||||
|
||||
rc = statement->rsr_cursor->fetchNext(&status_vector, message->msg_buffer);
|
||||
rc = statement->rsr_cursor->fetchNext(&status_vector, message->msg_buffer) == IStatus::FB_OK;
|
||||
|
||||
statement->rsr_flags.set(Rsr::FETCHED);
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
}
|
||||
@ -3459,14 +3454,14 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL)
|
||||
next = message;
|
||||
}
|
||||
|
||||
rc = statement->rsr_cursor->fetchNext(&status_vector, message->msg_buffer);
|
||||
if (!status_vector.isSuccess())
|
||||
rc = statement->rsr_cursor->fetchNext(&status_vector, message->msg_buffer) == IStatus::FB_OK;
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
// If already have an error queued, don't overwrite it
|
||||
if (!statement->rsr_flags.test(Rsr::STREAM_ERR))
|
||||
{
|
||||
statement->rsr_flags.set(Rsr::STREAM_ERR);
|
||||
statement->saveException(status_vector.get(), true);
|
||||
statement->saveException(&status_vector, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3504,7 +3499,7 @@ static bool get_next_msg_no(Rrq* request, USHORT incarnation, USHORT * msg_numbe
|
||||
request->rrq_iface->getInfo(&status_vector, incarnation,
|
||||
sizeof(request_info), request_info, sizeof(info_buffer), info_buffer);
|
||||
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return false;
|
||||
|
||||
bool result = false;
|
||||
@ -3575,34 +3570,29 @@ ISC_STATUS rem_port::get_segment(P_SGMT* segment, PACKET* sendL)
|
||||
LocalStatus status_vector;
|
||||
|
||||
UCHAR* p = buffer;
|
||||
ISC_STATUS state = 0;
|
||||
int state = 0;
|
||||
|
||||
while (buffer_length > 2)
|
||||
{
|
||||
buffer_length -= 2;
|
||||
p += 2;
|
||||
const USHORT length = blob->rbl_iface->getSegment(&status_vector, buffer_length, p);
|
||||
unsigned length;
|
||||
int cc = blob->rbl_iface->getSegment(&status_vector, buffer_length, p, &length);
|
||||
if (cc == IStatus::FB_EOF || cc == IStatus::FB_ERROR)
|
||||
{
|
||||
if (cc == IStatus::FB_EOF)
|
||||
state = 2;
|
||||
p -= 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (status_vector.get()[1] == isc_segstr_eof)
|
||||
{
|
||||
state = 2;
|
||||
status_vector.init();
|
||||
p -= 2;
|
||||
break;
|
||||
}
|
||||
if (!status_vector.isSuccess() && (status_vector.get()[1] != isc_segment))
|
||||
{
|
||||
p -= 2;
|
||||
break;
|
||||
}
|
||||
p[-2] = (UCHAR) length;
|
||||
p[-1] = (UCHAR) (length >> 8);
|
||||
p += length;
|
||||
buffer_length -= length;
|
||||
if (status_vector.get()[1] == isc_segment)
|
||||
if (cc == IStatus::FB_SEGMENT)
|
||||
{
|
||||
state = 1;
|
||||
status_vector.init();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3659,7 +3649,7 @@ ISC_STATUS rem_port::get_slice(P_SLC * stuff, PACKET* sendL)
|
||||
stuff->p_slc_parameters.cstr_address, stuff->p_slc_length, slice);
|
||||
|
||||
ISC_STATUS status;
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
status = this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
else
|
||||
{
|
||||
@ -3751,7 +3741,7 @@ void rem_port::info(P_OP op, P_INFO* stuff, PACKET* sendL)
|
||||
buffer_length, //sizeof(temp)
|
||||
temp_buffer); //temp
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
string version;
|
||||
version.printf("%s/%s%s", FB_VERSION, this->port_version->str_data,
|
||||
@ -3907,7 +3897,7 @@ ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL)
|
||||
&sendL->p_resp.p_resp_blob_id, bpb_length, bpb));
|
||||
|
||||
USHORT object = 0;
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
Rbl* blob = new Rbl;
|
||||
#ifdef DEBUG_REMOTE_MEMORY
|
||||
@ -3953,7 +3943,7 @@ ISC_STATUS rem_port::prepare(P_PREP * stuff, PACKET* sendL)
|
||||
|
||||
transaction->rtr_iface->prepare(&status_vector,
|
||||
stuff->p_prep_data.cstr_length, stuff->p_prep_data.cstr_address);
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
transaction->rtr_limbo = true;
|
||||
}
|
||||
@ -4022,7 +4012,7 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL)
|
||||
if (statement->rsr_iface)
|
||||
{
|
||||
statement->rsr_iface->free(&status_vector);
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
}
|
||||
|
||||
@ -4038,19 +4028,19 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL)
|
||||
iface, prepareL->p_sqlst_SQL_str.cstr_length,
|
||||
reinterpret_cast<const char*>(prepareL->p_sqlst_SQL_str.cstr_address),
|
||||
prepareL->p_sqlst_SQL_dialect * 10 + PARSER_VERSION, flags);
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
|
||||
if (statement->rsr_cursor_name.hasData())
|
||||
{
|
||||
statement->rsr_iface->setCursorName(&status_vector, statement->rsr_cursor_name.c_str());
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
}
|
||||
|
||||
LocalStatus s2;
|
||||
statement->rsr_iface->getInfo(&s2, infoLength, info, prepareL->p_sqlst_buffer_length, buffer);
|
||||
if (!s2.isSuccess())
|
||||
if (s2.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &s2, false);
|
||||
|
||||
REMOTE_reset_statement(statement);
|
||||
@ -4401,7 +4391,7 @@ static bool process_packet(rem_port* port, PACKET* sendL, PACKET* receive, rem_p
|
||||
|
||||
// Log the error to the user.
|
||||
ex.stuffException(&local_status);
|
||||
gds__log_status(0, local_status.get());
|
||||
iscLogStatus(NULL, &local_status);
|
||||
|
||||
port->send_response(sendL, 0, 0, &local_status, false);
|
||||
port->disconnect(sendL, receive); // Well, how about this...
|
||||
@ -4523,7 +4513,7 @@ ISC_STATUS rem_port::put_segment(P_OP op, P_SGMT * segment, PACKET* sendL)
|
||||
length += *p++ << 8;
|
||||
blob->rbl_iface->putSegment(&status_vector, length, p);
|
||||
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
p += length;
|
||||
}
|
||||
@ -4644,7 +4634,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->save(status_vector->get());
|
||||
sendL->p_resp.p_resp_status_vector->save(status_vector);
|
||||
|
||||
this->send_partial(sendL);
|
||||
|
||||
@ -4731,7 +4721,7 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL)
|
||||
requestL->rrq_iface->receive(&status_vector, level,
|
||||
msg_number, format->fmt_length, message->msg_buffer);
|
||||
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
|
||||
message->msg_address = message->msg_buffer;
|
||||
@ -4812,12 +4802,12 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL)
|
||||
|
||||
// Did we have an error? If so, save it for later delivery
|
||||
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
// If already have an error queued, don't overwrite it
|
||||
|
||||
if (requestL->rrqStatus.isSuccess())
|
||||
requestL->rrqStatus.save(status_vector.get());
|
||||
requestL->rrqStatus.save(&status_vector);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -5078,6 +5068,14 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS rem_port::send_response( PACKET* sendL,
|
||||
OBJCT object,
|
||||
ULONG length,
|
||||
@ -5300,13 +5298,13 @@ ISC_STATUS rem_port::service_attach(const char* service_name,
|
||||
LocalStatus status_vector;
|
||||
|
||||
provider->setDbCryptCallback(&status_vector, port_server_crypt_callback->getInterface());
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
dumpAuthBlock("rem_port::service_attach()", spb, isc_spb_auth_block);
|
||||
ServService iface(provider->attachServiceManager(&status_vector, service_name,
|
||||
(ULONG) spb->getBufferLength(), spb->getBuffer()));
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
Rdb* rdb = new Rdb;
|
||||
|
||||
@ -5345,7 +5343,7 @@ ISC_STATUS rem_port::service_end(P_RLSE* /*release*/, PACKET* sendL)
|
||||
|
||||
rdb->rdb_svc->svc_iface->detach(&status_vector);
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
port_flags |= PORT_detached;
|
||||
rdb->rdb_svc->svc_iface = NULL;
|
||||
@ -5404,8 +5402,8 @@ ISC_STATUS rem_port::set_cursor(P_SQLCUR * sqlcur, PACKET* sendL)
|
||||
if (port_protocol < PROTOCOL_VERSION13 && statement->rsr_cursor_name.hasData() &&
|
||||
statement->rsr_cursor_name != name)
|
||||
{
|
||||
status_vector.set((Arg::Gds(isc_dsql_decl_err) <<
|
||||
Arg::Gds(isc_dsql_cursor_redefined) << statement->rsr_cursor_name).value());
|
||||
(Arg::Gds(isc_dsql_decl_err) <<
|
||||
Arg::Gds(isc_dsql_cursor_redefined) << statement->rsr_cursor_name).copyTo(&status_vector);
|
||||
}
|
||||
else
|
||||
statement->rsr_cursor_name = name;
|
||||
@ -5476,10 +5474,7 @@ void rem_port::start_crypt(P_CRYPT * crypt, PACKET* sendL)
|
||||
// Initialize crypt key
|
||||
LocalStatus st;
|
||||
cp.plugin()->setKey(&st, key);
|
||||
if (! st.isSuccess())
|
||||
{
|
||||
status_exception::raise(st.get());
|
||||
}
|
||||
check(&st);
|
||||
|
||||
// Install plugin
|
||||
port_crypt_plugin = cp.plugin();
|
||||
@ -5555,7 +5550,7 @@ ISC_STATUS rem_port::start(P_OP operation, P_DATA * data, PACKET* sendL)
|
||||
|
||||
requestL->rrq_iface->start(&status_vector, transaction->rtr_iface, data->p_data_incarnation);
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
requestL->rrq_rtr = transaction;
|
||||
if (operation == op_start_and_receive)
|
||||
@ -5601,7 +5596,7 @@ ISC_STATUS rem_port::start_and_send(P_OP operation, P_DATA* data, PACKET* sendL)
|
||||
transaction->rtr_iface, data->p_data_incarnation,
|
||||
number, format->fmt_length, message->msg_address);
|
||||
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
requestL->rrq_rtr = transaction;
|
||||
if (operation == op_start_send_and_receive)
|
||||
@ -5637,7 +5632,7 @@ ISC_STATUS rem_port::start_transaction(P_OP operation, P_STTR * stuff, PACKET* s
|
||||
stuff->p_sttr_tpb.cstr_length, stuff->p_sttr_tpb.cstr_address));
|
||||
|
||||
OBJCT object = 0;
|
||||
if (status_vector.isSuccess())
|
||||
if (!(status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
Rtr* transaction = make_transaction(rdb, iface);
|
||||
if (transaction)
|
||||
@ -5989,7 +5984,7 @@ ISC_STATUS rem_port::transact_request(P_TRRQ* trrq, PACKET* sendL)
|
||||
rdb->rdb_iface->transactRequest(&status_vector, transaction->rtr_iface,
|
||||
blr_length, blr, in_msg_length, in_msg, out_msg_length, out_msg);
|
||||
|
||||
if (!status_vector.isSuccess())
|
||||
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return this->send_response(sendL, 0, 0, &status_vector, false);
|
||||
|
||||
P_DATA* data = &sendL->p_data;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "../common/classes/timestamp.h"
|
||||
#include "../common/utils_proto.h"
|
||||
#include "../common/classes/MsgPrint.h"
|
||||
#include "../common/StatusArg.h"
|
||||
#include "../jrd/license.h"
|
||||
|
||||
using namespace Firebird;
|
||||
|
@ -322,10 +322,10 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
return address;
|
||||
}
|
||||
|
||||
unsigned int FB_CARG authBlock(const unsigned char** bytes)
|
||||
const unsigned char* FB_CARG authBlock(unsigned* length)
|
||||
{
|
||||
*bytes = authBytes;
|
||||
return authLength;
|
||||
*length = authLength;
|
||||
return authBytes;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -357,9 +357,11 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
ex.stuffException(&st);
|
||||
}
|
||||
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
GSEC_error_redirect(st.get(), GsecMsg15);
|
||||
ISC_STATUS_ARRAY tmp;
|
||||
fb_utils::mergeStatus(tmp, FB_NELEM(tmp), &st);
|
||||
GSEC_error_redirect(tmp, GsecMsg15);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -542,8 +544,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
if (ret)
|
||||
{
|
||||
ret = setGsecCode(ret, user_data); // user_data, not u !
|
||||
fb_utils::copyStatus(status, FB_NELEM(status),
|
||||
st.get(), fb_utils::statusLength(st.get()));
|
||||
fb_utils::mergeStatus(status, FB_NELEM(status), &st);
|
||||
GSEC_print(ret, user_data->userName()->get());
|
||||
if (status[1])
|
||||
{
|
||||
@ -552,9 +553,9 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
get_security_error(status, ret);
|
||||
}
|
||||
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
Firebird::status_exception::raise(st.get());
|
||||
Firebird::status_exception::raise(&st);
|
||||
}
|
||||
|
||||
merge(&user_data->u, &u.u);
|
||||
@ -573,8 +574,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
if (ret)
|
||||
{
|
||||
ret = setGsecCode(ret, user_data);
|
||||
fb_utils::copyStatus(status, FB_NELEM(status),
|
||||
st.get(), fb_utils::statusLength(st.get()));
|
||||
fb_utils::mergeStatus(status, FB_NELEM(status), &st);
|
||||
GSEC_print(ret, user_data->userName()->get());
|
||||
if (status[1])
|
||||
{
|
||||
@ -584,9 +584,9 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
|
||||
manager->commit(&st);
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
Firebird::status_exception::raise(st.get());
|
||||
Firebird::status_exception::raise(&st);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -109,7 +109,7 @@ bool DTransaction::buildPrepareInfo(IStatus* status, TdrBuffer& tdr, ITransactio
|
||||
// limit MAX_USHORT is chosen cause for old API it was limit of all blocks
|
||||
UCHAR* buf = bigBuffer.getBuffer(MAX_USHORT);
|
||||
from->getInfo(status, sizeof(PREPARE_TR_INFO), PREPARE_TR_INFO, bigBuffer.getCount(), buf);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return false;
|
||||
|
||||
UCHAR* const end = bigBuffer.end();
|
||||
@ -190,7 +190,7 @@ void FB_CARG DTransaction::getInfo(IStatus* status,
|
||||
if (sub[i])
|
||||
{
|
||||
sub[i]->getInfo(status, itemsLength, items, bufferLength, buffer);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -244,7 +244,7 @@ void FB_CARG DTransaction::prepare(IStatus* status,
|
||||
{
|
||||
sub[i]->prepare(status, msgLength, message);
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -264,7 +264,7 @@ void FB_CARG DTransaction::commit(IStatus* status)
|
||||
status->init();
|
||||
|
||||
prepare(status, 0, NULL);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -277,7 +277,7 @@ void FB_CARG DTransaction::commit(IStatus* status)
|
||||
if (sub[i])
|
||||
{
|
||||
sub[i]->commit(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
sub[i] = NULL;
|
||||
@ -309,7 +309,7 @@ void FB_CARG DTransaction::commitRetaining(IStatus* status)
|
||||
if (sub[i])
|
||||
{
|
||||
sub[i]->commitRetaining(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -336,7 +336,7 @@ void FB_CARG DTransaction::rollback(IStatus* status)
|
||||
if (sub[i])
|
||||
{
|
||||
sub[i]->rollback(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
sub[i] = NULL;
|
||||
@ -365,7 +365,7 @@ void FB_CARG DTransaction::rollbackRetaining(IStatus* status)
|
||||
if (sub[i])
|
||||
{
|
||||
sub[i]->rollbackRetaining(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -394,7 +394,7 @@ void FB_CARG DTransaction::disconnect(IStatus* status)
|
||||
if (sub[i])
|
||||
{
|
||||
sub[i]->disconnect(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
sub[i] = NULL;
|
||||
@ -517,12 +517,12 @@ YTransaction* FB_CARG Dtc::start(IStatus* status, unsigned int cnt, DtcStart* co
|
||||
RefPtr<ITransaction> transaction(components[i].attachment->
|
||||
startTransaction(status, components[i].tpbLength, components[i].tpb));
|
||||
|
||||
if (! status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return NULL;
|
||||
|
||||
dtransaction->join(status, transaction);
|
||||
|
||||
if (! status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
LocalStatus tmp;
|
||||
dtransaction->rollback(&tmp);
|
||||
@ -550,12 +550,12 @@ YTransaction* FB_CARG Dtc::join(IStatus* status, ITransaction* one, ITransaction
|
||||
RefPtr<DTransaction> dtransaction(new DTransaction);
|
||||
|
||||
dtransaction->join(status, one);
|
||||
if (! status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return NULL;
|
||||
|
||||
dtransaction->join(status, two);
|
||||
/* We must not return NULL - first transaction is available only inside dtransaction
|
||||
if (! status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return NULL;
|
||||
*/
|
||||
|
||||
|
@ -620,7 +620,7 @@ namespace
|
||||
Firebird::LocalStatus s;
|
||||
IPluginBase* plugin = module->getPlugin(regPlugin).factory->createPlugin(&s, par);
|
||||
|
||||
if (s.isSuccess())
|
||||
if (!(s.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
plugin->setOwner(par);
|
||||
return plugin;
|
||||
@ -974,7 +974,7 @@ namespace
|
||||
}
|
||||
|
||||
next(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +274,8 @@ public:
|
||||
// IBlob implementation
|
||||
virtual void FB_CARG getInfo(Firebird::IStatus* status, unsigned int itemsLength,
|
||||
const unsigned char* items, unsigned int bufferLength, unsigned char* buffer);
|
||||
virtual unsigned int FB_CARG getSegment(Firebird::IStatus* status, unsigned int length, void* buffer);
|
||||
virtual int FB_CARG getSegment(Firebird::IStatus* status, unsigned int length, void* buffer,
|
||||
unsigned int* segmentLength);
|
||||
virtual void FB_CARG putSegment(Firebird::IStatus* status, unsigned int length, const void* buffer);
|
||||
virtual void FB_CARG cancel(Firebird::IStatus* status);
|
||||
virtual void FB_CARG close(Firebird::IStatus* status);
|
||||
@ -297,12 +298,12 @@ public:
|
||||
void destroy(unsigned dstrFlags);
|
||||
|
||||
// IResultSet implementation
|
||||
virtual FB_BOOLEAN FB_CARG fetchNext(Firebird::IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchPrior(Firebird::IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchFirst(Firebird::IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchLast(Firebird::IStatus* status, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchAbsolute(Firebird::IStatus* status, unsigned int position, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG fetchRelative(Firebird::IStatus* status, int offset, void* message);
|
||||
virtual int FB_CARG fetchNext(Firebird::IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchPrior(Firebird::IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchFirst(Firebird::IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchLast(Firebird::IStatus* status, void* message);
|
||||
virtual int FB_CARG fetchAbsolute(Firebird::IStatus* status, unsigned int position, void* message);
|
||||
virtual int FB_CARG fetchRelative(Firebird::IStatus* status, int offset, void* message);
|
||||
virtual FB_BOOLEAN FB_CARG isEof(Firebird::IStatus* status);
|
||||
virtual FB_BOOLEAN FB_CARG isBof(Firebird::IStatus* status);
|
||||
virtual Firebird::IMessageMetadata* FB_CARG getMetadata(Firebird::IStatus* status);
|
||||
|
@ -536,7 +536,7 @@ found: ;
|
||||
{
|
||||
UCHAR buffer[BUFFER_LARGE];
|
||||
att->getInfo(status, pinfo - info, info, sizeof(buffer), buffer);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
const UCHAR* p = buffer;
|
||||
|
@ -322,7 +322,7 @@ static void generate_error(IStatus* status, const string& token, SSHORT error, S
|
||||
break;
|
||||
}
|
||||
|
||||
status->set(temp_status);
|
||||
status->setErrors(temp_status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -184,7 +184,7 @@ void load(IStatus* status, ISC_QUAD* blobId, IAttachment* att, ITransaction* tra
|
||||
|
||||
// Open the blob. If it failed, what the hell -- just return failure
|
||||
IBlob *blob = att->createBlob(status, tra, blobId);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
// Copy data from file to blob. Make up boundaries at end of line.
|
||||
@ -206,7 +206,7 @@ void load(IStatus* status, ISC_QUAD* blobId, IAttachment* att, ITransaction* tra
|
||||
const SSHORT l = p - buffer;
|
||||
|
||||
blob->putSegment(status, l, buffer);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
blob->close(&temp);
|
||||
return;
|
||||
@ -238,7 +238,7 @@ void dump(IStatus* status, ISC_QUAD* blobId, IAttachment* att, ITransaction* tra
|
||||
// Open the blob. If it failed, what the hell -- just return failure
|
||||
|
||||
IBlob *blob = att->openBlob(status, tra, blobId);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
// Copy data from blob to scratch file
|
||||
@ -248,12 +248,11 @@ void dump(IStatus* status, ISC_QUAD* blobId, IAttachment* att, ITransaction* tra
|
||||
|
||||
for (;;)
|
||||
{
|
||||
USHORT l = 0;
|
||||
l = blob->getSegment(status, short_length, buffer);
|
||||
if (!status->isSuccess() && status->get()[1] != isc_segment)
|
||||
unsigned l = 0;
|
||||
switch(blob->getSegment(status, short_length, buffer, &l))
|
||||
{
|
||||
if (status->get()[1] == isc_segstr_eof)
|
||||
status->init();
|
||||
case Firebird::IStatus::FB_ERROR:
|
||||
case Firebird::IStatus::FB_EOF:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -310,7 +309,7 @@ FB_BOOLEAN edit(IStatus* status, ISC_QUAD* blob_id, IAttachment* att, ITransacti
|
||||
// Would have saved me a lot of time, if I had seen this earlier :-(
|
||||
// FSG 15.Oct.2000
|
||||
PathName tmpf = TempFile::create(status, buffer);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return FB_FALSE;
|
||||
|
||||
FILE* file = fopen(tmpf.c_str(), FOPEN_WRITE_TYPE_TEXT);
|
||||
@ -322,9 +321,9 @@ FB_BOOLEAN edit(IStatus* status, ISC_QUAD* blob_id, IAttachment* att, ITransacti
|
||||
|
||||
dump(status, blob_id, att, tra, file);
|
||||
|
||||
if (!status->isSuccess() && status->get()[1] != isc_segstr_eof)
|
||||
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
isc_print_status(status->get());
|
||||
isc_print_status(status->getErrors());
|
||||
fclose(file);
|
||||
unlink(tmpf.c_str());
|
||||
return FB_FALSE;
|
||||
@ -344,7 +343,7 @@ FB_BOOLEAN edit(IStatus* status, ISC_QUAD* blob_id, IAttachment* att, ITransacti
|
||||
load(status, blob_id, att, tra, file);
|
||||
|
||||
fclose(file);
|
||||
return status->isSuccess();
|
||||
return status->getStatus() & IStatus::FB_HAS_ERRORS ? FB_FALSE : FB_TRUE;
|
||||
}
|
||||
|
||||
unlink(tmpf.c_str());
|
||||
@ -444,7 +443,7 @@ void UtlInterface::getFbVersion(IStatus* status, IAttachment* att,
|
||||
do
|
||||
{
|
||||
att->getInfo(status, sizeof(info), info, buf_len, buf);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
const UCHAR* p = buf;
|
||||
@ -545,14 +544,14 @@ void UtlInterface::getFbVersion(IStatus* status, IAttachment* att,
|
||||
s.printf("%s (%s), version \"%.*s\"", implementation_string, class_string, l, versions);
|
||||
|
||||
callback->callback(status, s.c_str());
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
versions += l;
|
||||
}
|
||||
|
||||
USHORT ods_version, ods_minor_version;
|
||||
get_ods_version(status, att, &ods_version, &ods_minor_version);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
s.printf("on disk structure version %d.%d", ods_version, ods_minor_version);
|
||||
@ -582,13 +581,13 @@ YAttachment* FB_CARG UtlInterface::executeCreateDatabase(
|
||||
if (stmtIsCreateDb)
|
||||
*stmtIsCreateDb = FB_TRUE;
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return NULL;
|
||||
|
||||
LocalStatus tempStatus;
|
||||
ITransaction* crdbTrans = att->startTransaction(status, 0, NULL);
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
att->dropDatabase(&tempStatus);
|
||||
return NULL;
|
||||
@ -599,7 +598,7 @@ YAttachment* FB_CARG UtlInterface::executeCreateDatabase(
|
||||
if (!stmtEaten)
|
||||
{
|
||||
att->execute(status, crdbTrans, stmtLength, creatDBstatement, dialect, NULL, NULL, NULL, NULL);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
crdbTrans->rollback(&tempStatus);
|
||||
att->dropDatabase(&tempStatus);
|
||||
@ -608,7 +607,7 @@ YAttachment* FB_CARG UtlInterface::executeCreateDatabase(
|
||||
}
|
||||
|
||||
crdbTrans->commit(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
crdbTrans->rollback(&tempStatus);
|
||||
att->dropDatabase(&tempStatus);
|
||||
@ -1467,13 +1466,13 @@ int API_ROUTINE isc_version(FB_API_HANDLE* handle, FPTR_VERSION_CALLBACK routine
|
||||
|
||||
LocalStatus st;
|
||||
RefPtr<IAttachment> att(REF_NO_INCR, handleToIAttachment(&st, handle));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
|
||||
VersionCallback callback(routine, user_arg);
|
||||
UtlInterfacePtr()->getFbVersion(&st, att, &callback);
|
||||
|
||||
return st.isSuccess() ? FB_SUCCESS : FB_FAILURE;
|
||||
return st.getStatus() & IStatus::FB_HAS_ERRORS ? FB_FAILURE : FB_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@ -1630,10 +1629,10 @@ int API_ROUTINE BLOB_display(ISC_QUAD* blob_id,
|
||||
**************************************/
|
||||
LocalStatus st;
|
||||
RefPtr<IAttachment> att(REF_NO_INCR, handleToIAttachment(&st, &database));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
RefPtr<ITransaction> tra(REF_NO_INCR, handleToITransaction(&st, &transaction));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
|
||||
try
|
||||
@ -1645,9 +1644,9 @@ int API_ROUTINE BLOB_display(ISC_QUAD* blob_id,
|
||||
ex.stuffException(&st);
|
||||
}
|
||||
|
||||
if (!st.isSuccess() && st.get()[1] != isc_segstr_eof)
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
isc_print_status(st.get());
|
||||
isc_print_status(st.getErrors());
|
||||
return FB_FAILURE;
|
||||
}
|
||||
|
||||
@ -1705,17 +1704,17 @@ static int any_text_dump(ISC_QUAD* blob_id,
|
||||
**************************************/
|
||||
LocalStatus st;
|
||||
RefPtr<IAttachment> att(REF_NO_INCR, handleToIAttachment(&st, &database));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
RefPtr<ITransaction> tra(REF_NO_INCR, handleToITransaction(&st, &transaction));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
|
||||
UtlInterfacePtr()->dumpBlob(&st, blob_id, att, tra, file_name, txt);
|
||||
|
||||
if (!st.isSuccess() && st.get()[1] != isc_segstr_eof)
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
isc_print_status(st.get());
|
||||
isc_print_status(st.getErrors());
|
||||
return FB_FAILURE;
|
||||
}
|
||||
|
||||
@ -1804,10 +1803,10 @@ int API_ROUTINE BLOB_edit(ISC_QUAD* blob_id,
|
||||
|
||||
LocalStatus st;
|
||||
RefPtr<IAttachment> att(REF_NO_INCR, handleToIAttachment(&st, &database));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
RefPtr<ITransaction> tra(REF_NO_INCR, handleToITransaction(&st, &transaction));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
|
||||
int rc = FB_SUCCESS;
|
||||
@ -1821,8 +1820,8 @@ int API_ROUTINE BLOB_edit(ISC_QUAD* blob_id,
|
||||
ex.stuffException(&st);
|
||||
}
|
||||
|
||||
if (!st.isSuccess() && st.get()[1] != isc_segstr_eof)
|
||||
isc_print_status(st.get());
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
isc_print_status(st.getErrors());
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -1919,17 +1918,17 @@ static int any_text_load(ISC_QUAD* blob_id,
|
||||
**************************************/
|
||||
LocalStatus st;
|
||||
RefPtr<IAttachment> att(REF_NO_INCR, handleToIAttachment(&st, &database));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
RefPtr<ITransaction> tra(REF_NO_INCR, handleToITransaction(&st, &transaction));
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return FB_FAILURE;
|
||||
|
||||
UtlInterfacePtr()->loadBlob(&st, blob_id, att, tra, file_name, flag);
|
||||
|
||||
if (!st.isSuccess())
|
||||
if (st.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
isc_print_status(st.get());
|
||||
isc_print_status(st.getErrors());
|
||||
return FB_FAILURE;
|
||||
}
|
||||
|
||||
@ -2180,7 +2179,7 @@ static void get_ods_version(IStatus* status, IAttachment* att,
|
||||
|
||||
att->getInfo(status, sizeof(ods_info), ods_info, sizeof(buffer), buffer);
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
const UCHAR* p = buffer;
|
||||
|
@ -901,22 +901,22 @@ private:
|
||||
namespace Why
|
||||
{
|
||||
// StatusVector: Provides correct status vector for operation and init() it.
|
||||
class StatusVector : public AutoIface<IStatus, FB_STATUS_VERSION>
|
||||
class StatusVector : public AutoIface<BaseStatus, FB_STATUS_VERSION>
|
||||
{
|
||||
public:
|
||||
explicit StatusVector(ISC_STATUS* v) throw()
|
||||
: localVector(v ? v : localStatus)
|
||||
{
|
||||
init();
|
||||
}
|
||||
{ }
|
||||
|
||||
operator ISC_STATUS*()
|
||||
operator const ISC_STATUS*()
|
||||
{
|
||||
merge();
|
||||
return localVector;
|
||||
}
|
||||
|
||||
~StatusVector()
|
||||
{
|
||||
merge();
|
||||
#ifdef DEV_BUILD
|
||||
checkStatusVector(localVector);
|
||||
#endif
|
||||
@ -926,47 +926,6 @@ namespace Why
|
||||
void FB_CARG dispose()
|
||||
{ }
|
||||
|
||||
void FB_CARG set(unsigned int length, const ISC_STATUS* value)
|
||||
{
|
||||
fb_utils::copyStatus(localVector, FB_NELEM(localStatus), value, length);
|
||||
}
|
||||
|
||||
void FB_CARG set(const ISC_STATUS* value)
|
||||
{
|
||||
set(fb_utils::statusLength(value), value);
|
||||
}
|
||||
|
||||
void FB_CARG init()
|
||||
{
|
||||
fb_utils::init_status(localVector);
|
||||
}
|
||||
|
||||
const ISC_STATUS* FB_CARG get() const
|
||||
{
|
||||
return localVector;
|
||||
}
|
||||
|
||||
int FB_CARG isSuccess() const
|
||||
{
|
||||
switch (localVector[1])
|
||||
{
|
||||
case 0:
|
||||
case 100:
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void check()
|
||||
{
|
||||
if (!isSuccess())
|
||||
status_exception::raise(get());
|
||||
}
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
// Validate that a status vector looks valid.
|
||||
static void checkStatusVector(const ISC_STATUS* status)
|
||||
@ -1094,6 +1053,11 @@ namespace Why
|
||||
#endif
|
||||
|
||||
private:
|
||||
void merge()
|
||||
{
|
||||
fb_utils::mergeStatus(localVector, FB_NELEM(localStatus), this);
|
||||
}
|
||||
|
||||
ISC_STATUS_ARRAY localStatus;
|
||||
ISC_STATUS* localVector;
|
||||
};
|
||||
@ -1162,7 +1126,7 @@ namespace Why
|
||||
public:
|
||||
virtual void FB_CARG noEntrypoint(IStatus* s)
|
||||
{
|
||||
s->set(Arg::Gds(isc_wish_list).value());
|
||||
s->setErrors(Arg::Gds(isc_wish_list).value());
|
||||
}
|
||||
};
|
||||
|
||||
@ -1365,7 +1329,7 @@ namespace {
|
||||
|
||||
statement->openCursor(status, transaction, inMetadata, buffer, outMetadata);
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
fb_assert(statement->cursor);
|
||||
@ -1380,8 +1344,8 @@ namespace {
|
||||
fb_assert(!pseudoOpened);
|
||||
|
||||
statement->cursor->close(status);
|
||||
if (!status->isSuccess())
|
||||
Arg::StatusVector(status->get()).raise();
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(status);
|
||||
|
||||
statement->cursor = NULL;
|
||||
}
|
||||
@ -1396,8 +1360,8 @@ namespace {
|
||||
if (statement)
|
||||
{
|
||||
statement->free(status);
|
||||
if (!status->isSuccess())
|
||||
Arg::StatusVector(status->get()).raise();
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(status);
|
||||
|
||||
statement = NULL;
|
||||
}
|
||||
@ -1416,7 +1380,7 @@ namespace {
|
||||
ITransaction* newTrans = statement->execute(status, transaction,
|
||||
inMetadata, inBuffer, outMetadata, outBuffer);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
if (transaction && !newTrans)
|
||||
{
|
||||
@ -1440,13 +1404,13 @@ namespace {
|
||||
{
|
||||
statement->cursor->setDelayedOutputFormat(status, outMetadata);
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return FB_FALSE;
|
||||
|
||||
delayedFormat = false;
|
||||
}
|
||||
|
||||
return statement->cursor->fetchNext(status, outBuffer);
|
||||
return statement->cursor->fetchNext(status, outBuffer) == IStatus::FB_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1468,7 +1432,7 @@ static void badHandle(ISC_STATUS code)
|
||||
|
||||
static bool isNetworkError(const IStatus* status)
|
||||
{
|
||||
ISC_STATUS code = status->get()[1];
|
||||
ISC_STATUS code = status->getErrors()[1];
|
||||
return code == isc_network_error || code == isc_net_write_err || code == isc_net_read_err;
|
||||
}
|
||||
|
||||
@ -1581,7 +1545,7 @@ static ISC_STATUS openOrCreateBlob(ISC_STATUS* userStatus, FB_API_HANDLE* dbHand
|
||||
attachment->createBlob(&status, transaction, blobId, bpbLength, bpb) :
|
||||
attachment->openBlob(&status, transaction, blobId, bpbLength, bpb);
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
*blobHandle = blob->getHandle();
|
||||
@ -1675,12 +1639,12 @@ ISC_STATUS API_ROUTINE isc_attach_database(ISC_STATUS* userStatus, SSHORT fileLe
|
||||
RefPtr<Dispatcher> dispatcher(new Dispatcher);
|
||||
|
||||
dispatcher->setDbCryptCallback(&status, TLS_GET(legacyCryptCallback));
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
YAttachment* attachment = dispatcher->attachDatabase(&status, pathName.c_str(),
|
||||
dpbLength, reinterpret_cast<const UCHAR*>(dpb));
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
*publicHandle = attachment->getHandle();
|
||||
@ -1735,7 +1699,7 @@ ISC_STATUS API_ROUTINE isc_cancel_blob(ISC_STATUS* userStatus, FB_API_HANDLE* bl
|
||||
|
||||
blob->cancel(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*blobHandle = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -1763,7 +1727,7 @@ ISC_STATUS API_ROUTINE isc_cancel_events(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
|
||||
event->cancel(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*id = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -1806,7 +1770,7 @@ ISC_STATUS API_ROUTINE isc_close_blob(ISC_STATUS* userStatus, FB_API_HANDLE* blo
|
||||
|
||||
blob->close(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*blobHandle = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -1828,7 +1792,7 @@ ISC_STATUS API_ROUTINE isc_commit_transaction(ISC_STATUS* userStatus, FB_API_HAN
|
||||
RefPtr<YTransaction> transaction(translateHandle(transactions, traHandle));
|
||||
transaction->commit(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*traHandle = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -1876,7 +1840,7 @@ ISC_STATUS API_ROUTINE isc_compile_request(ISC_STATUS* userStatus, FB_API_HANDLE
|
||||
request = attachment->compileRequest(&status, blrLength,
|
||||
reinterpret_cast<const UCHAR*>(blr));
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
*reqHandle = request->getHandle();
|
||||
@ -1900,25 +1864,27 @@ ISC_STATUS API_ROUTINE isc_compile_request(ISC_STATUS* userStatus, FB_API_HANDLE
|
||||
ISC_STATUS API_ROUTINE isc_compile_request2(ISC_STATUS* userStatus, FB_API_HANDLE* dbHandle,
|
||||
FB_API_HANDLE* reqHandle, USHORT blrLength, const SCHAR* blr)
|
||||
{
|
||||
StatusVector status(userStatus);
|
||||
|
||||
if (isc_compile_request(status, dbHandle, reqHandle, blrLength, blr))
|
||||
return status[1];
|
||||
ISC_STATUS rc = isc_compile_request(userStatus, dbHandle, reqHandle, blrLength, blr);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
try
|
||||
{
|
||||
RefPtr<YRequest> request(translateHandle(requests, reqHandle));
|
||||
request->userHandle = reqHandle;
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
StatusVector temp(NULL);
|
||||
ISC_STATUS_ARRAY temp;
|
||||
isc_release_request(temp, reqHandle);
|
||||
|
||||
e.stuffException(&status);
|
||||
}
|
||||
StatusVector status(userStatus);
|
||||
|
||||
return status[1];
|
||||
e.stuffException(&status);
|
||||
return status[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1959,7 +1925,7 @@ ISC_STATUS API_ROUTINE isc_create_database(ISC_STATUS* userStatus, USHORT fileLe
|
||||
RefPtr<Dispatcher> dispatcher(new Dispatcher);
|
||||
|
||||
dispatcher->setDbCryptCallback(&status, TLS_GET(legacyCryptCallback));
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
ClumpletWriter newDpb(ClumpletReader::dpbList, MAX_DPB_SIZE, dpb, dpbLength);
|
||||
@ -1972,7 +1938,7 @@ ISC_STATUS API_ROUTINE isc_create_database(ISC_STATUS* userStatus, USHORT fileLe
|
||||
|
||||
YAttachment* attachment = dispatcher->createDatabase(&status, pathName.c_str(),
|
||||
dpbLength, reinterpret_cast<const UCHAR*>(dpb));
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
*publicHandle = attachment->getHandle();
|
||||
@ -2001,7 +1967,7 @@ ISC_STATUS API_ROUTINE isc_database_cleanup(ISC_STATUS* userStatus, FB_API_HANDL
|
||||
|
||||
attachment->addCleanupHandler(&status, callback);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
callback.release();
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -2066,7 +2032,7 @@ ISC_STATUS API_ROUTINE isc_detach_database(ISC_STATUS* userStatus, FB_API_HANDLE
|
||||
RefPtr<YAttachment> attachment(translateHandle(attachments, handle));
|
||||
attachment->detach(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*handle = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -2096,7 +2062,7 @@ ISC_STATUS API_ROUTINE isc_drop_database(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
RefPtr<YAttachment> attachment(translateHandle(attachments, handle));
|
||||
attachment->dropDatabase(&status);
|
||||
|
||||
if (status.isSuccess() || status[1] == isc_drdb_completed_with_errs)
|
||||
if ((!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)) || status[1] == isc_drdb_completed_with_errs)
|
||||
*handle = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -2119,25 +2085,27 @@ ISC_STATUS API_ROUTINE isc_dsql_alloc_statement(ISC_STATUS* userStatus, FB_API_H
|
||||
ISC_STATUS API_ROUTINE isc_dsql_alloc_statement2(ISC_STATUS* userStatus, FB_API_HANDLE* dbHandle,
|
||||
FB_API_HANDLE* stmtHandle)
|
||||
{
|
||||
StatusVector status(userStatus);
|
||||
|
||||
if (isc_dsql_alloc_statement(status, dbHandle, stmtHandle))
|
||||
return status[1];
|
||||
ISC_STATUS rc = isc_dsql_alloc_statement(userStatus, dbHandle, stmtHandle);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
try
|
||||
{
|
||||
RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle));
|
||||
statement->userHandle = stmtHandle;
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
StatusVector temp(NULL);
|
||||
ISC_STATUS_ARRAY temp;
|
||||
isc_dsql_free_statement(temp, stmtHandle, DSQL_drop);
|
||||
|
||||
e.stuffException(&status);
|
||||
}
|
||||
StatusVector status(userStatus);
|
||||
|
||||
return status[1];
|
||||
e.stuffException(&status);
|
||||
return status[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2245,7 +2213,7 @@ ISC_STATUS API_ROUTINE isc_dsql_execute2(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
statement->checkPrepared();
|
||||
|
||||
const unsigned flags = statement->statement->getFlags(&status);
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -2260,7 +2228,7 @@ ISC_STATUS API_ROUTINE isc_dsql_execute2(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
|
||||
statement->openCursor(&status, traHandle,
|
||||
inMessage.metadata, inMsgBuffer.begin(), DELAYED_OUT_FORMAT);
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -2273,7 +2241,7 @@ ISC_STATUS API_ROUTINE isc_dsql_execute2(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
|
||||
statement->execute(&status, traHandle,
|
||||
inMessage.metadata, inMsgBuffer.begin(), outMessage.metadata, outMessage.getBuffer());
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
outMessage.scatterData();
|
||||
}
|
||||
}
|
||||
@ -2320,7 +2288,7 @@ ISC_STATUS API_ROUTINE isc_dsql_execute2_m(ISC_STATUS* userStatus, FB_API_HANDLE
|
||||
InternalMessageBuffer outMsgBuffer(outBlrLength, (const UCHAR*)outBlr, outMsgLength, (UCHAR*)outMsg);
|
||||
|
||||
const unsigned flags = statement->statement->getFlags(&status);
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
if ((flags & IStatement::FLAG_HAS_CURSOR) && (outMsgLength == 0))
|
||||
{
|
||||
@ -2381,7 +2349,7 @@ ISC_STATUS API_ROUTINE isc_dsql_exec_immed2(ISC_STATUS* userStatus, FB_API_HANDL
|
||||
|
||||
if (stmtIsCrDb)
|
||||
{
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*dbHandle = att->getHandle();
|
||||
|
||||
return status[1];
|
||||
@ -2399,7 +2367,7 @@ ISC_STATUS API_ROUTINE isc_dsql_exec_immed2(ISC_STATUS* userStatus, FB_API_HANDL
|
||||
dialect, inMessage.metadata, inMessageBuffer.begin(),
|
||||
outMessage.metadata, outMessage.getBuffer());
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
outMessage.scatterData();
|
||||
}
|
||||
@ -2447,7 +2415,7 @@ ISC_STATUS API_ROUTINE isc_dsql_exec_immed2_m(ISC_STATUS* userStatus, FB_API_HAN
|
||||
|
||||
if (stmtIsCrDb)
|
||||
{
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*dbHandle = att->getHandle();
|
||||
|
||||
return status[1];
|
||||
@ -2505,7 +2473,7 @@ ISC_STATUS API_ROUTINE isc_dsql_fetch(ISC_STATUS* userStatus, FB_API_HANDLE* stm
|
||||
|
||||
if (statement->fetch(&status, outMessage.metadata, outMessage.getBuffer()))
|
||||
outMessage.scatterData();
|
||||
else if (status.isSuccess())
|
||||
else if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
return 100;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -2536,7 +2504,7 @@ ISC_STATUS API_ROUTINE isc_dsql_fetch_m(ISC_STATUS* userStatus, FB_API_HANDLE* s
|
||||
}
|
||||
|
||||
if (!statement->fetch(&status, msgBuffer.metadata, reinterpret_cast<UCHAR*>(msg)) &&
|
||||
status.isSuccess())
|
||||
!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
@ -2623,7 +2591,7 @@ ISC_STATUS API_ROUTINE isc_dsql_prepare(ISC_STATUS* userStatus, FB_API_HANDLE* t
|
||||
if (statement->statement)
|
||||
{
|
||||
statement->closeStatement(&status);
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
}
|
||||
|
||||
@ -2635,7 +2603,7 @@ ISC_STATUS API_ROUTINE isc_dsql_prepare(ISC_STATUS* userStatus, FB_API_HANDLE* t
|
||||
statement->statement = statement->attachment->prepare(&status, transaction, stmtLength,
|
||||
sqlStmt, dialect, IStatement::PREPARE_PREFETCH_METADATA);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
StatusVector tempStatus(NULL);
|
||||
|
||||
@ -2670,7 +2638,7 @@ ISC_STATUS API_ROUTINE isc_dsql_prepare_m(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
if (statement->statement)
|
||||
{
|
||||
statement->closeStatement(&status);
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
}
|
||||
|
||||
@ -2685,7 +2653,7 @@ ISC_STATUS API_ROUTINE isc_dsql_prepare_m(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
statement->statement = statement->attachment->prepare(&status, transaction, stmtLength,
|
||||
sqlStmt, dialect, flags);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
StatusVector tempStatus(NULL);
|
||||
statement->statement->getInfo(&tempStatus, itemLength, reinterpret_cast<const UCHAR*>(items),
|
||||
@ -2818,7 +2786,7 @@ ISC_STATUS API_ROUTINE isc_wait_for_event(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
|
||||
events = attachment->queEvents(&status, callback, length, eventsData);
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
callback->sem.enter();
|
||||
@ -2893,7 +2861,7 @@ ISC_STATUS API_ROUTINE isc_que_events(ISC_STATUS* userStatus, FB_API_HANDLE* dbH
|
||||
|
||||
events = attachment->queEvents(&status, callback, length, eventsData);
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
*id = FB_API_HANDLE_TO_ULONG(events->getHandle());
|
||||
@ -2923,12 +2891,21 @@ ISC_STATUS API_ROUTINE isc_get_segment(ISC_STATUS* userStatus, FB_API_HANDLE* bl
|
||||
try
|
||||
{
|
||||
RefPtr<YBlob> blob(translateHandle(blobs, blobHandle));
|
||||
unsigned int length = blob->getSegment(&status, bufferLength, buffer);
|
||||
unsigned int length;
|
||||
int cc = blob->getSegment(&status, bufferLength, buffer, &length);
|
||||
|
||||
if ((status.isSuccess() || status[1] == isc_segment || status[1] == isc_segstr_eof) &&
|
||||
returnLength)
|
||||
{
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*returnLength = length;
|
||||
|
||||
// Raise pseudo errors
|
||||
switch(cc)
|
||||
{
|
||||
case IStatus::FB_EOF:
|
||||
Arg::Gds(isc_segstr_eof).raise();
|
||||
break;
|
||||
case IStatus::FB_SEGMENT:
|
||||
Arg::Gds(isc_segment).raise();
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -2955,7 +2932,7 @@ ISC_STATUS API_ROUTINE isc_get_slice(ISC_STATUS* userStatus, FB_API_HANDLE* dbHa
|
||||
int length = attachment->getSlice(&status, transaction, arrayId, sdlLength, sdl,
|
||||
paramLength, param, sliceLength, slice);
|
||||
|
||||
if (status.isSuccess() && returnLength)
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS) && returnLength)
|
||||
*returnLength = length;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -2977,7 +2954,7 @@ ISC_STATUS API_ROUTINE fb_disconnect_transaction(ISC_STATUS* userStatus, FB_API_
|
||||
RefPtr<YTransaction> transaction(translateHandle(transactions, traHandle));
|
||||
transaction->disconnect(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*traHandle = 0; // ASF: Previous versions wasn't cleaning the handle.
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3112,7 +3089,7 @@ ISC_STATUS API_ROUTINE isc_reconnect_transaction(ISC_STATUS* userStatus, FB_API_
|
||||
|
||||
YTransaction* transaction = attachment->reconnectTransaction(&status, length, id);
|
||||
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(status);
|
||||
|
||||
*traHandle = transaction->getHandle();
|
||||
@ -3136,7 +3113,7 @@ ISC_STATUS API_ROUTINE isc_release_request(ISC_STATUS* userStatus, FB_API_HANDLE
|
||||
RefPtr<YRequest> request(translateHandle(requests, reqHandle));
|
||||
request->free(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*reqHandle = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3218,7 +3195,7 @@ ISC_STATUS API_ROUTINE isc_rollback_transaction(ISC_STATUS* userStatus, FB_API_H
|
||||
RefPtr<YTransaction> transaction(translateHandle(transactions, traHandle));
|
||||
transaction->rollback(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*traHandle = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3241,7 +3218,7 @@ ISC_STATUS API_ROUTINE isc_seek_blob(ISC_STATUS* userStatus, FB_API_HANDLE* blob
|
||||
RefPtr<YBlob> blob(translateHandle(blobs, blobHandle));
|
||||
unsigned int pos = blob->seek(&status, mode, offset);
|
||||
|
||||
if (status.isSuccess() && result)
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS) && result)
|
||||
*result = pos;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3292,12 +3269,12 @@ ISC_STATUS API_ROUTINE isc_service_attach(ISC_STATUS* userStatus, USHORT service
|
||||
RefPtr<Dispatcher> dispatcher(new Dispatcher);
|
||||
|
||||
dispatcher->setDbCryptCallback(&status, TLS_GET(legacyCryptCallback));
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
service = dispatcher->attachServiceManager(&status, svcName.c_str(),
|
||||
spbLength, reinterpret_cast<const UCHAR*>(spb));
|
||||
if (!status.isSuccess())
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return status[1];
|
||||
|
||||
*publicHandle = service->getHandle();
|
||||
@ -3327,7 +3304,7 @@ ISC_STATUS API_ROUTINE isc_service_detach(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
RefPtr<YService> service(translateHandle(services, handle));
|
||||
service->detach(&status);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
*handle = 0;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3511,8 +3488,6 @@ ISC_STATUS API_ROUTINE isc_start_multiple(ISC_STATUS* userStatus, FB_API_HANDLE*
|
||||
ISC_STATUS API_ROUTINE_VARARG isc_start_transaction(ISC_STATUS* userStatus,
|
||||
FB_API_HANDLE* traHandle, SSHORT count, ...)
|
||||
{
|
||||
StatusVector status(userStatus);
|
||||
|
||||
try
|
||||
{
|
||||
HalfStaticArray<TEB, 16> tebs;
|
||||
@ -3531,14 +3506,15 @@ ISC_STATUS API_ROUTINE_VARARG isc_start_transaction(ISC_STATUS* userStatus,
|
||||
|
||||
va_end(ptr);
|
||||
|
||||
isc_start_multiple(status, traHandle, count, teb);
|
||||
return isc_start_multiple(userStatus, traHandle, count, teb);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
e.stuffException(&status);
|
||||
}
|
||||
StatusVector status(userStatus);
|
||||
|
||||
return status[1];
|
||||
e.stuffException(&status);
|
||||
return status[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3583,7 +3559,7 @@ ISC_STATUS API_ROUTINE gds__transaction_cleanup(ISC_STATUS* userStatus, FB_API_H
|
||||
|
||||
transaction->addCleanupHandler(&status, callback);
|
||||
|
||||
if (status.isSuccess())
|
||||
if (!(status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
callback.release();
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3644,7 +3620,7 @@ int API_ROUTINE fb_shutdown(unsigned int timeout, const int reason)
|
||||
RefPtr<Dispatcher> dispatcher(new Dispatcher);
|
||||
|
||||
dispatcher->shutdown(&status, timeout, reason);
|
||||
return status.isSuccess() ? FB_SUCCESS : FB_FAILURE;
|
||||
return (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS) ? FB_FAILURE : FB_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@ -3782,7 +3758,7 @@ void YEvents::cancel(IStatus* status)
|
||||
|
||||
entry.next()->cancel(status);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3921,7 +3897,7 @@ void YRequest::free(IStatus* status)
|
||||
|
||||
entry.next()->free(status);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3974,12 +3950,12 @@ void YBlob::getInfo(IStatus* status, unsigned int itemsLength,
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int YBlob::getSegment(IStatus* status, unsigned int length, void* buffer)
|
||||
int YBlob::getSegment(IStatus* status, unsigned int bufferLength, void* buffer, unsigned int *segmentLength)
|
||||
{
|
||||
try
|
||||
{
|
||||
YEntry<YBlob> entry(status, this);
|
||||
return entry.next()->getSegment(status, length, buffer);
|
||||
return entry.next()->getSegment(status, bufferLength, buffer, segmentLength);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4010,7 +3986,7 @@ void YBlob::cancel(IStatus* status)
|
||||
|
||||
entry.next()->cancel(status);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -4027,7 +4003,7 @@ void YBlob::close(IStatus* status)
|
||||
|
||||
entry.next()->close(status);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -4165,8 +4141,8 @@ IMessageMetadata* YStatement::getMetadata(bool in, IStatement* next)
|
||||
{
|
||||
LocalStatus status;
|
||||
IMessageMetadata* rc = in ? next->getInputMetadata(&status) : next->getOutputMetadata(&status);
|
||||
if (!status.isSuccess())
|
||||
status_exception::raise(status.get());
|
||||
if (status.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(&status);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -4270,7 +4246,7 @@ IResultSet* YStatement::openCursor(Firebird::IStatus* status, ITransaction* tran
|
||||
attachment->getNextTransaction(status, transaction, trans);
|
||||
|
||||
IResultSet* rs = entry.next()->openCursor(status, trans, inMetadata, inBuffer, outMetadata);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -4295,7 +4271,7 @@ void YStatement::free(IStatus* status)
|
||||
YEntry<YStatement> entry(status, this);
|
||||
|
||||
entry.next()->free(status);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -4383,7 +4359,7 @@ void YResultSet::setDelayedOutputFormat(IStatus* status, IMessageMetadata* forma
|
||||
}
|
||||
}
|
||||
|
||||
FB_BOOLEAN YResultSet::fetchNext(IStatus* status, void* buffer)
|
||||
int YResultSet::fetchNext(IStatus* status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4399,7 +4375,7 @@ FB_BOOLEAN YResultSet::fetchNext(IStatus* status, void* buffer)
|
||||
return FB_FALSE;
|
||||
}
|
||||
|
||||
FB_BOOLEAN YResultSet::fetchPrior(IStatus* status, void* buffer)
|
||||
int YResultSet::fetchPrior(IStatus* status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4415,7 +4391,7 @@ FB_BOOLEAN YResultSet::fetchPrior(IStatus* status, void* buffer)
|
||||
return FB_FALSE;
|
||||
}
|
||||
|
||||
FB_BOOLEAN YResultSet::fetchFirst(IStatus* status, void* buffer)
|
||||
int YResultSet::fetchFirst(IStatus* status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4431,7 +4407,7 @@ FB_BOOLEAN YResultSet::fetchFirst(IStatus* status, void* buffer)
|
||||
return FB_FALSE;
|
||||
}
|
||||
|
||||
FB_BOOLEAN YResultSet::fetchLast(IStatus* status, void* buffer)
|
||||
int YResultSet::fetchLast(IStatus* status, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4447,7 +4423,7 @@ FB_BOOLEAN YResultSet::fetchLast(IStatus* status, void* buffer)
|
||||
return FB_FALSE;
|
||||
}
|
||||
|
||||
FB_BOOLEAN YResultSet::fetchAbsolute(IStatus* status, unsigned int position, void* buffer)
|
||||
int YResultSet::fetchAbsolute(IStatus* status, unsigned int position, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4463,7 +4439,7 @@ FB_BOOLEAN YResultSet::fetchAbsolute(IStatus* status, unsigned int position, voi
|
||||
return FB_FALSE;
|
||||
}
|
||||
|
||||
FB_BOOLEAN YResultSet::fetchRelative(IStatus* status, int offset, void* buffer)
|
||||
int YResultSet::fetchRelative(IStatus* status, int offset, void* buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4535,7 +4511,7 @@ void YResultSet::close(IStatus* status)
|
||||
|
||||
entry.next()->close(status);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -4630,7 +4606,7 @@ void YTransaction::commit(IStatus* status)
|
||||
|
||||
entry.next()->commit(status);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -4663,7 +4639,7 @@ void YTransaction::rollback(IStatus* status)
|
||||
if (isNetworkError(status))
|
||||
status->init();
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -4699,7 +4675,7 @@ void YTransaction::disconnect(IStatus* status)
|
||||
{
|
||||
i->next->disconnect(status);
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
return;
|
||||
|
||||
i->next = NULL;
|
||||
@ -4890,7 +4866,7 @@ YStatement* YAttachment::prepare(IStatus* status, ITransaction* transaction,
|
||||
getNextTransaction(status, transaction, trans);
|
||||
|
||||
IStatement* st = entry.next()->prepare(status, trans, stmtLength, sqlStmt, dialect, flags);
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
return new YStatement(this, st);
|
||||
}
|
||||
@ -5098,7 +5074,7 @@ IResultSet* YAttachment::openCursor(IStatus* status, ITransaction* transaction,
|
||||
|
||||
rs = entry.next()->openCursor(status, trans, length, string, dialect,
|
||||
inMetadata, inBuffer, outMetadata, cursorName);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -5173,7 +5149,7 @@ void YAttachment::execute(Firebird::IStatus* status, FB_API_HANDLE* traHandle,
|
||||
ITransaction* newTrans = execute(status, transaction, stmtLength, sqlStmt,
|
||||
dialect, inMetadata, inBuffer, outMetadata, outBuffer);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
if (transaction && !newTrans)
|
||||
{
|
||||
@ -5235,10 +5211,10 @@ void YAttachment::ping(IStatus* status)
|
||||
|
||||
entry.next()->ping(status);
|
||||
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
{
|
||||
if (!savedStatus.getError())
|
||||
savedStatus.save(status->get());
|
||||
savedStatus.save(status);
|
||||
|
||||
StatusVector temp(NULL);
|
||||
entry.next()->detach(&temp);
|
||||
@ -5262,7 +5238,7 @@ void YAttachment::detach(IStatus* status)
|
||||
if (entry.next())
|
||||
entry.next()->detach(status);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -5279,7 +5255,7 @@ void YAttachment::dropDatabase(IStatus* status)
|
||||
|
||||
entry.next()->dropDatabase(status);
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
destroy(DF_RELEASE);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -5313,8 +5289,8 @@ YTransaction* YAttachment::getTransaction(IStatus* status, ITransaction* tra)
|
||||
// If validation is successfull, this means that this attachment and valid transaction
|
||||
// use same provider. I.e. the following cast is safe.
|
||||
YTransaction* yt = static_cast<YTransaction*>(tra->validate(status, this));
|
||||
if (!status->isSuccess())
|
||||
status_exception::raise(status->get());
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
status_exception::raise(status);
|
||||
if (!yt)
|
||||
Arg::Gds(isc_bad_trans_handle).raise();
|
||||
|
||||
@ -5511,7 +5487,7 @@ YAttachment* Dispatcher::attachOrCreateDatabase(Firebird::IStatus* status, bool
|
||||
if (cryptCallback)
|
||||
{
|
||||
provider->setDbCryptCallback(currentStatus, cryptCallback);
|
||||
if (!currentStatus->isSuccess())
|
||||
if (currentStatus->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -5521,7 +5497,7 @@ YAttachment* Dispatcher::attachOrCreateDatabase(Firebird::IStatus* status, bool
|
||||
provider->attachDatabase(currentStatus, expandedFilename.c_str(),
|
||||
newDpb.getBufferLength(), newDpb.getBuffer());
|
||||
|
||||
if (currentStatus->isSuccess())
|
||||
if (!(currentStatus->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
#ifdef WIN_NT
|
||||
if (createFlag)
|
||||
@ -5536,17 +5512,18 @@ YAttachment* Dispatcher::attachOrCreateDatabase(Firebird::IStatus* status, bool
|
||||
}
|
||||
#endif
|
||||
|
||||
status->set(currentStatus->get());
|
||||
status->setErrors(currentStatus->getErrors());
|
||||
status->setWarnings(currentStatus->getWarnings());
|
||||
return new YAttachment(provider, attachment, expandedFilename);
|
||||
}
|
||||
|
||||
if (currentStatus->get()[1] != isc_unavailable)
|
||||
if (currentStatus->getErrors()[1] != isc_unavailable)
|
||||
currentStatus = &temp;
|
||||
|
||||
currentStatus->init();
|
||||
}
|
||||
|
||||
if (status->get()[1] == 0)
|
||||
if (status->getErrors()[1] == 0)
|
||||
Arg::Gds(isc_unavailable).raise();
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -5605,18 +5582,18 @@ YService* Dispatcher::attachServiceManager(IStatus* status, const char* serviceN
|
||||
if (cryptCallback)
|
||||
{
|
||||
p->setDbCryptCallback(status, cryptCallback);
|
||||
if (!status->isSuccess())
|
||||
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
|
||||
continue;
|
||||
}
|
||||
|
||||
service = p->attachServiceManager(status, svcName.c_str(),
|
||||
spbWriter.getBufferLength(), spbWriter.getBuffer());
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
return new YService(p, service, utfData);
|
||||
}
|
||||
|
||||
if (status->isSuccess())
|
||||
if (!(status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS))
|
||||
{
|
||||
(Arg::Gds(isc_service_att_err) <<
|
||||
Arg::Gds(isc_no_providers)).copyTo(status);
|
||||
@ -5665,7 +5642,7 @@ void Dispatcher::shutdown(IStatus* userStatus, unsigned int timeout, const int r
|
||||
// Ask clients about shutdown confirmation.
|
||||
if (ShutChain::run(fb_shut_confirmation, reason) != FB_SUCCESS)
|
||||
{
|
||||
userStatus->set(error.value());
|
||||
userStatus->setErrors(error.value());
|
||||
return; // Do not perform former shutdown
|
||||
}
|
||||
|
||||
@ -5675,7 +5652,7 @@ void Dispatcher::shutdown(IStatus* userStatus, unsigned int timeout, const int r
|
||||
|
||||
// Shutdown clients before providers
|
||||
if (ShutChain::run(fb_shut_preproviders, reason) != FB_SUCCESS)
|
||||
userStatus->set(error.value());
|
||||
userStatus->setErrors(error.value());
|
||||
|
||||
// Shutdown yValve
|
||||
// Since this moment no new thread will be able to enter yValve.
|
||||
@ -5694,7 +5671,7 @@ void Dispatcher::shutdown(IStatus* userStatus, unsigned int timeout, const int r
|
||||
provider->shutdown(&status2, timeout, reason);
|
||||
|
||||
if (status2[1])
|
||||
userStatus->set(error.value());
|
||||
userStatus->setErrors(error.value());
|
||||
}
|
||||
|
||||
// Close all known interfaces from providers...
|
||||
@ -5775,20 +5752,20 @@ void Dispatcher::shutdown(IStatus* userStatus, unsigned int timeout, const int r
|
||||
|
||||
// Shutdown clients after providers.
|
||||
if (ShutChain::run(fb_shut_postproviders, reason) != FB_SUCCESS)
|
||||
userStatus->set(error.value());
|
||||
userStatus->setErrors(error.value());
|
||||
|
||||
// Finish shutdown.
|
||||
if (ShutChain::run(fb_shut_finish, reason) != FB_SUCCESS)
|
||||
userStatus->set(error.value());
|
||||
userStatus->setErrors(error.value());
|
||||
|
||||
// At this step callbacks are welcome to exit (or take actions to make main thread do it).
|
||||
if (ShutChain::run(fb_shut_exit, reason) != FB_SUCCESS)
|
||||
userStatus->set(error.value());
|
||||
userStatus->setErrors(error.value());
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
e.stuffException(userStatus);
|
||||
gds__log_status(0, userStatus->get());
|
||||
iscLogStatus(NULL, userStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user