UpdateJSON.displayResult()

The UpdateJSON.displayResult() method shows the contents of a StatementResult object returned by a KVStore.executeSync() method call. It is used by this example as a convenience to help the user see that a DDL statement has executed correctly in the store.

    // Displays the results of an executeSync() call.
    private void displayResult(StatementResult result,
            String statement) {
        System.out.println("===========================");
        if (result.isSuccessful()) {
            System.out.println("Statement was successful:\n\t" +
                    statement);
            System.out.println("Results:\n\t" + result.getInfo());
        } else if (result.isCancelled()) {
            System.out.println("Statement was cancelled:\n\t" +
                    statement);
        } else {
             // statement wasn't successful: may be in error, or may
             // still be in progress.
            if (result.isDone()) {
                System.out.println("Statement failed:\n\t" +
                        statement);
                System.out.println("Problem:\n\t" +
                        result.getErrorMessage());
            } else {
                System.out.println("Statement in progress:\n\t" +
                        statement);
                System.out.println("Status:\n\t" +
                        result.getInfo());
            }
        }
    }