基于serf的数据库同步模块库
chenshijun
2019-09-04 2047ae9b11d66b33010c76bc2bd1db5a5458b921
Merge branch 'master' of ssh://192.168.1.14:29418/syncdb
1个文件已修改
13 ■■■■■ 已修改文件
dbself.go 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dbself.go
@@ -164,10 +164,23 @@
            for _,col :=range tDescArr {
                columnNames = append(columnNames, fmt.Sprintf(`'||quote("%s")||'`, col.Name))
            }
            if table == "dbTables" {
                tSql = fmt.Sprintf(`SELECT 'INSERT INTO "%s" VALUES(%s)' as sql FROM "%s" where (analyServerId='' or analyServerId is NULL);`,
                    table,
                    strings.Join(columnNames, ","),
                    table)
            } else if table == "dbtablepersons" {
                tSql = fmt.Sprintf(`SELECT 'INSERT INTO "%s" VALUES(%s)' as sql FROM "%s" where tableId in (select id from dbTables where (analyServerId='' or analyServerId is NULL));`,
                    table,
                    strings.Join(columnNames, ","),
                    table)
            } else {
            tSql = fmt.Sprintf(`SELECT 'INSERT INTO "%s" VALUES(%s)' as sql FROM "%s";`,
                table,
                strings.Join(columnNames, ","),
                table)
            }
            fmt.Println("tSql:",tSql)
            err = localDb.Raw(tSql).Scan(&dumpSql).Error