8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 08:40:39 +01:00

Get rid of upgradeInterface API method and some adjustments. To be continued.

This commit is contained in:
asfernandes 2014-11-10 14:45:40 +00:00
parent 3a1077b117
commit 49d1a73994
30 changed files with 570 additions and 1129 deletions

View File

@ -24,6 +24,7 @@
* Contributor(s): ______________________________________.
*/
#include "firebird.h" //// FIXME:
#include <stdio.h>
#include <string.h>
#include <stdint.h>

View File

@ -24,6 +24,7 @@
* Contributor(s): ______________________________________.
*/
#include "firebird.h" //// FIXME:
#include <stdint.h>
#include "ibase.h"

View File

@ -21,6 +21,7 @@
*/
#include "ibase.h"
#include "firebird.h" //// FIXME:
#include "firebird/UdrCppEngine.h"
#include <assert.h>
#include <stdio.h>

View File

@ -1610,6 +1610,8 @@ C --
PARAMETER (GDS__crdb_nodb = 335545098)
INTEGER*4 GDS__crdb_notable
PARAMETER (GDS__crdb_notable = 335545099)
INTEGER*4 GDS__interface_version_too_old
PARAMETER (GDS__interface_version_too_old = 335545100)
INTEGER*4 GDS__gfix_db_name
PARAMETER (GDS__gfix_db_name = 335740929)
INTEGER*4 GDS__gfix_invalid_sw

View File

@ -812,6 +812,7 @@ const
gds_crdb_load = 335545097;
gds_crdb_nodb = 335545098;
gds_crdb_notable = 335545099;
gds_interface_version_too_old = 335545100;
gds_gfix_db_name = 335740929;
gds_gfix_invalid_sw = 335740930;
gds_gfix_incmp_sw = 335740932;

View File

@ -47,7 +47,7 @@ public:
LocalStatus status;
pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType,
(namesList ? namesList : Config::getDefaultConfig()->getPlugins(interfaceType)),
P::VERSION, getUnloadDetector(), NULL));
NULL));
check(&status);
getPlugin();
@ -61,7 +61,7 @@ public:
LocalStatus status;
pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType,
(namesList ? namesList : knownConfig->getPlugins(interfaceType)),
P::VERSION, getUnloadDetector(), new FirebirdConf(knownConfig)));
new FirebirdConf(knownConfig)));
check(&status);
getPlugin();

View File

@ -72,22 +72,6 @@ IMaster* CachedMasterInterface::getMasterInterface()
}
void upgradeInterface(FirebirdApi<FirebirdPolicy>::Versioned* toUpgrade, int desiredVersion, void* function)
{
MasterInterfacePtr()->upgradeInterface(toUpgrade, desiredVersion, getPluginModule(), function);
}
void logOldPlugin()
{
gds__log("Old version of trace plugin is used - new types of events are ignored");
}
ISC_STATUS* getUpgradeError()
{
static ISC_STATUS failure[2] = {isc_arg_gds, isc_wish_list};
return failure;
}
#ifdef NOT_USED_OR_REPLACED
class IDebug
{

View File

@ -293,9 +293,4 @@ void fatal_exception::raiseFmt(const char* format, ...)
throw fatal_exception(buffer);
}
void raiseVersionError()
{
fatal_exception::raise("Interface version too old");
}
} // namespace Firebird

View File

