public static String escapeParameter(Object value, DatabasePlatform databasePlatform) {
    if (value == null) {
      return null;
    }

    if (value instanceof Enum<?>) {
      value = ((Enum) value).name();
    }

    String valueString = value.toString();
    if (value instanceof String || databasePlatform.convertToDatabaseType(value) instanceof String) {
      valueString = "'" + valueString + "'";
    }

    return valueString;
  }
Gets an escaped version of the specified value suitable for including as a
parameter when building statements.

@param value
         the value to escape
@return the escaped value
ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java