in v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/dbutils/dml/MySQLDMLGenerator.java [384:436]
private static String getColumnValueByType(
String columnType, String colValue, String sourceDbTimezoneOffset, String spannerColType) {
String response = "";
String cleanedNullBytes = "";
String decodedString = "";
switch (columnType) {
case "varchar":
case "char":
case "text":
case "tinytext":
case "mediumtext":
case "longtext":
case "enum":
case "date":
case "time":
case "year":
case "set":
case "json":
case "geometry":
case "geometrycollection":
case "point":
case "multipoint":
case "linestring":
case "multilinestring":
case "polygon":
case "multipolygon":
case "tinyblob":
case "mediumblob":
case "blob":
case "longblob":
response = getQuotedEscapedString(colValue, spannerColType);
break;
case "timestamp":
case "datetime":
colValue = colValue.substring(0, colValue.length() - 1); // trim the Z for mysql
response =
" CONVERT_TZ("
+ getQuotedEscapedString(colValue, spannerColType)
+ ",'+00:00','"
+ sourceDbTimezoneOffset
+ "')";
break;
case "binary":
case "varbinary":
case "bit":
response = getBinaryString(colValue, spannerColType);
break;
default:
response = colValue;
}
return response;
}