Skip to content

Commit

Permalink
update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
funky-eyes committed Feb 19, 2024
1 parent f11c64d commit 20039b9
Showing 1 changed file with 0 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,33 +376,4 @@ public void testGetUpdateColumns_2() {
}
}

@Test
public void testGetWhereColumns() {
String sql = "UPDATE t1 SET name1 = 'name1', name2 = 'name2' WHERE t1.id between ? and ? or `name1`= ? and name2= ?";

SQLStatement statement = getSQLStatement(sql);

MySQLUpdateRecognizer mySQLUpdateRecognizer = new MySQLUpdateRecognizer(sql, statement);
List<String> whereColumns = mySQLUpdateRecognizer.getWhereColumns();
Assertions.assertEquals("id", whereColumns.get(0));
Assertions.assertEquals("name1", whereColumns.get(1));
Assertions.assertEquals("name2", whereColumns.get(2));
sql = "UPDATE t1 SET name1 = 'name1', name2 = 'name2' WHERE id between ? and ?";

statement = getSQLStatement(sql);

mySQLUpdateRecognizer = new MySQLUpdateRecognizer(sql, statement);
whereColumns = mySQLUpdateRecognizer.getWhereColumns();
Assertions.assertEquals("id", whereColumns.get(0));

sql = "UPDATE t1 SET name1 = 'name1', name2 = 'name2' WHERE id in(?,? ) and createTime between ? and ?";

statement = getSQLStatement(sql);

mySQLUpdateRecognizer = new MySQLUpdateRecognizer(sql, statement);
whereColumns = mySQLUpdateRecognizer.getWhereColumns();
Assertions.assertEquals("id", whereColumns.get(0));
Assertions.assertEquals("createTime", whereColumns.get(1));
}

}

0 comments on commit 20039b9

Please sign in to comment.