mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 07:23:03 +01:00
Fixed CORE-5220 - ISQL -X: double quotes are missed for COLLATE <C> of CREATE DOMAIN statement when <C> is from any non-ascii charset.
This commit is contained in:
parent
5672912e54
commit
c2c322a576
@ -394,7 +394,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
char_sets[0] = '\0';
|
||||
collation = RFR.RDB$COLLATION_ID;
|
||||
char_set_id = FLD.RDB$CHARACTER_SET_ID;
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, true, false, char_sets);
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, true, false, true, char_sets);
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
}
|
||||
@ -447,7 +447,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
if (!FLD.RDB$CHARACTER_SET_ID.NULL)
|
||||
char_set_id = FLD.RDB$CHARACTER_SET_ID;
|
||||
if ((char_set_id != default_char_set_id) || collation)
|
||||
ISQL_get_character_sets (char_set_id, 0, false, false, char_sets);
|
||||
ISQL_get_character_sets (char_set_id, 0, false, false, true, char_sets);
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
// CVC: Someone deleted the code that checks intchar when handling collations
|
||||
@ -536,7 +536,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
if (collation)
|
||||
{
|
||||
char_sets[0] = '\0';
|
||||
ISQL_get_character_sets (char_set_id, collation, true, false, char_sets);
|
||||
ISQL_get_character_sets (char_set_id, collation, true, false, true, char_sets);
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
}
|
||||
@ -771,7 +771,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
{
|
||||
char_sets[0] = '\0';
|
||||
ISQL_get_character_sets(FLD.RDB$CHARACTER_SET_ID, prm_collation_id, true,
|
||||
!prm_null_flag_null && prm_null_flag, char_sets);
|
||||
!prm_null_flag_null && prm_null_flag, true, char_sets);
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
}
|
||||
@ -819,7 +819,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
FLD.RDB$CHARACTER_SET_ID = 0;
|
||||
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, collation, false,
|
||||
!prm_null_flag_null && prm_null_flag, char_sets);
|
||||
!prm_null_flag_null && prm_null_flag, true, char_sets);
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
}
|
||||
@ -987,7 +987,7 @@ static void get_function_args_ods12(const char* func_name, USHORT out_arg)
|
||||
{
|
||||
char_sets[0] = '\0';
|
||||
ISQL_get_character_sets(FLD.RDB$CHARACTER_SET_ID, prm_collation_id, true,
|
||||
!prm_null_flag_null && prm_null_flag, char_sets);
|
||||
!prm_null_flag_null && prm_null_flag, true, char_sets);
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
}
|
||||
@ -1035,7 +1035,7 @@ static void get_function_args_ods12(const char* func_name, USHORT out_arg)
|
||||
FLD.RDB$CHARACTER_SET_ID = 0;
|
||||
|
||||
ISQL_get_character_sets(FLD.RDB$CHARACTER_SET_ID, collation, false,
|
||||
!prm_null_flag_null && prm_null_flag, char_sets);
|
||||
!prm_null_flag_null && prm_null_flag, true, char_sets);
|
||||
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
@ -2228,7 +2228,8 @@ static void list_domain_table(const SCHAR* table_name, SSHORT default_char_set_i
|
||||
if ((FLD.RDB$CHARACTER_SET_ID != default_char_set_id) ||
|
||||
(!FLD.RDB$COLLATION_ID.NULL && FLD.RDB$COLLATION_ID != 0))
|
||||
{
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, false, false, char_sets);
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, false, false, true,
|
||||
char_sets);
|
||||
}
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
@ -2258,7 +2259,9 @@ static void list_domain_table(const SCHAR* table_name, SSHORT default_char_set_i
|
||||
if (!FLD.RDB$COLLATION_ID.NULL && FLD.RDB$COLLATION_ID != 0)
|
||||
{
|
||||
char_sets[0] = 0;
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, FLD.RDB$COLLATION_ID, true, false, char_sets);
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, FLD.RDB$COLLATION_ID, true, false,
|
||||
true, char_sets);
|
||||
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
}
|
||||
@ -2347,7 +2350,8 @@ static void list_domains(SSHORT default_char_set_id)
|
||||
if ((FLD.RDB$CHARACTER_SET_ID != default_char_set_id) ||
|
||||
(!FLD.RDB$COLLATION_ID.NULL && FLD.RDB$COLLATION_ID != 0))
|
||||
{
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, false, false, char_sets);
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, false, false, true,
|
||||
char_sets);
|
||||
}
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
@ -2373,7 +2377,9 @@ static void list_domains(SSHORT default_char_set_id)
|
||||
if (!FLD.RDB$COLLATION_ID.NULL && FLD.RDB$COLLATION_ID != 0)
|
||||
{
|
||||
char_sets[0] = 0;
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, FLD.RDB$COLLATION_ID, true, false, char_sets);
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, FLD.RDB$COLLATION_ID, true, false,
|
||||
true, char_sets);
|
||||
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
}
|
||||
@ -2516,7 +2522,9 @@ static void listRelationComputed(LegacyTables flag, SSHORT default_char_set_id)
|
||||
char_sets[0] = '\0';
|
||||
collation = RFR.RDB$COLLATION_ID;
|
||||
char_set_id = FLD.RDB$CHARACTER_SET_ID;
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, true, false, char_sets);
|
||||
ISQL_get_character_sets (FLD.RDB$CHARACTER_SET_ID, 0, true, false, true,
|
||||
char_sets);
|
||||
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
}
|
||||
@ -2569,7 +2577,7 @@ static void listRelationComputed(LegacyTables flag, SSHORT default_char_set_id)
|
||||
if (!FLD.RDB$CHARACTER_SET_ID.NULL)
|
||||
char_set_id = FLD.RDB$CHARACTER_SET_ID;
|
||||
if ((char_set_id != default_char_set_id) || collation)
|
||||
ISQL_get_character_sets (char_set_id, 0, false, false, char_sets);
|
||||
ISQL_get_character_sets (char_set_id, 0, false, false, true, char_sets);
|
||||
if (char_sets[0])
|
||||
isqlGlob.prints(char_sets);
|
||||
// CVC: Someone deleted the code that checks intchar when handling collations
|
||||
|
@ -1201,7 +1201,7 @@ SSHORT ISQL_get_field_length(const TEXT* field_name)
|
||||
|
||||
|
||||
void ISQL_get_character_sets(SSHORT char_set_id, SSHORT collation, bool collate_only,
|
||||
bool not_null, TEXT* string)
|
||||
bool not_null, bool quote, TEXT* string)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1239,17 +1239,31 @@ void ISQL_get_character_sets(SSHORT char_set_id, SSHORT collation, bool collate_
|
||||
fb_utils::exact_name(COL.RDB$COLLATION_NAME);
|
||||
fb_utils::exact_name(CST.RDB$DEFAULT_COLLATE_NAME);
|
||||
|
||||
char charSetName[QUOTEDLENGTH];
|
||||
char collateName[QUOTEDLENGTH];
|
||||
|
||||
if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION)
|
||||
{
|
||||
IUTILS_copy_SQL_id(CST.RDB$CHARACTER_SET_NAME, charSetName, DBL_QUOTE);
|
||||
IUTILS_copy_SQL_id(COL.RDB$COLLATION_NAME, collateName, DBL_QUOTE);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(charSetName, CST.RDB$CHARACTER_SET_NAME);
|
||||
strcpy(collateName, COL.RDB$COLLATION_NAME);
|
||||
}
|
||||
|
||||
// Is specified collation the default collation for character set?
|
||||
if (strcmp (CST.RDB$DEFAULT_COLLATE_NAME, COL.RDB$COLLATION_NAME) == 0)
|
||||
{
|
||||
if (!collate_only)
|
||||
sprintf (string, " CHARACTER SET %s%s", CST.RDB$CHARACTER_SET_NAME, notNullStr);
|
||||
sprintf (string, " CHARACTER SET %s%s", charSetName, notNullStr);
|
||||
}
|
||||
else if (collate_only)
|
||||
sprintf (string, "%s COLLATE %s", notNullStr, COL.RDB$COLLATION_NAME);
|
||||
sprintf (string, "%s COLLATE %s", notNullStr, collateName);
|
||||
else
|
||||
sprintf (string, " CHARACTER SET %s%s COLLATE %s",
|
||||
CST.RDB$CHARACTER_SET_NAME, notNullStr, COL.RDB$COLLATION_NAME);
|
||||
charSetName, notNullStr, collateName);
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
ISQL_errmsg(fbStatus);
|
||||
|
@ -41,7 +41,7 @@ void ISQL_exit_db();
|
||||
//int ISQL_extract(TEXT*, int, FILE*, FILE*, FILE*);
|
||||
int ISQL_frontend_command(TEXT*, FILE*, FILE*, FILE*);
|
||||
bool ISQL_get_base_column_null_flag(const TEXT*, const SSHORT, const TEXT*);
|
||||
void ISQL_get_character_sets(SSHORT, SSHORT, bool, bool, TEXT*);
|
||||
void ISQL_get_character_sets(SSHORT, SSHORT, bool, bool, bool, TEXT*);
|
||||
SSHORT ISQL_get_default_char_set_id();
|
||||
void ISQL_get_default_source(const TEXT*, TEXT*, ISC_QUAD*);
|
||||
SSHORT ISQL_get_field_length(const TEXT*);
|
||||
|
@ -2828,11 +2828,11 @@ static void show_charsets(const SCHAR* relation_name, const SCHAR* field_name,
|
||||
if ((char_set_id != default_char_set_id) || collation)
|
||||
{
|
||||
if (show_charset && !show_collation)
|
||||
ISQL_get_character_sets(char_set_id, 0, false, false, char_sets);
|
||||
ISQL_get_character_sets(char_set_id, 0, false, false, false, char_sets);
|
||||
else if (!show_charset && show_collation)
|
||||
ISQL_get_character_sets(char_set_id, collation, true, false, char_sets);
|
||||
ISQL_get_character_sets(char_set_id, collation, true, false, false, char_sets);
|
||||
else
|
||||
ISQL_get_character_sets(char_set_id, collation, false, false, char_sets);
|
||||
ISQL_get_character_sets(char_set_id, collation, false, false, false, char_sets);
|
||||
}
|
||||
if (char_sets[0])
|
||||
{
|
||||
@ -4376,7 +4376,10 @@ static processing_state show_func(const SCHAR* funcname)
|
||||
charset_collation[0] = 0;
|
||||
|
||||
if ((charset != default_charset) || collation)
|
||||
ISQL_get_character_sets(charset, collation, false, false, charset_collation);
|
||||
{
|
||||
ISQL_get_character_sets(charset, collation, false, false, false,
|
||||
charset_collation);
|
||||
}
|
||||
|
||||
if (charset_collation[0])
|
||||
isqlGlob.prints(charset_collation);
|
||||
@ -5244,7 +5247,10 @@ static processing_state show_proc(const SCHAR* procname)
|
||||
charset_collation[0] = 0;
|
||||
|
||||
if ((charset != default_charset) || collation)
|
||||
ISQL_get_character_sets(charset, collation, false, false, charset_collation);
|
||||
{
|
||||
ISQL_get_character_sets(charset, collation, false, false, false,
|
||||
charset_collation);
|
||||
}
|
||||
|
||||
if (charset_collation[0])
|
||||
isqlGlob.prints(charset_collation);
|
||||
|
Loading…
Reference in New Issue
Block a user