(t *testing.T)
| 642 | } |
| 643 | |
| 644 | func TestBuildTwoColumnUnionParts(t *testing.T) { |
| 645 | rangeStartArgs := []interface{}{3, 17} |
| 646 | rangeEndArgs := []interface{}{103, 117} |
| 647 | part1, part2, part3, explodedArgs := buildTwoColumnUnionParts( |
| 648 | "name, position", "mydb.tbl", |
| 649 | "name", "position", |
| 650 | "?", "?", "?", "?", |
| 651 | ">=", "order by name asc, position asc limit 500", |
| 652 | rangeStartArgs, rangeEndArgs, |
| 653 | ) |
| 654 | require.Equal(t, normalizeQuery("(select name, position from mydb.tbl where name = ? and position >= ? order by name asc, position asc limit 500)"), normalizeQuery(part1)) |
| 655 | require.Equal(t, normalizeQuery("(select name, position from mydb.tbl where name > ? and name < ? order by name asc, position asc limit 500)"), normalizeQuery(part2)) |
| 656 | require.Equal(t, normalizeQuery("(select name, position from mydb.tbl where name = ? and position <= ? order by name asc, position asc limit 500)"), normalizeQuery(part3)) |
| 657 | // Args follow the column order each subquery binds: (start1, start2), (start1, end1), (end1, end2). |
| 658 | require.Equal(t, []interface{}{3, 17, 3, 103, 103, 117}, explodedArgs) |
| 659 | } |
| 660 | |
| 661 | func TestBuildRangeInsertQueryTwoColumnGuards(t *testing.T) { |
| 662 | databaseName := "mydb" |
nothing calls this directly
no test coverage detected
searching dependent graphs…