NIFI-5342 CaptureChangeMySQL didn't escape database name

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes #2923
This commit is contained in:
uday 2018-07-22 00:50:05 +05:30 committed by Matthew Burgess
parent 44face10bf
commit e97ae921f7
1 changed files with 2 additions and 2 deletions

View File

@ -1000,8 +1000,8 @@ public class CaptureChangeMySQL extends AbstractSessionFactoryProcessor {
TableInfo tableInfo = null;
if (jdbcConnection != null) {
try (Statement s = jdbcConnection.createStatement()) {
s.execute("USE " + key.getDatabaseName());
ResultSet rs = s.executeQuery("SELECT * FROM " + key.getTableName() + " LIMIT 0");
s.execute("USE `" + key.getDatabaseName() + "`");
ResultSet rs = s.executeQuery("SELECT * FROM `" + key.getTableName() + "` LIMIT 0");
ResultSetMetaData rsmd = rs.getMetaData();
int numCols = rsmd.getColumnCount();
List<ColumnDefinition> columnDefinitions = new ArrayList<>();