src.com.ibm.as400.micro.ResultSetHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jt400-jdk8 Show documentation
Show all versions of jt400-jdk8 Show documentation
The Open Source version of the IBM Toolbox for Java
The newest version!
///////////////////////////////////////////////////////////////////////////////
//
// JTOpen (IBM Toolbox for Java - OSS version)
//
// Filename: ResultSetHandler.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 1997-2001 International Business Machines Corporation and
// others. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
package com.ibm.as400.micro;
import java.io.*;
import java.net.*;
import java.sql.*;
import java.util.*;
/**
* The ResultSetHandler class is designed to handle all interactions
* needed by the JDBC-ME driver with the JDBC ResultSet interface.
**/
class ResultSetHandler
{
private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others.";
JdbcMeService service_;
MicroDataInputStream in_;
MicroDataOutputStream out_;
/**
Constructor. Creates a new JDBC-ME handler for ResultSet
objects.
* @param jdbcme
* @param in
* @param out
**/
public ResultSetHandler(JdbcMeService jdbcme, MicroDataInputStream in, MicroDataOutputStream out)
{
service_ = jdbcme;
in_ = in;
out_ = out;
}
/**
The process function routes the function id and the ResultSet
to the proper handler.
* @param rs
* @param funcId
* @throws IOException
**/
public void process(ResultSet rs, int funcId) throws IOException
{
switch (funcId)
{
case MEConstants.RS_CLOSE:
close(rs);
break;
case MEConstants.RS_DELETE_ROW:
deleteRow(rs);
break;
case MEConstants.RS_INSERT_ROW:
insertRow(rs);
break;
case MEConstants.RS_NEXT:
next(rs);
break;
case MEConstants.RS_PREVIOUS:
previous(rs);
break;
case MEConstants.RS_UPDATE_ROW:
updateRow(rs);
break;
// TODO: from here down...
// returns data
case MEConstants.RS_ABSOLUTE:
absolute(rs);
break;
// true/false
case MEConstants.RS_AFTER_LAST:
afterLast(rs);
break;
// true/false
case MEConstants.RS_BEFORE_FIRST:
beforeFirst(rs);
break;
// returns data
case MEConstants.RS_FIRST:
first(rs);
break;
// true/false
case MEConstants.RS_IS_AFTER_LAST:
isAfterLast(rs);
break;
// true/false
case MEConstants.RS_IS_BEFORE_FIRST:
isBeforeFirst(rs);
break;
// true/false
case MEConstants.RS_IS_FIRST:
isFirst(rs);
break;
// true/false
case MEConstants.RS_IS_LAST:
isLast(rs);
break;
// returns data
case MEConstants.RS_LAST:
last(rs);
break;
// returns data
case MEConstants.RS_RELATIVE:
relative(rs);
break;
default:
// TODO: This is an exception condition...
System.out.println("Error - ResultSet Function ID not recognized - function code: " + funcId);
break;
}
}
/**
Closes the ResultSet object. Unlike most of the methods of this class,
if an exception occurs while closing the ResultSet, this method
will not report it back to the caller in any way. It is simply
swollowed and a message is logged concerning the failure.
The data flow is as follows:
- nothing more