newArray.put(k, new StringBuilderValue().append("'").append(v).append("'"));
if (v instanceof StringValue) { StringBuilderValue sb = new StringBuilderValue(); sb.append("'").append(v).append("'"); newArray.put(k, sb); } else if (v instanceof NullValue) { newArray.put(k, StringValue.create("NULL")); } else { newArray.put(k, v); }
  public static ArrayValue pg_convert(Env env,                                      @NotNull Postgres conn,                                      String tableName,                                      ArrayValue assocArray,                                      @Optional("0") int options)  {    try {      // XXX: options has not been implemented yet.      // XXX: the following PHP note has not been implemented yet.      // Note:  If there are boolean fields in table_name don't use      // the constant TRUE in assoc_array. It will be converted to the      // string 'TRUE' which is no valid entry for boolean fields in      // PostgreSQL. Use one of t, true, 1, y, yes instead.      if (options == 0) {        throw new UnimplementedException("pg_convert with options");      }      ArrayValueImpl newArray = new ArrayValueImpl();      for (Map.Entry<Value,Value> entry : assocArray.entrySet()) {        Value k = entry.getKey();        Value v = entry.getValue();        newArray.put(k, new StringBuilderValue().append("'").append(v).append("'"));      }      return newArray;    } catch (Exception ex) {      log.log(Level.FINE, ex.toString(), ex);      return null;    }  }