mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:00:38 +01:00
Misc.
This commit is contained in:
parent
e280bca0f9
commit
9ece682387
@ -13,7 +13,7 @@
|
|||||||
# See the License for the specific language governing rights
|
# See the License for the specific language governing rights
|
||||||
# and limitations under the License.
|
# and limitations under the License.
|
||||||
#
|
#
|
||||||
# The Original Code was created by Nickolay Samofatov
|
# The Original Code was created by Adriano dos Santos Fernandes
|
||||||
# for the Firebird Open Source RDBMS project.
|
# for the Firebird Open Source RDBMS project.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 Adriano dos Santos Fernandes <adrianosf@gmail.com>
|
# Copyright (c) 2015 Adriano dos Santos Fernandes <adrianosf@gmail.com>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* MODULE: 01.create.cpp
|
* MODULE: 01.create.cpp
|
||||||
* DESCRIPTION: A sample of creating new database and new table in it.
|
* DESCRIPTION: A sample of creating new database and new table in it.
|
||||||
* Run second time (whene database already exists) to see
|
* Run second time (whene database already exists) to see
|
||||||
* how FbException is caught and handled by thid code.
|
* how FbException is caught and handled by this code.
|
||||||
*
|
*
|
||||||
* Example for the following interfaces:
|
* Example for the following interfaces:
|
||||||
* IMaster - main inteface to access all the rest
|
* IMaster - main inteface to access all the rest
|
||||||
|
@ -131,7 +131,7 @@ int main()
|
|||||||
{
|
{
|
||||||
stmt->execute(&status, tra, meta, buffer, NULL, NULL);
|
stmt->execute(&status, tra, meta, buffer, NULL, NULL);
|
||||||
}
|
}
|
||||||
catch(const FbException& error)
|
catch (const FbException& error)
|
||||||
{
|
{
|
||||||
// Handle exception raised during statement execution
|
// Handle exception raised during statement execution
|
||||||
int sqlcode = isc_sqlcode(error.getStatus()->getErrors());
|
int sqlcode = isc_sqlcode(error.getStatus()->getErrors());
|
||||||
@ -210,4 +210,3 @@ int get_input (char *dept_no, double *percent)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
|
|||||||
Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
|
Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
|
||||||
return alice(uSvc);
|
return alice(uSvc);
|
||||||
}
|
}
|
||||||
catch(const Firebird::Exception& ex)
|
catch (const Firebird::Exception& ex)
|
||||||
{
|
{
|
||||||
ISC_STATUS_ARRAY st;
|
ISC_STATUS_ARRAY st;
|
||||||
ex.stuff_exception(st);
|
ex.stuff_exception(st);
|
||||||
|
@ -48,7 +48,7 @@ int CLIB_ROUTINE main( int argc, char* argv[])
|
|||||||
Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
|
Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
|
||||||
return gbak(uSvc);
|
return gbak(uSvc);
|
||||||
}
|
}
|
||||||
catch(const Firebird::Exception& ex)
|
catch (const Firebird::Exception& ex)
|
||||||
{
|
{
|
||||||
ISC_STATUS_ARRAY st;
|
ISC_STATUS_ARRAY st;
|
||||||
ex.stuff_exception(st);
|
ex.stuff_exception(st);
|
||||||
|
@ -355,7 +355,7 @@ bool ISC_get_user(Firebird::string* name, int* id, int* group)
|
|||||||
p = password->pw_name;
|
p = password->pw_name;
|
||||||
else
|
else
|
||||||
p = "";
|
p = "";
|
||||||
#ifndef ANDROID // Why do they print silly unimplemted message for this function?
|
#ifndef ANDROID // Why do they print silly unimplemented message for this function?
|
||||||
endpwent();
|
endpwent();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
using namespace Firebird;
|
using namespace Firebird;
|
||||||
using namespace Jrd;
|
using namespace Jrd;
|
||||||
|
|
||||||
const char* const SCRATCH = "fb_cursor_";
|
static const char* const SCRATCH = "fb_cursor_";
|
||||||
const ULONG PREFETCH_SIZE = 65536; // 64 KB
|
static const ULONG PREFETCH_SIZE = 65536; // 64 KB
|
||||||
|
|
||||||
DsqlCursor::DsqlCursor(dsql_req* req, ULONG flags)
|
DsqlCursor::DsqlCursor(dsql_req* req, ULONG flags)
|
||||||
: m_request(req), m_flags(flags),
|
: m_request(req), m_flags(flags),
|
||||||
|
@ -75,4 +75,3 @@ private:
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif // DSQL_CURSOR_H
|
#endif // DSQL_CURSOR_H
|
||||||
|
|
||||||
|
@ -3242,8 +3242,8 @@ static void down_grade(thread_db* tdbb, BufferDesc* bdb, int high)
|
|||||||
return; // false;
|
return; // false;
|
||||||
|
|
||||||
// hvlad: buffer is in use and we can't downgrade its lock. But if this
|
// hvlad: buffer is in use and we can't downgrade its lock. But if this
|
||||||
// buffer blocks some lower precedence buffer, it is enough to just write
|
// buffer blocks some lower precedence buffer, it is enough to just write
|
||||||
// our (high) buffer to clear precedence and thus allow blocked (low)
|
// our (high) buffer to clear precedence and thus allow blocked (low)
|
||||||
// buffer to be downgraded. IO lock guarantees that there is no buffer
|
// buffer to be downgraded. IO lock guarantees that there is no buffer
|
||||||
// modification in progress currently and it is safe to write it right now.
|
// modification in progress currently and it is safe to write it right now.
|
||||||
// No need to mark our buffer as blocking nor to change state of our lock.
|
// No need to mark our buffer as blocking nor to change state of our lock.
|
||||||
@ -3255,9 +3255,9 @@ static void down_grade(thread_db* tdbb, BufferDesc* bdb, int high)
|
|||||||
return; // true
|
return; // true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!oldBlocking) {
|
if (!oldBlocking)
|
||||||
bdb->bdb_ast_flags &= ~BDB_blocking;
|
bdb->bdb_ast_flags &= ~BDB_blocking;
|
||||||
}
|
|
||||||
justWrite = true;
|
justWrite = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3397,6 +3397,7 @@ static void down_grade(thread_db* tdbb, BufferDesc* bdb, int high)
|
|||||||
} // syncPrec scope
|
} // syncPrec scope
|
||||||
|
|
||||||
bdb->bdb_flags &= ~BDB_not_valid;
|
bdb->bdb_flags &= ~BDB_not_valid;
|
||||||
|
|
||||||
if (justWrite)
|
if (justWrite)
|
||||||
bdb->unLockIO(tdbb);
|
bdb->unLockIO(tdbb);
|
||||||
else
|
else
|
||||||
|
@ -4495,10 +4495,8 @@ JResultSet* JStatement::openCursor(CheckStatusWrapper* user_status, ITransaction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DsqlCursor* const cursor =
|
DsqlCursor* const cursor = DSQL_open(tdbb, &tra, getHandle(),
|
||||||
DSQL_open(tdbb, &tra, getHandle(),
|
inMetadata, static_cast<UCHAR*>(inBuffer), outMetadata, flags);
|
||||||
inMetadata, static_cast<UCHAR*>(inBuffer),
|
|
||||||
outMetadata, flags);
|
|
||||||
|
|
||||||
rs = new JResultSet(cursor, this);
|
rs = new JResultSet(cursor, this);
|
||||||
rs->addRef();
|
rs->addRef();
|
||||||
|
@ -1686,8 +1686,8 @@ SRQ_PTR LockManager::create_owner(Arg::StatusVector& statusVector,
|
|||||||
{
|
{
|
||||||
TEXT bug_buffer[BUFFER_TINY];
|
TEXT bug_buffer[BUFFER_TINY];
|
||||||
sprintf(bug_buffer, "inconsistent lock table type/version; found %d/%d:%d, expected %d/%d:%d",
|
sprintf(bug_buffer, "inconsistent lock table type/version; found %d/%d:%d, expected %d/%d:%d",
|
||||||
m_sharedMemory->getHeader()->mhb_type,
|
m_sharedMemory->getHeader()->mhb_type,
|
||||||
m_sharedMemory->getHeader()->mhb_header_version,
|
m_sharedMemory->getHeader()->mhb_header_version,
|
||||||
m_sharedMemory->getHeader()->mhb_version,
|
m_sharedMemory->getHeader()->mhb_version,
|
||||||
SharedMemoryBase::SRAM_LOCK_MANAGER, MemoryHeader::HEADER_VERSION, LHB_VERSION);
|
SharedMemoryBase::SRAM_LOCK_MANAGER, MemoryHeader::HEADER_VERSION, LHB_VERSION);
|
||||||
bug(&statusVector, bug_buffer);
|
bug(&statusVector, bug_buffer);
|
||||||
|
@ -762,7 +762,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
|
|||||||
|
|
||||||
// if we can't read this version - admit there's nothing to say and return.
|
// if we can't read this version - admit there's nothing to say and return.
|
||||||
|
|
||||||
if (LOCK_header->mhb_header_version != MemoryHeader::HEADER_VERSION ||
|
if (LOCK_header->mhb_header_version != MemoryHeader::HEADER_VERSION ||
|
||||||
LOCK_header->mhb_version != LHB_VERSION)
|
LOCK_header->mhb_version != LHB_VERSION)
|
||||||
{
|
{
|
||||||
if (LOCK_header->mhb_type == 0 && LOCK_header->mhb_header_version == 0 && LOCK_header->mhb_version == 0)
|
if (LOCK_header->mhb_type == 0 && LOCK_header->mhb_header_version == 0 && LOCK_header->mhb_version == 0)
|
||||||
|
@ -127,7 +127,7 @@ void Arc4::setKey(CheckStatusWrapper* status, ICryptKey* key)
|
|||||||
k = key->getDecryptKey(&l);
|
k = key->getDecryptKey(&l);
|
||||||
de = createCypher(l, k);
|
de = createCypher(l, k);
|
||||||
}
|
}
|
||||||
catch(const Exception& ex)
|
catch (const Exception& ex)
|
||||||
{
|
{
|
||||||
ex.stuffException(status);
|
ex.stuffException(status);
|
||||||
}
|
}
|
||||||
|
@ -199,8 +199,6 @@ public:
|
|||||||
for (bool cont = accessor.getFirst(); cont; cont = accessor.getNext())
|
for (bool cont = accessor.getFirst(); cont; cont = accessor.getNext())
|
||||||
accessor.current()->second->dispose();
|
accessor.current()->second->dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete module;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -265,7 +263,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PathName moduleName;
|
PathName moduleName;
|
||||||
ModuleLoader::Module* module;
|
AutoPtr<ModuleLoader::Module> module;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FB_BOOLEAN myUnloadFlag;
|
FB_BOOLEAN myUnloadFlag;
|
||||||
|
@ -1676,7 +1676,8 @@ void rem_port::initCompression()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InternalCryptKey::setSymmetric(Firebird::CheckStatusWrapper* status, const char* type, unsigned keyLength, const void* key)
|
void InternalCryptKey::setSymmetric(Firebird::CheckStatusWrapper* status, const char* type,
|
||||||
|
unsigned keyLength, const void* key)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1685,14 +1686,15 @@ void InternalCryptKey::setSymmetric(Firebird::CheckStatusWrapper* status, const
|
|||||||
encrypt.set(keyLength, key);
|
encrypt.set(keyLength, key);
|
||||||
decrypt.clear();
|
decrypt.clear();
|
||||||
}
|
}
|
||||||
catch(const Firebird::Exception& ex)
|
catch (const Firebird::Exception& ex)
|
||||||
{
|
{
|
||||||
ex.stuffException(status);
|
ex.stuffException(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InternalCryptKey::setAsymmetric(Firebird::CheckStatusWrapper* status, const char* type, unsigned encryptKeyLength,
|
void InternalCryptKey::setAsymmetric(Firebird::CheckStatusWrapper* status, const char* type,
|
||||||
const void* encryptKey, unsigned decryptKeyLength, const void* decryptKey)
|
unsigned encryptKeyLength, const void* encryptKey, unsigned decryptKeyLength,
|
||||||
|
const void* decryptKey)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1701,7 +1703,7 @@ void InternalCryptKey::setAsymmetric(Firebird::CheckStatusWrapper* status, const
|
|||||||
encrypt.set(encryptKeyLength, encryptKey);
|
encrypt.set(encryptKeyLength, encryptKey);
|
||||||
decrypt.set(decryptKeyLength, decryptKey);
|
decrypt.set(decryptKeyLength, decryptKey);
|
||||||
}
|
}
|
||||||
catch(const Firebird::Exception& ex)
|
catch (const Firebird::Exception& ex)
|
||||||
{
|
{
|
||||||
ex.stuffException(status);
|
ex.stuffException(status);
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// CryptKey implementation
|
// CryptKey implementation
|
||||||
class InternalCryptKey FB_FINAL : public Firebird::VersionedIface<Firebird::ICryptKeyImpl<InternalCryptKey, Firebird::CheckStatusWrapper> >,
|
class InternalCryptKey FB_FINAL :
|
||||||
|
public Firebird::VersionedIface<Firebird::ICryptKeyImpl<InternalCryptKey, Firebird::CheckStatusWrapper> >,
|
||||||
public Firebird::GlobalStorage
|
public Firebird::GlobalStorage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -48,7 +48,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
|
|||||||
Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
|
Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
|
||||||
return gsec(uSvc);
|
return gsec(uSvc);
|
||||||
}
|
}
|
||||||
catch(const Firebird::Exception& ex)
|
catch (const Firebird::Exception& ex)
|
||||||
{
|
{
|
||||||
ISC_STATUS_ARRAY st;
|
ISC_STATUS_ARRAY st;
|
||||||
ex.stuff_exception(st);
|
ex.stuff_exception(st);
|
||||||
|
@ -48,7 +48,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
|
|||||||
Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
|
Firebird::AutoPtr<Firebird::UtilSvc> uSvc(Firebird::UtilSvc::createStandalone(argc, argv));
|
||||||
return gstat(uSvc);
|
return gstat(uSvc);
|
||||||
}
|
}
|
||||||
catch(const Firebird::Exception& ex)
|
catch (const Firebird::Exception& ex)
|
||||||
{
|
{
|
||||||
ISC_STATUS_ARRAY st;
|
ISC_STATUS_ARRAY st;
|
||||||
ex.stuff_exception(st);
|
ex.stuff_exception(st);
|
||||||
|
@ -502,7 +502,8 @@ void DtcStart::addAttachment(CheckStatusWrapper* status, IAttachment* att)
|
|||||||
this->addWithTpb(status, att, 0, NULL);
|
this->addWithTpb(status, att, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DtcStart::addWithTpb(CheckStatusWrapper* status, IAttachment* att, unsigned length, const unsigned char* tpb)
|
void DtcStart::addWithTpb(CheckStatusWrapper* status, IAttachment* att,
|
||||||
|
unsigned length, const unsigned char* tpb)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,8 @@ public:
|
|||||||
|
|
||||||
// IDtcStart implementation
|
// IDtcStart implementation
|
||||||
void addAttachment(Firebird::CheckStatusWrapper* status, Firebird::IAttachment* att);
|
void addAttachment(Firebird::CheckStatusWrapper* status, Firebird::IAttachment* att);
|
||||||
void addWithTpb(Firebird::CheckStatusWrapper* status, Firebird::IAttachment* att, unsigned length, const unsigned char* tpb);
|
void addWithTpb(Firebird::CheckStatusWrapper* status, Firebird::IAttachment* att,
|
||||||
|
unsigned length, const unsigned char* tpb);
|
||||||
YTransaction* start(Firebird::CheckStatusWrapper* status);
|
YTransaction* start(Firebird::CheckStatusWrapper* status);
|
||||||
void dispose();
|
void dispose();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user