mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 18:03:04 +01:00
Remove reference counting where not appropriate
This commit is contained in:
parent
e532b564fe
commit
9ef53b65e0
@ -41,14 +41,10 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
|
||||
{
|
||||
const char* name = "Auth_Debug";
|
||||
|
||||
Firebird::IPlugin* iPlugin = master->getPluginInterface();
|
||||
Firebird::PluginInterface iPlugin(master);
|
||||
|
||||
clientFactory->addRef();
|
||||
iPlugin->registerPlugin(Firebird::PluginType::AuthClient, name, &clientFactory);
|
||||
serverFactory->addRef();
|
||||
iPlugin->registerPlugin(Firebird::PluginType::AuthServer, name, &serverFactory);
|
||||
|
||||
iPlugin->release();
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,22 +39,20 @@ namespace Auth {
|
||||
|
||||
enum Result {AUTH_SUCCESS, AUTH_CONTINUE, AUTH_FAILED, AUTH_MORE_DATA};
|
||||
|
||||
class WriterInterface : public Firebird::Interface
|
||||
class WriterInterface : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual void FB_CARG reset() = 0;
|
||||
virtual void FB_CARG add(const char* user, const char* method, const char* details) = 0;
|
||||
};
|
||||
#define FB_AUTH_WRITER_VERSION (FB_INTERFACE_VERSION + 2)
|
||||
|
||||
class DpbInterface : public Firebird::Interface
|
||||
class DpbInterface : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual int FB_CARG find(UCHAR tag) = 0;
|
||||
virtual void FB_CARG add(UCHAR tag, const void* bytes, unsigned int count) = 0;
|
||||
virtual void FB_CARG drop() = 0;
|
||||
};
|
||||
#define FB_AUTH_DBP_VERSION (FB_INTERFACE_VERSION + 3)
|
||||
|
||||
class Server : public Firebird::Plugin
|
||||
{
|
||||
@ -77,14 +75,13 @@ public:
|
||||
};
|
||||
#define FB_AUTH_CLIENT_VERSION (FB_PLUGIN_VERSION + 3)
|
||||
|
||||
class UserField : public Firebird::Interface
|
||||
class UserField : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual int FB_CARG entered() = 0;
|
||||
virtual int FB_CARG specified() = 0;
|
||||
virtual void FB_CARG setEntered(int newValue) = 0;
|
||||
};
|
||||
#define FB_USER_FIELD_VERSION (FB_INTERFACE_VERSION + 3)
|
||||
|
||||
class CharUserField : public UserField
|
||||
{
|
||||
@ -92,7 +89,6 @@ public:
|
||||
virtual const char* FB_CARG get() = 0;
|
||||
virtual void FB_CARG set(const char* newValue) = 0;
|
||||
};
|
||||
#define FB_AUTH_CHAR_USER_VERSION (FB_USER_FIELD_VERSION + 2)
|
||||
|
||||
class IntUserField : public UserField
|
||||
{
|
||||
@ -100,9 +96,8 @@ public:
|
||||
virtual int FB_CARG get() = 0;
|
||||
virtual void FB_CARG set(int newValue) = 0;
|
||||
};
|
||||
#define FB_AUTH_INT_USER_VERSION (FB_USER_FIELD_VERSION + 2)
|
||||
|
||||
class User : public Firebird::Interface
|
||||
class User : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual int FB_CARG operation() = 0;
|
||||
@ -121,16 +116,14 @@ public:
|
||||
|
||||
virtual void FB_CARG clear() = 0;
|
||||
};
|
||||
#define FB_AUTH_USER_VERSION (FB_INTERFACE_VERSION + 11)
|
||||
|
||||
class ListUsers : public Firebird::Interface
|
||||
class ListUsers : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual void FB_CARG list(User* user) = 0;
|
||||
};
|
||||
#define FB_AUTH_LIST_USERS_VERSION (FB_INTERFACE_VERSION + 1)
|
||||
|
||||
class LogonInfo : public Firebird::Interface
|
||||
class LogonInfo : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual const char* FB_CARG name() = 0;
|
||||
@ -139,7 +132,6 @@ public:
|
||||
virtual const char* FB_CARG networkProtocol() = 0;
|
||||
virtual const char* FB_CARG remoteAddress() = 0;
|
||||
};
|
||||
#define FB_AUTH_LOGON_INFO_VERSION (FB_INTERFACE_VERSION + 5)
|
||||
|
||||
class Management : public Firebird::Plugin
|
||||
{
|
||||
|
@ -66,7 +66,6 @@ namespace {
|
||||
|
||||
void registerLegacyClient(Firebird::IPlugin* iPlugin)
|
||||
{
|
||||
factory->addRef();
|
||||
iPlugin->registerPlugin(Firebird::PluginType::AuthClient, "Legacy_Auth", &factory);
|
||||
}
|
||||
|
||||
|
@ -672,11 +672,8 @@ static Firebird::UnloadDetector unloadDetector;
|
||||
|
||||
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
|
||||
{
|
||||
Firebird::IPlugin* iPlugin = master->getPluginInterface();
|
||||
Firebird::PluginInterface pi(master);
|
||||
|
||||
factory->addRef();
|
||||
iPlugin->registerPlugin(Firebird::PluginType::AuthUserManagement, "Legacy_Auth", &factory);
|
||||
iPlugin->setModuleCleanup(&unloadDetector);
|
||||
|
||||
iPlugin->release();
|
||||
pi->registerPlugin(Firebird::PluginType::AuthUserManagement, "Legacy_Auth", &factory);
|
||||
pi->setModuleCleanup(&unloadDetector);
|
||||
}
|
||||
|
@ -508,6 +508,7 @@ Result SecurityDatabaseServer::startAuthentication(Firebird::Status* status,
|
||||
if (!instance)
|
||||
{
|
||||
instance = new SecurityDatabase;
|
||||
instance->addRef();
|
||||
secDbName.copyTo(instance->secureDbName, sizeof(instance->secureDbName));
|
||||
curInstances.add(instance);
|
||||
}
|
||||
@ -557,7 +558,6 @@ namespace {
|
||||
|
||||
void registerLegacyServer(Firebird::IPlugin* iPlugin)
|
||||
{
|
||||
factory->addRef();
|
||||
iPlugin->registerPlugin(Firebird::PluginType::AuthServer, "Legacy_Auth", &factory);
|
||||
}
|
||||
|
||||
|
@ -43,12 +43,6 @@
|
||||
|
||||
namespace Auth {
|
||||
|
||||
class SecurityDatabaseServerFactory : public Firebird::StdIface<Firebird::PluginsFactory, FB_PLUGINS_FACTORY_VERSION>
|
||||
{
|
||||
public:
|
||||
Firebird::Plugin* FB_CARG createPlugin(const char* name, const char* configFile);
|
||||
};
|
||||
|
||||
class SecurityDatabaseServer : public Firebird::StdPlugin<Server, FB_AUTH_SERVER_VERSION>
|
||||
{
|
||||
public:
|
||||
|
@ -41,7 +41,7 @@ namespace Auth {
|
||||
|
||||
bool legacy(const char* nm);
|
||||
|
||||
class WriterImplementation : public Firebird::StackIface<WriterInterface, FB_AUTH_WRITER_VERSION>
|
||||
class WriterImplementation : public Firebird::StackIface<WriterInterface>
|
||||
{
|
||||
public:
|
||||
WriterImplementation(bool svcFlag);
|
||||
@ -57,7 +57,7 @@ private:
|
||||
unsigned char tag;
|
||||
};
|
||||
|
||||
class DpbImplementation : public Firebird::StackIface<DpbInterface, FB_AUTH_DBP_VERSION>
|
||||
class DpbImplementation : public Firebird::StackIface<DpbInterface>
|
||||
{
|
||||
public:
|
||||
DpbImplementation(Firebird::ClumpletWriter& base);
|
||||
|
@ -73,7 +73,7 @@ private:
|
||||
ISC_STATUS vector[40]; // FixMe - may be a kind of dynamic storage will be better?
|
||||
};
|
||||
|
||||
class LocalStatus : public StackIface<BaseStatus, FB_STATUS_VERSION>
|
||||
class LocalStatus : public StackIface<BaseStatus>
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -425,7 +425,7 @@ void callRemoteServiceManager(ISC_STATUS* status,
|
||||
{
|
||||
const char request[] = {isc_info_svc_get_users};
|
||||
int startQuery = 0;
|
||||
Auth::UserData uData;
|
||||
Auth::StackUserData uData;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
desiredVersion, &missing, NULL)),
|
||||
currentPlugin(NULL)
|
||||
{
|
||||
pluginSet->release();
|
||||
getPlugin();
|
||||
}
|
||||
|
||||
@ -65,6 +66,7 @@ public:
|
||||
desiredVersion, &missing, new FirebirdConf(knownConfig))),
|
||||
currentPlugin(NULL)
|
||||
{
|
||||
pluginSet->release();
|
||||
getPlugin();
|
||||
}
|
||||
|
||||
@ -117,16 +119,13 @@ public:
|
||||
pluginInterface->releasePlugin(currentPlugin);
|
||||
currentPlugin = NULL;
|
||||
}
|
||||
if (pluginSet)
|
||||
pluginSet->release();
|
||||
}
|
||||
|
||||
private:
|
||||
AutoPtr<IMaster, AutoInterface> masterInterface;
|
||||
AutoPtr<IPlugin, AutoInterface> pluginInterface;
|
||||
M missing;
|
||||
// AutoPtr<IPluginSet, AutoInterface> pluginSet;
|
||||
IPluginSet *pluginSet;
|
||||
RefPtr<IPluginSet> pluginSet;
|
||||
P* currentPlugin;
|
||||
|
||||
void getPlugin()
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "gen/iberror.h"
|
||||
#include "../yvalve/gds_proto.h"
|
||||
#include "../common/classes/init.h"
|
||||
#include "../common/classes/auto.h"
|
||||
#include "../common/classes/RefCounted.h"
|
||||
#include "consts_pub.h"
|
||||
|
||||
extern "C" int API_ROUTINE fb_shutdown(unsigned int timeout, const int reason);
|
||||
@ -46,61 +48,34 @@ namespace Firebird {
|
||||
class AutoInterface
|
||||
{
|
||||
public:
|
||||
static void clear(Interface* ptr)
|
||||
static void clear(IDisposable* ptr)
|
||||
{
|
||||
if (ptr)
|
||||
{
|
||||
ptr->release();
|
||||
ptr->dispose();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Implement standard interface and plugin functions
|
||||
template <class C, int V, typename S>
|
||||
class Versioned : public C, public S
|
||||
template <class C, typename S = GlobalStorage>
|
||||
class DisposeIface : public C, public S
|
||||
{
|
||||
public:
|
||||
int FB_CARG version()
|
||||
{
|
||||
return V;
|
||||
}
|
||||
DisposeIface() { }
|
||||
|
||||
private:
|
||||
DisposeIface(const DisposeIface&);
|
||||
DisposeIface& operator=(const DisposeIface&);
|
||||
};
|
||||
|
||||
template <class C, int V, typename S = GlobalStorage>
|
||||
class StackIface : public Versioned<C, V, S>
|
||||
template <class C, typename S = GlobalStorage>
|
||||
class StackIface : public DisposeIface <C, S>
|
||||
{
|
||||
#ifdef DEV_BUILD
|
||||
private:
|
||||
int counter;
|
||||
|
||||
public:
|
||||
// StackIface is destroyed in same frame where created,
|
||||
// therefore final release() call is not expected,
|
||||
// therefore initialize check counter with 0, not 1.
|
||||
StackIface() : counter(0) { }
|
||||
|
||||
~StackIface()
|
||||
{
|
||||
fb_assert(counter == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
void FB_CARG addRef()
|
||||
{
|
||||
#ifdef DEV_BUILD
|
||||
++counter;
|
||||
#endif
|
||||
}
|
||||
|
||||
int FB_CARG release()
|
||||
{
|
||||
#ifdef DEV_BUILD
|
||||
--counter;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
void FB_CARG dispose()
|
||||
{ }
|
||||
|
||||
void* operator new(size_t, void* memory) throw()
|
||||
{
|
||||
@ -109,15 +84,20 @@ public:
|
||||
};
|
||||
|
||||
template <class C, int V, typename S = GlobalStorage>
|
||||
class StdIface : public Versioned<C, V, S>
|
||||
class StdIface : public C, public S
|
||||
{
|
||||
public:
|
||||
StdIface() : refCounter(1) { }
|
||||
StdIface() : refCounter(0) { }
|
||||
|
||||
int FB_CARG version()
|
||||
{
|
||||
return V;
|
||||
}
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
~StdIface()
|
||||
{
|
||||
// fb_assert(refCounter.value() == 0);
|
||||
fb_assert(refCounter.value() == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -156,12 +136,14 @@ public:
|
||||
|
||||
// Trivial factory
|
||||
template <class P>
|
||||
class SimpleFactoryBase : public StackIface<PluginsFactory, FB_PLUGINS_FACTORY_VERSION>
|
||||
class SimpleFactoryBase : public StackIface<PluginsFactory>
|
||||
{
|
||||
public:
|
||||
Plugin* FB_CARG createPlugin(IFactoryParameter* factoryParameter)
|
||||
{
|
||||
return new P(factoryParameter);
|
||||
P* p = new P(factoryParameter);
|
||||
p->addRef();
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
@ -184,12 +166,10 @@ public:
|
||||
class PluginInterface : public AutoPtr<IPlugin, AutoInterface>
|
||||
{
|
||||
public:
|
||||
PluginInterface() : AutoPtr<IPlugin, AutoInterface>(NULL)
|
||||
{
|
||||
IMaster* mi = fb_get_master_interface();
|
||||
reset(mi->getPluginInterface());
|
||||
mi->release();
|
||||
}
|
||||
PluginInterface() : AutoPtr<IPlugin, AutoInterface>(fb_get_master_interface()->getPluginInterface())
|
||||
{ }
|
||||
PluginInterface(IMaster* master) : AutoPtr<IPlugin, AutoInterface>(master->getPluginInterface())
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@ -197,12 +177,8 @@ public:
|
||||
class TimerInterface : public AutoPtr<ITimerControl, AutoInterface>
|
||||
{
|
||||
public:
|
||||
TimerInterface() : AutoPtr<ITimerControl, AutoInterface>(NULL)
|
||||
{
|
||||
IMaster* mi = fb_get_master_interface();
|
||||
reset(mi->getTimerControl());
|
||||
mi->release();
|
||||
}
|
||||
TimerInterface() : AutoPtr<ITimerControl, AutoInterface>(fb_get_master_interface()->getTimerControl())
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@ -216,7 +192,7 @@ class DummyStorage
|
||||
{
|
||||
};
|
||||
|
||||
class UnloadDetectorHelper : public StdIface<IModuleCleanup, FB_MODULE_CLEANUP_VERSION, DummyStorage>
|
||||
class UnloadDetectorHelper : public DisposeIface<IModuleCleanup, DummyStorage>
|
||||
{
|
||||
public:
|
||||
UnloadDetectorHelper(MemoryPool&)
|
||||
@ -234,17 +210,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int FB_CARG release()
|
||||
{
|
||||
if (--refCounter == 0)
|
||||
{
|
||||
//delete this;
|
||||
fb_assert(false);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool unloadStarted()
|
||||
{
|
||||
return !flagOsUnload;
|
||||
@ -255,6 +220,11 @@ public:
|
||||
cleanup = c;
|
||||
}
|
||||
|
||||
void FB_CARG dispose()
|
||||
{
|
||||
// delete this; -don't do that!
|
||||
}
|
||||
|
||||
private:
|
||||
bool flagOsUnload;
|
||||
FPTR_VOID cleanup;
|
||||
|
@ -36,9 +36,7 @@ void makePermanentVector(ISC_STATUS* perm, const ISC_STATUS* trans, FB_THREAD_ID
|
||||
perm [-1] = isc_arg_string;
|
||||
const size_t len = *trans++;
|
||||
const char* temp = reinterpret_cast<char*>(*trans++);
|
||||
IMaster* im = fb_get_master_interface();
|
||||
*perm++ = (ISC_STATUS)(IPTR) (im->circularAlloc(temp, len, thr));
|
||||
im->release();
|
||||
*perm++ = (ISC_STATUS)(IPTR) (MasterInterface()->circularAlloc(temp, len, thr));
|
||||
}
|
||||
break;
|
||||
case isc_arg_string:
|
||||
@ -47,9 +45,7 @@ void makePermanentVector(ISC_STATUS* perm, const ISC_STATUS* trans, FB_THREAD_ID
|
||||
{
|
||||
const char* temp = reinterpret_cast<char*>(*trans++);
|
||||
const size_t len = strlen(temp);
|
||||
IMaster* im = fb_get_master_interface();
|
||||
*perm++ = (ISC_STATUS)(IPTR) (im->circularAlloc(temp, len, thr));
|
||||
im->release();
|
||||
*perm++ = (ISC_STATUS)(IPTR) (MasterInterface()->circularAlloc(temp, len, thr));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
namespace Auth {
|
||||
|
||||
class CharField : public Firebird::StackIface<CharUserField, FB_AUTH_CHAR_USER_VERSION>
|
||||
class CharField : public Firebird::StackIface<CharUserField>
|
||||
{
|
||||
public:
|
||||
CharField()
|
||||
@ -87,7 +87,7 @@ private:
|
||||
Firebird::string value;
|
||||
};
|
||||
|
||||
class IntField : public Firebird::StackIface<IntUserField, FB_AUTH_INT_USER_VERSION>
|
||||
class IntField : public Firebird::StackIface<IntUserField>
|
||||
{
|
||||
public:
|
||||
IntField()
|
||||
@ -139,7 +139,7 @@ private:
|
||||
int value;
|
||||
};
|
||||
|
||||
class UserData : public Firebird::StackIface<User, FB_AUTH_USER_VERSION>
|
||||
class UserData : public User
|
||||
{
|
||||
public:
|
||||
UserData()
|
||||
@ -204,6 +204,10 @@ public:
|
||||
CharField database, dba, dbaPassword, role, trustedUser;
|
||||
};
|
||||
|
||||
class StackUserData : public Firebird::StackIface<UserData>
|
||||
{
|
||||
};
|
||||
|
||||
class Get : public Firebird::GetPlugins<Auth::Management>
|
||||
{
|
||||
public:
|
||||
|
@ -161,6 +161,7 @@ dsql_req* DSQL_allocate_statement(thread_db* tdbb, Jrd::Attachment* attachment)
|
||||
MemoryPool& pool = *tdbb->getDefaultPool();
|
||||
DsqlCompiledStatement* statement = FB_NEW(pool) DsqlCompiledStatement(pool);
|
||||
dsql_req* const request = FB_NEW(pool) dsql_req(statement);
|
||||
request->addRef();
|
||||
request->req_dbb = database;
|
||||
|
||||
return request;
|
||||
@ -1873,6 +1874,7 @@ static dsql_req* prepareStatement(thread_db* tdbb, dsql_dbb* database, jrd_tra*
|
||||
scratch->clientDialect = client_dialect;
|
||||
|
||||
dsql_req* request = FB_NEW(statement->getPool()) dsql_req(statement);
|
||||
request->addRef();
|
||||
request->req_dbb = database;
|
||||
request->req_transaction = transaction;
|
||||
|
||||
|
@ -677,20 +677,10 @@ using namespace Firebird;
|
||||
class DummyMasterImpl : public IMaster
|
||||
{
|
||||
public:
|
||||
virtual void FB_CARG addRef()
|
||||
virtual void FB_CARG dispose()
|
||||
{
|
||||
}
|
||||
|
||||
virtual int FB_CARG release()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual int FB_CARG version()
|
||||
{
|
||||
return IMaster::VERSION;
|
||||
}
|
||||
|
||||
virtual Status* FB_CARG getStatusInstance()
|
||||
{
|
||||
fb_assert(false);
|
||||
|
@ -142,25 +142,23 @@ public:
|
||||
#define FB_FACTORY_PARAMETER_VERSION (FB_INTERFACE_VERSION + 3)
|
||||
|
||||
// Required to creat instances of given plugin
|
||||
class PluginsFactory : public Interface
|
||||
class PluginsFactory : public IDisposable
|
||||
{
|
||||
public:
|
||||
virtual Plugin* FB_CARG createPlugin(IFactoryParameter* factoryParameter) = 0;
|
||||
};
|
||||
#define FB_PLUGINS_FACTORY_VERSION (FB_INTERFACE_VERSION + 1)
|
||||
|
||||
// Required to let plugins manager invoke module's cleanup routine before unloading it.
|
||||
// For some OS/compiler this may be done in dtor of global variable in module itself.
|
||||
// Others (Windows/VC) fail to create some very useful resources (threads) when module is unloading.
|
||||
class IModuleCleanup : public Interface
|
||||
class IModuleCleanup : public IDisposable
|
||||
{
|
||||
public:
|
||||
virtual void FB_CARG doClean() = 0;
|
||||
};
|
||||
#define FB_MODULE_CLEANUP_VERSION (FB_INTERFACE_VERSION + 1)
|
||||
|
||||
// Interface to deal with plugins here and there, returned by master interface
|
||||
class IPlugin : public Interface
|
||||
class IPlugin : public IDisposable
|
||||
{
|
||||
public:
|
||||
// Main function called by plugin modules in firebird_plugin()
|
||||
@ -188,7 +186,6 @@ public:
|
||||
// will cause resources leak
|
||||
virtual void FB_CARG releasePlugin(Plugin* plugin) = 0;
|
||||
};
|
||||
#define FB_I_PLUGIN_VERSION (FB_INTERFACE_VERSION + 5)
|
||||
|
||||
typedef void StartLoadedModule(IMaster* masterInterface);
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
// Regular interface - base for all FB interfaces
|
||||
// Regular interface - base for refCounted FB interfaces
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
@ -53,8 +53,15 @@ public:
|
||||
};
|
||||
#define FB_INTERFACE_VERSION 3 // If this is changed, types of all interfaces must be changed
|
||||
|
||||
// Disposable interface - base for static and onStack interfaces, may be used in regular case too
|
||||
class IDisposable
|
||||
{
|
||||
public:
|
||||
virtual void FB_CARG dispose() = 0;
|
||||
};
|
||||
|
||||
// Interface to work with status vector
|
||||
class Status : public Interface
|
||||
class Status : public IDisposable
|
||||
{
|
||||
public:
|
||||
virtual void FB_CARG set(unsigned int length, const ISC_STATUS* value) = 0;
|
||||
@ -64,12 +71,11 @@ public:
|
||||
virtual const ISC_STATUS* FB_CARG get() const = 0;
|
||||
virtual int FB_CARG isSuccess() const = 0;
|
||||
};
|
||||
#define FB_STATUS_VERSION (FB_INTERFACE_VERSION + 5)
|
||||
|
||||
class IPlugin;
|
||||
class ITimerControl;
|
||||
|
||||
class IMaster : public Interface
|
||||
class IMaster : public IDisposable
|
||||
{
|
||||
public:
|
||||
// This interface can't be upgraded - therefore another form of version is used
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
typedef ISC_INT64 TimerDelay;
|
||||
|
||||
// Interface to set timer for particular time
|
||||
class ITimerControl : public Interface
|
||||
class ITimerControl : public IDisposable
|
||||
{
|
||||
public:
|
||||
// Set timer
|
||||
@ -53,7 +53,6 @@ public:
|
||||
// Stop timer
|
||||
virtual void FB_CARG stop(ITimer* timer) = 0;
|
||||
};
|
||||
#define FB_I_TIMER_CONTROL_VERSION (FB_INTERFACE_VERSION + 2)
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
|
@ -51,6 +51,7 @@ enum BlockType
|
||||
type_prf,
|
||||
type_ctl,
|
||||
type_Events,
|
||||
type_user_data,
|
||||
|
||||
type_PageSpace,
|
||||
type_PageManager,
|
||||
|
@ -56,6 +56,7 @@ Jrd::Attachment* Jrd::Attachment::create(Database* dbb, FB_API_HANDLE publicHand
|
||||
{
|
||||
Attachment* const attachment = FB_NEW(*pool) Attachment(pool, dbb, publicHandle);
|
||||
pool->setStatsGroup(attachment->att_memory_stats);
|
||||
attachment->addRef();
|
||||
return attachment;
|
||||
}
|
||||
catch (const Firebird::Exception&)
|
||||
|
@ -230,6 +230,7 @@ JrdStatement* JrdStatement::makeStatement(thread_db* tdbb, CompilerScratch* csb,
|
||||
MemoryPool* const pool = tdbb->getDefaultPool();
|
||||
|
||||
statement = FB_NEW(*pool) JrdStatement(tdbb, pool, csb);
|
||||
statement->addRef();
|
||||
|
||||
tdbb->setRequest(old_request);
|
||||
} // try
|
||||
|
@ -71,7 +71,7 @@ UserManagement::UserManagement(jrd_tra* tra)
|
||||
fb_assert(manager);
|
||||
manager->addRef();
|
||||
|
||||
class UserIdInfo : public StackIface<Auth::LogonInfo, FB_AUTH_LOGON_INFO_VERSION>
|
||||
class UserIdInfo : public StackIface<Auth::LogonInfo>
|
||||
{
|
||||
public:
|
||||
UserIdInfo(const Attachment* pAtt)
|
||||
@ -297,7 +297,7 @@ RecordBuffer* UserManagement::getList(thread_db* tdbb, jrd_rel* relation)
|
||||
fb_assert(buffer);
|
||||
|
||||
LocalStatus status;
|
||||
Auth::UserData u;
|
||||
Auth::StackUserData u;
|
||||
u.op = DIS_OPER;
|
||||
int errcode = manager->execute(&status, &u, &display);
|
||||
checkSecurityResult(errcode, &status, "Unknown");
|
||||
|
@ -54,7 +54,7 @@ protected:
|
||||
class UserManagement : public DataDump
|
||||
{
|
||||
public:
|
||||
class Display : public Firebird::StackIface<Auth::ListUsers, FB_AUTH_LIST_USERS_VERSION>
|
||||
class Display : public Firebird::StackIface<Auth::ListUsers>
|
||||
{
|
||||
public:
|
||||
Display(UserManagement* um)
|
||||
|
@ -1894,6 +1894,7 @@ static blb* allocate_blob(thread_db* tdbb, jrd_tra* transaction)
|
||||
// Create a blob large enough to hold a single data page.
|
||||
|
||||
blb* blob = FB_NEW(*transaction->tra_pool) blb(*transaction->tra_pool, dbb->dbb_page_size);
|
||||
blob->addRef();
|
||||
blob->blb_attachment = tdbb->getAttachment();
|
||||
blob->blb_transaction = transaction;
|
||||
|
||||
|
@ -1970,7 +1970,16 @@ static void dyn_user(Global* gbl, const UCHAR** ptr)
|
||||
ISC_STATUS_ARRAY status;
|
||||
try
|
||||
{
|
||||
Auth::UserData* userData = new((void*)(FB_NEW(*tra->tra_pool) char[sizeof(Auth::UserData)])) Auth::UserData;
|
||||
class DisposeableUserData : public Firebird::DisposeIface<Auth::UserData, pool_alloc<type_user_data> >
|
||||
{
|
||||
public:
|
||||
void FB_CARG dispose()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
};
|
||||
|
||||
DisposeableUserData* userData = FB_NEW(*tra->tra_pool) DisposeableUserData;
|
||||
UCHAR verb;
|
||||
while ((verb = *(*ptr)++) != isc_user_end)
|
||||
{
|
||||
|
@ -281,7 +281,7 @@ int Provider::release()
|
||||
|
||||
static Firebird::UnloadDetector unloadDetector;
|
||||
|
||||
class EngineFactory : public StackIface<PluginsFactory, FB_PLUGINS_FACTORY_VERSION>
|
||||
class EngineFactory : public StackIface<PluginsFactory>
|
||||
{
|
||||
public:
|
||||
Plugin* FB_CARG createPlugin(IFactoryParameter* factoryParameter)
|
||||
@ -292,7 +292,9 @@ public:
|
||||
}
|
||||
|
||||
++shutdownCounter;
|
||||
return new Provider(factoryParameter);
|
||||
Plugin* p = new Provider(factoryParameter);
|
||||
p->addRef();
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
@ -300,7 +302,6 @@ static Static<EngineFactory> engineFactory;
|
||||
|
||||
void registerEngine(IPlugin* iPlugin)
|
||||
{
|
||||
engineFactory->addRef();
|
||||
iPlugin->registerPlugin(PluginType::Provider, "Engine12", &engineFactory);
|
||||
iPlugin->setModuleCleanup(&unloadDetector);
|
||||
}
|
||||
@ -309,9 +310,8 @@ void registerEngine(IPlugin* iPlugin)
|
||||
|
||||
extern "C" void FB_PLUGIN_ENTRY_POINT(IMaster* master)
|
||||
{
|
||||
IPlugin* pi = master->getPluginInterface();
|
||||
PluginInterface pi;
|
||||
registerEngine(pi);
|
||||
pi->release();
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -691,7 +691,7 @@ private:
|
||||
|
||||
/// trace manager support
|
||||
|
||||
class TraceFailedConnection : public StackIface<TraceConnection, FB_TRACE_CONNECTION_VERSION>
|
||||
class TraceFailedConnection : public StackIface<TraceConnection>
|
||||
{
|
||||
public:
|
||||
TraceFailedConnection(const char* filename, const DatabaseOptions* options);
|
||||
@ -976,7 +976,9 @@ const char SINGLE_QUOTE = '\'';
|
||||
|
||||
PProvider* currentProvider()
|
||||
{
|
||||
return new Provider(NULL);
|
||||
PProvider* p = new Provider(NULL);
|
||||
p->addRef();
|
||||
return p;
|
||||
}
|
||||
|
||||
// External hook definitions
|
||||
@ -3029,6 +3031,7 @@ Firebird::IEvents* Attachment::queEvents(Status* user_status, Firebird::EventCal
|
||||
lock->lck_length, (const TEXT*) &lock->lck_key,
|
||||
length, events, callback);
|
||||
ev = FB_NEW(*getDefaultMemoryPool()) Events(id, this);
|
||||
ev->addRef();
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -3407,6 +3410,7 @@ Firebird::IService* Provider::attachServiceManager(Status* user_status, const ch
|
||||
ThreadContextHolder tdbb(user_status);
|
||||
|
||||
svc = new Svc(new Service(service_name, spbLength, spb));
|
||||
svc->addRef();
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
struct PerformanceInfo;
|
||||
|
||||
class TraceConnection : public Firebird::Interface
|
||||
class TraceConnection : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual int FB_CARG getConnectionID() = 0;
|
||||
@ -52,7 +52,6 @@ public:
|
||||
virtual int FB_CARG getRemoteProcessID() = 0;
|
||||
virtual const char* FB_CARG getRemoteProcessName() = 0;
|
||||
};
|
||||
#define FB_TRACE_CONNECTION_VERSION (FB_INTERFACE_VERSION + 10)
|
||||
|
||||
enum ntrace_tra_isolation_t
|
||||
{
|
||||
@ -62,7 +61,7 @@ enum ntrace_tra_isolation_t
|
||||
tra_iso_read_committed_norecver
|
||||
};
|
||||
|
||||
class TraceTransaction : public Firebird::Interface
|
||||
class TraceTransaction : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual int FB_CARG getTransactionID() = 0;
|
||||
@ -71,25 +70,22 @@ public:
|
||||
virtual ntrace_tra_isolation_t FB_CARG getIsolation() = 0;
|
||||
virtual PerformanceInfo* FB_CARG getPerf() = 0;
|
||||
};
|
||||
#define FB_TRACE_TRANSACTION_VERSION (FB_INTERFACE_VERSION + 5)
|
||||
|
||||
typedef int ntrace_relation_t;
|
||||
|
||||
class TraceParams : public Firebird::Interface
|
||||
class TraceParams : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual size_t FB_CARG getCount() = 0;
|
||||
virtual const struct dsc* FB_CARG getParam(size_t idx) = 0;
|
||||
};
|
||||
#define FB_TRACE_PARAMS_VERSION (FB_INTERFACE_VERSION + 2)
|
||||
|
||||
class TraceStatement : public Firebird::Interface
|
||||
class TraceStatement : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual int FB_CARG getStmtID() = 0;
|
||||
virtual PerformanceInfo* FB_CARG getPerf() = 0;
|
||||
};
|
||||
#define FB_TRACE_STATEMENT_VERSION (FB_INTERFACE_VERSION + 2)
|
||||
|
||||
class TraceSQLStatement : public TraceStatement
|
||||
{
|
||||
@ -99,7 +95,6 @@ public:
|
||||
virtual TraceParams* FB_CARG getInputs() = 0;
|
||||
virtual const char* FB_CARG getTextUTF8() = 0;
|
||||
};
|
||||
#define FB_TRACE_SQL_VERSION (FB_TRACE_STATEMENT_VERSION + 4)
|
||||
|
||||
class TraceBLRStatement : public TraceStatement
|
||||
{
|
||||
@ -108,36 +103,32 @@ public:
|
||||
virtual size_t FB_CARG getDataLength() = 0;
|
||||
virtual const char* FB_CARG getText() = 0;
|
||||
};
|
||||
#define FB_TRACE_BLR_VERSION (FB_TRACE_STATEMENT_VERSION + 3)
|
||||
|
||||
class TraceDYNRequest : public Firebird::Interface
|
||||
class TraceDYNRequest : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual const unsigned char* FB_CARG getData() = 0;
|
||||
virtual size_t FB_CARG getDataLength() = 0;
|
||||
virtual const char* FB_CARG getText() = 0;
|
||||
};
|
||||
#define FB_TRACE_DYN_VERSION (FB_INTERFACE_VERSION + 3)
|
||||
|
||||
class TraceContextVariable : public Firebird::Interface
|
||||
class TraceContextVariable : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual const char* FB_CARG getNameSpace() = 0;
|
||||
virtual const char* FB_CARG getVarName() = 0;
|
||||
virtual const char* FB_CARG getVarValue() = 0;
|
||||
};
|
||||
#define FB_TRACE_CONTEXT_VARIABLE_VERSION (FB_INTERFACE_VERSION + 3)
|
||||
|
||||
class TraceProcedure : public Firebird::Interface
|
||||
class TraceProcedure : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual const char* FB_CARG getProcName() = 0;
|
||||
virtual TraceParams* FB_CARG getInputs() = 0;
|
||||
virtual PerformanceInfo* FB_CARG getPerf() = 0;
|
||||
};
|
||||
#define FB_TRACE_PROCEDURE_VERSION (FB_INTERFACE_VERSION + 3)
|
||||
|
||||
class TraceTrigger : public Firebird::Interface
|
||||
class TraceTrigger : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual const char* FB_CARG getTriggerName() = 0;
|
||||
@ -146,11 +137,10 @@ public:
|
||||
virtual int FB_CARG getWhich() = 0;
|
||||
virtual PerformanceInfo* FB_CARG getPerf() = 0;
|
||||
};
|
||||
#define FB_TRACE_TRIGGER_VERSION (FB_INTERFACE_VERSION + 5)
|
||||
|
||||
typedef void* ntrace_service_t;
|
||||
|
||||
class TraceService : public Firebird::Interface
|
||||
class TraceService : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual ntrace_service_t FB_CARG getServiceID() = 0;
|
||||
@ -165,7 +155,6 @@ public:
|
||||
virtual int FB_CARG getRemoteProcessID() = 0;
|
||||
virtual const char* FB_CARG getRemoteProcessName() = 0;
|
||||
};
|
||||
#define FB_TRACE_SERVICE_VERSION (FB_INTERFACE_VERSION + 10)
|
||||
|
||||
|
||||
// Plugin-specific argument. Passed by the engine to each hook
|
||||
@ -239,7 +228,7 @@ public:
|
||||
};
|
||||
#define FB_TRACE_LOG_WRITER_VERSION (FB_INTERFACE_VERSION + 1)
|
||||
|
||||
class TraceInitInfo : public Firebird::Interface
|
||||
class TraceInitInfo : public Firebird::IDisposable
|
||||
{
|
||||
public:
|
||||
virtual const char* FB_CARG getConfigText() = 0;
|
||||
@ -250,7 +239,6 @@ public:
|
||||
virtual TraceConnection* FB_CARG getConnection() = 0;
|
||||
virtual TraceLogWriter* FB_CARG getLogWriter() = 0;
|
||||
};
|
||||
#define FB_TRACE_INIT_INFO_VERSION (FB_INTERFACE_VERSION + 7)
|
||||
|
||||
|
||||
// API of trace plugin. Used to deliver notifications for each database
|
||||
|
@ -759,6 +759,7 @@ void TRA_init(Jrd::Attachment* attachment)
|
||||
|
||||
MemoryPool* const pool = dbb->dbb_permanent;
|
||||
jrd_tra* const trans = FB_NEW(*pool) jrd_tra(pool, &dbb->dbb_memory_stats, NULL, NULL);
|
||||
trans->addRef();
|
||||
trans->tra_attachment = attachment;
|
||||
attachment->setSysTransaction(trans);
|
||||
trans->tra_flags |= TRA_system | TRA_ignore_limbo;
|
||||
|
@ -187,6 +187,7 @@ public:
|
||||
pool->setStatsGroup(transaction->tra_memory_stats);
|
||||
}
|
||||
|
||||
transaction->addRef();
|
||||
return transaction;
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,7 @@ void checkFileError(const char* filename, const char* operation, ISC_STATUS iscE
|
||||
}
|
||||
|
||||
ConfigStorage::ConfigStorage()
|
||||
: timer(new TouchFile)
|
||||
{
|
||||
m_cfg_file = -1;
|
||||
m_dirty = false;
|
||||
@ -121,14 +122,14 @@ ConfigStorage::ConfigStorage()
|
||||
|
||||
StorageGuard guard(this);
|
||||
checkFile();
|
||||
timer.start(sh_mem_header->cfg_file_name);
|
||||
timer->start(sh_mem_header->cfg_file_name);
|
||||
|
||||
++sh_mem_header->cnt_uses;
|
||||
}
|
||||
|
||||
ConfigStorage::~ConfigStorage()
|
||||
{
|
||||
timer.stop();
|
||||
timer->stop();
|
||||
|
||||
::close(m_cfg_file);
|
||||
m_cfg_file = -1;
|
||||
@ -567,4 +568,15 @@ void ConfigStorage::TouchFile::stop()
|
||||
TimerInterface()->stop(this);
|
||||
}
|
||||
|
||||
int FB_CARG ConfigStorage::TouchFile::release()
|
||||
{
|
||||
if (--refCounter == 0)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // namespace Jrd
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "../../common/classes/init.h"
|
||||
#include "../../common/isc_s_proto.h"
|
||||
#include "../../jrd/trace/TraceSession.h"
|
||||
#include "../../common/classes/RefCounted.h"
|
||||
|
||||
namespace Jrd {
|
||||
|
||||
@ -69,16 +70,17 @@ private:
|
||||
void checkFile();
|
||||
void touchFile();
|
||||
|
||||
class TouchFile : public Firebird::StackIface<Firebird::ITimer, FB_I_TIMER_VERSION>
|
||||
class TouchFile : public Firebird::StdIface<Firebird::ITimer, FB_I_TIMER_VERSION>
|
||||
{
|
||||
public:
|
||||
void FB_CARG handler();
|
||||
void start(const char* fName);
|
||||
void stop();
|
||||
int FB_CARG release();
|
||||
private:
|
||||
const char* fileName;
|
||||
};
|
||||
TouchFile timer;
|
||||
Firebird::RefPtr<TouchFile> timer;
|
||||
|
||||
void checkDirty()
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ const char* TraceTriggerImpl::getRelationName()
|
||||
|
||||
/// TraceLogWriterImpl
|
||||
|
||||
class TraceLogWriterImpl : public StdIface<TraceLogWriter, FB_TRACE_INIT_INFO_VERSION>
|
||||
class TraceLogWriterImpl : public StdIface<TraceLogWriter, FB_TRACE_LOG_WRITER_VERSION>
|
||||
{
|
||||
public:
|
||||
TraceLogWriterImpl(const TraceSession& session) :
|
||||
@ -502,6 +502,7 @@ TraceLogWriter* TraceInitInfoImpl::getLogWriter()
|
||||
{
|
||||
m_logWriter = new TraceLogWriterImpl(m_session);
|
||||
}
|
||||
m_logWriter->addRef();
|
||||
return m_logWriter;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Database;
|
||||
class Attachment;
|
||||
class jrd_tra;
|
||||
|
||||
class TraceConnectionImpl : public Firebird::StackIface<TraceConnection, FB_TRACE_CONNECTION_VERSION>
|
||||
class TraceConnectionImpl : public Firebird::StackIface<TraceConnection>
|
||||
{
|
||||
public:
|
||||
TraceConnectionImpl(const Attachment* att) :
|
||||
@ -72,7 +72,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TraceTransactionImpl : public Firebird::StackIface<TraceTransaction, FB_TRACE_TRANSACTION_VERSION>
|
||||
class TraceTransactionImpl : public Firebird::StackIface<TraceTransaction>
|
||||
{
|
||||
public:
|
||||
TraceTransactionImpl(const jrd_tra* tran, PerformanceInfo* perf = NULL) :
|
||||
@ -92,7 +92,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class BLRPrinter : public Firebird::StackIface<TraceBLRStatement, FB_TRACE_BLR_VERSION>
|
||||
class BLRPrinter : public Firebird::StackIface<TraceBLRStatement>
|
||||
{
|
||||
public:
|
||||
BLRPrinter(const unsigned char* blr, size_t length) :
|
||||
@ -144,7 +144,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class TraceSQLStatementImpl : public Firebird::StackIface<TraceSQLStatement, FB_TRACE_SQL_VERSION>
|
||||
class TraceSQLStatementImpl : public Firebird::StackIface<TraceSQLStatement>
|
||||
{
|
||||
public:
|
||||
TraceSQLStatementImpl(const dsql_req* stmt, PerformanceInfo* perf) :
|
||||
@ -162,7 +162,7 @@ public:
|
||||
virtual const char* FB_CARG getTextUTF8();
|
||||
|
||||
private:
|
||||
class DSQLParamsImpl : public Firebird::StackIface<TraceParams, FB_TRACE_PARAMS_VERSION>
|
||||
class DSQLParamsImpl : public Firebird::StackIface<TraceParams>
|
||||
{
|
||||
public:
|
||||
DSQLParamsImpl(Firebird::MemoryPool& pool, const Firebird::Array<dsql_par*>* params) :
|
||||
@ -188,7 +188,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TraceFailedSQLStatement : public Firebird::StackIface<TraceSQLStatement, FB_TRACE_SQL_VERSION>
|
||||
class TraceFailedSQLStatement : public Firebird::StackIface<TraceSQLStatement>
|
||||
{
|
||||
public:
|
||||
TraceFailedSQLStatement(Firebird::string& text) :
|
||||
@ -208,7 +208,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TraceContextVarImpl : public Firebird::StackIface<TraceContextVariable, FB_TRACE_CONTEXT_VARIABLE_VERSION>
|
||||
class TraceContextVarImpl : public Firebird::StackIface<TraceContextVariable>
|
||||
{
|
||||
public:
|
||||
TraceContextVarImpl(const char* ns, const char* name, const char* value) :
|
||||
@ -227,7 +227,7 @@ private:
|
||||
const char* const m_value;
|
||||
};
|
||||
|
||||
class TraceProcedureImpl : public Firebird::StackIface<TraceProcedure, FB_TRACE_PROCEDURE_VERSION>
|
||||
class TraceProcedureImpl : public Firebird::StackIface<TraceProcedure>
|
||||
{
|
||||
public:
|
||||
TraceProcedureImpl(jrd_req* request, PerformanceInfo* perf) :
|
||||
@ -245,7 +245,7 @@ public:
|
||||
virtual PerformanceInfo* FB_CARG getPerf() { return m_perf; };
|
||||
|
||||
private:
|
||||
class JrdParamsImpl : public Firebird::StackIface<TraceParams, FB_TRACE_PARAMS_VERSION>
|
||||
class JrdParamsImpl : public Firebird::StackIface<TraceParams>
|
||||
{
|
||||
public:
|
||||
JrdParamsImpl(Firebird::MemoryPool& pool, jrd_req* request, const ValueListNode* params) :
|
||||
@ -271,7 +271,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TraceTriggerImpl : public Firebird::StackIface<TraceTrigger, FB_TRACE_TRIGGER_VERSION>
|
||||
class TraceTriggerImpl : public Firebird::StackIface<TraceTrigger>
|
||||
{
|
||||
public:
|
||||
TraceTriggerImpl(const jrd_req* trig, SSHORT which, PerformanceInfo* perf) :
|
||||
@ -293,7 +293,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TraceServiceImpl : public Firebird::StackIface<TraceService, FB_TRACE_SERVICE_VERSION>
|
||||
class TraceServiceImpl : public Firebird::StackIface<TraceService>
|
||||
{
|
||||
public:
|
||||
TraceServiceImpl(const Service* svc) :
|
||||
@ -331,7 +331,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TraceInitInfoImpl : public Firebird::StackIface<TraceInitInfo, FB_TRACE_INIT_INFO_VERSION>
|
||||
class TraceInitInfoImpl : public Firebird::StackIface<TraceInitInfo>
|
||||
{
|
||||
public:
|
||||
TraceInitInfoImpl(const Firebird::TraceSession& session, const Attachment* att,
|
||||
|
@ -808,10 +808,9 @@ static Firebird::UnloadDetector unloadDetector;
|
||||
|
||||
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
|
||||
{
|
||||
IPlugin* plugin = master->getPluginInterface();
|
||||
plugin->registerPlugin(PluginType::ExternalEngine, "UDR", &factory);
|
||||
plugin->setModuleCleanup(&unloadDetector);
|
||||
plugin->release();
|
||||
PluginInterface pi;
|
||||
pi->registerPlugin(PluginType::ExternalEngine, "UDR", &factory);
|
||||
pi->setModuleCleanup(&unloadDetector);
|
||||
|
||||
libraryName->assign("fbclient");
|
||||
ModuleLoader::doctorModuleExtension(libraryName);
|
||||
|
@ -497,10 +497,7 @@ namespace {
|
||||
|
||||
void registerRedirector(Firebird::IPlugin* iPlugin)
|
||||
{
|
||||
remoteFactory->addRef();
|
||||
iPlugin->registerPlugin(Firebird::PluginType::Provider, "Remote", &remoteFactory);
|
||||
|
||||
loopbackFactory->addRef();
|
||||
iPlugin->registerPlugin(Firebird::PluginType::Provider, "Loopback", &loopbackFactory);
|
||||
|
||||
Auth::registerLegacyClient(iPlugin);
|
||||
@ -640,7 +637,9 @@ Firebird::IAttachment* Provider::attach(Status* status, const char* filename,
|
||||
|
||||
init(status, port, op_attach, expanded_name, newDpb);
|
||||
|
||||
return new Attachment(port->port_context);
|
||||
Firebird::IAttachment* a = new Attachment(port->port_context);
|
||||
a->addRef();
|
||||
return a;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -993,7 +992,9 @@ Firebird::IRequest* Attachment::compileRequest(Status* status,
|
||||
message->msg_address = NULL;
|
||||
}
|
||||
|
||||
return new Request(request);
|
||||
Firebird::IRequest* r = new Request(request);
|
||||
r->addRef();
|
||||
return r;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -1071,7 +1072,9 @@ IBlob* Attachment::createBlob(Status* status, ITransaction* apiTra, ISC_QUAD* bl
|
||||
blob->rbl_next = transaction->rtr_blobs;
|
||||
transaction->rtr_blobs = blob;
|
||||
|
||||
return new Blob(blob);
|
||||
Firebird::IBlob* b = new Blob(blob);
|
||||
b->addRef();
|
||||
return b;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -1119,7 +1122,9 @@ Firebird::IAttachment* Provider::create(Status* status, const char* filename,
|
||||
|
||||
init(status, port, op_create, expanded_name, newDpb);
|
||||
|
||||
return new Attachment(rdb);
|
||||
Firebird::IAttachment* a = new Attachment(rdb);
|
||||
a->addRef();
|
||||
return a;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -1454,7 +1459,9 @@ Firebird::IStatement* Attachment::allocateStatement(Status* status)
|
||||
statement->rsr_next = rdb->rdb_sql_requests;
|
||||
rdb->rdb_sql_requests = statement;
|
||||
|
||||
return new Statement(statement);
|
||||
Firebird::IStatement* s = new Statement(statement);
|
||||
s->addRef();
|
||||
return s;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -1646,7 +1653,9 @@ Firebird::ITransaction* Statement::execute(Status* status, Firebird::ITransactio
|
||||
{
|
||||
transaction = make_transaction(rdb, packet->p_resp.p_resp_object);
|
||||
statement->rsr_rtr = transaction;
|
||||
return new Transaction(transaction);
|
||||
Firebird::ITransaction* t = new Transaction(transaction);
|
||||
t->addRef();
|
||||
return t;
|
||||
}
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
@ -1832,7 +1841,9 @@ Firebird::ITransaction* Attachment::execute(Status* status, Firebird::ITransacti
|
||||
else if (!transaction && packet->p_resp.p_resp_object)
|
||||
{
|
||||
transaction = make_transaction(rdb, packet->p_resp.p_resp_object);
|
||||
return new Transaction(transaction);
|
||||
Firebird::ITransaction* t = new Transaction(transaction);
|
||||
t->addRef();
|
||||
return t;
|
||||
}
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
@ -2946,7 +2957,9 @@ IBlob* Attachment::openBlob(Status* status, ITransaction* apiTra, ISC_QUAD* id,
|
||||
blob->rbl_next = transaction->rtr_blobs;
|
||||
transaction->rtr_blobs = blob;
|
||||
|
||||
return new Blob(blob);
|
||||
Firebird::IBlob* b = new Blob(blob);
|
||||
b->addRef();
|
||||
return b;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -3247,7 +3260,9 @@ Firebird::IEvents* Attachment::queEvents(Status* status, Firebird::EventCallback
|
||||
send_packet(port, packet);
|
||||
receive_response(status, rdb, packet);
|
||||
|
||||
return new Events(rem_event);
|
||||
Firebird::IEvents* rc = new Events(rem_event);
|
||||
rc->addRef();
|
||||
return rc;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -3453,7 +3468,9 @@ Firebird::ITransaction* Attachment::reconnectTransaction(Status* status,
|
||||
|
||||
send_and_receive(status, rdb, packet);
|
||||
|
||||
return new Transaction(make_transaction(rdb, packet->p_resp.p_resp_object));
|
||||
Firebird::ITransaction* t = new Transaction(make_transaction(rdb, packet->p_resp.p_resp_object));
|
||||
t->addRef();
|
||||
return t;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -3824,7 +3841,9 @@ Firebird::IService* Provider::attachSvc(Status* status, const char* service,
|
||||
|
||||
init(status, port, op_service_attach, expanded_name, newSpb);
|
||||
|
||||
return new Service(rdb);
|
||||
Firebird::IService* s = new Service(rdb);
|
||||
s->addRef();
|
||||
return s;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -4178,7 +4197,9 @@ Firebird::ITransaction* Attachment::startTransaction(Status* status,
|
||||
|
||||
send_and_receive(status, rdb, packet);
|
||||
|
||||
return new Transaction(make_transaction(rdb, packet->p_resp.p_resp_object));
|
||||
Firebird::ITransaction* t = new Transaction(make_transaction(rdb, packet->p_resp.p_resp_object));
|
||||
t->addRef();
|
||||
return t;
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
tsec* tdsec = &tsecInstance;
|
||||
tsec::putSpecific(tdsec);
|
||||
|
||||
Auth::UserData u;
|
||||
Auth::StackUserData u;
|
||||
tdsec->tsec_user_data = &u;
|
||||
|
||||
try {
|
||||
@ -252,7 +252,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
fb_assert(user_data->trustedUser.entered());
|
||||
if (user_data->trustedUser.entered())
|
||||
{
|
||||
class GsecInfo : public Firebird::StackIface<Auth::LogonInfo, FB_AUTH_LOGON_INFO_VERSION>
|
||||
class GsecInfo : public Firebird::StackIface<Auth::LogonInfo>
|
||||
{
|
||||
public:
|
||||
GsecInfo(const char* pTrustedUser, const char* pRole, int pTrustedRole,
|
||||
@ -334,7 +334,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
class Display : public Firebird::StackIface<Auth::ListUsers, FB_AUTH_LIST_USERS_VERSION>
|
||||
class Display : public Firebird::StackIface<Auth::ListUsers>
|
||||
{
|
||||
public:
|
||||
Display(tsec* t)
|
||||
|
@ -114,7 +114,6 @@ static Firebird::UnloadDetector unloadDetector;
|
||||
|
||||
void registerTrace(Firebird::IPlugin* iPlugin)
|
||||
{
|
||||
traceFactory->addRef();
|
||||
iPlugin->registerPlugin(Firebird::PluginType::Trace, "fbtrace", &traceFactory);
|
||||
iPlugin->setModuleCleanup(&unloadDetector);
|
||||
}
|
||||
@ -122,7 +121,6 @@ void registerTrace(Firebird::IPlugin* iPlugin)
|
||||
|
||||
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
|
||||
{
|
||||
Firebird::IPlugin* pi = master->getPluginInterface();
|
||||
Firebird::PluginInterface pi(master);
|
||||
registerTrace(pi);
|
||||
pi->release();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
class MasterImplementation : public StackIface<IMaster, IMaster::VERSION>
|
||||
class MasterImplementation : public StackIface<IMaster>
|
||||
{
|
||||
public:
|
||||
Status* FB_CARG getStatusInstance();
|
||||
@ -60,17 +60,12 @@ public:
|
||||
// getStatusInstance()
|
||||
//
|
||||
|
||||
class UserStatus : public Firebird::StdIface<Firebird::BaseStatus, FB_STATUS_VERSION>
|
||||
class UserStatus : public Firebird::DisposeIface<Firebird::BaseStatus>
|
||||
{
|
||||
private:
|
||||
int FB_CARG release()
|
||||
void FB_CARG dispose()
|
||||
{
|
||||
if (--refCounter == 0)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
delete this;
|
||||
}
|
||||
};
|
||||
|
||||
@ -87,7 +82,6 @@ IPlugin* FB_CARG MasterImplementation::getPluginInterface()
|
||||
{
|
||||
static Static<PluginManager> manager;
|
||||
|
||||
manager->addRef();
|
||||
return &manager;
|
||||
}
|
||||
|
||||
@ -460,7 +454,7 @@ THREAD_ENTRY_DECLARE TimerEntry::timeThread(THREAD_ENTRY_PARAM)
|
||||
|
||||
} // namespace
|
||||
|
||||
class TimerImplementation : public StackIface<ITimerControl, FB_I_TIMER_CONTROL_VERSION>
|
||||
class TimerImplementation : public StackIface<ITimerControl>
|
||||
{
|
||||
public:
|
||||
void FB_CARG start(ITimer* timer, TimerDelay microSeconds)
|
||||
@ -510,7 +504,6 @@ ITimerControl* FB_CARG MasterImplementation::getTimerControl()
|
||||
{
|
||||
static Static<TimerImplementation> timer;
|
||||
|
||||
timer->addRef();
|
||||
return &timer;
|
||||
}
|
||||
|
||||
@ -530,6 +523,5 @@ Firebird::IMaster* ISC_EXPORT fb_get_master_interface()
|
||||
{
|
||||
static Firebird::Static<Firebird::MasterImplementation> master;
|
||||
|
||||
master->addRef();
|
||||
return &master;
|
||||
}
|
||||
|
@ -210,7 +210,9 @@ namespace
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
return new ConfigParameterAccess(this, p);
|
||||
IConfigParameter* rc = new ConfigParameterAccess(this, p);
|
||||
rc->addRef();
|
||||
return rc;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -221,7 +223,9 @@ namespace
|
||||
{
|
||||
if (par && par->sub.hasData())
|
||||
{
|
||||
return new ConfigAccess(par->sub);
|
||||
IConfig* rc = new ConfigAccess(par->sub);
|
||||
rc->addRef();
|
||||
return rc;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -323,17 +327,17 @@ namespace
|
||||
|
||||
for (unsigned int i = 0; i < regPlugins.getCount(); ++i)
|
||||
{
|
||||
regPlugins[i].factory->release();
|
||||
regPlugins[i].factory->dispose();
|
||||
}
|
||||
|
||||
if (cleanup.hasData())
|
||||
if (cleanup)
|
||||
{
|
||||
cleanup->doClean();
|
||||
}
|
||||
}
|
||||
|
||||
Firebird::AutoPtr<ModuleLoader::Module> module;
|
||||
Firebird::RefPtr<Firebird::IModuleCleanup> cleanup;
|
||||
Firebird::IModuleCleanup* cleanup;
|
||||
HalfStaticArray<RegisteredPlugin, 2> regPlugins;
|
||||
PluginModule* next;
|
||||
PluginModule** prev;
|
||||
@ -406,7 +410,9 @@ namespace
|
||||
if (defaultConfig.hasData())
|
||||
{
|
||||
const ConfigFile::Parameter* p = defaultConfig->findParameter("Config");
|
||||
return new ConfigAccess(p ? findConfig("Config", p->value.c_str()) : RefPtr<ConfigFile>(NULL));
|
||||
IConfig* rc = new ConfigAccess(p ? findConfig("Config", p->value.c_str()) : RefPtr<ConfigFile>(NULL));
|
||||
rc->addRef();
|
||||
return rc;
|
||||
}
|
||||
|
||||
PluginInterface pi;
|
||||
@ -479,10 +485,11 @@ namespace
|
||||
|
||||
Plugin* ConfiguredPlugin::factory(IFirebirdConf* firebirdConf)
|
||||
{
|
||||
FactoryParameter* par = new FactoryParameter(this, firebirdConf);
|
||||
RefPtr<FactoryParameter> par(new FactoryParameter(this, firebirdConf));
|
||||
Plugin* plugin = module->getPlugin(regPlugin).factory->createPlugin(par);
|
||||
if (plugin)
|
||||
{
|
||||
par->addRef();
|
||||
plugin->owner(par);
|
||||
}
|
||||
return plugin;
|
||||
@ -630,7 +637,7 @@ namespace
|
||||
PathName currentName;
|
||||
RefPtr<ConfiguredPlugin> currentPlugin; // Missing data in this field indicates EOF
|
||||
|
||||
IFirebirdConf* firebirdConf;
|
||||
RefPtr<IFirebirdConf> firebirdConf;
|
||||
AutoPtr<IMaster, AutoInterface> masterInterface;
|
||||
|
||||
RefPtr<PluginModule> loadModule(const PathName& modName);
|
||||
@ -845,8 +852,10 @@ IPluginSet* FB_CARG PluginManager::getPlugins(unsigned int interfaceType, const
|
||||
{
|
||||
MutexLockGuard g(plugins->mutex);
|
||||
|
||||
return new PluginSet(interfaceType, namesList, desiredVersion,
|
||||
IPluginSet* rc = new PluginSet(interfaceType, namesList, desiredVersion,
|
||||
missingFunctionClass, firebirdConf);
|
||||
rc->addRef();
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@ -878,7 +887,9 @@ void FB_CARG PluginManager::releasePlugin(Plugin* plugin)
|
||||
|
||||
IConfig* FB_CARG PluginManager::getConfig(const char* filename)
|
||||
{
|
||||
return new ConfigAccess(RefPtr<ConfigFile>(FB_NEW(*getDefaultMemoryPool()) ConfigFile(filename, 0)));
|
||||
IConfig* rc = new ConfigAccess(RefPtr<ConfigFile>(FB_NEW(*getDefaultMemoryPool()) ConfigFile(filename, 0)));
|
||||
rc->addRef();
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
namespace Firebird {
|
||||
|
||||
class PluginManager : public StackIface<IPlugin, FB_I_PLUGIN_VERSION>
|
||||
class PluginManager : public StackIface<IPlugin>
|
||||
{
|
||||
public:
|
||||
IPluginSet* FB_CARG getPlugins(unsigned int interfaceType, const char* namesList,
|
||||
|
@ -857,7 +857,7 @@ ISC_STATUS API_ROUTINE isc_add_user(ISC_STATUS* status, const USER_SEC_DATA* inp
|
||||
* Return > 0 if any error occurs.
|
||||
*
|
||||
**************************************/
|
||||
Auth::UserData userInfo;
|
||||
Auth::StackUserData userInfo;
|
||||
userInfo.op = ADD_OPER;
|
||||
Firebird::string work;
|
||||
|
||||
@ -926,7 +926,7 @@ ISC_STATUS API_ROUTINE isc_delete_user(ISC_STATUS* status, const USER_SEC_DATA*
|
||||
* Return > 0 if any error occurs.
|
||||
*
|
||||
**************************************/
|
||||
Auth::UserData userInfo;
|
||||
Auth::StackUserData userInfo;
|
||||
userInfo.op = DEL_OPER;
|
||||
Firebird::string work;
|
||||
|
||||
@ -968,7 +968,7 @@ ISC_STATUS API_ROUTINE isc_modify_user(ISC_STATUS* status, const USER_SEC_DATA*
|
||||
* Return > 0 if any error occurs.
|
||||
*
|
||||
**************************************/
|
||||
Auth::UserData userInfo;
|
||||
Auth::StackUserData userInfo;
|
||||
userInfo.op = MOD_OPER;
|
||||
Firebird::string work;
|
||||
|
||||
|
@ -1024,7 +1024,7 @@ const USHORT DESCRIBE_BUFFER_SIZE = 1024; // size of buffer used in isc_dsql_de
|
||||
namespace
|
||||
{
|
||||
// Status: Provides correct status vector for operation and init() it.
|
||||
class StatusVector : public StackIface<Status, FB_STATUS_VERSION>
|
||||
class StatusVector : public StackIface<Status>
|
||||
{
|
||||
public:
|
||||
explicit StatusVector(ISC_STATUS* v) throw()
|
||||
|
Loading…
Reference in New Issue
Block a user