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

Make diagnostics about wrong array subscript a bit better

This commit is contained in:
alexpeshkoff 2011-08-02 09:26:49 +00:00
parent 34628ca2f3
commit 417b13b2a2
11 changed files with 18 additions and 5 deletions

View File

@ -1466,6 +1466,8 @@ C --
PARAMETER (GDS__ee_blr_mismatch_null = 335545026)
INTEGER*4 GDS__ee_blr_mismatch_length
PARAMETER (GDS__ee_blr_mismatch_length = 335545027)
INTEGER*4 GDS__ss_out_of_bounds
PARAMETER (GDS__ss_out_of_bounds = 335545028)
INTEGER*4 GDS__gfix_db_name
PARAMETER (GDS__gfix_db_name = 335740929)
INTEGER*4 GDS__gfix_invalid_sw

View File

@ -740,6 +740,7 @@ const
gds_spb_no_id = 335545025;
gds_ee_blr_mismatch_null = 335545026;
gds_ee_blr_mismatch_length = 335545027;
gds_ss_out_of_bounds = 335545028;
gds_gfix_db_name = 335740929;
gds_gfix_invalid_sw = 335740930;
gds_gfix_incmp_sw = 335740932;

View File

@ -148,7 +148,8 @@ SLONG SDL_compute_subscript(ISC_STATUS* status_vector,
const SLONG n = *subscripts++;
if (n < range->iad_lower || n > range->iad_upper)
{
error(status_vector, Arg::Gds(isc_out_of_bounds));
error(status_vector, Arg::Gds(isc_ss_out_of_bounds) <<
Arg::Num(n) << Arg::Num(range->iad_lower) << Arg::Num(range->iad_upper));
return -1;
}
subscript += (n - range->iad_lower) * range->iad_length;
@ -666,7 +667,8 @@ static bool execute(sdl_arg* arg)
const SLONG n = *stack_ptr++;
if (n < range->iad_lower || n > range->iad_upper)
{
error(arg->sdl_arg_status_vector, Arg::Gds(isc_out_of_bounds));
error(arg->sdl_arg_status_vector, Arg::Gds(isc_ss_out_of_bounds) <<
Arg::Num(n) << Arg::Num(range->iad_lower) << Arg::Num(range->iad_upper));
return false;
}
subscript += (n - range->iad_lower) * range->iad_length;

View File

@ -729,6 +729,7 @@ static const struct {
{"spb_no_id", 335545025},
{"ee_blr_mismatch_null", 335545026},
{"ee_blr_mismatch_length", 335545027},
{"ss_out_of_bounds", 335545028},
{"gfix_db_name", 335740929},
{"gfix_invalid_sw", 335740930},
{"gfix_incmp_sw", 335740932},

View File

@ -763,6 +763,7 @@ const ISC_STATUS isc_sysf_argscant_both_be_zero = 335545024L;
const ISC_STATUS isc_spb_no_id = 335545025L;
const ISC_STATUS isc_ee_blr_mismatch_null = 335545026L;
const ISC_STATUS isc_ee_blr_mismatch_length = 335545027L;
const ISC_STATUS isc_ss_out_of_bounds = 335545028L;
const ISC_STATUS isc_gfix_db_name = 335740929L;
const ISC_STATUS isc_gfix_invalid_sw = 335740930L;
const ISC_STATUS isc_gfix_incmp_sw = 335740932L;
@ -1187,7 +1188,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 = 1131;
const ISC_STATUS isc_err_max = 1132;
#else /* c definitions */
@ -1920,6 +1921,7 @@ const ISC_STATUS isc_err_max = 1131;
#define isc_spb_no_id 335545025L
#define isc_ee_blr_mismatch_null 335545026L
#define isc_ee_blr_mismatch_length 335545027L
#define isc_ss_out_of_bounds 335545028L
#define isc_gfix_db_name 335740929L
#define isc_gfix_invalid_sw 335740930L
#define isc_gfix_incmp_sw 335740932L
@ -2344,7 +2346,7 @@ const ISC_STATUS isc_err_max = 1131;
#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 1131
#define isc_err_max 1132
#endif

View File

@ -732,6 +732,7 @@ Data source : @4"}, /* eds_statement */
{335545025, "missing service ID in spb"}, /* spb_no_id */
{335545026, "External BLR message mismatch: invalid null descriptor at field @1"}, /* ee_blr_mismatch_null */
{335545027, "External BLR message mismatch: length = @1, expected @2"}, /* ee_blr_mismatch_length */
{335545028, "Subscript @1 out of bounds [@2, @3]"}, /* ss_out_of_bounds */
{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

@ -728,6 +728,7 @@ static const struct {
{335545025, -901}, /* 705 spb_no_id */
{335545026, -901}, /* 706 ee_blr_mismatch_null */
{335545027, -901}, /* 707 ee_blr_mismatch_length */
{335545028, -406}, /* 708 ss_out_of_bounds */
{335740929, -901}, /* 1 gfix_db_name */
{335740930, -901}, /* 2 gfix_invalid_sw */
{335740932, -901}, /* 4 gfix_incmp_sw */

View File

@ -728,6 +728,7 @@ static const struct {
{335545025, "HY000"}, // 705 spb_no_id
{335545026, "42000"}, // 706 ee_blr_mismatch_null
{335545027, "42000"}, // 707 ee_blr_mismatch_length
{335545028, "42000"}, // 708 ss_out_of_bounds
{335740929, "00000"}, // 1 gfix_db_name
{335740930, "00000"}, // 2 gfix_invalid_sw
{335740932, "00000"}, // 4 gfix_incmp_sw

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 (?, ?, ?, ?);
--
('2011-07-07 12:33:00', 'JRD', 0, 708)
('2011-07-29 16:58:38', 'JRD', 0, 709)
('2010-03-15 06:59:09', 'QLI', 1, 531)
--
--('2008-11-28 20:27:04', 'GDEF', 2, 346)

View File

@ -815,6 +815,7 @@ Data source : @4', NULL, NULL)
('spb_no_id', 'Service::start', 'svc.c', NULL, 0, 705, NULL, 'missing service ID in spb', NULL, NULL);
('ee_blr_mismatch_null', NULL, 'met.epp', NULL, 0, 706, NULL, 'External BLR message mismatch: invalid null descriptor at field @1', NULL, NULL)
('ee_blr_mismatch_length', NULL, 'met.epp', NULL, 0, 707, NULL, 'External BLR message mismatch: length = @1, expected @2', NULL, NULL)
('ss_out_of_bounds', NULL, 'sdl.cpp', NULL, 0, 708, NULL, 'Subscript @1 out of bounds [@2, @3]', 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

@ -713,6 +713,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
(-901, 'HY', '000', 0, 705, 'spb_no_id', NULL, NULL)
(-901, '42', '000', 0, 706, 'ee_blr_mismatch_null', NULL, NULL)
(-901, '42', '000', 0, 707, 'ee_blr_mismatch_length', NULL, NULL)
(-406, '42', '000', 0, 708, 'ss_out_of_bounds', NULL, NULL)
-- GFIX
(-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL)
(-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)