diff --git a/packages/web/src/appobj/DatabaseObjectAppObject.svelte b/packages/web/src/appobj/DatabaseObjectAppObject.svelte index 521789cd..4202837c 100644 --- a/packages/web/src/appobj/DatabaseObjectAppObject.svelte +++ b/packages/web/src/appobj/DatabaseObjectAppObject.svelte @@ -61,11 +61,11 @@ }, { label: 'SQL: CREATE TABLE', - sqlTemplate: 'CREATE TABLE', + scriptTemplate: 'CREATE TABLE', }, { label: 'SQL: SELECT', - sqlTemplate: 'SELECT', + scriptTemplate: 'SELECT', }, { label: 'SQL Generator: CREATE TABLE', @@ -123,15 +123,15 @@ }, { label: 'SQL: CREATE VIEW', - sqlTemplate: 'CREATE OBJECT', + scriptTemplate: 'CREATE OBJECT', }, { label: 'SQL: CREATE TABLE', - sqlTemplate: 'CREATE TABLE', + scriptTemplate: 'CREATE TABLE', }, { label: 'SQL: SELECT', - sqlTemplate: 'SELECT', + scriptTemplate: 'SELECT', }, { label: 'SQL Generator: CREATE VIEW', @@ -149,11 +149,11 @@ procedures: [ { label: 'SQL: CREATE PROCEDURE', - sqlTemplate: 'CREATE OBJECT', + scriptTemplate: 'CREATE OBJECT', }, { label: 'SQL: EXECUTE', - sqlTemplate: 'EXECUTE PROCEDURE', + scriptTemplate: 'EXECUTE PROCEDURE', }, { label: 'SQL Generator: CREATE PROCEDURE', @@ -171,7 +171,7 @@ functions: [ { label: 'SQL: CREATE FUNCTION', - sqlTemplate: 'CREATE OBJECT', + scriptTemplate: 'CREATE OBJECT', }, { label: 'SQL Generator: CREATE FUNCTION', @@ -211,7 +211,7 @@ export async function openDatabaseObjectDetail( tabComponent, - sqlTemplate, + scriptTemplate, { schemaName, pureName, conid, database, objectTypeField }, forceNewTab, initialData @@ -224,17 +224,17 @@ openNewTab( { - title: sqlTemplate ? 'Query #' : pureName, + title: scriptTemplate ? 'Query #' : pureName, tooltip, - icon: sqlTemplate ? 'img sql-file' : icons[objectTypeField], - tabComponent: sqlTemplate ? 'QueryTab' : tabComponent, + icon: scriptTemplate ? 'img sql-file' : icons[objectTypeField], + tabComponent: scriptTemplate ? 'QueryTab' : tabComponent, props: { schemaName, pureName, conid, database, objectTypeField, - initialArgs: sqlTemplate ? { sqlTemplate } : null, + initialArgs: scriptTemplate ? { scriptTemplate } : null, }, }, initialData, @@ -387,7 +387,7 @@ database: data.database, }); } else { - openDatabaseObjectDetail(menu.tab, menu.sqlTemplate, data, menu.forceNewTab, menu.initialData); + openDatabaseObjectDetail(menu.tab, menu.scriptTemplate, data, menu.forceNewTab, menu.initialData); } }, }; diff --git a/packages/web/src/tabs/QueryTab.svelte b/packages/web/src/tabs/QueryTab.svelte index 2a87a9e7..9c981cdf 100644 --- a/packages/web/src/tabs/QueryTab.svelte +++ b/packages/web/src/tabs/QueryTab.svelte @@ -40,7 +40,7 @@ import SqlEditor from '../query/SqlEditor.svelte'; import useEditorData from '../query/useEditorData'; import { extensions } from '../stores'; - import applySqlTemplate from '../utility/applySqlTemplate'; + import applyScriptTemplate from '../utility/applyScriptTemplate'; import axiosInstance from '../utility/axiosInstance'; import { changeTab } from '../utility/common'; import { getDatabaseInfo, useConnectionInfo } from '../utility/metadataLoaders'; @@ -207,8 +207,8 @@ const { editorState, editorValue, setEditorData } = useEditorData({ tabid, loadFromArgs: - initialArgs && initialArgs.sqlTemplate - ? () => applySqlTemplate(initialArgs.sqlTemplate, $extensions, $$props) + initialArgs && initialArgs.scriptTemplate + ? () => applyScriptTemplate(initialArgs.scriptTemplate, $extensions, $$props) : null, }); diff --git a/packages/web/src/utility/applySqlTemplate.ts b/packages/web/src/utility/applyScriptTemplate.ts similarity index 85% rename from packages/web/src/utility/applySqlTemplate.ts rename to packages/web/src/utility/applyScriptTemplate.ts index 5f16040e..083de618 100644 --- a/packages/web/src/utility/applySqlTemplate.ts +++ b/packages/web/src/utility/applyScriptTemplate.ts @@ -11,11 +11,11 @@ async function generateTableSql(extensions, props, dumpProc, format = false) { return format ? sqlFormatter.format(dmp.s) : dmp.s; } -export default async function applySqlTemplate(sqlTemplate, extensions, props) { - if (sqlTemplate == 'CREATE TABLE') { +export default async function applyScriptTemplate(scriptTemplate, extensions, props) { + if (scriptTemplate == 'CREATE TABLE') { return generateTableSql(extensions, props, (dmp, tableInfo) => dmp.createTable(tableInfo)); } - if (sqlTemplate == 'SELECT') { + if (scriptTemplate == 'SELECT') { return generateTableSql( extensions, props, @@ -29,14 +29,14 @@ export default async function applySqlTemplate(sqlTemplate, extensions, props) { true ); } - if (sqlTemplate == 'CREATE OBJECT') { + if (scriptTemplate == 'CREATE OBJECT') { const objectInfo = await getSqlObjectInfo(props); if (objectInfo) { if (objectInfo.requiresFormat && objectInfo.createSql) return sqlFormatter.format(objectInfo.createSql); else return objectInfo.createSql; } } - if (sqlTemplate == 'EXECUTE PROCEDURE') { + if (scriptTemplate == 'EXECUTE PROCEDURE') { const procedureInfo = await getSqlObjectInfo(props); const connection = await getConnectionInfo(props);