/** * Escape the given identifier <tt>value</tt> and append it to the string builder <tt>sbuf</tt>. * If <tt>sbuf</tt> is <tt>null</tt>, a new StringBuilder will be returned. This method is * different from appendEscapedLiteral in that it includes the quoting required for the identifier * while {@link #escapeLiteral(StringBuilder, String, boolean)} does not. * * @param sbuf the string builder to append to; or <tt>null</tt> * @param value the string value * @return the sbuf argument; or a new string builder for sbuf == null * @throws SQLException if the string contains a <tt>\0</tt> character */ public static StringBuilder escapeIdentifier(StringBuilder sbuf, String value) throws SQLException { if (sbuf == null) { sbuf = new StringBuilder(2 + (value.length() + 10) / 10 * 11); // Add 10% for escaping. } doAppendEscapedIdentifier(sbuf, value); return sbuf; }