5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-05 04:50:47 +08:00

SQOOP-2833: Sqoop2: Integration Tests: Allow setting which "time type" should be used based on the DatabaseProvider

(Abraham Fine via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2016-02-29 12:32:35 -08:00
parent e06190b2f8
commit d6a24fc0b8
5 changed files with 23 additions and 2 deletions

View File

@ -513,4 +513,15 @@ public String getTableFragment(TableName tableName) {
*/ */
public void dropDatabase(String databaseName) { public void dropDatabase(String databaseName) {
} }
/**
* Different databases handle datetimes/timestamps in different ways.
*
* This is the type we should use when creating schemas.
*
* @return A string representing a SQL datatype
*/
public String getDateTimeType() {
return "timestamp";
}
} }

View File

@ -116,4 +116,9 @@ public String escapeName(String entity) {
public String escapeValue(String entity) { public String escapeValue(String entity) {
return "\'" + entity + "\'"; return "\'" + entity + "\'";
} }
@Override
public String getDateTimeType() {
return "datetime";
}
} }

View File

@ -90,4 +90,9 @@ public String getJdbcDriver() {
public String escape(String entity) { public String escape(String entity) {
return "[" + entity + "]"; return "[" + entity + "]";
} }
@Override
public String getDateTimeType() {
return "datetime";
}
} }

View File

@ -38,7 +38,7 @@ public DataSet createTables() {
"id", "id",
"id", "int", "id", "int",
"country", "varchar(50)", "country", "varchar(50)",
"some_date", "timestamp", "some_date", provider.getDateTimeType(),
"city", "varchar(50)" "city", "varchar(50)"
); );

View File

@ -41,7 +41,7 @@ public DataSet createTables() {
"id", "int", "id", "int",
"code_name", "varchar(64)", "code_name", "varchar(64)",
"version", "numeric(4,2)", "version", "numeric(4,2)",
"release_date", "timestamp" "release_date", provider.getDateTimeType()
); );
return this; return this;