Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class org.gjt.mm.mysql.ResultSet

java.lang.Object
  |
  +--org.gjt.mm.mysql.ResultSet

public class ResultSet
extends java.lang.Object
implements java.sql.ResultSet

Method Summary
void clearWarnings()
          After this call, getWarnings returns null until a new warning is reported for this ResultSet
void close()
          In some cases, it is desirable to immediately release a ResultSet database and JDBC resources instead of waiting for this to happen when it is automatically closed.
int findColumn(java.lang.String ColumnName)
          Map a ResultSet column name to a ResultSet column index
java.io.InputStream getAsciiStream(int columnIndex)
          A column value can be retrieved as a stream of ASCII characters and then read in chunks from the stream.
java.io.InputStream getAsciiStream(java.lang.String ColumnName)
           
java.math.BigDecimal getBigDecimal(int columnIndex, int scale)
          Get the value of a column in the current row as a java.lang.
java.math.BigDecimal getBigDecimal(java.lang.String ColumnName, int scale)
           
java.io.InputStream getBinaryStream(int columnIndex)
          A column value can also be retrieved as a binary strea.
java.io.InputStream getBinaryStream(java.lang.String ColumnName)
           
boolean getBoolean(int columnIndex)
          Get the value of a column in the current row as a Java boolean
boolean getBoolean(java.lang.String ColumnName)
           
byte getByte(int columnIndex)
          Get the value of a column in the current row as a Java byte.
byte getByte(java.lang.String ColumnName)
           
byte[] getBytes(int columnIndex)
          Get the value of a column in the current row as a Java byte array.
byte[] getBytes(java.lang.String ColumnName)
           
java.lang.String getCursorName()
          Get the name of the SQL cursor used by this ResultSet

In SQL, a result table is retrieved though a cursor that is named.

java.sql.Date getDate(int columnIndex)
          Get the value of a column in the current row as a java.sql.
java.sql.Date getDate(java.lang.String ColumnName)
           
double getDouble(int columnIndex)
          Get the value of a column in the current row as a Java double.
double getDouble(java.lang.String ColumnName)
           
float getFloat(int columnIndex)
          Get the value of a column in the current row as a Java float.
float getFloat(java.lang.String ColumnName)
           
int getInt(int columnIndex)
          Get the value of a column in the current row as a Java int.
int getInt(java.lang.String ColumnName)
           
long getLong(int columnIndex)
          Get the value of a column in the current row as a Java long.
long getLong(java.lang.String ColumnName)
           
java.sql.ResultSetMetaData getMetaData()
          The numbers, types and properties of a ResultSet's columns are provided by the getMetaData method
java.lang.Object getObject(int columnIndex)
          Get the value of a column in the current row as a Java object

This method will return the value of the given column as a Java object.

java.lang.Object getObject(java.lang.String ColumnName)
          Get the value of a column in the current row as a Java object

This method will return the value of the given column as a Java object.

short getShort(int columnIndex)
          Get the value of a column in the current row as a Java short.
short getShort(java.lang.String ColumnName)
           
java.lang.String getString(int columnIndex)
          Get the value of a column in the current row as a Java String
java.lang.String getString(java.lang.String ColumnName)
          The following routines simply convert the columnName into a columnIndex and then call the appropriate routine above.
java.sql.Time getTime(int columnIndex)
          Get the value of a column in the current row as a java.sql.
java.sql.Time getTime(java.lang.String ColumnName)
           
java.sql.Timestamp getTimestamp(int columnIndex)
          Get the value of a column in the current row as a java.sql.
java.sql.Timestamp getTimestamp(java.lang.String ColumnName)
           
java.io.InputStream getUnicodeStream(int columnIndex)
          A column value can also be retrieved as a stream of Unicode characters.
java.io.InputStream getUnicodeStream(java.lang.String ColumnName)
           
java.sql.SQLWarning getWarnings()
          The first warning reported by calls on this ResultSet is returned.
boolean next()
          A ResultSet is initially positioned before its first row, the first call to next makes the first row the current row; the second call makes the second row the current row, etc.
boolean prev()
          The prev method is not part of JDBC, but because of the architecture of this driver it is possible to move both forward and backward within the result set.
