Skip to content

Quite simple method is marked as too complex to analyze #95

@unv-unv

Description

@unv-unv

изображение

public class SQLClob
{
    protected static final int MAX_STRING_LITERAL_LENGTH = 3904;

    public final String value;

    public SQLClob(String value)
    {
        this.value = value;
    }

//    @SuppressWarnings("ConstantConditions")
    public void appendTo(StringBuilder sql)
    {
        if (value == null)
        {
            sql.append("to_clob(null)");
            return;
        }
        else if (value.isEmpty())
        {
            sql.append("empty_clob()");
            return;
        }

        for (int i = 0, j, n = value.length(); i < n; i = j)
        {
            if (i > 0) sql.append(" ||");
            j = Math.min(i + MAX_STRING_LITERAL_LENGTH, n);
            sql.append("to_clob('")
                .append(value.substring(i, j).replace("'", "''"))
                .append("')");
        }
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions