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

Tell the user he can't drop a default collation as sugested by Claudio

This commit is contained in:
asfernandes 2006-08-14 18:49:08 +00:00
parent d2630c6312
commit dbc714ec52
3 changed files with 16 additions and 2 deletions

View File

@ -104,8 +104,9 @@ void DYN_delete_collation(Global* gbl, const UCHAR** ptr)
FOR (REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
COLL IN RDB$COLLATIONS
CROSS CS IN RDB$CHARACTER_SETS
WITH COLL.RDB$COLLATION_NAME EQ collName.c_str() AND
NOT COLL.RDB$COLLATION_ID EQ 0
CS.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID
if (!DYN_REQUEST(drq_e_colls))
DYN_REQUEST(drq_e_colls) = request;
@ -117,6 +118,18 @@ void DYN_delete_collation(Global* gbl, const UCHAR** ptr)
// msg 237: "Cannot delete system collation"
}
if (COLL.RDB$COLLATION_ID == 0 ||
(!CS.RDB$DEFAULT_COLLATE_NAME.NULL &&
Firebird::MetaName(COLL.RDB$COLLATION_NAME) == Firebird::MetaName(CS.RDB$DEFAULT_COLLATE_NAME)))
{
fb_utils::exact_name_limit(CS.RDB$CHARACTER_SET_NAME,
sizeof(CS.RDB$CHARACTER_SET_NAME));
DYN_rundown_request(request, -1);
DYN_error_punt(false, 238, CS.RDB$CHARACTER_SET_NAME, NULL, NULL, NULL, NULL);
// msg 238: "Cannot delete default collation of CHARACTER SET %s"
}
found = true;
fb_utils::exact_name_limit(COLL.RDB$COLLATION_NAME,
sizeof(COLL.RDB$COLLATION_NAME));

View File

@ -9,7 +9,7 @@ INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('19
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('1996-11-07 13:39:40', 'GRST', 6, 1);
*/
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('2005-06-05 12:50:00', 'DSQL', 7, 25);
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('2006-08-07 13:00:00', 'DYN', 8, 238);
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('2006-08-14 15:55:00', 'DYN', 8, 239);
/*
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('1996-11-07 13:39:40', 'FRED', 9, 1);
*/

View File

@ -3056,5 +3056,6 @@ INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FL
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('NO_COLLATION', 'SHOW_metadata', 'show.epp', NULL, 17, 148, NULL, 'There is no collation %s in this database', NULL, NULL);
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('NO_COLLATIONS', 'SHOW_metadata', 'show.epp', NULL, 17, 149, NULL, 'There are no collations in this database', NULL, NULL);
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('', 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 237, NULL, 'Cannot delete system collation', NULL, NULL);
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('', 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 238, NULL, 'Cannot delete default collation of CHARACTER SET %s', NULL, NULL);
COMMIT WORK;