Java SQL ResultSet Print printRsetTypeAndConcurrencyType(ResultSet rset)

Here you can find the source of printRsetTypeAndConcurrencyType(ResultSet rset)

Description

print Rset Type And Concurrency Type

License

Open Source License

Declaration

public static void printRsetTypeAndConcurrencyType(ResultSet rset) throws SQLException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.ResultSet;
import java.sql.Statement;

import java.sql.SQLException;

public class Main {
    public static void printRsetTypeAndConcurrencyType(Statement stmt) throws SQLException {
        System.out.print("\tResult set category (using Statement API): ");
        int resultSetType = stmt.getResultSetType();
        switch (resultSetType) {
        case ResultSet.TYPE_FORWARD_ONLY:
            System.out.print("Forward only");
            break;
        case ResultSet.TYPE_SCROLL_INSENSITIVE:
            System.out.print("Scroll insensitive");
            break;
        case ResultSet.TYPE_SCROLL_SENSITIVE:
            System.out.print("Scroll sensitive");
            break;
        }/*  w  ww .  j a v a 2 s .c  om*/
        int resultSetConcurrency = stmt.getResultSetConcurrency();
        switch (resultSetConcurrency) {
        case ResultSet.CONCUR_READ_ONLY:
            System.out.println(", Read only");
            break;
        case ResultSet.CONCUR_UPDATABLE:
            System.out.println(", Updatable");
            break;
        }
    }

    public static void printRsetTypeAndConcurrencyType(ResultSet rset) throws SQLException {
        int resultSetType = rset.getType();
        System.out.print("\tResult set category (using ResultSet API): ");

        switch (resultSetType) {
        case ResultSet.TYPE_FORWARD_ONLY:
            System.out.print("Forward only");
            break;
        case ResultSet.TYPE_SCROLL_INSENSITIVE:
            System.out.print("Scroll insensitive");
            break;
        case ResultSet.TYPE_SCROLL_SENSITIVE:
            System.out.print("Scroll sensitive");
            break;
        }
        int resultSetConcurrency = rset.getConcurrency();
        switch (resultSetConcurrency) {
        case ResultSet.CONCUR_READ_ONLY:
            System.out.println(", Read only");
            break;
        case ResultSet.CONCUR_UPDATABLE:
            System.out.println(", Updatable");
            break;
        }
    }
}

Related

  1. printResultSetHeader(ResultSet rs)
  2. printResultSetMetadata(ResultSetMetaData rsmd, Writer out)
  3. printResultSetRow(ResultSet rs)
  4. printResultsToFile(ResultSet rst, File outFile)
  5. printRow(ResultSet pk)
  6. printSet(ResultSet set, int columns)
  7. printValues(final ResultSet resultSet)
  8. printView(ResultSet rs)
  9. printWarnings(ResultSet resultSet)