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://www.aoindustries.com/contact
public class SQLUtility extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
decodeString(String S) |
static String |
encodeString(String S) |
static String |
escapeSQL(String S)
Deprecated.
use PreparedStatement instead
|
static void |
escapeSQL(String S,
StringBuilder B)
Deprecated.
use PreparedStatement instead
|
static String |
getDate(long time) |
static Date |
getDate(String yyyy_mm_dd) |
static String |
getDateTime(long time)
Gets the database format for a date/time field.
|
static Date |
getDateTime(String s)
Gets the date and time from the YYYY-MM-DD HH:MM:SS format.
|
static long |
getDaysFromMillis(long time)
Gets the number of days from epoch
|
static String |
getDecimal(int pennies)
Converts a number of pennies into decimal representation.
|
static String |
getDecimal(long pennies)
Converts a number of pennies into decimal representation.
|
static String |
getMilliDecimal(int millis)
Converts a number of millis into decimal representation.
|
static String |
getMilliDecimal(long millis)
Converts a number of millis into decimal representation.
|
static int |
getMillis(String decimal)
Gets the number of millis represented by a
String containing a decimal(8,3) type. |
static long |
getMillisFromDays(long time)
Gets the number of millis from epoch
|
static int |
getPennies(String decimal)
Gets the number of pennies represented by a
String containing a decimal type. |
static long |
getPenniesLong(String decimal)
Gets the number of pennies represented by a
String containing a decimal type. |
static String |
getTime(long time)
Gets the database format for a time field.
|
static int |
negIntIfEmpty(String s)
Removes the milliseconds from a time, rounds down every time.
|
static long |
negLongIfEmpty(String s)
Removes the milliseconds from a time, rounds down every time.
|
static String |
nullIfEmpty(String value)
Deprecated.
Use
StringUtility.nullIfEmpty(java.lang.String) instead |
static void |
printResultSetHTMLTable(ResultSet results,
Appendable out,
String title,
boolean wordWrap) |
static void |
printTable(Object[] titles,
Collection<Object> values,
Appendable out,
boolean isInteractive,
boolean[] alignRights) |
static void |
printTable(Object[] titles,
Object[] values,
Appendable out,
boolean isInteractive,
boolean[] alignRights) |
static long |
roundToDay(long time)
Rounds the time to an exact day.
|
@Deprecated public static String escapeSQL(String S)
S - the string to be escaped.@Deprecated public static void escapeSQL(String S, StringBuilder B)
S - the string to be escaped.B - the StringBuilder to append to.public static String getDate(long time)
public static Date getDate(String yyyy_mm_dd) throws IllegalArgumentException
IllegalArgumentExceptionCalendarUtils.parseDate(java.lang.String)public static Date getDateTime(String s) throws IllegalArgumentException
IllegalArgumentExceptionpublic static String getDateTime(long time)
-1, returns nullpublic static String getTime(long time)
-1, returns nullpublic static long getDaysFromMillis(long time)
public static long getMillisFromDays(long time)
public static long roundToDay(long time)
public static String getDecimal(int pennies)
public static String getDecimal(long pennies)
public static String getMilliDecimal(int millis)
public static String getMilliDecimal(long millis)
public static int getMillis(String decimal)
String containing a decimal(8,3) type.public static int getPennies(String decimal)
String containing a decimal type.public static long getPenniesLong(String decimal)
String containing a decimal type.public static int negIntIfEmpty(String s)
public static long negLongIfEmpty(String s)
@Deprecated public static String nullIfEmpty(String value)
StringUtility.nullIfEmpty(java.lang.String) insteadpublic static void printResultSetHTMLTable(ResultSet results, Appendable out, String title, boolean wordWrap) throws SQLException, IOException
SQLExceptionIOExceptionpublic static void printTable(Object[] titles, Object[] values, Appendable out, boolean isInteractive, boolean[] alignRights) throws IOException
IOExceptionpublic static void printTable(Object[] titles, Collection<Object> values, Appendable out, boolean isInteractive, boolean[] alignRights) throws IOException
IOExceptionCopyright © 2000–2016 AO Industries, Inc.. All rights reserved.