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 Date |
adjustDate(Date date)
Adjust date for before 1582-10-05
|
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,
net.snowflake.common.core.SnowflakeDateTimeFormat dateFormatter)
Convert a date value into a string
|
static net.snowflake.common.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(net.snowflake.common.core.SFTime sft,
int scale,
net.snowflake.common.core.SnowflakeDateTimeFormat timeFormatter)
Convert a time value into a string
|
static net.snowflake.common.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(net.snowflake.common.core.SFTimestamp sfTS,
int columnType,
int scale,
net.snowflake.common.core.SnowflakeDateTimeFormat timestampNTZFormatter,
net.snowflake.common.core.SnowflakeDateTimeFormat timestampLTZFormatter,
net.snowflake.common.core.SnowflakeDateTimeFormat timestampTZFormatter,
SFSession session)
Convert a SFTimestamp to a string value.
|
static int |
listSearchCaseInsensitive(List<String> source,
String target)
Given a list of String, do a case insensitive search for target string
Used by resultsetMetadata to search for target column name
|
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 net.snowflake.common.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 net.snowflake.common.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(net.snowflake.common.core.SFTime sft, int scale, net.snowflake.common.core.SnowflakeDateTimeFormat timeFormatter)
sft - snowflake time objectscale - time scaletimeFormatter - time formatterpublic static String getBooleanAsString(boolean bool)
bool - booleanpublic static String getSFTimestampAsString(net.snowflake.common.core.SFTimestamp sfTS, int columnType, int scale, net.snowflake.common.core.SnowflakeDateTimeFormat timestampNTZFormatter, net.snowflake.common.core.SnowflakeDateTimeFormat timestampLTZFormatter, net.snowflake.common.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, net.snowflake.common.core.SnowflakeDateTimeFormat dateFormatter)
date - date will be converteddateFormatter - date formatpublic static Date adjustDate(Date date)
date - date before 1582-10-05public 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 - boolean type in string representationpublic static int calculateUpdateCount(ResultSet resultSet, long statementTypeId) throws SQLException
SQLExceptionpublic static int listSearchCaseInsensitive(List<String> source, String target)
source - source string listtarget - target string to matchCopyright © 2017. All rights reserved.