Add a new quote() method which converts a date to a quoted string.

This commit is contained in:
mthomas
2011-06-21 16:19:50 -07:00
parent d78405cc46
commit 70f7c38fbf
@@ -200,6 +200,19 @@ public class JDBCUtil
} }
} }
/**
* Converts the date to a string and surrounds it in single-quotes via the escape method. If the
* date is null, returns null.
*/
public String quote (Date date)
{
if (date == null) {
return ;
}
return escape(String.valueOf(date));
}
/** /**
* Escapes any single quotes in the supplied text and wraps it in single quotes to make it safe * Escapes any single quotes in the supplied text and wraps it in single quotes to make it safe
* for embedding into a database query. * for embedding into a database query.