mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 17:23:04 +01:00
Support for default collations in ISQL - SHOW DATABASE and metadata extraction
This commit is contained in:
parent
0232635f91
commit
53f24220f6
@ -73,6 +73,7 @@ static void list_all_procs();
|
||||
static void list_all_tables(LegacyTables flag, SSHORT);
|
||||
static void list_all_triggers();
|
||||
static void list_check();
|
||||
static void list_charsets();
|
||||
static void list_collations();
|
||||
static void list_create_db();
|
||||
static void list_domain_table(const SCHAR*, SSHORT);
|
||||
@ -188,6 +189,7 @@ int EXTRACT_ddl(LegacyTables flag,
|
||||
{
|
||||
list_create_db();
|
||||
list_filters();
|
||||
list_charsets();
|
||||
list_collations();
|
||||
list_functions();
|
||||
list_generators();
|
||||
@ -1563,6 +1565,61 @@ static void list_check()
|
||||
}
|
||||
|
||||
|
||||
static void list_charsets()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* l i s t _ c h a r s e t s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Alter character sets.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
bool first = true;
|
||||
|
||||
FOR CS IN RDB$CHARACTER_SETS
|
||||
WITH NOT CS.RDB$CHARACTER_SET_NAME EQ CS.RDB$DEFAULT_COLLATE_NAME
|
||||
SORTED BY CS.RDB$CHARACTER_SET_NAME
|
||||
|
||||
if (first)
|
||||
{
|
||||
isqlGlob.printf(
|
||||
"%s/* Character sets */%s",
|
||||
NEWLINE,
|
||||
NEWLINE);
|
||||
first = false;
|
||||
}
|
||||
|
||||
isqlGlob.printf("ALTER CHARACTER SET ");
|
||||
|
||||
fb_utils::exact_name(CS.RDB$CHARACTER_SET_NAME);
|
||||
if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION)
|
||||
ISQL_copy_SQL_id (CS.RDB$CHARACTER_SET_NAME, SQL_identifier, DBL_QUOTE);
|
||||
else
|
||||
strcpy (SQL_identifier, CS.RDB$CHARACTER_SET_NAME);
|
||||
isqlGlob.printf("%s", SQL_identifier);
|
||||
|
||||
fb_utils::exact_name(CS.RDB$DEFAULT_COLLATE_NAME);
|
||||
if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION)
|
||||
ISQL_copy_SQL_id (CS.RDB$DEFAULT_COLLATE_NAME, SQL_identifier, DBL_QUOTE);
|
||||
else
|
||||
strcpy (SQL_identifier, CS.RDB$DEFAULT_COLLATE_NAME);
|
||||
isqlGlob.printf(" SET DEFAULT COLLATION %s", SQL_identifier);
|
||||
|
||||
isqlGlob.printf("%s%s", isqlGlob.global_Term, NEWLINE);
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
ISQL_errmsg(gds_status);
|
||||
return;
|
||||
END_ERROR;
|
||||
|
||||
isqlGlob.printf(NEWLINE);
|
||||
}
|
||||
|
||||
|
||||
static void list_collations()
|
||||
{
|
||||
/**************************************
|
||||
|
@ -2447,11 +2447,21 @@ static void show_db()
|
||||
}
|
||||
|
||||
FOR DBB IN RDB$DATABASE
|
||||
WITH DBB.RDB$CHARACTER_SET_NAME NOT MISSING
|
||||
AND DBB.RDB$CHARACTER_SET_NAME NE " "
|
||||
isqlGlob.printf("Default Character set: %s%s",
|
||||
DBB.RDB$CHARACTER_SET_NAME,
|
||||
NEWLINE);
|
||||
CROSS CS IN RDB$CHARACTER_SETS
|
||||
WITH CS.RDB$CHARACTER_SET_NAME EQ DBB.RDB$CHARACTER_SET_NAME
|
||||
|
||||
fb_utils::exact_name(DBB.RDB$CHARACTER_SET_NAME);
|
||||
fb_utils::exact_name(CS.RDB$DEFAULT_COLLATE_NAME);
|
||||
|
||||
isqlGlob.printf("Default Character set: %s", DBB.RDB$CHARACTER_SET_NAME);
|
||||
|
||||
if (!CS.RDB$DEFAULT_COLLATE_NAME.NULL &&
|
||||
strcmp(CS.RDB$DEFAULT_COLLATE_NAME, DBB.RDB$CHARACTER_SET_NAME) != 0)
|
||||
{
|
||||
isqlGlob.printf(" (with Default Collation %s)", CS.RDB$DEFAULT_COLLATE_NAME);
|
||||
}
|
||||
|
||||
isqlGlob.printf("%s", NEWLINE);
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
ISQL_errmsg(isc_status);
|
||||
|
Loading…
Reference in New Issue
Block a user