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.core.json.Converters;
import net.snowflake.client.jdbc.ErrorCode;
import net.snowflake.client.jdbc.SFBaseFileTransferAgent;
import net.snowflake.client.jdbc.SFBaseFileTransferAgent.CommandType;
import net.snowflake.client.jdbc.SnowflakeFixedView;
import net.snowflake.client.jdbc.SnowflakeLoggedFeatureNotSupportedException;
import net.snowflake.client.jdbc.SnowflakeSQLException;
import net.snowflake.client.jdbc.SnowflakeSQLLoggedException;
import net.snowflake.client.log.SFLogger;
import net.snowflake.client.log.SFLoggerFactory;
import net.snowflake.common.core.SFBinaryFormat;
import net.snowflake.common.core.SqlState;
/**
* Fixed view result set. This class iterates through any fixed view implementation and return the
* objects as rows
*/
// Works only for strings, numbers, etc, does not work for timestamps, dates, times etc.
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 {
super(
null,
new Converters(
null,
new SFSession(),
0,
false,
false,
false,
false,
SFBinaryFormat.BASE64,
null,
null,
null,
null,
null));
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(
queryID,
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.trace("next called", false);
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy