mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 20:43:58 +00:00
SYNC: INSERT SQL template
This commit is contained in:
committed by
Diflow
parent
191c25a26b
commit
f81207737c
@@ -52,6 +52,23 @@ export default async function applyScriptTemplate(
|
|||||||
connectionInfo
|
connectionInfo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (scriptTemplate == 'INSERT') {
|
||||||
|
return generateTableSql(
|
||||||
|
extensions,
|
||||||
|
props,
|
||||||
|
(dmp, tableInfo) => {
|
||||||
|
dmp.put(
|
||||||
|
'^insert ^into %f (%,i) ^values (%,v)',
|
||||||
|
tableInfo,
|
||||||
|
tableInfo.columns.map(x => x.columnName),
|
||||||
|
tableInfo.columns.map(x => null)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
dbinfo,
|
||||||
|
connectionInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
if (scriptTemplate == 'CREATE OBJECT') {
|
if (scriptTemplate == 'CREATE OBJECT') {
|
||||||
const objectInfo = dbinfo ? extractDbObjectInfo(dbinfo, props) : await getSqlObjectInfo(props);
|
const objectInfo = dbinfo ? extractDbObjectInfo(dbinfo, props) : await getSqlObjectInfo(props);
|
||||||
if (objectInfo) {
|
if (objectInfo) {
|
||||||
@@ -95,6 +112,7 @@ export function getSupportedScriptTemplates(objectTypeField: string): { label: s
|
|||||||
return [
|
return [
|
||||||
{ label: 'CREATE TABLE', scriptTemplate: 'CREATE TABLE' },
|
{ label: 'CREATE TABLE', scriptTemplate: 'CREATE TABLE' },
|
||||||
{ label: 'SELECT', scriptTemplate: 'SELECT' },
|
{ label: 'SELECT', scriptTemplate: 'SELECT' },
|
||||||
|
{ label: 'INSERT', scriptTemplate: 'INSERT' },
|
||||||
];
|
];
|
||||||
case 'views':
|
case 'views':
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user