org.postgresql.core.Utils Java Examples

The following examples show how to use org.postgresql.core.Utils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PostgresqlSessions.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
public static String escapeAndWrapString(String value) {
    StringBuilder builder = new StringBuilder(8 + value.length());
    builder.append('\'');
    try {
        Utils.escapeLiteral(builder, value, false);
    } catch (SQLException e) {
        throw new HugeException("Failed to escape '%s'", e, value);
    }
    builder.append('\'');
    return builder.toString();
}
 
Example #2
Source File: JDBCUtil.java    From hugegraph-loader with Apache License 2.0 5 votes vote down vote up
public static String escapePostgresql(String value) {
    StringBuilder builder = new StringBuilder(8 + value.length());
    builder.append('\'');
    try {
        Utils.escapeLiteral(builder, value, false);
    } catch (SQLException e) {
        throw new LoadException("Failed to escape '%s'", e, value);
    }
    builder.append('\'');
    return builder.toString();
}
 
Example #3
Source File: RedshiftConnection.java    From digdag with Apache License 2.0 5 votes vote down vote up
private static String escapeParam(String param)
{
    StringBuilder sb = new StringBuilder();
    try {
        return Utils.escapeLiteral(sb, param, false).toString();
    }
    catch (SQLException e) {
        throw new ConfigException("Failed to escape a parameter in configuration file: param=" + param, e);
    }
}