public class ResultUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ResultUtil.ResultInput |
static class |
ResultUtil.ResultOutput |
| Constructor and Description |
|---|
ResultUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Timestamp |
adjustTimestamp(Timestamp timestamp)
Adjust timestamp for dates before 1582-10-05
|
static long |
calculateMilliToAdjust(Date date)
For dates before 1582-10-05, calculate the number of millis to adjust.
|
static int |
calculateUpdateCount(ResultSet resultSet,
long statementTypeId) |
static boolean |
getBoolean(String str)
Converst snowflake bool to java boolean
|
static String |
getBooleanAsString(boolean bool)
Convert a boolean to a string
|
static Date |
getDate(String str,
TimeZone tz,
SFSession session)
Convert a date internal object to a Date object in specified timezone.
|
static String |
getDateAsString(Date date,
com.snowflake.gscommon.core.SnowflakeDateTimeFormat dateFormatter)
Convert a date value into a string
|
static com.snowflake.gscommon.core.SFTime |
getSFTime(String obj,
int scale,
SFSession session)
Convert a time internal value (scaled number of seconds + fractional
seconds) into an SFTime.
|
static String |
getSFTimeAsString(com.snowflake.gscommon.core.SFTime sft,
int scale,
com.snowflake.gscommon.core.SnowflakeDateTimeFormat timeFormatter)
Convert a time value into a string
|
static com.snowflake.gscommon.core.SFTimestamp |
getSFTimestamp(String timestampStr,
int scale,
int internalColumnType,
long resultVersion,
TimeZone sessionTZ,
SFSession session)
Convert a timestamp internal value (scaled number of seconds + fractional
seconds) into a SFTimestamp.
|
static String |
getSFTimestampAsString(com.snowflake.gscommon.core.SFTimestamp sfTS,
int columnType,
int scale,
com.snowflake.gscommon.core.SnowflakeDateTimeFormat timestampNTZFormatter,
com.snowflake.gscommon.core.SnowflakeDateTimeFormat timestampLTZFormatter,
com.snowflake.gscommon.core.SnowflakeDateTimeFormat timestampTZFormatter,
SFSession session)
Convert a SFTimestamp to a string value.
|
static ResultUtil.ResultOutput |
processResult(ResultUtil.ResultInput resultData)
A common helper to process result response
|
public static ResultUtil.ResultOutput processResult(ResultUtil.ResultInput resultData) throws SnowflakeSQLException
resultData - wrapper object over simple json resultSnowflakeSQLException - if failed to get number of columnspublic static Timestamp adjustTimestamp(Timestamp timestamp)
timestamp - needs to be adjustedpublic static long calculateMilliToAdjust(Date date)
date - date before 1582-10-05public static com.snowflake.gscommon.core.SFTimestamp getSFTimestamp(String timestampStr, int scale, int internalColumnType, long resultVersion, TimeZone sessionTZ, SFSession session) throws SFException
timestampStr - timestamp objectscale - timestamp scaleinternalColumnType - snowflake timestamp typeresultVersion - For new result version, timestamp with timezone is formatted as
the seconds since epoch with fractional part in the decimal followed
by time zone index. E.g.: "123.456 1440". Here 123.456 is the * number
of seconds since epoch and 1440 is the timezone index.sessionTZ - session timezonesession - session objectSFException - if timestampStr is an invalid timestamppublic static com.snowflake.gscommon.core.SFTime getSFTime(String obj, int scale, SFSession session) throws SFException
obj - time objectscale - time scalesession - session objectSFException - if time is invalidpublic static String getSFTimeAsString(com.snowflake.gscommon.core.SFTime sft, int scale, com.snowflake.gscommon.core.SnowflakeDateTimeFormat timeFormatter)
sft - snowflake time objectscale - time scaletimeFormatter - time formatterpublic static String getBooleanAsString(boolean bool)
bool - booleanpublic static String getSFTimestampAsString(com.snowflake.gscommon.core.SFTimestamp sfTS, int columnType, int scale, com.snowflake.gscommon.core.SnowflakeDateTimeFormat timestampNTZFormatter, com.snowflake.gscommon.core.SnowflakeDateTimeFormat timestampLTZFormatter, com.snowflake.gscommon.core.SnowflakeDateTimeFormat timestampTZFormatter, SFSession session) throws SFException
sfTS - snowflake timestamp objectcolumnType - internal snowflake tscale - timestamp scaletimestampNTZFormatter - snowflake timestamp ntz formattimestampLTZFormatter - snowflake timestamp ltz formattimestampTZFormatter - snowflake timestamp tz formatsession - session objectSFException - timestamp format is missingpublic static String getDateAsString(Date date, com.snowflake.gscommon.core.SnowflakeDateTimeFormat dateFormatter)
date - date will be converteddateFormatter - date formatpublic static Date getDate(String str, TimeZone tz, SFSession session) throws SFException
str - snowflake date objecttz - timezone we want convert tosession - snowflake session objectSFException - if date is invalidpublic static boolean getBoolean(String str)
str - public static int calculateUpdateCount(ResultSet resultSet, long statementTypeId) throws SQLException
SQLExceptionCopyright © 2016. All rights reserved.