@ -711,13 +711,6 @@ public:
return NULL;
}
int upgradeInterface(IVersioned* /*toUpgrade*/, int /*desiredVersion*/,
IPluginModule* /*destMod*/, void* /*function*/)
{
fb_assert(false);
return 0;
}
const char* circularAlloc(const char* s, unsigned len, intptr_t /*thr*/)
{
char* buf = (char*) malloc(len + 1);

View File

@ -57,7 +57,7 @@ interface Status : Disposable
const uint FB_HAS_WARNINGS = 0x01;
const uint FB_HAS_ERRORS = 0x02;
// completion codes - not used in IStatus, but I must have them somewhere
// completion codes - not used in Status, but I must have them somewhere
const int FB_ERROR = -1;
const int FB_OK = 0;
const int FB_EOF = 1;
@ -81,8 +81,6 @@ interface Master : Versioned
Status getStatus();
Provider getDispatcher();
PluginManager getPluginManager();
int upgradeInterface(Versioned toUpgrade, int desiredVersion,
PluginModule destModule, void* function);
const string circularAlloc(const string s, uint len, intptr thr);
TimerControl getTimerControl();
Dtc getDtc();
@ -90,7 +88,7 @@ interface Master : Versioned
Transaction registerTransaction(Attachment attachment, Transaction transaction);
// This function is required to compare interfaces based on vtables of them
int same(Versioned first, Versioned second);
int same(Versioned first, Versioned second); //// FIXME: Should we really publish this API?
MetadataBuilder getMetadataBuilder(Status status, uint fieldCount);
//// FIXME: Debug getDebug();
@ -248,13 +246,11 @@ interface PluginManager : Versioned
// Main function called to access plugins registered in plugins manager
// Has front-end in GetPlugins.h - template GetPlugins
// In namesList parameter comma or space separated list of names of configured plugins is passed
// PluginModule is a module from which interface is upgraded
// in case when plugin's version is less than desired
// If caller already has an interface for firebird.conf, it may be passed here
// If parameter is missing, plugins will get access to default (non database specific) config
PluginSet getPlugins(Status status, uint pluginType,
const string namesList, int desiredVersion,
PluginModule destModule, FirebirdConf firebirdConf);
const string namesList, FirebirdConf firebirdConf);
// Get generic config interface for given file
Config getConfig(Status status, const string filename);
// Plugins must be released using this function - use of plugin's release()
@ -281,7 +277,7 @@ typedef void PluginEntrypoint(Master masterInterface);
// Generic access to all config interfaces
interface ConfigManager : Versioned
{
// Codes for IConfigManager::getDirectory()
// Codes for ConfigManager::getDirectory()
const uint FB_DIR_BIN = 0;
const uint FB_DIR_SBIN = 1;
const uint FB_DIR_CONF = 2;
@ -323,8 +319,10 @@ interface Blob : ReferenceCounted
void getInfo(Status status,
uint itemsLength, const uchar* items,
uint bufferLength, uchar* buffer);
int getSegment(Status status, uint bufferLength,
void* buffer, uint* segmentLength);
[notImplemented(Status::FB_ERROR)]
int getSegment(Status status, uint bufferLength, void* buffer, uint* segmentLength);
void putSegment(Status status, uint length,
const void* buffer);
void cancel(Status status);
@ -387,12 +385,12 @@ interface MetadataBuilder : ReferenceCounted
interface ResultSet : ReferenceCounted
{
int fetchNext(Status status, void* message);
int fetchPrior(Status status, void* message);
int fetchFirst(Status status, void* message);
int fetchLast(Status status, void* message);
int fetchAbsolute(Status status, uint position, void* message);
int fetchRelative(Status status, int offset, void* message);
[notImplemented(Status::FB_ERROR)] int fetchNext(Status status, void* message);
[notImplemented(Status::FB_ERROR)] int fetchPrior(Status status, void* message);
[notImplemented(Status::FB_ERROR)] int fetchFirst(Status status, void* message);
[notImplemented(Status::FB_ERROR)] int fetchLast(Status status, void* message);
[notImplemented(Status::FB_ERROR)] int fetchAbsolute(Status status, uint position, void* message);
[notImplemented(Status::FB_ERROR)] int fetchRelative(Status status, int offset, void* message);
boolean isEof(Status status);
boolean isBof(Status status);
MessageMetadata getMetadata(Status status);
@ -591,12 +589,14 @@ interface ClientBlock : ReferenceCounted
// server part of authentication plugin
interface Server : Auth
{
[notImplemented(Auth::AUTH_FAILED)]
int authenticate(Status status, ServerBlock sBlock, Writer writerInterface);
}
// .. and corresponding client
interface Client : Auth
{
[notImplemented(Auth::AUTH_FAILED)]
int authenticate(Status status, ClientBlock cBlock);
}
@ -715,7 +715,7 @@ interface DbCryptPlugin : PluginBase
// It's supposed that crypt plugin will invoke keyHandle() function from them
// to access callback interface for getting actual crypt key.
// If crypt plugin fails to find appropriate key in sources, it should raise error.
void setKey(Status status, uint length, KeyHolderPlugin* sources); // Adriano - this is really ptr to ptr, a set of plugins is passed
void setKey(Status status, uint length, KeyHolderPlugin* sources);
void encrypt(Status status, uint length, const void* from, void* to);
void decrypt(Status status, uint length, const void* from, void* to);
}
@ -1080,63 +1080,103 @@ interface TracePlugin : ReferenceCounted
// Events supported:
// Create/close attachment
[notImplemented(true)]
boolean trace_attach(TraceDatabaseConnection connection, boolean create_db, uint att_result);
[notImplemented(true)]
boolean trace_detach(TraceDatabaseConnection connection, boolean drop_db);
// Start/end transaction
[notImplemented(true)]
boolean trace_transaction_start(TraceDatabaseConnection connection, TraceTransaction transaction,
uint tpb_length, const uchar* tpb, uint tra_result);
[notImplemented(true)]
boolean trace_transaction_end(TraceDatabaseConnection connection, TraceTransaction transaction,
boolean commit, boolean retain_context, uint tra_result);
// Stored procedures and triggers execution
[notImplemented(true)]
boolean trace_proc_execute (TraceDatabaseConnection connection, TraceTransaction transaction, TraceProcedure procedure,
boolean started, uint proc_result);
[notImplemented(true)]
boolean trace_trigger_execute(TraceDatabaseConnection connection, TraceTransaction transaction, TraceTrigger trigger,
boolean started, uint trig_result);
// Assignment to context variables
[notImplemented(true)]
boolean trace_set_context(TraceDatabaseConnection connection, TraceTransaction transaction, TraceContextVariable variable);
// DSQL statement lifecycle
[notImplemented(true)]
boolean trace_dsql_prepare(TraceDatabaseConnection connection, TraceTransaction transaction,
TraceSQLStatement statement, int64 time_millis, uint req_result);
[notImplemented(true)]
boolean trace_dsql_free(TraceDatabaseConnection connection, TraceSQLStatement statement, uint option);
[notImplemented(true)]
boolean trace_dsql_execute(TraceDatabaseConnection connection, TraceTransaction transaction, TraceSQLStatement statement,
boolean started, uint req_result);
// BLR requests
[notImplemented(true)]
boolean trace_blr_compile(TraceDatabaseConnection connection, TraceTransaction transaction,
TraceBLRStatement statement, int64 time_millis, uint req_result);
[notImplemented(true)]
boolean trace_blr_execute(TraceDatabaseConnection connection, TraceTransaction transaction,
TraceBLRStatement statement, uint req_result);
// DYN requests
[notImplemented(true)]
boolean trace_dyn_execute(TraceDatabaseConnection connection, TraceTransaction transaction,
TraceDYNRequest request, int64 time_millis, uint req_result);
// Using the services
[notImplemented(true)]
boolean trace_service_attach(TraceServiceConnection service, uint att_result);
[notImplemented(true)]
boolean trace_service_start(TraceServiceConnection service, uint switches_length, const string switches,
uint start_result);
[notImplemented(true)]
boolean trace_service_query(TraceServiceConnection service, uint send_item_length,
const uchar* send_items, uint recv_item_length,
const uchar* recv_items, uint query_result);
[notImplemented(true)]
boolean trace_service_detach(TraceServiceConnection service, uint detach_result);
// Errors happened
[notImplemented(true)]
boolean trace_event_error(TraceConnection connection, TraceStatusVector status, const string function);
// Sweep activity
const uint SWEEP_STATE_STARTED = 1;
const uint SWEEP_STATE_FINISHED = 2;
const uint SWEEP_STATE_FAILED = 3;
const uint SWEEP_STATE_PROGRESS = 4;
[notImplemented(true)]
boolean trace_event_sweep(TraceDatabaseConnection connection, TraceSweepInfo sweep,
uint sweep_state);
// Stored functions execution
[notImplemented(true)]
boolean trace_func_execute (TraceDatabaseConnection connection, TraceTransaction transaction, TraceFunction function,
boolean started, uint func_result);
}

