mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 02:16:02 +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
|
||||
);
|
||||
}
|
||||
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') {
|
||||
const objectInfo = dbinfo ? extractDbObjectInfo(dbinfo, props) : await getSqlObjectInfo(props);
|
||||
if (objectInfo) {
|
||||
@@ -95,6 +112,7 @@ export function getSupportedScriptTemplates(objectTypeField: string): { label: s
|
||||
return [
|
||||
{ label: 'CREATE TABLE', scriptTemplate: 'CREATE TABLE' },
|
||||
{ label: 'SELECT', scriptTemplate: 'SELECT' },
|
||||
{ label: 'INSERT', scriptTemplate: 'INSERT' },
|
||||
];
|
||||
case 'views':
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user