mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
@@ -63,6 +63,7 @@
|
||||
"sass": "^1.83.4",
|
||||
"typescript": "^5.7.3",
|
||||
"vite": "^6.0.7",
|
||||
"vite-plugin-progress": "0.0.7",
|
||||
"vue-eslint-parser": "^9.4.3"
|
||||
},
|
||||
"browserslist": [
|
||||
|
||||
@@ -3,6 +3,7 @@ import { resolve } from 'path';
|
||||
import type { UserConfig } from 'vite';
|
||||
import { loadEnv } from './src/common/utils/viteBuild';
|
||||
import { CodeInspectorPlugin } from 'code-inspector-plugin';
|
||||
import progress from 'vite-plugin-progress';
|
||||
|
||||
const pathResolve = (dir: string): any => {
|
||||
return resolve(__dirname, '.', dir);
|
||||
@@ -21,6 +22,7 @@ const viteConfig: UserConfig = {
|
||||
bundler: 'vite',
|
||||
editor: VITE_EDITOR as any,
|
||||
}),
|
||||
progress(),
|
||||
],
|
||||
root: process.cwd(),
|
||||
resolve: {
|
||||
|
||||
@@ -348,7 +348,9 @@ func (d *dbAppImpl) DumpDb(ctx context.Context, reqParam *dto.DumpDb) error {
|
||||
}
|
||||
|
||||
beforeInsert := dumpHelper.BeforeInsertSql(quoteSchema, quoteTableName)
|
||||
writer.WriteString(beforeInsert)
|
||||
if beforeInsert != "" {
|
||||
writer.WriteString(beforeInsert)
|
||||
}
|
||||
insertSql := targetSqlGenerator.GenInsert(tableName, columns, rows, dbi.DuplicateStrategyNone)
|
||||
if _, err := writer.WriteString(strings.Join(insertSql, ";\n") + ";\n"); err != nil {
|
||||
return err
|
||||
@@ -364,14 +366,12 @@ func (d *dbAppImpl) DumpDb(ctx context.Context, reqParam *dto.DumpDb) error {
|
||||
|
||||
if len(rows) > 0 {
|
||||
beforeInsert := dumpHelper.BeforeInsertSql(quoteSchema, quoteTableName)
|
||||
writer.WriteString(beforeInsert)
|
||||
sqls := targetSqlGenerator.GenInsert(tableName, columns, rows, dbi.DuplicateStrategyNone)
|
||||
|
||||
for _, sqlStr := range sqls {
|
||||
_, err := writer.WriteString(sqlStr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if beforeInsert != "" {
|
||||
writer.WriteString(beforeInsert)
|
||||
}
|
||||
insertSql := targetSqlGenerator.GenInsert(tableName, columns, rows, dbi.DuplicateStrategyNone)
|
||||
if _, err := writer.WriteString(strings.Join(insertSql, ";\n") + ";\n"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
)
|
||||
|
||||
type DumpHelper struct {
|
||||
dbi.DefaultDumpHelper
|
||||
}
|
||||
|
||||
func (dh *DumpHelper) BeforeInsert(writer io.Writer, tableName string) {
|
||||
@@ -16,7 +17,3 @@ func (dh *DumpHelper) BeforeInsert(writer io.Writer, tableName string) {
|
||||
func (dh *DumpHelper) BeforeInsertSql(quoteSchema string, tableName string) string {
|
||||
return fmt.Sprintf("set identity_insert %s on;", tableName)
|
||||
}
|
||||
|
||||
func (dh *DumpHelper) AfterInsert(writer io.Writer, tableName string, columns []dbi.Column) {
|
||||
writer.Write([]byte("COMMIT;\n"))
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ func (sg *SQLGenerator) GenInsert(tableName string, columns []dbi.Column, values
|
||||
// 达梦数据库只能一条条的执行insert语句,所以这里需要将values拆分成多条insert语句
|
||||
sqls := collx.ArrayMap(values, func(value []any) string {
|
||||
columnStr, valuesStrs := dbi.GenInsertSqlColumnAndValues(sg.Dialect, DbTypeDM, columns, [][]any{value})
|
||||
return fmt.Sprintf("insert into %s %s values %s ;", quote(tableName), columnStr, valuesStrs[0])
|
||||
return fmt.Sprintf("insert into %s %s values %s", quote(tableName), columnStr, valuesStrs[0])
|
||||
})
|
||||
|
||||
res = append(res, sqls...)
|
||||
|
||||
@@ -52,7 +52,7 @@ func (md *MysqlDialect) Quoter() dbi.Quoter {
|
||||
return mysqlQuoter
|
||||
}
|
||||
|
||||
func (pd *MysqlDialect) GetSQLParser() sqlparser.SqlParser {
|
||||
func (md *MysqlDialect) GetSQLParser() sqlparser.SqlParser {
|
||||
return new(mysql.MysqlParser)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user