|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.db.SqlHelper
public class SqlHelper
Some common methods for SQL-Processing.
| Field Summary | |
|---|---|
static Time |
maxTime
one second before midnight: 23:59:59 |
static Date |
minDate
epochal date zero: 1.1.1970 00:00:00 |
static Time |
minTime
midnight 00:00:00 |
static Timestamp |
minTimestamp
epochal timestamp zero: 1.1.1970 00:00:00.000 |
| Constructor Summary | |
|---|---|
SqlHelper()
|
|
| Method Summary | |
|---|---|
static Time |
daytime()
Gets the current time. |
static String |
extractAllExceptIdAndSerial(String sql)
Gets only the first n-2 of extracted comma-separated list. Used to get all fields except ID and SERIAL. |
static String |
extractColumnsFromInsertStatement(String sql)
Gets the column names of an insert statement. (see History for an example) |
static String |
extractValuesFromInsertStatement(String sql)
Gets the values of an insert statement. (see History for an example) |
static Pattern |
likeStringToPattern(String likeString)
Converts an SQL-like-String to a regular expression. |
static Timestamp |
now()
Gets the current system time. |
static Timestamp |
now(long offsetMillis)
Gets the current system time plus an optional offset. |
static Date |
toDate(Date date)
Converts a java.util.Date into an java.sql.Date. |
static Date |
toDate(GregorianCalendar cal)
Converts a GregorianCalendar into a java.sql.Date. |
static Date |
today()
Gets the current date. |
static String |
toLikeString(String pattern)
Converts a string to a string that can be used as a parameter for a LIKE-clause. |
static String |
toLikeStringWithNull(String pattern)
Converts a string to a string that can be used as a parameter for a LIKE-clause, nullpointer safe. |
static Time |
toTime(Date date)
Converts a java.util.Date into a java.sql.Time. |
static Time |
toTime(GregorianCalendar cal)
Converts a GregorianCalendar into a java.sql.Time. |
static Timestamp |
toTimestamp(Date date)
Converts a java.util.Date into a java.sql.Timestamp. |
static Timestamp |
toTimestamp(GregorianCalendar cal)
Converts a GregorianCalendar into a java.sql.Timestamp. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Date minDate
public static final Time minTime
public static final Time maxTime
public static final Timestamp minTimestamp
| Constructor Detail |
|---|
public SqlHelper()
| Method Detail |
|---|
public static String toLikeString(String pattern)
pattern - the search pattern
public static String toLikeStringWithNull(String pattern)
pattern - the search pattern
toLikeString(java.lang.String)public static Pattern likeStringToPattern(String likeString)
Example: "%blah_foo" -> ".*blah.foo"
likeString - the LIKE-string
public static String extractColumnsFromInsertStatement(String sql)
throws ApplicationException
History for an example)
sql - is the original sql string
ApplicationException - of malformed sql
public static String extractValuesFromInsertStatement(String sql)
throws ApplicationException
History for an example)
sql - is the original sql string
ApplicationException - of malformed sqlpublic static String extractAllExceptIdAndSerial(String sql)
sql - is the original sql string
public static Date toDate(Date date)
date - the util date
public static Date toDate(GregorianCalendar cal)
cal - the calendar
public static Time toTime(Date date)
date - the date
public static Time toTime(GregorianCalendar cal)
cal - the calendar
public static Timestamp toTimestamp(Date date)
date - the date
public static Timestamp toTimestamp(GregorianCalendar cal)
cal - the calendar
public static Date today()
public static Time daytime()
public static Timestamp now(long offsetMillis)
offsetMillis - the offset to the current system time in milliseconds
public static Timestamp now()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||