Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://aoindustries.com/contact
public class SQLUtility extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
MAX_TIMESTAMP_SECONDS
The maximum number of seconds in a
Timestamp. |
static long |
MIN_TIMESTAMP_SECONDS
The minimum number of seconds in a
Timestamp. |
| Modifier and Type | Method and Description |
|---|---|
static String |
formatDate(Date date) |
static String |
formatDate(Date date,
TimeZone timeZone) |
static String |
formatDate(long time) |
static String |
formatDate(Long time) |
static String |
formatDate(long time,
TimeZone timeZone) |
static String |
formatDate(Long time,
TimeZone timeZone) |
static String |
formatDateTime(Date date) |
static String |
formatDateTime(Date date,
TimeZone timeZone) |
static String |
formatDateTime(long time) |
static String |
formatDateTime(Long time) |
static String |
formatDateTime(long time,
TimeZone timeZone) |
static String |
formatDateTime(Long time,
TimeZone timeZone) |
static String |
formatDecimal2(int pennies)
Converts a number of pennies into decimal representation.
|
static String |
formatDecimal2(long pennies)
Converts a number of pennies into decimal representation.
|
static String |
formatDecimal3(int millis)
Converts a number of millis into decimal representation.
|
static String |
formatDecimal3(long millis)
Converts a number of millis into decimal representation.
|
static String |
formatTime(Date date) |
static String |
formatTime(Date date,
TimeZone timeZone) |
static String |
formatTime(long time) |
static String |
formatTime(Long time) |
static String |
formatTime(long time,
TimeZone timeZone) |
static String |
formatTime(Long time,
TimeZone timeZone) |
static Timestamp |
newTimestamp(long seconds,
int nanos)
Converts a number of seconds and nanoseconds into a new
Timestamp. |
static <E extends Throwable> |
newTimestamp(long seconds,
int nanos,
Class<E> exceptionType)
Converts a number of seconds and nanoseconds into a new
Timestamp. |
static UnmodifiableTimestamp |
newUnmodifiableTimestamp(long seconds,
int nanos)
Converts a number of seconds and nanoseconds into a new
UnmodifiableTimestamp. |
static <E extends Throwable> |
newUnmodifiableTimestamp(long seconds,
int nanos,
Class<E> exceptionType)
Converts a number of seconds and nanoseconds into a new
UnmodifiableTimestamp. |
static Date |
parseDate(String yyyy_mm_dd) |
static Date |
parseDate(String yyyy_mm_dd,
TimeZone timeZone) |
static Timestamp |
parseDateTime(String dateTime) |
static Timestamp |
parseDateTime(String dateTime,
TimeZone timeZone) |
static int |
parseDecimal2(String decimal2)
Gets the number of pennies represented by a
String containing a decimal(?,2) type. |
static int |
parseDecimal3(String decimal3)
Gets the number of millis represented by a
String containing a decimal(?,3) type. |
static long |
parseLongDecimal2(String decimal2)
Gets the number of pennies represented by a
String containing a decimal(?,2) type. |
static long |
parseLongDecimal3(String decimal3)
Gets the number of millis represented by a
String containing a decimal(?,3) type. |
static void |
printTable(Object[] titles,
Collection<Object> values,
Appendable out,
boolean isInteractive,
boolean[] alignRights)
Deprecated.
Please use
printTable(java.lang.Object[], java.lang.Iterable, java.lang.Appendable, boolean, boolean[])
when possible, as it may provide for more efficiency on large datasets. |
static void |
printTable(Object[] titles,
Iterable<? extends Object[]> rows,
Appendable out,
boolean isInteractive,
boolean[] alignRights)
Prints a table.
|
static void |
printTable(Object[] titles,
Object[] values,
Appendable out,
boolean isInteractive,
boolean[] alignRights)
Deprecated.
Please use
printTable(java.lang.Object[], java.lang.Iterable, java.lang.Appendable, boolean, boolean[])
when possible, as it may provide for more efficiency on large datasets. |
static void |
toTimestamp(long seconds,
int nanos,
Timestamp ts)
Converts a number of seconds and nanoseconds into a given
Timestamp. |
static <E extends Throwable> |
toTimestamp(long seconds,
int nanos,
Timestamp ts,
Class<E> exceptionType)
Converts a number of seconds and nanoseconds into a given
Timestamp. |
public static final long MAX_TIMESTAMP_SECONDS
Timestamp.public static final long MIN_TIMESTAMP_SECONDS
Timestamp.public static String formatDate(long time, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatDate(java.util.Calendar)public static String formatDate(long time)
public static String formatDate(Long time, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatDate(java.util.Calendar)public static String formatDate(Date date, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatDate(java.util.Calendar)public static Date parseDate(String yyyy_mm_dd, TimeZone timeZone) throws IllegalArgumentException
timeZone - The time zone to use or null to use the default time zoneIllegalArgumentExceptionCalendarUtils.parseDate(java.lang.String, java.util.TimeZone)public static Date parseDate(String yyyy_mm_dd) throws IllegalArgumentException
IllegalArgumentExceptionCalendarUtils.parseDate(java.lang.String)public static String formatDateTime(long time, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatDateTime(java.util.Calendar)public static String formatDateTime(long time)
public static String formatDateTime(Long time, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatDateTime(java.util.Calendar)public static String formatDateTime(Date date, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatDateTime(java.util.Calendar)public static Timestamp parseDateTime(String dateTime, TimeZone timeZone) throws IllegalArgumentException
timeZone - The time zone to use or null to use the default time zoneIllegalArgumentExceptionCalendarUtils.parseDateTime(java.lang.String, java.util.TimeZone, com.aoindustries.util.CalendarUtils.DateTimeProducer)public static Timestamp parseDateTime(String dateTime) throws IllegalArgumentException
IllegalArgumentExceptionCalendarUtils.parseDateTime(java.lang.String)public static String formatTime(long time, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatTime(java.util.Calendar)public static String formatTime(long time)
public static String formatTime(Long time, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatTime(java.util.Calendar)public static String formatTime(Date date, TimeZone timeZone)
timeZone - The time zone to use or null to use the default time zoneCalendarUtils.formatTime(java.util.Calendar)public static String formatDecimal2(int pennies)
public static String formatDecimal2(long pennies)
public static int parseDecimal2(String decimal2)
String containing a decimal(?,2) type.public static long parseLongDecimal2(String decimal2)
String containing a decimal(?,2) type.public static String formatDecimal3(int millis)
public static String formatDecimal3(long millis)
public static int parseDecimal3(String decimal3)
String containing a decimal(?,3) type.public static long parseLongDecimal3(String decimal3)
String containing a decimal(?,3) type.public static void printTable(Object[] titles, Iterable<? extends Object[]> rows, Appendable out, boolean isInteractive, boolean[] alignRights) throws IOException
titles - Optional titles to displayrows - Iterated once in non-interactive mode.
Iterated twice in interactive mode (first to find widest columns, then to display output).
Must provide consistent output when iterated twice for interactive mode.IOException@Deprecated public static void printTable(Object[] titles, Collection<Object> values, Appendable out, boolean isInteractive, boolean[] alignRights) throws IOException
printTable(java.lang.Object[], java.lang.Iterable, java.lang.Appendable, boolean, boolean[])
when possible, as it may provide for more efficiency on large datasets.values - One element for each row and columnIOException@Deprecated public static void printTable(Object[] titles, Object[] values, Appendable out, boolean isInteractive, boolean[] alignRights) throws IOException
printTable(java.lang.Object[], java.lang.Iterable, java.lang.Appendable, boolean, boolean[])
when possible, as it may provide for more efficiency on large datasets.values - One element for each row and columnIOExceptionpublic static <E extends Throwable> void toTimestamp(long seconds, int nanos, Timestamp ts, Class<E> exceptionType) throws E extends Throwable
Timestamp.E extends Throwablepublic static void toTimestamp(long seconds,
int nanos,
Timestamp ts)
Timestamp.public static <E extends Throwable> Timestamp newTimestamp(long seconds, int nanos, Class<E> exceptionType) throws E extends Throwable
Timestamp.E extends Throwablepublic static Timestamp newTimestamp(long seconds, int nanos) throws IllegalArgumentException
Timestamp.IllegalArgumentExceptionpublic static <E extends Throwable> UnmodifiableTimestamp newUnmodifiableTimestamp(long seconds, int nanos, Class<E> exceptionType) throws E extends Throwable
UnmodifiableTimestamp.E extends Throwablepublic static UnmodifiableTimestamp newUnmodifiableTimestamp(long seconds, int nanos) throws IllegalArgumentException
UnmodifiableTimestamp.IllegalArgumentExceptionCopyright © 2000–2019 AO Industries, Inc.. All rights reserved.