boolean wasNull()
          A column may have the value of SQL NULL; wasNull() reports whether the last column read had this special value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Method Detail

next

public boolean next()
            throws java.sql.SQLException
A ResultSet is initially positioned before its first row, the first call to next makes the first row the current row; the second call makes the second row the current row, etc.

If an input stream from the previous row is open, it is implicitly closed. The ResultSet's warning chain is cleared when a new row is read

Specified by:
next() in interface java.sql.ResultSet
Returns:
true if the new current is valid; false if there are no more rows
Throws:
java.sql.SQLException - if a database access error occurs

prev

public boolean prev()
            throws java.sql.SQLException
The prev method is not part of JDBC, but because of the architecture of this driver it is possible to move both forward and backward within the result set.

If an input stream from the previous row is open, it is implicitly closed. The ResultSet's warning chain is cleared when a new row is read

Returns:
true if the new current is valid; false if there are no more rows
Throws:
java.sql.SQLException - if a database access error occurs

close

public void close()
          throws java.sql.SQLException
In some cases, it is desirable to immediately release a ResultSet database and JDBC resources instead of waiting for this to happen when it is automatically closed. The close method provides this immediate release.

Note: A ResultSet is automatically closed by the Statement the Statement that generated it when that Statement is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A ResultSet is also automatically closed when it is garbage collected.

Specified by:
close() in interface java.sql.ResultSet
Throws:
java.sql.SQLException - if a database access error occurs

wasNull

public boolean wasNull()
               throws java.sql.SQLException
A column may have the value of SQL NULL; wasNull() reports whether the last column read had this special value. Note that you must first call getXXX on a column to try to read its value and then call wasNull() to find if the value was SQL NULL
Specified by:
wasNull() in interface java.sql.ResultSet
Returns:
true if the last column read was SQL NULL
Throws:
java.sql.SQLException - if a database access error occurred

getString

public java.lang.String getString(int columnIndex)
                          throws java.sql.SQLException
