java.lang.Object
com.aoapps.sql.SQLUtility
SQL utilities.
- Author:
- AO Industries, Inc.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatDate(long time) static StringformatDate(long time, TimeZone timeZone) static StringformatDate(Long time) static StringformatDate(Long time, TimeZone timeZone) static StringformatDate(Date date) static StringformatDate(Date date, TimeZone timeZone) static StringformatDateTime(long time) static StringformatDateTime(long time, TimeZone timeZone) static StringformatDateTime(Long time) static StringformatDateTime(Long time, TimeZone timeZone) static StringformatDateTime(Date date) static StringformatDateTime(Date date, TimeZone timeZone) static StringformatDecimal2(int pennies) Converts a number of pennies into decimal representation.static StringformatDecimal2(long pennies) Converts a number of pennies into decimal representation.static StringformatDecimal3(int millis) Converts a number of millis into decimal representation.static StringformatDecimal3(long millis) Converts a number of millis into decimal representation.static StringformatTime(long time) static StringformatTime(long time, TimeZone timeZone) static StringformatTime(Long time) static StringformatTime(Long time, TimeZone timeZone) static StringformatTime(Date date) static StringformatTime(Date date, TimeZone timeZone) static TimestampnewTimestamp(long seconds, int nanos) Converts a number of seconds and nanoseconds into a newTimestamp.newTimestamp(long seconds, int nanos, Class<? extends Ex> exClass) Deprecated.newTimestamp(long seconds, int nanos, Function<? super String, ? extends Ex> exSupplier) Converts a number of seconds and nanoseconds into a newTimestamp.static UnmodifiableTimestampnewUnmodifiableTimestamp(long seconds, int nanos) Converts a number of seconds and nanoseconds into a newUnmodifiableTimestamp.static <Ex extends Throwable>
UnmodifiableTimestampnewUnmodifiableTimestamp(long seconds, int nanos, Class<? extends Ex> exClass) Deprecated.Please usenewUnmodifiableTimestamp(long, int, java.util.function.Function), typically with lambda constructor referencestatic <Ex extends Throwable>
UnmodifiableTimestampnewUnmodifiableTimestamp(long seconds, int nanos, Function<? super String, ? extends Ex> exSupplier) Converts a number of seconds and nanoseconds into a newUnmodifiableTimestamp.static Datestatic Datestatic TimestampparseDateTime(String dateTime) static TimestampparseDateTime(String dateTime, TimeZone timeZone) static intparseDecimal2(String decimal2) Gets the number of pennies represented by aStringcontaining a decimal(?static intparseDecimal3(String decimal3) Gets the number of millis represented by aStringcontaining a decimal(?static longparseLongDecimal2(String decimal2) Gets the number of pennies represented by aStringcontaining a decimal(?static longparseLongDecimal3(String decimal3) Gets the number of millis represented by aStringcontaining a decimal(?static voidprintTable(Object[] titles, Iterable<? extends Object[]> rows, Appendable out, boolean isInteractive, boolean[] alignRights) Prints a table.static voidprintTable(Object[] titles, Object[] values, Appendable out, boolean isInteractive, boolean[] alignRights) Deprecated.Please useprintTable(java.lang.Object[], java.lang.Iterable, java.lang.Appendable, boolean, boolean[])when possible, as it may provide for more efficiency on large datasets.static voidprintTable(Object[] titles, Collection<Object> values, Appendable out, boolean isInteractive, boolean[] alignRights) Deprecated.Please useprintTable(java.lang.Object[], java.lang.Iterable, java.lang.Appendable, boolean, boolean[])when possible, as it may provide for more efficiency on large datasets.static voidtoTimestamp(long seconds, int nanos, Timestamp ts) Converts a number of seconds and nanoseconds into a givenTimestamp.static <Ex extends Throwable>
voidtoTimestamp(long seconds, int nanos, Timestamp ts, Class<? extends Ex> exClass) Deprecated.Please usetoTimestamp(long, int, java.sql.Timestamp, java.util.function.Function), typically with lambda constructor referencestatic <Ex extends Throwable>
voidtoTimestamp(long seconds, int nanos, Timestamp ts, Function<? super String, ? extends Ex> exSupplier) Converts a number of seconds and nanoseconds into a givenTimestamp.
-
Field Details
-
Method Details
-
formatDate
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatDate
- See Also:
-
formatDate
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatDate
- See Also:
-
formatDate
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatDate
- See Also:
-
parseDate
- Parameters:
yyyy_mm_dd- The date in YYYY-MM-DD format.timeZone- The time zone to use ornullto use the default time zone- Throws:
IllegalArgumentException- See Also:
-
parseDate
- Parameters:
yyyy_mm_dd- The date in YYYY-MM-DD format.- Throws:
IllegalArgumentException- See Also:
-
formatDateTime
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatDateTime
- See Also:
-
formatDateTime
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatDateTime
- See Also:
-
formatDateTime
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatDateTime
- See Also:
-
parseDateTime
public static Timestamp parseDateTime(String dateTime, TimeZone timeZone) throws IllegalArgumentException - Parameters:
timeZone- The time zone to use ornullto use the default time zone- Throws:
IllegalArgumentException- See Also:
-
parseDateTime
- Throws:
IllegalArgumentException- See Also:
-
formatTime
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatTime
- See Also:
-
formatTime
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatTime
- See Also:
-
formatTime
- Parameters:
timeZone- The time zone to use ornullto use the default time zone- See Also:
-
formatTime
- See Also:
-
formatDecimal2
Converts a number of pennies into decimal representation. -
formatDecimal2
Converts a number of pennies into decimal representation. -
parseDecimal2
Gets the number of pennies represented by aStringcontaining a decimal(?,2) type. -
parseLongDecimal2
Gets the number of pennies represented by aStringcontaining a decimal(?,2) type. -
formatDecimal3
Converts a number of millis into decimal representation. -
formatDecimal3
Converts a number of millis into decimal representation. -
parseDecimal3
Gets the number of millis represented by aStringcontaining a decimal(?,3) type. -
parseLongDecimal3
Gets the number of millis represented by aStringcontaining a decimal(?,3) type. -
printTable
public static void printTable(Object[] titles, Iterable<? extends Object[]> rows, Appendable out, boolean isInteractive, boolean[] alignRights) throws IOException Prints a table.- Parameters:
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.- Throws:
IOException
-
printTable
@Deprecated public static void printTable(Object[] titles, Collection<Object> values, Appendable out, boolean isInteractive, boolean[] alignRights) throws IOException Deprecated.Please useprintTable(java.lang.Object[], java.lang.Iterable, java.lang.Appendable, boolean, boolean[])when possible, as it may provide for more efficiency on large datasets.- Parameters:
values- One element for each row and column- Throws:
IOException
-
printTable
@Deprecated public static void printTable(Object[] titles, Object[] values, Appendable out, boolean isInteractive, boolean[] alignRights) throws IOException Deprecated.Please useprintTable(java.lang.Object[], java.lang.Iterable, java.lang.Appendable, boolean, boolean[])when possible, as it may provide for more efficiency on large datasets.- Parameters:
values- One element for each row and column- Throws:
IOException
-
toTimestamp
public static <Ex extends Throwable> void toTimestamp(long seconds, int nanos, Timestamp ts, Function<? super String, ? extends Ex> exSupplier) throws ExConverts a number of seconds and nanoseconds into a givenTimestamp.- Throws:
Ex
-
toTimestamp
@Deprecated public static <Ex extends Throwable> void toTimestamp(long seconds, int nanos, Timestamp ts, Class<? extends Ex> exClass) throws Ex Deprecated.Please usetoTimestamp(long, int, java.sql.Timestamp, java.util.function.Function), typically with lambda constructor referenceConverts a number of seconds and nanoseconds into a givenTimestamp.- Throws:
Ex
-
toTimestamp
Converts a number of seconds and nanoseconds into a givenTimestamp. -
newTimestamp
public static <Ex extends Throwable> Timestamp newTimestamp(long seconds, int nanos, Function<? super String, ? extends Ex> exSupplier) throws ExConverts a number of seconds and nanoseconds into a newTimestamp.- Throws:
Ex
-
newTimestamp
@Deprecated public static <Ex extends Throwable> Timestamp newTimestamp(long seconds, int nanos, Class<? extends Ex> exClass) throws Ex Deprecated.Please usenewTimestamp(long, int, java.util.function.Function), typically with lambda constructor referenceConverts a number of seconds and nanoseconds into a newTimestamp.- Throws:
Ex
-
newTimestamp
Converts a number of seconds and nanoseconds into a newTimestamp.- Throws:
IllegalArgumentException
-
newUnmodifiableTimestamp
public static <Ex extends Throwable> UnmodifiableTimestamp newUnmodifiableTimestamp(long seconds, int nanos, Function<? super String, ? extends Ex> exSupplier) throws ExConverts a number of seconds and nanoseconds into a newUnmodifiableTimestamp.- Throws:
Ex
-
newUnmodifiableTimestamp
@Deprecated public static <Ex extends Throwable> UnmodifiableTimestamp newUnmodifiableTimestamp(long seconds, int nanos, Class<? extends Ex> exClass) throws Ex Deprecated.Please usenewUnmodifiableTimestamp(long, int, java.util.function.Function), typically with lambda constructor referenceConverts a number of seconds and nanoseconds into a newUnmodifiableTimestamp.- Throws:
Ex
-
newUnmodifiableTimestamp
public static UnmodifiableTimestamp newUnmodifiableTimestamp(long seconds, int nanos) throws IllegalArgumentException Converts a number of seconds and nanoseconds into a newUnmodifiableTimestamp.- Throws:
IllegalArgumentException
-

newTimestamp(long, int, java.util.function.Function), typically with lambda constructor reference