private String printAsJson()

in asterixdb-jdbc/asterix-jdbc-core/src/main/java/org/apache/asterix/jdbc/core/ADBRowStore.java [1036:1056]


    private String printAsJson(Object value) throws SQLException {
        if (jsonGenBuffer == null) {
            jsonGenBuffer = new StringWriter();
            try {
                //TODO:FIXME:need to configure generator to print java.sql.Date/Times properly
                jsonGen = resultSet.metadata.statement.connection.protocol.getDriverContext().getGenericObjectWriter()
                        .getFactory().createGenerator(jsonGenBuffer);
            } catch (IOException e) {
                throw getErrorReporter().errorInResultHandling(e);
            }
        }
        try {
            jsonGen.writeObject(value);
            jsonGen.flush();
            return jsonGenBuffer.getBuffer().toString();
        } catch (IOException e) {
            throw getErrorReporter().errorInResultHandling(e);
        } finally {
            jsonGenBuffer.getBuffer().setLength(0);
        }
    }