Get the value of a column in the current row as a Java String
Specified by:
getString(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
Returns:
the column value, null for SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getBoolean

public boolean getBoolean(int columnIndex)
                  throws java.sql.SQLException
Get the value of a column in the current row as a Java boolean
Specified by:
getBoolean(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
Returns:
the column value, false for SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getByte

public byte getByte(int columnIndex)
            throws java.sql.SQLException
Get the value of a column in the current row as a Java byte.
Specified by:
getByte(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2,...
Returns:
the column value; 0 if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getShort

public short getShort(int columnIndex)
              throws java.sql.SQLException
Get the value of a column in the current row as a Java short.
Specified by:
getShort(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2,...
Returns:
the column value; 0 if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getInt

public int getInt(int columnIndex)
          throws java.sql.SQLException
Get the value of a column in the current row as a Java int.
Specified by:
getInt(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2,...
Returns:
the column value; 0 if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getLong

public long getLong(int columnIndex)
            throws java.sql.SQLException
Get the value of a column in the current row as a Java long.
Specified by:
getLong(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2,...
Returns:
the column value; 0 if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getFloat

public float getFloat(int columnIndex)
              throws java.sql.SQLException
Get the value of a column in the current row as a Java float.
Specified by:
getFloat(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2,...
Returns:
the column value; 0 if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getDouble

public double getDouble(int columnIndex)
                throws java.sql.SQLException
Get the value of a column in the current row as a Java double.
Specified by:
getDouble(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2,...
Returns:
the column value; 0 if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getBigDecimal

public java.math.BigDecimal getBigDecimal(int columnIndex,
                                int scale)
                                  throws java.sql.SQLException
Get the value of a column in the current row as a java.lang.BigDecimal object
Specified by:
getBigDecimal(int, int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
scale - the number of digits to the right of the decimal
Returns:
the column value; if the value is SQL NULL, null
Throws:
java.sql.SQLException - if a database access error occurs

getBytes

public byte[] getBytes(int columnIndex)
               throws java.sql.SQLException
Get the value of a column in the current row as a Java byte array.

Be warned If the blob is huge, then you may run out of memory.

Specified by:
getBytes(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
java.sql.SQLException - if a database access error occurs

getDate

public java.sql.Date getDate(int columnIndex)
                     throws java.sql.SQLException
Get the value of a column in the current row as a java.sql.Date object
Specified by:
getDate(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
Returns:
the column value; null if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getTime

public java.sql.Time getTime(int columnIndex)
                     throws java.sql.SQLException
Get the value of a column in the current row as a java.sql.Time object
Specified by:
getTime(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
Returns:
the column value; null if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getTimestamp

public java.sql.Timestamp getTimestamp(int columnIndex)
                               throws java.sql.SQLException
Get the value of a column in the current row as a java.sql.Timestamp object
Specified by:
getTimestamp(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
Returns:
the column value; null if SQL NULL
Throws:
java.sql.SQLException - if a database access error occurs

getAsciiStream

public java.io.InputStream getAsciiStream(int columnIndex)
                                  throws java.sql.SQLException
A column value can be retrieved as a stream of ASCII characters and then read in chunks from the stream. This method is particulary suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into ASCII.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream. Also, a stream may return 0 for available() whether there is data available or not.

Specified by:
getAsciiStream(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
a Java InputStream that delivers the database column value as a stream of one byte ASCII characters. If the value is SQL NULL then the result is null
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
getBinaryStream

getUnicodeStream

public java.io.InputStream getUnicodeStream(int columnIndex)
                                    throws java.sql.SQLException
A column value can also be retrieved as a stream of Unicode characters. We implement this as a binary stream.
Specified by:
getUnicodeStream(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
Returns:
a Java InputStream that delivers the database column value as a stream of two byte Unicode characters. If the value is SQL NULL, then the result is null
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
getAsciiStream, getBinaryStream

getBinaryStream

public java.io.InputStream getBinaryStream(int columnIndex)
                                   throws java.sql.SQLException
A column value can also be retrieved as a binary strea. This method is suitable for retrieving LONGVARBINARY values.
Specified by:
getBinaryStream(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
Returns:
a Java InputStream that delivers the database column value as a stream of bytes. If the value is SQL NULL, then the result is null
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
getAsciiStream, getUnicodeStream

getString

public java.lang.String getString(java.lang.String ColumnName)
                          throws java.sql.SQLException
The following routines simply convert the columnName into a columnIndex and then call the appropriate routine above.
Specified by:
getString(java.lang.String) in interface java.sql.ResultSet
Parameters:
columnName - is the SQL name of the column
Returns:
the column value
Throws:
java.sql.SQLException - if a database access error occurs

getBoolean

public boolean getBoolean(java.lang.String ColumnName)
                  throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getBoolean(java.lang.String) in interface java.sql.ResultSet

getByte

public byte getByte(java.lang.String ColumnName)
            throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getByte(java.lang.String) in interface java.sql.ResultSet

getShort

public short getShort(java.lang.String ColumnName)
              throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getShort(java.lang.String) in interface java.sql.ResultSet

getInt

public int getInt(java.lang.String ColumnName)
          throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getInt(java.lang.String) in interface java.sql.ResultSet

getLong

public long getLong(java.lang.String ColumnName)
            throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getLong(java.lang.String) in interface java.sql.ResultSet

getFloat

public float getFloat(java.lang.String ColumnName)
              throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getFloat(java.lang.String) in interface java.sql.ResultSet

getDouble

public double getDouble(java.lang.String ColumnName)
                throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getDouble(java.lang.String) in interface java.sql.ResultSet

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String ColumnName,
                                int scale)
                                  throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getBigDecimal(java.lang.String, int) in interface java.sql.ResultSet

getBytes

public byte[] getBytes(java.lang.String ColumnName)
               throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getBytes(java.lang.String) in interface java.sql.ResultSet

getDate

public java.sql.Date getDate(java.lang.String ColumnName)
                     throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getDate(java.lang.String) in interface java.sql.ResultSet

getTime

public java.sql.Time getTime(java.lang.String ColumnName)
                     throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getTime(java.lang.String) in interface java.sql.ResultSet

getTimestamp

public java.sql.Timestamp getTimestamp(java.lang.String ColumnName)
                               throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getTimestamp(java.lang.String) in interface java.sql.ResultSet

getAsciiStream

public java.io.InputStream getAsciiStream(java.lang.String ColumnName)
                                  throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getAsciiStream(java.lang.String) in interface java.sql.ResultSet

getUnicodeStream

public java.io.InputStream getUnicodeStream(java.lang.String ColumnName)
                                    throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getUnicodeStream(java.lang.String) in interface java.sql.ResultSet

getBinaryStream

public java.io.InputStream getBinaryStream(java.lang.String ColumnName)
                                   throws java.sql.SQLException
Description copied from interface:
 
Specified by:
getBinaryStream(java.lang.String) in interface java.sql.ResultSet

getWarnings

public java.sql.SQLWarning getWarnings()
                               throws java.sql.SQLException
The first warning reported by calls on this ResultSet is returned. Subsequent ResultSet warnings will be chained to this SQLWarning.

The warning chain is automatically cleared each time a new row is read.

Note: This warning chain only covers warnings caused by ResultSet methods. Any warnings caused by statement methods (such as reading OUT parameters) will be chained on the Statement object.

Specified by:
getWarnings() in interface java.sql.ResultSet
Returns:
the first SQLWarning or null;
Throws:
java.sql.SQLException - if a database access error occurs.

clearWarnings

public void clearWarnings()
                  throws java.sql.SQLException
After this call, getWarnings returns null until a new warning is reported for this ResultSet
Specified by:
clearWarnings() in interface java.sql.ResultSet
Throws:
java.sql.SQLException - if a database access error occurs

getCursorName

public java.lang.String getCursorName()
                              throws java.sql.SQLException
Get the name of the SQL cursor used by this ResultSet

In SQL, a result table is retrieved though a cursor that is named. The current row of a result can be updated or deleted using a positioned update/delete statement that references the cursor name.

JDBC supports this SQL feature by providing the name of the SQL cursor used by a ResultSet. The current row of a ResulSet is also the current row of this SQL cursor.

Note: If positioned update is not supported, a SQLException is thrown.

Specified by:
getCursorName() in interface java.sql.ResultSet
Returns:
the ResultSet's SQL cursor name.
Throws:
java.sql.SQLException - if a database access error occurs

getMetaData

public java.sql.ResultSetMetaData getMetaData()
                                      throws java.sql.SQLException
The numbers, types and properties of a ResultSet's columns are provided by the getMetaData method
Specified by:
getMetaData() in interface java.sql.ResultSet
Returns:
a description of the ResultSet's columns
Throws:
java.sql.SQLException - if a database access error occurs

getObject

public java.lang.Object getObject(int columnIndex)
                          throws java.sql.SQLException
Get the value of a column in the current row as a Java object

This method will return the value of the given column as a Java object. The type of the Java object will be the default Java Object type corresponding to the column's SQL type, following the mapping specified in the JDBC specification.

This method may also be used to read database specific abstract data types.

Specified by:
getObject(int) in interface java.sql.ResultSet
Parameters:
columnIndex - the first column is 1, the second is 2...
Returns:
a Object holding the column value
Throws:
java.sql.SQLException - if a database access error occurs

getObject

public java.lang.Object getObject(java.lang.String ColumnName)
                          throws java.sql.SQLException
Get the value of a column in the current row as a Java object

This method will return the value of the given column as a Java object. The type of the Java object will be the default Java Object type corresponding to the column's SQL type, following the mapping specified in the JDBC specification.

This method may also be used to read database specific abstract data types.

Specified by:
getObject(java.lang.String) in interface java.sql.ResultSet
Parameters:
columnName - is the SQL name of the column
Returns:
a Object holding the column value
Throws:
java.sql.SQLException - if a database access error occurs

findColumn

public int findColumn(java.lang.String ColumnName)
              throws java.sql.SQLException
Map a ResultSet column name to a ResultSet column index
Specified by:
findColumn(java.lang.String) in interface java.sql.ResultSet
Parameters:
columnName - the name of the column
Returns:
the column index
Throws:
java.sql.SQLException - if a database access error occurs

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD