(columns []string)
| 209 | } |
| 210 | |
| 211 | func (g *generator) findDisjointUniqueKey(columns []string) ([]string, error) { |
| 212 | columnMap := make(map[string]bool) |
| 213 | for _, column := range columns { |
| 214 | columnMap[column] = true |
| 215 | } |
| 216 | if g.pk != nil { |
| 217 | if disjoint(g.pk.GetProto().Expressions, columnMap) { |
| 218 | return g.pk.GetProto().Expressions, nil |
| 219 | } |
| 220 | } |
| 221 | for _, index := range g.table.GetProto().Indexes { |
| 222 | if index.Primary { |
| 223 | continue |
| 224 | } |
| 225 | if !index.Unique { |
| 226 | continue |
| 227 | } |
| 228 | if strings.Contains(index.Type, "FUNCTION-BASED") { |
| 229 | continue |
| 230 | } |
| 231 | if disjoint(index.Expressions, columnMap) { |
| 232 | return index.Expressions, nil |
| 233 | } |
| 234 | } |
| 235 | return nil, errors.Errorf("no disjoint unique key found for %s.%s", g.originalDatabase, g.originalTable) |
| 236 | } |
| 237 | |
| 238 | func (g *generator) generateUpdate(stmt *oracleast.UpdateStmt) error { |
| 239 | updateColumns := extractOmniUpdateColumns(stmt) |
no test coverage detected