Used the source column definition to fetch and convert insert values

When processing binlog insert statements, we want to use `sharedColumns`
to decide which values to fetch and convert from the insert DML event.

We only want to  `mappedShareColumns` to define the column names in the
`replace into ...` statement.
This commit is contained in:
Paulo Bittencourt 2016-09-14 11:07:36 -04:00
parent 25b5474cfa
commit 2f80c9d424

View File

@ -344,7 +344,7 @@ func BuildDMLInsertQuery(databaseName, tableName string, tableColumns, sharedCol
databaseName = EscapeName(databaseName) databaseName = EscapeName(databaseName)
tableName = EscapeName(tableName) tableName = EscapeName(tableName)
for _, column := range mappedSharedColumns.Columns() { for _, column := range sharedColumns.Columns() {
tableOrdinal := tableColumns.Ordinals[column.Name] tableOrdinal := tableColumns.Ordinals[column.Name]
arg := column.convertArg(args[tableOrdinal]) arg := column.convertArg(args[tableOrdinal])
sharedArgs = append(sharedArgs, arg) sharedArgs = append(sharedArgs, arg)