Java Code Examples for java.sql.Statement.SUCCESS_NO_INFO

The following are Jave code examples for showing how to use SUCCESS_NO_INFO of the java.sql.Statement class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: sane-dbc   File: Binders.java   Source Code and License Vote up 6 votes
private static Option<Integer> sumBatchResult(int[] xs)
{
    int result = 0;
    for (int x: xs)
    {
        if (x >= 0)
        {
            result += x;
        }
        else if (x == Statement.SUCCESS_NO_INFO)
        {
            return Option.none();
        }
        else if (x == Statement.EXECUTE_FAILED)
        {
            throw new IllegalStateException("a batch command failed but an sql exception was not raised by the driver!");
        }
        else
        {
            throw new IllegalStateException("unrecognized batch return code " + x);
        }
    }
    return Option.some(result);
}
 
Example 2
Project: otter-G   File: DbLoadAction.java   Source Code and License Vote up 5 votes
private void processStat(EventData data, int affect, boolean batch) {
    if (batch && (affect < 1 && affect != Statement.SUCCESS_NO_INFO)) {
        failedDatas.add(data); // 记录到错误的临时队列,进行重试处理
    } else if (!batch && affect < 1) {
        failedDatas.add(data);// 记录到错误的临时队列,进行重试处理
    } else {
        processedDatas.add(data); // 记录到成功的临时队列,commit也可能会失败。所以这记录也可能需要进行重试
        DbLoadAction.this.processStat(data, context);
    }
}