mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
Merge branch 'master' into develop
This commit is contained in:
commit
e0703b1bae
@ -53,6 +53,8 @@ function getPortalCollections() {
|
|||||||
databaseUrl: process.env[`URL_${id}`],
|
databaseUrl: process.env[`URL_${id}`],
|
||||||
useDatabaseUrl: !!process.env[`URL_${id}`],
|
useDatabaseUrl: !!process.env[`URL_${id}`],
|
||||||
databaseFile: process.env[`FILE_${id}`],
|
databaseFile: process.env[`FILE_${id}`],
|
||||||
|
socketPath: process.env[`SOCKET_PATH_${id}`],
|
||||||
|
authType: process.env[`AUTH_TYPE_${id}`] || (process.env[`SOCKET_PATH_${id}`] ? 'socket' : undefined),
|
||||||
defaultDatabase:
|
defaultDatabase:
|
||||||
process.env[`DATABASE_${id}`] ||
|
process.env[`DATABASE_${id}`] ||
|
||||||
(process.env[`FILE_${id}`] ? getDatabaseFileLabel(process.env[`FILE_${id}`]) : null),
|
(process.env[`FILE_${id}`] ? getDatabaseFileLabel(process.env[`FILE_${id}`]) : null),
|
||||||
|
@ -32,6 +32,12 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
dialect: SqlDialect;
|
dialect: SqlDialect;
|
||||||
indentLevel = 0;
|
indentLevel = 0;
|
||||||
|
|
||||||
|
static keywordsCase = 'upperCase';
|
||||||
|
static convertKeywordCase(keyword: any): string {
|
||||||
|
if (this.keywordsCase == 'lowerCase') return keyword?.toString()?.toLowerCase();
|
||||||
|
return keyword?.toString()?.toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
constructor(driver: EngineDriver) {
|
constructor(driver: EngineDriver) {
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
this.dialect = driver.dialect;
|
this.dialect = driver.dialect;
|
||||||
@ -60,10 +66,10 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
this.putRaw("'");
|
this.putRaw("'");
|
||||||
}
|
}
|
||||||
putByteArrayValue(value) {
|
putByteArrayValue(value) {
|
||||||
this.putRaw('NULL');
|
this.put('^null');
|
||||||
}
|
}
|
||||||
putValue(value) {
|
putValue(value) {
|
||||||
if (value === null) this.putRaw('NULL');
|
if (value === null) this.put('^null');
|
||||||
else if (value === true) this.putRaw('1');
|
else if (value === true) this.putRaw('1');
|
||||||
else if (value === false) this.putRaw('0');
|
else if (value === false) this.putRaw('0');
|
||||||
else if (_isString(value)) this.putStringValue(value);
|
else if (_isString(value)) this.putStringValue(value);
|
||||||
@ -71,7 +77,7 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
else if (_isDate(value)) this.putStringValue(new Date(value).toISOString());
|
else if (_isDate(value)) this.putStringValue(new Date(value).toISOString());
|
||||||
else if (value?.type == 'Buffer' && _isArray(value?.data)) this.putByteArrayValue(value?.data);
|
else if (value?.type == 'Buffer' && _isArray(value?.data)) this.putByteArrayValue(value?.data);
|
||||||
else if (_isPlainObject(value) || _isArray(value)) this.putStringValue(JSON.stringify(value));
|
else if (_isPlainObject(value) || _isArray(value)) this.putStringValue(JSON.stringify(value));
|
||||||
else this.putRaw('NULL');
|
else this.put('^null');
|
||||||
}
|
}
|
||||||
putCmd(format, ...args) {
|
putCmd(format, ...args) {
|
||||||
this.put(format, ...args);
|
this.put(format, ...args);
|
||||||
@ -92,7 +98,7 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
case 'k':
|
case 'k':
|
||||||
{
|
{
|
||||||
if (value) {
|
if (value) {
|
||||||
this.putRaw(value.toUpperCase());
|
this.putRaw(SqlDumper.convertKeywordCase(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -128,7 +134,7 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
switch (c) {
|
switch (c) {
|
||||||
case '^':
|
case '^':
|
||||||
while (i < length && format[i].match(/[a-z0-9_]/i)) {
|
while (i < length && format[i].match(/[a-z0-9_]/i)) {
|
||||||
this.putRaw(format[i].toUpperCase());
|
this.putRaw(SqlDumper.convertKeywordCase(format[i]));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
import AppTitleProvider from './utility/AppTitleProvider.svelte';
|
import AppTitleProvider from './utility/AppTitleProvider.svelte';
|
||||||
import getElectron from './utility/getElectron';
|
import getElectron from './utility/getElectron';
|
||||||
import AppStartInfo from './widgets/AppStartInfo.svelte';
|
import AppStartInfo from './widgets/AppStartInfo.svelte';
|
||||||
|
import SettingsListener from './utility/SettingsListener.svelte';
|
||||||
|
|
||||||
let loadedApi = false;
|
let loadedApi = false;
|
||||||
let loadedPlugins = false;
|
let loadedPlugins = false;
|
||||||
@ -79,6 +80,7 @@
|
|||||||
<AppTitleProvider />
|
<AppTitleProvider />
|
||||||
{#if loadedPlugins}
|
{#if loadedPlugins}
|
||||||
<OpenTabsOnStartup />
|
<OpenTabsOnStartup />
|
||||||
|
<SettingsListener />
|
||||||
<Screen />
|
<Screen />
|
||||||
{:else}
|
{:else}
|
||||||
<AppStartInfo
|
<AppStartInfo
|
||||||
|
@ -229,6 +229,30 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleQueryDesigner = () => {
|
||||||
|
openNewTab({
|
||||||
|
title: 'Query #',
|
||||||
|
icon: 'img query-design',
|
||||||
|
tabComponent: 'QueryDesignTab',
|
||||||
|
props: {
|
||||||
|
conid: connection._id,
|
||||||
|
database: name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleNewPerspective = () => {
|
||||||
|
openNewTab({
|
||||||
|
title: 'Perspective #',
|
||||||
|
icon: 'img perspective',
|
||||||
|
tabComponent: 'PerspectiveTab',
|
||||||
|
props: {
|
||||||
|
conid: connection._id,
|
||||||
|
database: name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
async function handleConfirmSql(sql) {
|
async function handleConfirmSql(sql) {
|
||||||
saveScriptToDatabase({ conid: connection._id, database: name }, sql, false);
|
saveScriptToDatabase({ conid: connection._id, database: name }, sql, false);
|
||||||
}
|
}
|
||||||
@ -244,16 +268,21 @@
|
|||||||
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
|
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
|
||||||
driver?.databaseEngineTypes?.includes('sql') && { onClick: handleNewTable, text: 'New table' },
|
driver?.databaseEngineTypes?.includes('sql') && { onClick: handleNewTable, text: 'New table' },
|
||||||
driver?.databaseEngineTypes?.includes('document') && { onClick: handleNewCollection, text: 'New collection' },
|
driver?.databaseEngineTypes?.includes('document') && { onClick: handleNewCollection, text: 'New collection' },
|
||||||
isSqlOrDoc &&
|
driver?.databaseEngineTypes?.includes('sql') && { onClick: handleQueryDesigner, text: 'Design query' },
|
||||||
!connection.isReadOnly &&
|
driver?.databaseEngineTypes?.includes('sql') && {
|
||||||
!connection.singleDatabase && { onClick: handleDropDatabase, text: 'Drop database' },
|
onClick: handleNewPerspective,
|
||||||
|
text: 'Design perspective query',
|
||||||
|
},
|
||||||
{ divider: true },
|
{ divider: true },
|
||||||
isSqlOrDoc && !connection.isReadOnly && { onClick: handleImport, text: 'Import wizard' },
|
isSqlOrDoc && !connection.isReadOnly && { onClick: handleImport, text: 'Import wizard' },
|
||||||
isSqlOrDoc && { onClick: handleExport, text: 'Export wizard' },
|
isSqlOrDoc && { onClick: handleExport, text: 'Export wizard' },
|
||||||
driver?.databaseEngineTypes?.includes('sql') && { onClick: handleSqlRestore, text: 'Restore/import SQL dump' },
|
driver?.databaseEngineTypes?.includes('sql') && { onClick: handleSqlRestore, text: 'Restore/import SQL dump' },
|
||||||
driver?.supportsDatabaseDump && { onClick: handleSqlDump, text: 'Backup/export SQL dump' },
|
driver?.supportsDatabaseDump && { onClick: handleSqlDump, text: 'Backup/export SQL dump' },
|
||||||
|
isSqlOrDoc &&
|
||||||
|
!connection.isReadOnly &&
|
||||||
|
!connection.singleDatabase && { onClick: handleDropDatabase, text: 'Drop database' },
|
||||||
{ divider: true },
|
{ divider: true },
|
||||||
isSqlOrDoc && { onClick: handleShowDiagram, text: 'Show diagram' },
|
driver?.databaseEngineTypes?.includes('sql') && { onClick: handleShowDiagram, text: 'Show diagram' },
|
||||||
isSqlOrDoc && { onClick: handleSqlGenerator, text: 'SQL Generator' },
|
isSqlOrDoc && { onClick: handleSqlGenerator, text: 'SQL Generator' },
|
||||||
isSqlOrDoc && { onClick: handleOpenJsonModel, text: 'Open model as JSON' },
|
isSqlOrDoc && { onClick: handleOpenJsonModel, text: 'Open model as JSON' },
|
||||||
isSqlOrDoc && { onClick: handleExportModel, text: 'Export DB model - experimental' },
|
isSqlOrDoc && { onClick: handleExportModel, text: 'Export DB model - experimental' },
|
||||||
|
@ -52,7 +52,12 @@
|
|||||||
icon: 'img table-structure',
|
icon: 'img table-structure',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Open perspective',
|
label: 'Design query',
|
||||||
|
isQueryDesigner: true,
|
||||||
|
requiresWriteAccess: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Design perspective query',
|
||||||
tab: 'PerspectiveTab',
|
tab: 'PerspectiveTab',
|
||||||
forceNewTab: true,
|
forceNewTab: true,
|
||||||
icon: 'img perspective',
|
icon: 'img perspective',
|
||||||
@ -80,11 +85,6 @@
|
|||||||
isDuplicateTable: true,
|
isDuplicateTable: true,
|
||||||
requiresWriteAccess: true,
|
requiresWriteAccess: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'Query designer',
|
|
||||||
isQueryDesigner: true,
|
|
||||||
requiresWriteAccess: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Show diagram',
|
label: 'Show diagram',
|
||||||
isDiagram: true,
|
isDiagram: true,
|
||||||
@ -155,7 +155,11 @@
|
|||||||
icon: 'img view-structure',
|
icon: 'img view-structure',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Open perspective',
|
label: 'Design query',
|
||||||
|
isQueryDesigner: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Design perspective query',
|
||||||
tab: 'PerspectiveTab',
|
tab: 'PerspectiveTab',
|
||||||
forceNewTab: true,
|
forceNewTab: true,
|
||||||
icon: 'img perspective',
|
icon: 'img perspective',
|
||||||
@ -164,10 +168,6 @@
|
|||||||
label: 'Drop view',
|
label: 'Drop view',
|
||||||
isDrop: true,
|
isDrop: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'Query designer',
|
|
||||||
isQueryDesigner: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
divider: true,
|
divider: true,
|
||||||
},
|
},
|
||||||
|
@ -127,6 +127,9 @@ registerCommand({
|
|||||||
name: 'Query design',
|
name: 'Query design',
|
||||||
menuName: 'New query design',
|
menuName: 'New query design',
|
||||||
onClick: () => newQueryDesign(),
|
onClick: () => newQueryDesign(),
|
||||||
|
testEnabled: () =>
|
||||||
|
getCurrentDatabase() &&
|
||||||
|
findEngineDriver(getCurrentDatabase()?.connection, getExtensions())?.databaseEngineTypes?.includes('sql'),
|
||||||
});
|
});
|
||||||
|
|
||||||
registerCommand({
|
registerCommand({
|
||||||
@ -144,6 +147,9 @@ registerCommand({
|
|||||||
icon: 'img diagram',
|
icon: 'img diagram',
|
||||||
name: 'ER Diagram',
|
name: 'ER Diagram',
|
||||||
menuName: 'New ER diagram',
|
menuName: 'New ER diagram',
|
||||||
|
testEnabled: () =>
|
||||||
|
getCurrentDatabase() &&
|
||||||
|
findEngineDriver(getCurrentDatabase()?.connection, getExtensions())?.databaseEngineTypes?.includes('sql'),
|
||||||
onClick: () => newDiagram(),
|
onClick: () => newDiagram(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<InlineButton
|
<InlineButton
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
skip -= limit;
|
skip = parseInt(skip) - parseInt(limit);
|
||||||
if (skip < 0) skip = 0;
|
if (skip < 0) skip = 0;
|
||||||
dispatch('load');
|
dispatch('load');
|
||||||
}}
|
}}
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<TextField type="number" bind:value={limit} on:blur={() => dispatch('load')} on:keydown={handleKeyDown} />
|
<TextField type="number" bind:value={limit} on:blur={() => dispatch('load')} on:keydown={handleKeyDown} />
|
||||||
<InlineButton
|
<InlineButton
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
skip += limit;
|
skip = parseInt(skip) + parseInt(limit);
|
||||||
dispatch('load');
|
dispatch('load');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { SqlDumper } from 'dbgate-tools';
|
||||||
import FormStyledButton from '../buttons/FormStyledButton.svelte';
|
import FormStyledButton from '../buttons/FormStyledButton.svelte';
|
||||||
import TableControl from '../elements/TableControl.svelte';
|
import TableControl from '../elements/TableControl.svelte';
|
||||||
import TextField from '../forms/TextField.svelte';
|
import TextField from '../forms/TextField.svelte';
|
||||||
@ -63,9 +64,11 @@
|
|||||||
const source = sources[sourceIndex];
|
const source = sources[sourceIndex];
|
||||||
const target = targets[targetIndex];
|
const target = targets[targetIndex];
|
||||||
if (source && target) {
|
if (source && target) {
|
||||||
return `${JOIN_TYPES[joinIndex]} ${target.refTable}${alias ? ` ${alias}` : ''} ON ${target.columnMap
|
return `${SqlDumper.convertKeywordCase(JOIN_TYPES[joinIndex])} ${target.refTable}${
|
||||||
|
alias ? ` ${alias}` : ''
|
||||||
|
} ${SqlDumper.convertKeywordCase('ON')} ${target.columnMap
|
||||||
.map(col => `${source.name}.${col.columnName} = ${alias || target.refTable}.${col.refColumnName}`)
|
.map(col => `${source.name}.${col.columnName} = ${alias || target.refTable}.${col.refColumnName}`)
|
||||||
.join(' AND ')}`;
|
.join(SqlDumper.convertKeywordCase(' AND '))}`;
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getAsImageSrc, safeJsonParse } from 'dbgate-tools';
|
import { getAsImageSrc, safeJsonParse } from 'dbgate-tools';
|
||||||
import { isArray } from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import CellValue from '../datagrid/CellValue.svelte';
|
import CellValue from '../datagrid/CellValue.svelte';
|
||||||
import JSONTree from '../jsontree/JSONTree.svelte';
|
import JSONTree from '../jsontree/JSONTree.svelte';
|
||||||
@ -12,7 +12,7 @@
|
|||||||
export let displayType;
|
export let displayType;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<td rowspan={rowSpan} data-column={columnIndex} class:isEmpty={value===undefined}>
|
<td rowspan={rowSpan} data-column={columnIndex} class:isEmpty={value === undefined}>
|
||||||
{#if value !== undefined}
|
{#if value !== undefined}
|
||||||
{#if displayType == 'json'}
|
{#if displayType == 'json'}
|
||||||
<JSONTree value={safeJsonParse(value, value?.toString())} slicedKeyCount={1} disableContextMenu />
|
<JSONTree value={safeJsonParse(value, value?.toString())} slicedKeyCount={1} disableContextMenu />
|
||||||
@ -23,6 +23,8 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<span class="null"> (no image)</span>
|
<span class="null"> (no image)</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
{:else if _.isArray(value) || _.isPlainObject(value)}
|
||||||
|
<JSONTree {value} slicedKeyCount={1} disableContextMenu />
|
||||||
{:else}
|
{:else}
|
||||||
<CellValue {rowData} {value} />
|
<CellValue {rowData} {value} />
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
let errorMessage;
|
let errorMessage;
|
||||||
let rowCount;
|
let rowCount;
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
|
let isLoadQueued = false;
|
||||||
const lastVisibleRowIndexRef = createRef(0);
|
const lastVisibleRowIndexRef = createRef(0);
|
||||||
const disableLoadNextRef = createRef(false);
|
const disableLoadNextRef = createRef(false);
|
||||||
|
|
||||||
@ -121,6 +122,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadData(node: PerspectiveTreeNode, counts) {
|
async function loadData(node: PerspectiveTreeNode, counts) {
|
||||||
|
if (isLoading) {
|
||||||
|
isLoadQueued = true;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
isLoadQueued = false;
|
||||||
|
}
|
||||||
// console.log('LOADING', node);
|
// console.log('LOADING', node);
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
const rows = [];
|
const rows = [];
|
||||||
@ -147,6 +154,10 @@
|
|||||||
// loadProps.push(child.getNodeLoadProps());
|
// loadProps.push(child.getNodeLoadProps());
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (isLoadQueued) {
|
||||||
|
loadData(root, $loadedCounts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openJson() {
|
export function openJson() {
|
||||||
|
@ -2,6 +2,7 @@ import _ from 'lodash';
|
|||||||
import { addCompleter, setCompleters } from 'ace-builds/src-noconflict/ext-language_tools';
|
import { addCompleter, setCompleters } from 'ace-builds/src-noconflict/ext-language_tools';
|
||||||
import { getDatabaseInfo } from '../utility/metadataLoaders';
|
import { getDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
import analyseQuerySources from './analyseQuerySources';
|
import analyseQuerySources from './analyseQuerySources';
|
||||||
|
import { getStringSettingsValue } from '../settings/settingsTools';
|
||||||
|
|
||||||
const COMMON_KEYWORDS = [
|
const COMMON_KEYWORDS = [
|
||||||
'select',
|
'select',
|
||||||
@ -78,13 +79,21 @@ export function mountCodeCompletion({ conid, database, editor, getText }) {
|
|||||||
const line = session.getLine(cursor.row).slice(0, cursor.column);
|
const line = session.getLine(cursor.row).slice(0, cursor.column);
|
||||||
const dbinfo = await getDatabaseInfo({ conid, database });
|
const dbinfo = await getDatabaseInfo({ conid, database });
|
||||||
|
|
||||||
let list = COMMON_KEYWORDS.map(word => ({
|
const convertUpper = getStringSettingsValue('sqlEditor.sqlCommandsCase', 'upperCase') == 'upperCase';
|
||||||
name: word,
|
|
||||||
value: word,
|
let list = COMMON_KEYWORDS.map(word => {
|
||||||
caption: word,
|
if (convertUpper) {
|
||||||
meta: 'keyword',
|
word = word.toUpperCase();
|
||||||
score: 800,
|
}
|
||||||
}));
|
|
||||||
|
return {
|
||||||
|
name: word,
|
||||||
|
value: word,
|
||||||
|
caption: word,
|
||||||
|
meta: 'keyword',
|
||||||
|
score: 800,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
if (dbinfo) {
|
if (dbinfo) {
|
||||||
const colMatch = line.match(/([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]*)?$/);
|
const colMatch = line.match(/([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]*)?$/);
|
||||||
|
@ -111,6 +111,19 @@ ORDER BY
|
|||||||
defaultValue="30"
|
defaultValue="30"
|
||||||
disabled={values['connection.autoRefresh'] === false}
|
disabled={values['connection.autoRefresh'] === false}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div class="heading">SQL editor</div>
|
||||||
|
<FormSelectField
|
||||||
|
label="SQL commands case"
|
||||||
|
name="sqlEditor.sqlCommandsCase"
|
||||||
|
isNative
|
||||||
|
defaultValue="upperCase"
|
||||||
|
options={[
|
||||||
|
{ value: 'upperCase', label: 'UPPER CASE' },
|
||||||
|
{ value: 'lowerCase', label: 'lower case' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="2">
|
<svelte:fragment slot="2">
|
||||||
<div class="heading">Application theme</div>
|
<div class="heading">Application theme</div>
|
||||||
|
@ -21,3 +21,10 @@ export function getBoolSettingsValue(name, defaultValue) {
|
|||||||
if (res == null) return defaultValue;
|
if (res == null) return defaultValue;
|
||||||
return !!res;
|
return !!res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getStringSettingsValue(name, defaultValue) {
|
||||||
|
const settings = getCurrentSettings();
|
||||||
|
const res = settings[name];
|
||||||
|
if (res == null) return defaultValue;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
8
packages/web/src/utility/SettingsListener.svelte
Normal file
8
packages/web/src/utility/SettingsListener.svelte
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { SqlDumper } from 'dbgate-tools';
|
||||||
|
import { useSettings } from './metadataLoaders';
|
||||||
|
|
||||||
|
const settings = useSettings();
|
||||||
|
|
||||||
|
$: SqlDumper.keywordsCase = $settings?.['sqlEditor.sqlCommandsCase'] || 'upperCase';
|
||||||
|
</script>
|
@ -9,7 +9,9 @@ const AbstractCursor = require('mongodb').AbstractCursor;
|
|||||||
const createBulkInsertStream = require('./createBulkInsertStream');
|
const createBulkInsertStream = require('./createBulkInsertStream');
|
||||||
|
|
||||||
function transformMongoData(row) {
|
function transformMongoData(row) {
|
||||||
return _.mapValues(row, (v) => (v && v.constructor == ObjectId ? { $oid: v.toString() } : v));
|
return _.cloneDeepWith(row, (x) => {
|
||||||
|
if (x && x.constructor == ObjectId) return { $oid: x.toString() };
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function readCursor(cursor, options) {
|
async function readCursor(cursor, options) {
|
||||||
|
Loading…
Reference in New Issue
Block a user