File diff suppressed because it is too large Load Diff

View File

@ -46,185 +46,125 @@ struct DtcStart;
#include "IdlFbInterfaces.h"
#define FB_USE_API(name, prefix) \
/* awk <FirebirdInterface.idl '($1 == "interface") {printf "\t\ttypedef name::%s prefix##%s;\n", $2, $2;}' */ \
typedef name::Versioned prefix##Versioned; \
typedef name::ReferenceCounted prefix##ReferenceCounted; \
typedef name::Disposable prefix##Disposable; \
typedef name::Status prefix##Status; \
typedef name::Master prefix##Master; \
typedef name::PluginBase prefix##PluginBase; \
typedef name::PluginSet prefix##PluginSet; \
typedef name::ConfigEntry prefix##ConfigEntry; \
typedef name::Config prefix##Config; \
typedef name::FirebirdConf prefix##FirebirdConf; \
typedef name::PluginConfig prefix##PluginConfig; \
typedef name::PluginFactory prefix##PluginFactory; \
typedef name::PluginModule prefix##PluginModule; \
typedef name::PluginManager prefix##PluginManager; \
typedef name::ConfigManager prefix##ConfigManager; \
typedef name::EventCallback prefix##EventCallback; \
typedef name::Blob prefix##Blob; \
typedef name::Transaction prefix##Transaction; \
typedef name::MessageMetadata prefix##MessageMetadata; \
typedef name::MetadataBuilder prefix##MetadataBuilder; \
typedef name::ResultSet prefix##ResultSet; \
typedef name::Statement prefix##Statement; \
typedef name::Request prefix##Request; \
typedef name::Events prefix##Events; \
typedef name::Attachment prefix##Attachment; \
typedef name::Service prefix##Service; \
typedef name::Provider prefix##Provider; \
typedef name::Dtc prefix##Dtc; \
typedef name::Auth prefix##Auth; \
typedef name::Writer prefix##Writer; \
typedef name::ServerBlock prefix##ServerBlock; \
typedef name::ClientBlock prefix##ClientBlock; \
typedef name::Server prefix##Server; \
typedef name::Client prefix##Client; \
typedef name::UserField prefix##UserField; \
typedef name::CharUserField prefix##CharUserField; \
typedef name::IntUserField prefix##IntUserField; \
typedef name::User prefix##User; \
typedef name::ListUsers prefix##ListUsers; \
typedef name::LogonInfo prefix##LogonInfo; \
typedef name::Management prefix##Management; \
typedef name::WireCryptPlugin prefix##WireCryptPlugin; \
typedef name::CryptKeyCallback prefix##CryptKeyCallback; \
typedef name::KeyHolderPlugin prefix##KeyHolderPlugin; \
typedef name::DbCryptPlugin prefix##DbCryptPlugin; \
typedef name::ExternalContext prefix##ExternalContext; \
typedef name::ExternalResultSet prefix##ExternalResultSet; \
typedef name::ExternalFunction prefix##ExternalFunction; \
typedef name::ExternalProcedure prefix##ExternalProcedure; \
typedef name::ExternalTrigger prefix##ExternalTrigger; \
typedef name::RoutineMetadata prefix##RoutineMetadata; \
typedef name::ExternalEngine prefix##ExternalEngine; \
typedef name::Timer prefix##Timer; \
typedef name::TimerControl prefix##TimerControl; \
typedef name::VersionCallback prefix##VersionCallback; \
typedef name::Utl prefix##Utl; \
typedef name::TraceConnection prefix##TraceConnection; \
typedef name::TraceDatabaseConnection prefix##TraceDatabaseConnection; \
typedef name::TraceTransaction prefix##TraceTransaction; \
typedef name::TraceParams prefix##TraceParams; \
typedef name::TraceStatement prefix##TraceStatement; \
typedef name::TraceSQLStatement prefix##TraceSQLStatement; \
typedef name::TraceBLRStatement prefix##TraceBLRStatement; \
typedef name::TraceDYNRequest prefix##TraceDYNRequest; \
typedef name::TraceContextVariable prefix##TraceContextVariable; \
typedef name::TraceProcedure prefix##TraceProcedure; \
typedef name::TraceFunction prefix##TraceFunction; \
typedef name::TraceTrigger prefix##TraceTrigger; \
typedef name::TraceServiceConnection prefix##TraceServiceConnection; \
typedef name::TraceStatusVector prefix##TraceStatusVector; \
typedef name::TraceSweepInfo prefix##TraceSweepInfo; \
typedef name::TraceLogWriter prefix##TraceLogWriter; \
typedef name::TraceInitInfo prefix##TraceInitInfo; \
typedef name::TracePlugin prefix##TracePlugin; \
typedef name::TraceFactory prefix##TraceFactory;
#ifdef INCLUDE_Firebird_H // Building internal module
class FirebirdPolicy;
extern void raiseVersionError();
extern void upgradeInterface(FirebirdApi<FirebirdPolicy>::Versioned* toUpgrade, int desiredVersion, void* function);
extern void logOldPlugin();
extern ISC_STATUS* getUpgradeError();
namespace
{
static void defaultUpgradeFunction(void*, FirebirdApi<FirebirdPolicy>::Status* status)
{
status->setErrors2(2, getUpgradeError());
}
// This may be used when old plugin, missing some newer events is used.
// Reasonable action here is to log once and ignore next times.
static void ignoreMissing(void*)
{
static bool flagFirst = true;
if (flagFirst)
{
flagFirst = false;
logOldPlugin();
}
};
template <typename T>
static inline void upgradeVersionedInterface(T* versioned)
{
if (versioned && versioned->cloopVTable->version < T::VERSION)
{
upgradeInterface(versioned, T::VERSION, (void*)defaultUpgradeFunction);
}
}
template <>
void upgradeVersionedInterface<FirebirdApi<FirebirdPolicy>::TracePlugin>
(FirebirdApi<FirebirdPolicy>::TracePlugin* versioned)
{
if (versioned && versioned->cloopVTable->version < FirebirdApi<FirebirdPolicy>::TracePlugin::VERSION)
{
upgradeInterface(versioned, FirebirdApi<FirebirdPolicy>::TracePlugin::VERSION, (void*)ignoreMissing);
}
}
}
typedef FirebirdApi<class FirebirdPolicy> Api;
FB_USE_API(Api, I)
class FirebirdPolicy
{
public:
template <unsigned V, typename T>
static inline void checkVersion(T* versioned)
static inline bool checkVersion(T* versioned, IStatus* status)
{
if (versioned && versioned->cloopVTable->version < V)
if (versioned->cloopVTable->version < V)
return true;
if (status)
{
raiseVersionError();
intptr_t codes[] = {
isc_arg_gds,
isc_interface_version_too_old,
isc_arg_number,
(intptr_t) V,
isc_arg_number,
(intptr_t) versioned->cloopVTable->version,
isc_arg_end
};
status->setErrors(codes);
}
return false;
}
template <typename T>
static inline T* upgrade(T* versioned)
{
upgradeVersionedInterface(versioned);
return versioned;
}
static void checkException(FirebirdApi<FirebirdPolicy>::Status* status) { }
static void catchException(FirebirdApi<FirebirdPolicy>::Status* status) { }
typedef FirebirdApi<FirebirdPolicy>::Status* Status;
static void checkException(Api::Status* status) { }
static void catchException(Api::Status* status) { }
typedef Api::Status* Status;
};
#else // INCLUDE_Firebird_H building external module
// use empty default policy
class FirebirdPolicy
{
public:
template <unsigned V, typename T>
static inline void checkVersion(T* versioned) { }
template <typename T>
static inline T* upgrade(T* versioned)
{
return versioned;
}
template <typename S>
static void checkException(S status) { }
template <typename S>
static void catchException(S status) { }
typedef FirebirdApi<FirebirdPolicy>::Status* Status;
};
#endif // INCLUDE_Firebird_H
typedef FirebirdApi<FirebirdPolicy> Api;
//awk <FirebirdInterface.idl '($1 == "interface") {printf "\ttypedef Api::%s I%s;\n", $2, $2;}'
typedef Api::Versioned IVersioned;
typedef Api::ReferenceCounted IReferenceCounted;
typedef Api::Disposable IDisposable;
typedef Api::Status IStatus;
typedef Api::Master IMaster;
typedef Api::PluginBase IPluginBase;
typedef Api::PluginSet IPluginSet;
typedef Api::ConfigEntry IConfigEntry;
typedef Api::Config IConfig;
typedef Api::FirebirdConf IFirebirdConf;
typedef Api::PluginConfig IPluginConfig;
typedef Api::PluginFactory IPluginFactory;
typedef Api::PluginModule IPluginModule;
typedef Api::PluginManager IPluginManager;
typedef Api::ConfigManager IConfigManager;
typedef Api::EventCallback IEventCallback;
typedef Api::Blob IBlob;
typedef Api::Transaction ITransaction;
typedef Api::MessageMetadata IMessageMetadata;
typedef Api::MetadataBuilder IMetadataBuilder;
typedef Api::ResultSet IResultSet;
typedef Api::Statement IStatement;
typedef Api::Request IRequest;
typedef Api::Events IEvents;
typedef Api::Attachment IAttachment;
typedef Api::Service IService;
typedef Api::Provider IProvider;
typedef Api::Dtc IDtc;
typedef Api::Auth IAuth;
typedef Api::Writer IWriter;
typedef Api::ServerBlock IServerBlock;
typedef Api::ClientBlock IClientBlock;
typedef Api::Server IServer;
typedef Api::Client IClient;
typedef Api::UserField IUserField;
typedef Api::CharUserField ICharUserField;
typedef Api::IntUserField IIntUserField;
typedef Api::User IUser;
typedef Api::ListUsers IListUsers;
typedef Api::LogonInfo ILogonInfo;
typedef Api::Management IManagement;
typedef Api::WireCryptPlugin IWireCryptPlugin;
typedef Api::CryptKeyCallback ICryptKeyCallback;
typedef Api::KeyHolderPlugin IKeyHolderPlugin;
typedef Api::DbCryptPlugin IDbCryptPlugin;
typedef Api::ExternalContext IExternalContext;
typedef Api::ExternalResultSet IExternalResultSet;
typedef Api::ExternalFunction IExternalFunction;
typedef Api::ExternalProcedure IExternalProcedure;
typedef Api::ExternalTrigger IExternalTrigger;
typedef Api::RoutineMetadata IRoutineMetadata;
typedef Api::ExternalEngine IExternalEngine;
typedef Api::Timer ITimer;
typedef Api::TimerControl ITimerControl;
typedef Api::VersionCallback IVersionCallback;
typedef Api::Utl IUtl;
typedef Api::TraceConnection ITraceConnection;
typedef Api::TraceDatabaseConnection ITraceDatabaseConnection;
typedef Api::TraceTransaction ITraceTransaction;
typedef Api::TraceParams ITraceParams;
typedef Api::TraceStatement ITraceStatement;
typedef Api::TraceSQLStatement ITraceSQLStatement;
typedef Api::TraceBLRStatement ITraceBLRStatement;
typedef Api::TraceDYNRequest ITraceDYNRequest;
typedef Api::TraceContextVariable ITraceContextVariable;
typedef Api::TraceProcedure ITraceProcedure;
typedef Api::TraceFunction ITraceFunction;
typedef Api::TraceTrigger ITraceTrigger;
typedef Api::TraceServiceConnection ITraceServiceConnection;
typedef Api::TraceStatusVector ITraceStatusVector;
typedef Api::TraceSweepInfo ITraceSweepInfo;
typedef Api::TraceLogWriter ITraceLogWriter;
typedef Api::TraceInitInfo ITraceInitInfo;
typedef Api::TracePlugin ITracePlugin;
typedef Api::TraceFactory ITraceFactory;
struct FbCryptKey
{
const char* type; // If NULL type is auth plugin name
@ -242,27 +182,13 @@ struct DtcStart
};
typedef void PluginEntrypoint(IMaster* masterInterface);
typedef char Utf8; // Utf8* used as nul-terminated string
#ifdef INCLUDE_Firebird_H // Building internal module
// This item is for ISC API emulation only
// It may be gone in future versions
// Please do not use it!
static IMessageMetadata* const DELAYED_OUT_FORMAT = (IMessageMetadata*)(1);
namespace
{
template <>
void upgradeVersionedInterface<IMessageMetadata>(IMessageMetadata* versioned)
{
if (versioned && versioned != DELAYED_OUT_FORMAT &&
versioned->cloopVTable->version < FirebirdApi<FirebirdPolicy>::TracePlugin::VERSION)
{
upgradeInterface(versioned, FirebirdApi<FirebirdPolicy>::TracePlugin::VERSION, (void*)ignoreMissing);
}
}
}
static IMessageMetadata* const DELAYED_OUT_FORMAT = reinterpret_cast<IMessageMetadata*>(1);
#endif //INCLUDE_Firebird_H

