protected static String quoteSQL(Object data,int type) throws SQLException {
  if (data == null) {
    return "NULL";
  }
switch (type) {
case Types.BIT:
case Types.BOOLEAN:
case Types.INTEGER:
case Types.BIGINT:
case Types.DECIMAL:
case Types.DOUBLE:
case Types.FLOAT:
case Types.NUMERIC:
case Types.REAL:
case Types.SMALLINT:
case Types.TINYINT:
    return data.toString();
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
case Types.LONGVARCHAR:
case Types.CHAR:
case Types.VARCHAR:
  return quoteString(data.toString());
case Types.VARBINARY:
case Types.LONGVARBINARY:
case Types.BINARY:
if (data instanceof UUID) {
  return "'" + data.toString() + "'";
}
return "'" + StringUtils.convertBytesToHex((byte[])data) + "'";
case Types.CLOB:
case Types.JAVA_OBJECT:
case Types.OTHER:
case Types.BLOB:
case Types.STRUCT:
case Types.REF:
case Types.NULL:
case Types.ARRAY:
case Types.DATALINK:
case Types.DISTINCT:
throw throwException("Unsupported key data type: " + type);
default :
return "";
}
}

protected static String quoteSQL ( Object data , int type ) throws SQLException { if ( data == null ) { return "NULL" ; } switch ( type ) { case Types . BIT : case Types . BOOLEAN : case Types . INTEGER : case Types . BIGINT : case Types . DECIMAL : case Types . DOUBLE : case Types . FLOAT : case Types . NUMERIC : case Types . REAL : case Types . SMALLINT : case Types . TINYINT : return data . toString ( ) ; case Types . DATE : case Types . TIME : case Types . TIMESTAMP : case Types . LONGVARCHAR : case Types . CHAR : case Types . VARCHAR : return quoteString ( data . toString ( ) ) ; case Types . VARBINARY : case Types . LONGVARBINARY : case Types . BINARY : if ( data instanceof UUID ) { return "'" + data . toString ( ) + "'" ; } return "'" + StringUtils . convertBytesToHex ( ( byte [ ] ) data ) + "'" ; case Types . CLOB : case Types . JAVA_OBJECT : case Types . OTHER : case Types . BLOB : case Types . STRUCT : case Types . REF : case Types . NULL : case Types . ARRAY : case Types . DATALINK : case Types . DISTINCT : throw throwException ( "Unsupported key data type: " + type ) ; default : return "" ; } }
internal . convert an object to a string as used in a sql statement .
