mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 23:23:02 +01:00
Merge pull request #274 from aafemt/postfix_622
Fix issues spotted by Vlad Khorsun in PR#266
This commit is contained in:
commit
1b92598ce2
@ -45,9 +45,9 @@ New items for isc_database_info
|
||||
isc_dpb_addr_flag_conn_encrypted - connection is encrypted;
|
||||
fb_info_wire_crypt - name of connection encryption plugin.
|
||||
|
||||
6. fb_info_provider_features:
|
||||
6. fb_info_features:
|
||||
return list of features supported by current connection's provider.
|
||||
Each byte in returned array shall be one of following info_provider_features:
|
||||
Each byte in returned array shall be one of following info_features:
|
||||
|
||||
fb_feature_multi_statements - multiple prepared statements in single attachment
|
||||
fb_feature_multi_transactions - multiple concurrent transactions in single attachment
|
||||
@ -55,6 +55,7 @@ New items for isc_database_info
|
||||
fb_feature_session_reset - ALTER SESSION RESET is supported
|
||||
fb_feature_read_consistency - read consistency TIL is supported
|
||||
fb_feature_statement_timeout - statement timeout is supported
|
||||
fb_feature_statement_long_life - prepared statements are not dropped on transaction end
|
||||
|
||||
|
||||
New items for isc_transaction_info:
|
||||
|
@ -163,7 +163,7 @@ enum db_info_types
|
||||
fb_info_wire_crypt = 140,
|
||||
|
||||
// Return list of features supported by provider of current connection
|
||||
fb_info_provider_features = 141,
|
||||
fb_info_features = 141,
|
||||
|
||||
isc_info_db_last_value /* Leave this LAST! */
|
||||
};
|
||||
@ -174,7 +174,7 @@ enum db_info_crypt /* flags set in fb_info_crypt_state */
|
||||
fb_info_crypt_process = 0x02
|
||||
};
|
||||
|
||||
enum info_provider_features // response to fb_info_provider_features
|
||||
enum info_features // response to fb_info_features
|
||||
{
|
||||
fb_feature_multi_statements = 1, // Multiple prepared statements in single attachment
|
||||
fb_feature_multi_transactions = 2, // Multiple concurrent transaction in single attachment
|
||||
@ -182,7 +182,7 @@ enum info_provider_features // response to fb_info_provider_features
|
||||
fb_feature_session_reset = 4, // ALTER SESSION RESET is supported
|
||||
fb_feature_read_consistency = 5, // Read consistency TIL is supported
|
||||
fb_feature_statement_timeout = 6, // Statement timeout is supported
|
||||
fb_feature_statement_long_life = 7, // Prepared statement can survive transaction end
|
||||
fb_feature_statement_long_life = 7, // Prepared statements are not dropped on transaction end
|
||||
|
||||
info_provider_features_max // Not really a feature. Keep this last.
|
||||
};
|
||||
|
@ -492,11 +492,11 @@ public:
|
||||
virtual Blob* createBlob() = 0;
|
||||
|
||||
// Test specified feature flag
|
||||
bool testFeature(info_provider_features value) const { return m_features[value]; }
|
||||
bool testFeature(info_features value) const { return m_features[value]; }
|
||||
// Set specified flag
|
||||
void setFeature(info_provider_features value) { m_features[value] = true; }
|
||||
void setFeature(info_features value) { m_features[value] = true; }
|
||||
// Clear specified flag
|
||||
void clearFeature(info_provider_features value) { m_features[value] = false; }
|
||||
void clearFeature(info_features value) { m_features[value] = false; }
|
||||
|
||||
protected:
|
||||
virtual Transaction* doCreateTransaction() = 0;
|
||||
|
@ -189,8 +189,8 @@ void InternalConnection::attach(thread_db* tdbb)
|
||||
SQL_DIALECT_V6 : SQL_DIALECT_V5;
|
||||
|
||||
memset(m_features, false, sizeof(m_features));
|
||||
static const info_provider_features features[] = ENGINE_FEATURES;
|
||||
for (int i = 0; i < sizeof(features); i++)
|
||||
static const info_features features[] = ENGINE_FEATURES;
|
||||
for (int i = 0; i < FB_NELEM(features); i++)
|
||||
setFeature(features[i]);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ void IscConnection::attach(thread_db* tdbb)
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
|
||||
const unsigned char info[] = {isc_info_db_sql_dialect, fb_info_provider_features, isc_info_end};
|
||||
const unsigned char info[] = {isc_info_db_sql_dialect, fb_info_features, isc_info_end};
|
||||
m_iscProvider.isc_database_info(&status, &m_handle, sizeof(info), info, sizeof(buff), buff);
|
||||
}
|
||||
if (status->getState() & IStatus::STATE_ERRORS) {
|
||||
@ -171,7 +171,7 @@ void IscConnection::attach(thread_db* tdbb)
|
||||
m_sqlDialect = m_iscProvider.isc_vax_integer(p, len);
|
||||
break;
|
||||
|
||||
case fb_info_provider_features:
|
||||
case fb_info_features:
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (p[i] == 0)
|
||||
@ -181,7 +181,7 @@ void IscConnection::attach(thread_db* tdbb)
|
||||
|
||||
if (p[i] < info_provider_features_max)
|
||||
{
|
||||
setFeature(static_cast<info_provider_features>(p[i]));
|
||||
setFeature(static_cast<info_features>(p[i]));
|
||||
}
|
||||
// else this provider supports unknown feature, ignore it.
|
||||
}
|
||||
@ -192,7 +192,7 @@ void IscConnection::attach(thread_db* tdbb)
|
||||
const ULONG err = m_iscProvider.isc_vax_integer(p + 1, len - 1);
|
||||
if (err == isc_infunk)
|
||||
{
|
||||
if (*p == fb_info_provider_features)
|
||||
if (*p == fb_info_features)
|
||||
{
|
||||
// Used provider follow Firebird error reporting conventions but is not aware of
|
||||
// this info item. Assume Firebird 3 or earlier.
|
||||
|
@ -227,7 +227,7 @@ void INF_database_info(thread_db* tdbb,
|
||||
CHECK_INPUT("INF_database_info");
|
||||
|
||||
CountsBuffer counts_buffer;
|
||||
UCHAR* buffer = counts_buffer.getBuffer(BUFFER_SMALL);
|
||||
UCHAR* buffer = counts_buffer.getBuffer(BUFFER_SMALL, false);
|
||||
USHORT length;
|
||||
ULONG err_val;
|
||||
bool header_refreshed = false;
|
||||
@ -458,31 +458,24 @@ void INF_database_info(thread_db* tdbb,
|
||||
|
||||
case isc_info_db_id:
|
||||
{
|
||||
counts_buffer.resize(BUFFER_SMALL);
|
||||
const UCHAR* const end_buf = counts_buffer.end();
|
||||
// May be simpler to code using a server-side version of isql's Extender class.
|
||||
counts_buffer.clear();
|
||||
|
||||
const PathName& str_fn = dbb->dbb_database_name;
|
||||
STUFF(p, 2);
|
||||
USHORT len = str_fn.length();
|
||||
if (p + len + 1 >= end_buf)
|
||||
len = end_buf - p - 1;
|
||||
counts_buffer.push(2);
|
||||
PathName::size_type len = str_fn.length();
|
||||
if (len > 255)
|
||||
len = 255; // Cannot put more in one byte, will truncate instead.
|
||||
*p++ = len;
|
||||
memcpy(p, str_fn.c_str(), len);
|
||||
p += len;
|
||||
if (p + 2 < end_buf)
|
||||
{
|
||||
SCHAR site[256];
|
||||
ISC_get_host(site, sizeof(site));
|
||||
len = static_cast<USHORT>(strlen(site));
|
||||
if (p + len + 1 >= end_buf)
|
||||
len = end_buf - p - 1;
|
||||
*p++ = len;
|
||||
memcpy(p, site, len);
|
||||
p += len;
|
||||
}
|
||||
length = p - buffer;
|
||||
counts_buffer.push(static_cast<UCHAR>(len));
|
||||
counts_buffer.push(reinterpret_cast<const UCHAR*>(str_fn.c_str()), len);
|
||||
|
||||
TEXT site[256];
|
||||
ISC_get_host(site, sizeof(site));
|
||||
UCHAR siteLen = static_cast<UCHAR>(strlen(site));
|
||||
counts_buffer.push(siteLen);
|
||||
counts_buffer.push(reinterpret_cast<UCHAR*>(site), siteLen);
|
||||
|
||||
buffer = counts_buffer.begin();
|
||||
length = counts_buffer.getCount();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -855,11 +848,12 @@ void INF_database_info(thread_db* tdbb,
|
||||
length = INF_convert(att->getActualIdleTimeout(), buffer);
|
||||
break;
|
||||
|
||||
case fb_info_provider_features:
|
||||
case fb_info_features:
|
||||
{
|
||||
static const unsigned char features[] = ENGINE_FEATURES;
|
||||
length = sizeof(features);
|
||||
memcpy(buffer, features, length);
|
||||
counts_buffer.assign(features, length);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user