mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-30 19:23:03 +01:00
21ca11f328
2. Added class Reference (RefCounted guard) and use it in the tree.
86 lines
2.0 KiB
C++
86 lines
2.0 KiB
C++
/*
|
|
* PROGRAM: JRD access method
|
|
* MODULE: Database.cpp
|
|
* DESCRIPTION: Common descriptions
|
|
*
|
|
* The contents of this file are subject to the Interbase Public
|
|
* License Version 1.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy
|
|
* of the License at http://www.Inprise.com/IPL.html
|
|
*
|
|
* Software distributed under the License is distributed on an
|
|
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
|
* or implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code was created by Inprise Corporation
|
|
* and its predecessors. Portions created by Inprise Corporation are
|
|
* Copyright (C) Inprise Corporation.
|
|
*
|
|
* All Rights Reserved.
|
|
* Contributor(s): ______________________________________.
|
|
*
|
|
* Sean Leyne
|
|
* Claudio Valderrama C.
|
|
*/
|
|
|
|
#include "firebird.h"
|
|
#include "../jrd/ibase.h"
|
|
#include "../jrd/common.h"
|
|
#include "../jrd/ods.h"
|
|
#include "../jrd/Database.h"
|
|
#include "../jrd/isc.h"
|
|
#include "../jrd/tra.h"
|
|
#include "../jrd/os/pio_proto.h"
|
|
|
|
// Thread data block / IPC related data blocks
|
|
#include "../jrd/ThreadData.h"
|
|
#include "../jrd/isc.h"
|
|
|
|
// recursive mutexes
|
|
#include "../common/thd.h"
|
|
|
|
// Definition of block types for data allocation in JRD
|
|
#include "../include/fb_blk.h"
|
|
|
|
namespace Jrd
|
|
{
|
|
bool Database::onRawDevice() const
|
|
{
|
|
#ifdef SUPPORT_RAW_DEVICES
|
|
return PIO_on_raw_device(dbb_filename);
|
|
#else
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
Database::~Database()
|
|
{
|
|
delete dbb_sys_trans;
|
|
|
|
destroyIntlObjects();
|
|
|
|
fb_assert(dbb_pools[0] == dbb_permanent);
|
|
for (size_t i = 1; i < dbb_pools.getCount(); ++i)
|
|
{
|
|
MemoryPool::deletePool(dbb_pools[i]);
|
|
}
|
|
}
|
|
|
|
void Database::deletePool(MemoryPool* pool)
|
|
{
|
|
fb_assert(pool);
|
|
|
|
for (size_t i = 0; i < dbb_pools.getCount(); ++i)
|
|
{
|
|
if (dbb_pools[i] == pool)
|
|
{
|
|
dbb_pools.remove(i);
|
|
break;
|
|
}
|
|
}
|
|
MemoryPool::deletePool(pool);
|
|
}
|
|
|
|
} // namespace
|