net.snowflake.client.core.SFFixedViewResultSet Maven / Gradle / Ivy
/*
* Copyright (c) 2012-2019 Snowflake Computing Inc. All rights reserved.
*/
package net.snowflake.client.core;
import java.sql.SQLException;
import java.util.List;
import net.snowflake.client.jdbc.*;
import net.snowflake.client.jdbc.SFBaseFileTransferAgent.CommandType;
import net.snowflake.client.log.SFLogger;
import net.snowflake.client.log.SFLoggerFactory;
import net.snowflake.common.core.SqlState;
/**
* Fixed view result set. This class iterates through any fixed view implementation and return the
* objects as rows
*/
public class SFFixedViewResultSet extends SFJsonResultSet {
private static final SFLogger logger = SFLoggerFactory.getLogger(SFFixedViewResultSet.class);
private SnowflakeFixedView fixedView;
private Object[] nextRow = null;
private final CommandType commandType;
private final String queryID;
public SFFixedViewResultSet(SnowflakeFixedView fixedView, CommandType commandType, String queryID)
throws SnowflakeSQLException {
this.fixedView = fixedView;
this.commandType = commandType;
this.queryID = queryID;
try {
resultSetMetaData =
new SFResultSetMetaData(
fixedView.describeColumns(session),
session,
timestampNTZFormatter,
timestampLTZFormatter,
timestampTZFormatter,
dateFormatter,
timeFormatter);
} catch (Exception ex) {
throw new SnowflakeSQLLoggedException(
session,
SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
ex,
"Failed to describe fixed view: " + fixedView.getClass().getName());
}
}
/**
* Advance to next row
*
* @return true if next row exists, false otherwise
* @throws net.snowflake.client.core.SFException if failed to get next row
*/
@Override
public boolean next() throws SFException {
logger.debug("next called", false);
List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy