non default schema name in tab title

This commit is contained in:
Jan Prochazka 2022-09-28 16:56:47 +02:00
parent b2204e1d77
commit 53b6b71a29
5 changed files with 16 additions and 2 deletions

View File

@ -16,6 +16,7 @@ const dialect = {
isSparse: false,
isPersisted: false,
},
defaultSchemaName: null,
};
export const driverBase = {

View File

@ -9,6 +9,7 @@ export interface SqlDialect {
fallbackDataType?: string;
explicitDropConstraint?: boolean;
anonymousPrimaryKey?: boolean;
defaultSchemaName?: string;
enableConstraintsPerTable?: boolean;
dropColumnDependencies?: string[];

View File

@ -9,7 +9,7 @@
schemaName,
...(columns?.map(({ columnName }) => ({ childName: columnName })) || [])
);
export const createTitle = ({ pureName }) => pureName;
export const createTitle = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
export const databaseObjectIcons = {
tables: 'img table',
@ -586,6 +586,16 @@
}
}
function getObjectTitle(connection, schemaName, pureName) {
const driver = findEngineDriver(connection, getExtensions());
const defaultSchema = driver?.dialect?.defaultSchemaName;
if (schemaName && defaultSchema && schemaName != defaultSchema) {
return `${schemaName}.${pureName}`;
}
return pureName;
}
export async function openDatabaseObjectDetail(
tabComponent,
scriptTemplate,
@ -603,7 +613,7 @@
openNewTab(
{
title: scriptTemplate ? 'Query #' : pureName,
title: scriptTemplate ? 'Query #' : getObjectTitle(connection, schemaName, pureName),
tooltip,
icon: icon || (scriptTemplate ? 'img sql-file' : databaseObjectIcons[objectTypeField]),
tabComponent: scriptTemplate ? 'QueryTab' : tabComponent,

View File

@ -10,6 +10,7 @@ const dialect = {
rangeSelect: true,
offsetFetchRangeSyntax: true,
rowNumberOverPaging: true,
defaultSchemaName: 'dbo',
stringEscapeChar: "'",
fallbackDataType: 'nvarchar(max)',
explicitDropConstraint: false,

View File

@ -8,6 +8,7 @@ const spatialTypes = ['GEOGRAPHY'];
const dialect = {
rangeSelect: true,
ilike: true,
defaultSchemaName: 'public',
// stringEscapeChar: '\\',
stringEscapeChar: "'",
fallbackDataType: 'varchar',