src/main/java/org/embulk/input/jdbc/getter/StringColumnGetter.java in embulk-input-jdbc-0.7.2 vs src/main/java/org/embulk/input/jdbc/getter/StringColumnGetter.java in embulk-input-jdbc-0.7.3
- old
+ new
@@ -1,9 +1,11 @@
package org.embulk.input.jdbc.getter;
import java.sql.ResultSet;
+import java.sql.PreparedStatement;
import java.sql.SQLException;
+import com.fasterxml.jackson.databind.JsonNode;
import org.embulk.spi.Column;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.json.JsonParseException;
import org.embulk.spi.json.JsonParser;
import org.embulk.spi.type.Type;
@@ -77,6 +79,18 @@
public void stringColumn(Column column)
{
to.setString(column, value);
}
+ @Override
+ public JsonNode encodeToJson()
+ {
+ return jsonNodeFactory.textNode(value);
+ }
+
+ @Override
+ public void decodeFromJsonTo(PreparedStatement toStatement, int toIndex, JsonNode fromValue)
+ throws SQLException
+ {
+ toStatement.setString(toIndex, fromValue.asText());
+ }
}