From cf42eaf4d53fd52561082807741664e1edd1948c Mon Sep 17 00:00:00 2001 From: asfernandes Date: Thu, 23 May 2013 15:53:06 +0000 Subject: [PATCH] Make the master interface available in UDR. --- examples/udr/UdrCppExample.cpp | 3 --- src/include/firebird/UdrCppEngine.h | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/examples/udr/UdrCppExample.cpp b/examples/udr/UdrCppExample.cpp index 1104a767b9..4897f1a12f 100644 --- a/examples/udr/UdrCppExample.cpp +++ b/examples/udr/UdrCppExample.cpp @@ -111,9 +111,6 @@ namespace } -static IMaster* master = fb_get_master_interface(); - - //------------------------------------------------------------------------------ diff --git a/src/include/firebird/UdrCppEngine.h b/src/include/firebird/UdrCppEngine.h index cd1357bc0e..2e343ecfe5 100644 --- a/src/include/firebird/UdrCppEngine.h +++ b/src/include/firebird/UdrCppEngine.h @@ -515,9 +515,10 @@ public: { } - void* operator new(size_t size, const IRoutineMetadata* metadata) + void* operator new(size_t size, IMaster* master, const IRoutineMetadata* metadata) { Function* p = reinterpret_cast(::new char[size]); + p->master = master; p->metadata = metadata; return p; } @@ -528,6 +529,7 @@ public: } public: + IMaster* master; const IRoutineMetadata* metadata; }; @@ -556,9 +558,10 @@ public: { } - void* operator new(size_t size, const IRoutineMetadata* metadata) + void* operator new(size_t size, IMaster* master, const IRoutineMetadata* metadata) { Procedure* p = reinterpret_cast(::new char[size]); + p->master = master; p->metadata = metadata; return p; } @@ -569,6 +572,7 @@ public: } public: + IMaster* master; const IRoutineMetadata* metadata; }; @@ -597,9 +601,10 @@ public: { } - void* operator new(size_t size, const IRoutineMetadata* metadata) + void* operator new(size_t size, IMaster* master, const IRoutineMetadata* metadata) { Trigger* p = reinterpret_cast(::new char[size]); + p->master = master; p->metadata = metadata; return p; } @@ -610,6 +615,7 @@ public: } public: + IMaster* master; const IRoutineMetadata* metadata; }; @@ -632,7 +638,7 @@ public: virtual ExternalFunction* FB_CARG newItem(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata) { - T* obj = new(metadata) Routine; + T* obj = new(context->getMaster(), metadata) Routine; obj->initialize(status, context); return obj; } @@ -657,7 +663,7 @@ public: virtual ExternalProcedure* FB_CARG newItem(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata) { - T* obj = new(metadata) Routine; + T* obj = new(context->getMaster(), metadata) Routine; obj->initialize(status, context); return obj; } @@ -681,7 +687,7 @@ public: virtual ExternalTrigger* FB_CARG newItem(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata) { - T* obj = new(metadata) Routine; + T* obj = new(context->getMaster(), metadata) Routine; obj->initialize(status, context); return obj; }