8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00

Make ALTER SESSION RESET throws isc_ses_reset_err when active transaction(s) present in current connection.

New error code created: isc_ses_reset_err.
This commit is contained in:
hvlad 2018-06-01 14:17:26 +03:00
parent a793d56375
commit bbf8348817
11 changed files with 25 additions and 3 deletions

View File

@ -1822,6 +1822,8 @@ C --
PARAMETER (GDS__db_crypt_key = 335545204)
INTEGER*4 GDS__no_keyholder_plugin
PARAMETER (GDS__no_keyholder_plugin = 335545205)
INTEGER*4 GDS__ses_reset_err
PARAMETER (GDS__ses_reset_err = 335545206)
INTEGER*4 GDS__gfix_db_name
PARAMETER (GDS__gfix_db_name = 335740929)
INTEGER*4 GDS__gfix_invalid_sw

View File

@ -1817,6 +1817,8 @@ const
gds_db_crypt_key = 335545204;
isc_no_keyholder_plugin = 335545205;
gds_no_keyholder_plugin = 335545205;
isc_ses_reset_err = 335545206;
gds_ses_reset_err = 335545206;
isc_gfix_db_name = 335740929;
gds_gfix_db_name = 335740929;
isc_gfix_invalid_sw = 335740930;

View File

@ -907,6 +907,7 @@ static const struct {
{"vld_plugins", 335545203},
{"db_crypt_key", 335545204},
{"no_keyholder_plugin", 335545205},
{"ses_reset_err", 335545206},
{"gfix_db_name", 335740929},
{"gfix_invalid_sw", 335740930},
{"gfix_incmp_sw", 335740932},

View File

@ -941,6 +941,7 @@ const ISC_STATUS isc_hdr_overflow = 335545202L;
const ISC_STATUS isc_vld_plugins = 335545203L;
const ISC_STATUS isc_db_crypt_key = 335545204L;
const ISC_STATUS isc_no_keyholder_plugin = 335545205L;
const ISC_STATUS isc_ses_reset_err = 335545206L;
const ISC_STATUS isc_gfix_db_name = 335740929L;
const ISC_STATUS isc_gfix_invalid_sw = 335740930L;
const ISC_STATUS isc_gfix_incmp_sw = 335740932L;
@ -1415,7 +1416,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 = 1359;
const ISC_STATUS isc_err_max = 1360;
#else /* c definitions */
@ -2326,6 +2327,7 @@ const ISC_STATUS isc_err_max = 1359;
#define isc_vld_plugins 335545203L
#define isc_db_crypt_key 335545204L
#define isc_no_keyholder_plugin 335545205L
#define isc_ses_reset_err 335545206L
#define isc_gfix_db_name 335740929L
#define isc_gfix_invalid_sw 335740930L
#define isc_gfix_incmp_sw 335740932L
@ -2800,7 +2802,7 @@ const ISC_STATUS isc_err_max = 1359;
#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 1359
#define isc_err_max 1360
#endif

View File

@ -910,6 +910,7 @@ Data source : @4"}, /* eds_statement */
{335545203, "No matching client/server authentication plugins configured for execute statement in embedded datasource"}, /* vld_plugins */
{335545204, "Missing database encryption key for your attachment"}, /* db_crypt_key */
{335545205, "Key holder plugin @1 failed to load"}, /* no_keyholder_plugin */
{335545206, "Cannot reset user session with open transactions (@1 active)"}, /* ses_reset_err */
{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

@ -906,6 +906,7 @@ static const struct {
{335545203, -901}, /* 883 vld_plugins */
{335545204, -902}, /* 884 db_crypt_key */
{335545205, -104}, /* 885 no_keyholder_plugin */
{335545206, -901}, /* 886 ses_reset_err */
{335740929, -901}, /* 1 gfix_db_name */
{335740930, -901}, /* 2 gfix_invalid_sw */
{335740932, -901}, /* 4 gfix_incmp_sw */

View File

@ -906,6 +906,7 @@ static const struct {
{335545203, "28000"}, // 883 vld_plugins
{335545204, "08004"}, // 884 db_crypt_key
{335545205, "HY024"}, // 885 no_keyholder_plugin
{335545206, "01002"}, // 886 ses_reset_err
{335740929, "00000"}, // 1 gfix_db_name
{335740930, "00000"}, // 2 gfix_invalid_sw
{335740932, "00000"}, // 4 gfix_incmp_sw

View File

@ -383,6 +383,16 @@ void Jrd::Attachment::releaseGTTs(thread_db* tdbb)
void Jrd::Attachment::resetSession(thread_db* tdbb)
{
if (att_transactions)
{
int n = 0;
for (const jrd_tra* tra = att_transactions; tra; tra = tra->tra_next)
n++;
// Cannot reset user session with open transactions (@1 active)
ERR_post(Arg::Gds(isc_ses_reset_err) << Arg::Num(n));
}
// reset DecFloat
att_dec_status = DecimalStatus::DEFAULT;
att_dec_binding = DecimalBinding::DEFAULT;

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 (?, ?, ?, ?);
--
('2018-05-05 16:40:00', 'JRD', 0, 886)
('2018-06-01 11:50:00', 'JRD', 0, 887)
('2015-03-17 18:33:00', 'QLI', 1, 533)
('2015-01-07 18:01:51', 'GFIX', 3, 134)
('1996-11-07 13:39:40', 'GPRE', 4, 1)

View File

@ -993,6 +993,7 @@ Data source : @4', NULL, NULL)
('vld_plugins', NULL, 'ValidatePassword.cpp', NULL, 0, 883, NULL, 'No matching client/server authentication plugins configured for execute statement in embedded datasource', NULL, NULL);
('db_crypt_key', NULL, 'CryptoManager.cpp', NULL, 0, 884, NULL, 'Missing database encryption key for your attachment', NULL, NULL);
('no_keyholder_plugin', NULL, 'mvol.cpp', NULL, 0, 885, NULL, 'Key holder plugin @1 failed to load', NULL, NULL);
('ses_reset_err', NULL, 'Attachment.cpp', NULL, 0, 886, NULL, 'Cannot reset user session with open transactions (@1 active)', 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

@ -892,6 +892,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
(-901, '28', '000', 0, 883, 'vld_plugins', NULL, NULL)
(-902, '08', '004', 0, 884, 'db_crypt_key', NULL, NULL)
(-104, 'HY', '024', 0, 885, 'no_keyholder_plugin', NULL, NULL)
(-901, '01', '002', 0, 886, 'ses_reset_err', 2, 'ERROR')
-- GFIX
(-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL)
(-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)