Add a new quote() method which converts a date to a quoted string.
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user