mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:40:38 +01:00
Implemented #6954: fb_info_protocol_version support
This commit is contained in:
parent
5d99498645
commit
18d59a5e79
@ -251,6 +251,7 @@ static const UCHAR db_items[] =
|
|||||||
isc_info_db_id,
|
isc_info_db_id,
|
||||||
#endif
|
#endif
|
||||||
fb_info_crypt_state,
|
fb_info_crypt_state,
|
||||||
|
fb_info_protocol_version,
|
||||||
fb_info_wire_crypt,
|
fb_info_wire_crypt,
|
||||||
isc_info_end
|
isc_info_end
|
||||||
};
|
};
|
||||||
@ -560,6 +561,14 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle,
|
|||||||
sprintf (info, "Wire crypt plugin: %.*s%s", length, d, separator);
|
sprintf (info, "Wire crypt plugin: %.*s%s", length, d, separator);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case fb_info_protocol_version:
|
||||||
|
value_out = ISQL_vax_integer(d, length);
|
||||||
|
if (value_out)
|
||||||
|
sprintf(info, "Protocol version = %" SQUADFORMAT"%s", value_out, separator);
|
||||||
|
else
|
||||||
|
sprintf(info, "Embedded connection%s", separator);
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
case isc_info_db_id:
|
case isc_info_db_id:
|
||||||
{
|
{
|
||||||
@ -3536,7 +3545,7 @@ static void show_db()
|
|||||||
return;
|
return;
|
||||||
END_ERROR;
|
END_ERROR;
|
||||||
|
|
||||||
SCHAR info_buf[BUFFER_LENGTH400];
|
SCHAR info_buf[BUFFER_LENGTH512];
|
||||||
|
|
||||||
// First general database parameters
|
// First general database parameters
|
||||||
|
|
||||||
|
@ -890,6 +890,10 @@ void INF_database_info(thread_db* tdbb,
|
|||||||
length = INF_convert(att->getActualIdleTimeout(), buffer);
|
length = INF_convert(att->getActualIdleTimeout(), buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case fb_info_protocol_version:
|
||||||
|
length = INF_convert(0, buffer);
|
||||||
|
break;
|
||||||
|
|
||||||
case fb_info_features:
|
case fb_info_features:
|
||||||
{
|
{
|
||||||
static const unsigned char features[] = ENGINE_FEATURES;
|
static const unsigned char features[] = ENGINE_FEATURES;
|
||||||
|
@ -1888,7 +1888,11 @@ void Attachment::getInfo(CheckStatusWrapper* status,
|
|||||||
HalfStaticArray<UCHAR, 1024> temp;
|
HalfStaticArray<UCHAR, 1024> temp;
|
||||||
|
|
||||||
CHECK_HANDLE(rdb, isc_bad_db_handle);
|
CHECK_HANDLE(rdb, isc_bad_db_handle);
|
||||||
|
|
||||||
rem_port* port = rdb->rdb_port;
|
rem_port* port = rdb->rdb_port;
|
||||||
|
USHORT protocol = memchr(items, fb_info_protocol_version, item_length) ? port->port_protocol : 0;
|
||||||
|
protocol &= FB_PROTOCOL_MASK;
|
||||||
|
|
||||||
RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION);
|
RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION);
|
||||||
|
|
||||||
UCHAR* temp_buffer = temp.getBuffer(buffer_length);
|
UCHAR* temp_buffer = temp.getBuffer(buffer_length);
|
||||||
@ -1902,7 +1906,8 @@ void Attachment::getInfo(CheckStatusWrapper* status,
|
|||||||
MERGE_database_info(temp_buffer, buffer, buffer_length,
|
MERGE_database_info(temp_buffer, buffer, buffer_length,
|
||||||
DbImplementation::current.backwardCompatibleImplementation(), 3, 1,
|
DbImplementation::current.backwardCompatibleImplementation(), 3, 1,
|
||||||
reinterpret_cast<const UCHAR*>(version.c_str()),
|
reinterpret_cast<const UCHAR*>(version.c_str()),
|
||||||
reinterpret_cast<const UCHAR*>(port->port_host->str_data));
|
reinterpret_cast<const UCHAR*>(port->port_host->str_data),
|
||||||
|
protocol);
|
||||||
}
|
}
|
||||||
catch (const Exception& ex)
|
catch (const Exception& ex)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,8 @@ USHORT MERGE_database_info(const UCHAR* const in,
|
|||||||
USHORT class_,
|
USHORT class_,
|
||||||
USHORT base_level,
|
USHORT base_level,
|
||||||
const UCHAR* version,
|
const UCHAR* version,
|
||||||
const UCHAR* id)
|
const UCHAR* id,
|
||||||
|
USHORT protocol)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -98,6 +99,23 @@ USHORT MERGE_database_info(const UCHAR* const in,
|
|||||||
switch (input.getClumpTag())
|
switch (input.getClumpTag())
|
||||||
{
|
{
|
||||||
case isc_info_end:
|
case isc_info_end:
|
||||||
|
if (protocol)
|
||||||
|
{
|
||||||
|
--out;
|
||||||
|
if (out + (1 + 2 + 2 + 1) <= end)
|
||||||
|
{
|
||||||
|
PUT(out, (UCHAR)fb_info_protocol_version);
|
||||||
|
PUT_WORD(out, 2u);
|
||||||
|
PUT_WORD(out, protocol);
|
||||||
|
protocol = 0;
|
||||||
|
|
||||||
|
PUT(out, (UCHAR)isc_info_end);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PUT(out, (UCHAR)isc_info_truncated);
|
||||||
|
}
|
||||||
|
// fall down...
|
||||||
|
|
||||||
case isc_info_truncated:
|
case isc_info_truncated:
|
||||||
return out - start;
|
return out - start;
|
||||||
|
|
||||||
@ -142,6 +160,10 @@ USHORT MERGE_database_info(const UCHAR* const in,
|
|||||||
PUT(out, (UCHAR) base_level);
|
PUT(out, (UCHAR) base_level);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case fb_info_protocol_version:
|
||||||
|
--out;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
USHORT length = input.getClumpLength();
|
USHORT length = input.getClumpLength();
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#define REMOTE_MERGE_PROTO_H
|
#define REMOTE_MERGE_PROTO_H
|
||||||
|
|
||||||
USHORT MERGE_database_info(const UCHAR*, UCHAR*, USHORT, USHORT,
|
USHORT MERGE_database_info(const UCHAR*, UCHAR*, USHORT, USHORT,
|
||||||
USHORT, USHORT, const UCHAR*, const UCHAR*); //, ULONG);
|
USHORT, USHORT, const UCHAR*, const UCHAR*, USHORT);
|
||||||
|
|
||||||
#endif // REMOTE_MERGE_PROTO_H
|
#endif // REMOTE_MERGE_PROTO_H
|
||||||
|
|
||||||
|
@ -4391,11 +4391,14 @@ void rem_port::info(P_OP op, P_INFO* stuff, PACKET* sendL)
|
|||||||
{
|
{
|
||||||
string version;
|
string version;
|
||||||
versionInfo(version);
|
versionInfo(version);
|
||||||
|
USHORT protocol = memchr(stuff->p_info_items.cstr_address, fb_info_protocol_version,
|
||||||
|
stuff->p_info_items.cstr_length) ? port_protocol & FB_PROTOCOL_MASK : 0;
|
||||||
info_db_len = MERGE_database_info(temp_buffer, //temp
|
info_db_len = MERGE_database_info(temp_buffer, //temp
|
||||||
buffer, buffer_length,
|
buffer, buffer_length,
|
||||||
DbImplementation::current.backwardCompatibleImplementation(), 4, 1,
|
DbImplementation::current.backwardCompatibleImplementation(), 4, 1,
|
||||||
reinterpret_cast<const UCHAR*>(version.c_str()),
|
reinterpret_cast<const UCHAR*>(version.c_str()),
|
||||||
reinterpret_cast<const UCHAR*>(this->port_host->str_data));
|
reinterpret_cast<const UCHAR*>(this->port_host->str_data),
|
||||||
|
protocol);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user