net.snowflake.client.core.SFFixedViewResultSet Maven / Gradle / Ivy
/*
* Copyright (c) 2012-2018 Snowflake Computing Inc. All rights reserved.
*/
package net.snowflake.client.core;
import net.snowflake.client.jdbc.ErrorCode;
import net.snowflake.client.jdbc.SnowflakeFileTransferAgent.CommandType;
import net.snowflake.client.jdbc.SnowflakeFixedView;
import net.snowflake.client.jdbc.SnowflakeSQLException;
import net.snowflake.common.core.SqlState;
import java.util.List;
import net.snowflake.client.log.SFLogger;
import net.snowflake.client.log.SFLoggerFactory;
/**
* Fixed view result set. This class iterates through any fixed view
* implementation and return the objects as rows
*
* @author jhuang
*/
public class SFFixedViewResultSet extends SFBaseResultSet
{
static final SFLogger logger = SFLoggerFactory.getLogger(
SFFixedViewResultSet.class);
private SnowflakeFixedView fixedView;
private Object[] nextRow = null;
private final CommandType commandType;
public SFFixedViewResultSet(SnowflakeFixedView fixedView,
CommandType commandType)
throws SnowflakeSQLException
{
this.fixedView = fixedView;
this.commandType = commandType;
try
{
resultSetMetaData
= new SFResultSetMetaData(fixedView.describeColumns(), session,
timestampNTZFormatter,
timestampLTZFormatter,
timestampTZFormatter,
dateFormatter,
timeFormatter);
}
catch (Exception ex)
{
throw new SnowflakeSQLException(ex, SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
"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");
List