S-PLUS Connect/Java v1.0

com.insightful.splus.util
Class ResultSetUtilities

java.lang.Object
  extended by com.insightful.splus.util.ResultSetUtilities

public class ResultSetUtilities
extends Object

Provides static methods for accessing a ResultSet from S-PLUS.

This is experimental code that has not been extensively bullet-proofed.

This code uses the following data type mappings from SQL Types to Java Types to S-PLUS Types

 SQL TYPES    Java Type        S-PLUS Type
 BIGINT        double           numeric
 DECIMAL       double           numeric
 NUMERIC       double           numeric
 DOUBLE        double           numeric
 FLOAT         float            single
 REAL          float            single
 DATE          double           numeric
 TIME          double           numeric
 TIMESTAMP     double           numeric
 TINYINT       integer          integer
 SMALLINT      integer          integer
 INTEGER       integer          integer 
 BOOLEAN       boolean          logical
 BIT           boolean          logical
 All Others    String           character
 


Method Summary
static Object[] getData(String key)
          Get data from a registered ResultSet.
static int getDefaultNumberOfRows()
           
static void register(String key, ResultSet set)
          Register a ResultSet in the Hashtable of known sets.
static void setDefaultNumberOfRows(int nrow)
          Specify the default number of rows.
static void unregister(String key)
          Unregister a ResultSet from the Hashtable of known sets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

register

public static void register(String key,
                            ResultSet set)
Register a ResultSet in the Hashtable of known sets.


unregister

public static void unregister(String key)
Unregister a ResultSet from the Hashtable of known sets.


setDefaultNumberOfRows

public static void setDefaultNumberOfRows(int nrow)
Specify the default number of rows. If the ResultSet is of type ResultSet.TYPE_FORWARD_ONLY, then the number of rows cannot be determined prior to retrieving the data. In this case the default number of rows will be used, and the arrays containing the retrieved values will be doubled in size when the number of rows exceeds the current array size.


getDefaultNumberOfRows

public static int getDefaultNumberOfRows()

getData

public static Object[] getData(String key)
                        throws SQLException
Get data from a registered ResultSet.

Parameters:
key - used to register the ResultSet in the Hashtable of known ResultSets.
Returns:
Object array with four elements: column names, column type code as a String, column type code as an int, and column values. The first three items are the values returned by the ResultSetMetaData methods getColumnName(), getColumnTypeName(), and getColumnType(). The column values element is itself an array of Vectors with one Vector of values for each column. Returns null if the key does not match a registered ResultSet.
Throws:
Throws - an SQLException if an error occurs accessing the ResultSet.
SQLException

S-PLUS Connect/Java v1.0

Copyright © 2000, 2002 Insightful Corporation
Warning: Classes not documented in the S-PLUS Programmer's Guide may change in future releases.