Ejemplo n.º 1
0
 public boolean equals(Object obj) {
   if (!(obj instanceof NlsString)) {
     return false;
   }
   NlsString that = (NlsString) obj;
   return Util.equal(value, that.value)
       && Util.equal(charsetName, that.charsetName)
       && Util.equal(collation, that.collation);
 }
Ejemplo n.º 2
0
  /**
   * Returns the string quoted for SQL, for example <code>_ISO-8859-1'is it a
   * plane? no it''s superman!'</code>.
   *
   * @param prefix if true, prefix the character set name
   * @param suffix if true, suffix the collation clause
   * @return the quoted string
   */
  public String asSql(boolean prefix, boolean suffix) {
    StringBuilder ret = new StringBuilder();
    if (prefix && (null != charsetName)) {
      ret.append("_");
      ret.append(charsetName);
    }
    ret.append("'");
    ret.append(Util.replace(value, "'", "''"));
    ret.append("'");

    // NOTE jvs 3-Feb-2005:  see FRG-78 for why this should go away
    if (false) {
      if (suffix && (null != collation)) {
        ret.append(" ");
        ret.append(collation.toString());
      }
    }
    return ret.toString();
  }
Ejemplo n.º 3
0
 public int hashCode() {
   int h = value.hashCode();
   h = Util.hash(h, charsetName);
   h = Util.hash(h, collation);
   return h;
 }