5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-20 19:00:48 +08:00

SQOOP-2130: BaseSqoopTestCase should use manager.escapeTable instead of directly hardcoding double quotes

(Jarek Jarcec Cecho via Abraham Elmahrek)
This commit is contained in:
Abraham Elmahrek 2015-02-24 18:07:45 -08:00
parent 1c3d0efe2f
commit 653668f0f6

View File

@ -281,7 +281,7 @@ protected String getColName(int i) {
protected void dropTableIfExists(String table) throws SQLException {
Connection conn = getManager().getConnection();
PreparedStatement statement = conn.prepareStatement(
"DROP TABLE \"" + table + "\" IF EXISTS",
"DROP TABLE " + manager.escapeTableName(table) + " IF EXISTS",
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
try {
statement.executeUpdate();
@ -322,7 +322,7 @@ protected void createTableWithColTypesAndNames(String[] colNames,
}
}
createTableStr = "CREATE TABLE \"" + getTableName() + "\"(" + columnDefStr + ")";
createTableStr = "CREATE TABLE " + manager.escapeTableName(getTableName()) + "(" + columnDefStr + ")";
LOG.info("Creating table: " + createTableStr);
statement = conn.prepareStatement(
createTableStr,
@ -356,7 +356,7 @@ protected void createTableWithColTypesAndNames(String[] colNames,
}
}
try {
String insertValsStr = "INSERT INTO \"" + getTableName() + "\"(" + columnListStr + ")"
String insertValsStr = "INSERT INTO " + manager.escapeTableName(getTableName()) + "(" + columnListStr + ")"
+ " VALUES(" + valueListStr + ")";
LOG.info("Inserting values: " + insertValsStr);
statement = conn.prepareStatement(