View File

@ -455,7 +455,7 @@ public:
}
void getCharSet(IStatus* /*status*/, IExternalContext* /*context*/,
Utf8* /*name*/, unsigned /*nameSize*/)
char* /*name*/, unsigned /*nameSize*/)
{
}
};
@ -479,7 +479,7 @@ public:
}
void getCharSet(IStatus* /*status*/, IExternalContext* /*context*/,
Utf8* /*name*/, unsigned /*nameSize*/)
char* /*name*/, unsigned /*nameSize*/)
{
}
};
@ -502,7 +502,7 @@ public:
}
void getCharSet(IStatus* /*status*/, IExternalContext* /*context*/,
Utf8* /*name*/, unsigned /*nameSize*/)
char* /*name*/, unsigned /*nameSize*/)
{
}
};

View File

@ -801,6 +801,7 @@ static const struct {
{"crdb_load", 335545097},
{"crdb_nodb", 335545098},
{"crdb_notable", 335545099},
{"interface_version_too_old", 335545100},
{"gfix_db_name", 335740929},
{"gfix_invalid_sw", 335740930},
{"gfix_incmp_sw", 335740932},

View File

@ -835,6 +835,7 @@ const ISC_STATUS isc_read_conflict = 335545096L;
const ISC_STATUS isc_crdb_load = 335545097L;
const ISC_STATUS isc_crdb_nodb = 335545098L;
const ISC_STATUS isc_crdb_notable = 335545099L;
const ISC_STATUS isc_interface_version_too_old = 335545100L;
const ISC_STATUS isc_gfix_db_name = 335740929L;
const ISC_STATUS isc_gfix_invalid_sw = 335740930L;
const ISC_STATUS isc_gfix_incmp_sw = 335740932L;
@ -1293,7 +1294,7 @@ const ISC_STATUS isc_trace_switch_user_only = 337182757L;
const ISC_STATUS isc_trace_switch_param_miss = 337182758L;
const ISC_STATUS isc_trace_param_act_notcompat = 337182759L;
const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L;
const ISC_STATUS isc_err_max = 1237;
const ISC_STATUS isc_err_max = 1238;
#else /* c definitions */
@ -2098,6 +2099,7 @@ const ISC_STATUS isc_err_max = 1237;
#define isc_crdb_load 335545097L
#define isc_crdb_nodb 335545098L
#define isc_crdb_notable 335545099L
#define isc_interface_version_too_old 335545100L
#define isc_gfix_db_name 335740929L
#define isc_gfix_invalid_sw 335740930L
#define isc_gfix_incmp_sw 335740932L
@ -2556,7 +2558,7 @@ const ISC_STATUS isc_err_max = 1237;
#define isc_trace_switch_param_miss 337182758L
#define isc_trace_param_act_notcompat 337182759L
#define isc_trace_mandatory_switch_miss 337182760L
#define isc_err_max 1237
#define isc_err_max 1238
#endif

View File

@ -804,6 +804,7 @@ Data source : @4"}, /* eds_statement */
{335545097, "@1 failed when working with CREATE DATABASE grants"}, /* crdb_load */
{335545098, "CREATE DATABASE grants check is not possible when database @1 is not present"}, /* crdb_nodb */
{335545099, "CREATE DATABASE grants check is not possible when table RDB$DB_CREATORS is not present in database @1"}, /* crdb_notable */
{335545100, "Interface version too old: expected @1, found @2"}, /* interface_version_too_old */
{335740929, "data base file name (@1) already given"}, /* gfix_db_name */
{335740930, "invalid switch @1"}, /* gfix_invalid_sw */
{335740932, "incompatible switch combination"}, /* gfix_incmp_sw */

View File

@ -800,6 +800,7 @@ static const struct {
{335545097, -901}, /* 777 crdb_load */
{335545098, -901}, /* 778 crdb_nodb */
{335545099, -901}, /* 779 crdb_notable */
{335545100, -804}, /* 780 interface_version_too_old */
{335740929, -901}, /* 1 gfix_db_name */
{335740930, -901}, /* 2 gfix_invalid_sw */
{335740932, -901}, /* 4 gfix_incmp_sw */

View File

@ -800,6 +800,7 @@ static const struct {
{335545097, "08004"}, // 777 crdb_load
{335545098, "0A000"}, // 778 crdb_nodb
{335545099, "0A000"}, // 779 crdb_notable
{335545100, "HY000"}, // 780 interface_version_too_old
{335740929, "00000"}, // 1 gfix_db_name
{335740930, "00000"}, // 2 gfix_invalid_sw
{335740932, "00000"}, // 4 gfix_incmp_sw

View File

@ -1,6 +1,7 @@
#ifdef FB_COMPILING_WHY_CPP
#include "../dsql/sqlda_pub.h"
#include "../yvalve/why_proto.h"
#include "gen/iberror.h"
#else
#include "../jrd/ibase.h"
#endif

View File

@ -672,7 +672,7 @@ namespace Jrd {
{
IKeyHolderPlugin* keyPlugin = keyControl.plugin();
LocalStatus st;
if (keyPlugin->keyCallback(&st, att->att_crypt_callback) == 1)
if (keyPlugin->keyCallback(&st, att->att_crypt_callback) == 1) //// FIXME: 1 ???
{
// holder accepted attachment's key
HolderAttachments* ha = NULL;

View File

@ -532,7 +532,7 @@ private:
if (!obj)
return;
Utf8 charSetName[MAX_SQL_IDENTIFIER_SIZE];
char charSetName[MAX_SQL_IDENTIFIER_SIZE];
{ // scope
Attachment::Checkout attCout(attachment, FB_FUNCTION);
@ -660,7 +660,7 @@ const char* ExtEngineManager::ExternalContextImpl::getDatabaseName()
return internalAttachment->att_database->dbb_database_name.c_str();
}
const Utf8* ExtEngineManager::ExternalContextImpl::getClientCharSet()
const char* ExtEngineManager::ExternalContextImpl::getClientCharSet()
{
return clientCharSet.c_str();
}
@ -1470,7 +1470,7 @@ void ExtEngineManager::setupAdminCharSet(thread_db* tdbb, IExternalEngine* engin
{
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, CS_UTF8);
Utf8 charSetName[MAX_SQL_IDENTIFIER_SIZE] = "NONE";
char charSetName[MAX_SQL_IDENTIFIER_SIZE] = "NONE";
LocalStatus status;
engine->open(&status, attInfo->context, charSetName, MAX_SQL_IDENTIFIER_LEN);

View File

@ -160,7 +160,7 @@ private:
Firebird::ITransaction* getTransaction(Firebird::IStatus* status);
const char* getUserName();
const char* getDatabaseName();
const Firebird::Utf8* getClientCharSet();
const char* getClientCharSet();
int obtainInfoCode();
void* getInfo(int code);
void* setInfo(int code, void* value);

View File

@ -1,7 +1,7 @@
/* MAX_NUMBER is the next number to be used, always one more than the highest message number. */
set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?);
--
('2014-09-02 19:54:57', 'JRD', 0, 780)
('2014-11-06 12:17:00', 'JRD', 0, 781)
('2012-01-23 20:10:30', 'QLI', 1, 532)
('2014-09-25 19:47:00', 'GFIX', 3, 131)
('1996-11-07 13:39:40', 'GPRE', 4, 1)

View File

@ -887,6 +887,7 @@ Data source : @4', NULL, NULL)
('crdb_load', 'check', 'DbCreators.cpp', NULL, 0, 777, NULL, '@1 failed when working with CREATE DATABASE grants', NULL, NULL);
('crdb_nodb', 'DbCreatorsList::getList', 'DbCreators.cpp', NULL, 0, 778, NULL, 'CREATE DATABASE grants check is not possible when database @1 is not present', NULL, NULL);
('crdb_notable', 'DbCreatorsList::getList', 'DbCreators.cpp', NULL, 0, 779, NULL, 'CREATE DATABASE grants check is not possible when table RDB$DB_CREATORS is not present in database @1', NULL, NULL);
('interface_version_too_old', NULL, 'Interface.h', NULL, 0, 780, NULL, 'Interface version too old: expected @1, found @2', NULL, NULL);
-- QLI
(NULL, NULL, NULL, NULL, 1, 0, NULL, 'expected type', NULL, NULL);
(NULL, NULL, NULL, NULL, 1, 1, NULL, 'bad block type', NULL, NULL);

View File

@ -786,6 +786,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
(-901, '08', '004', 0, 777, 'crdb_load', NULL, NULL);
(-901, '0A', '000', 0, 778, 'crdb_nodb', NULL, NULL);
(-901, '0A', '000', 0, 779, 'crdb_notable', NULL, NULL);
(-804, 'HY', '000', 0, 780, 'interface_version_too_old', NULL, NULL)
-- GFIX
(-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL)
(-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)

View File

@ -147,7 +147,7 @@ private:
const string& entryPoint);
public:
void open(IStatus* status, IExternalContext* context, Utf8* name, unsigned nameSize);
void open(IStatus* status, IExternalContext* context, char* name, unsigned nameSize);
void openAttachment(IStatus* status, IExternalContext* context);
void closeAttachment(IStatus* status, IExternalContext* context);
IExternalFunction* makeFunction(IStatus* status, IExternalContext* context,
@ -229,7 +229,7 @@ public:
public:
void getCharSet(IStatus* status, IExternalContext* context,
Utf8* name, unsigned nameSize)
char* name, unsigned nameSize)
{
strncpy(name, context->getClientCharSet(), nameSize);
@ -299,7 +299,7 @@ public:
public:
void getCharSet(IStatus* status, IExternalContext* context,
Utf8* name, unsigned nameSize)
char* name, unsigned nameSize)
{
strncpy(name, context->getClientCharSet(), nameSize);
@ -375,7 +375,7 @@ public:
public:
void getCharSet(IStatus* status, IExternalContext* context,
Utf8* name, unsigned nameSize)
char* name, unsigned nameSize)
{
strncpy(name, context->getClientCharSet(), nameSize);
@ -619,7 +619,7 @@ template <typename T, typename T2> T2* Engine::getNode(IStatus* status, T* nodes
}
void Engine::open(IStatus* /*status*/, IExternalContext* /*context*/, Utf8* name, unsigned nameSize)
void Engine::open(IStatus* /*status*/, IExternalContext* /*context*/, char* name, unsigned nameSize)
{
strncpy(name, "UTF-8", nameSize);
}

View File

@ -102,135 +102,6 @@ IPluginManager* MasterImplementation::getPluginManager()
return &manager;
}
//
// upgradeInterface()
//
namespace
{
class UpgradeKey
{
public:
UpgradeKey(IVersioned::VTable* aTbl, IPluginModule* aModuleA, IPluginModule* aModuleB)
: vt(aTbl), moduleA(aModuleA), moduleB(aModuleB)
{ }
UpgradeKey(const UpgradeKey& el)
: vt(el.vt), moduleA(el.moduleA), moduleB(el.moduleB)
{ }
UpgradeKey()
: vt(NULL), moduleA(NULL), moduleB(NULL)
{ }
bool operator<(const UpgradeKey& el) const
{
return memcmp(this, &el, sizeof(UpgradeKey)) < 0;
}
bool operator>(const UpgradeKey& el) const
{
return memcmp(this, &el, sizeof(UpgradeKey)) > 0;
}
bool contains(IPluginModule* module)
{
return moduleA == module || moduleB == module;
}
private:
IVersioned::VTable* vt;
IPluginModule* moduleA;
IPluginModule* moduleB;
};
typedef Firebird::Pair<Firebird::NonPooled<UpgradeKey, IVersioned::VTable*> > FunctionPair;
GlobalPtr<GenericMap<FunctionPair> > functionMap;
GlobalPtr<RWLock> mapLock;
}
int MasterImplementation::upgradeInterface(IVersioned* toUpgrade,
int desiredVersion, IPluginModule* clientModule, void* function)
{
if (!toUpgrade)
return 0;
IVersioned::VTable* vt = toUpgrade->cloopVTable;
int existingVersion = vt->version;
if (existingVersion >= desiredVersion)
return 0;
IVersioned::VTable* newTab = NULL;
try
{
UpgradeKey key(vt, toUpgrade->getModule(), clientModule);
{ // sync scope
ReadLockGuard sync(mapLock, FB_FUNCTION);
if (functionMap->get(key, newTab))
{
toUpgrade->cloopVTable = newTab;
return 0;
}
}
WriteLockGuard sync(mapLock, FB_FUNCTION);
if (!functionMap->get(key, newTab))
{
newTab = (IVersioned::VTable*) FB_NEW(*getDefaultMemoryPool()) char[(desiredVersion + 2) * sizeof(vt->cloopDummy[0])];
for (int i = 0; i < desiredVersion; ++i)
{
newTab->cloopDummy[i + 2] = i < existingVersion ? vt->cloopDummy[i + 2] : function;
}
newTab->version = desiredVersion;
functionMap->put(key, newTab);
}
toUpgrade->cloopVTable = newTab;
}
catch (const Exception& ex)
{
ISC_STATUS_ARRAY s;
ex.stuff_exception(s);
iscLogStatus("upgradeInterface", s);
if (newTab)
{
delete[] newTab;
}
return -1;
}
return 0;
}
void releaseUpgradeTabs(IPluginModule* module)
{
HalfStaticArray<UpgradeKey, 16> removeList;
WriteLockGuard sync(mapLock, FB_FUNCTION);
GenericMap<FunctionPair>::Accessor scan(&functionMap);
if (scan.getFirst())
{
do
{
UpgradeKey& cur(scan.current()->first);
if (cur.contains(module))
removeList.add(cur);
} while (scan.getNext());
}
for(unsigned int i = 0; i < removeList.getCount(); ++i)
functionMap->remove(removeList[i]);
}
int MasterImplementation::same(IVersioned* first, IVersioned* second)
{
return first->cloopVTable == second->cloopVTable ? 1 : 0;

View File

@ -61,8 +61,6 @@ namespace Why
Firebird::IStatus* getStatus();
Firebird::IProvider* getDispatcher();
Firebird::IPluginManager* getPluginManager();
int upgradeInterface(Firebird::IVersioned* toUpgrade, int desiredVersion,
Firebird::IPluginModule* destModule, void* function);
const char* circularAlloc(const char* s, unsigned len, intptr_t thr);
Firebird::ITimerControl* getTimerControl();
Firebird::IAttachment* registerAttachment(Firebird::IProvider* provider,
@ -79,7 +77,6 @@ namespace Why
};
void shutdownTimers();
void releaseUpgradeTabs(Firebird::IPluginModule* module);
Firebird::Mutex& pauseTimer();
} // namespace Why

View File

@ -408,7 +408,6 @@ namespace
MutexLockGuard timerPause(Why::pauseTimer(), FB_FUNCTION);
cleanup->doClean();
Why::releaseUpgradeTabs(cleanup);
}
}
@ -812,10 +811,8 @@ namespace
void next(IStatus* status);
PluginSet(unsigned int pinterfaceType, const char* pnamesList,
int pdesiredVersion, IPluginModule* pdestModule,
IFirebirdConf* fbConf)
: interfaceType(pinterfaceType), namesList(getPool()),
desiredVersion(pdesiredVersion), destModule(pdestModule),
currentName(getPool()), currentPlugin(NULL),
firebirdConf(fbConf)
{
@ -840,8 +837,6 @@ namespace
private:
unsigned int interfaceType;
PathName namesList;
int desiredVersion;
IPluginModule* destModule;
PathName currentName;
RefPtr<ConfiguredPlugin> currentPlugin; // Missing data in this field indicates EOF
@ -969,14 +964,7 @@ namespace
{
IPluginBase* p = currentPlugin->factory(firebirdConf);
if (p)
{
if (masterInterface->upgradeInterface(p, desiredVersion, destModule, (void*) upFunction) >= 0)
{
return p;
}
PluginManagerInterfacePtr()->releasePlugin(p);
}
return p;
next(status);
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
@ -1076,9 +1064,8 @@ void PluginManager::unregisterModule(IPluginModule* cleanup)
fb_shutdown(5000, fb_shutrsn_exit_called);
}
IPluginSet* PluginManager::getPlugins(IStatus* status, unsigned int interfaceType, const char* namesList,
int desiredVersion, IPluginModule* destModule,
IFirebirdConf* firebirdConf)
IPluginSet* PluginManager::getPlugins(IStatus* status, unsigned int interfaceType,
const char* namesList, IFirebirdConf* firebirdConf)
{
try
{
@ -1087,7 +1074,7 @@ IPluginSet* PluginManager::getPlugins(IStatus* status, unsigned int interfaceTyp
MutexLockGuard g(plugins->mutex, FB_FUNCTION);
IPluginSet* rc = new PluginSet(interfaceType, namesList, desiredVersion, destModule, firebirdConf);
IPluginSet* rc = new PluginSet(interfaceType, namesList, firebirdConf);
rc->addRef();
return rc;
}

View File

@ -42,8 +42,7 @@ class PluginManager : public AutoIface<Api::PluginManagerImpl<PluginManager> >
public:
// IPluginManager implementation
IPluginSet* getPlugins(IStatus* status, unsigned int interfaceType,
const char* namesList, int desiredVersion, IPluginModule* destModule,
IFirebirdConf* firebirdConf);
const char* namesList, IFirebirdConf* firebirdConf);
void registerPluginFactory(unsigned int interfaceType, const char* defaultName,
IPluginFactory* factory);
IConfig* getConfig(IStatus* status, const char* filename);