Class com.imaginary.sql.msql.MsqlQueryData
java.lang.Object
|
+--com.imaginary.sql.msql.MsqlResultSet
|
+--com.imaginary.sql.msql.MsqlQueryData
- Subclasses:
- ColumnResults, PrimaryKeyResults, TableResults
- public class MsqlQueryData
- extends MsqlResultSet
The MsqlQueryData class is new to mSQL-JDBC 2.0 and replaces the
functionality of the old MsqlResultSet class. That is, it represents
the results of a SQL query sent to mSQL.
Last modified $Date: 1999/07/06 05:56:09 $
- Version:
- $Revision: 1.6 $
- Author:
- George Reese (borg@imaginary.com)
Method Summary
|
boolean
|
absolute(int row)
Positions the result set to an absolute position relative to
either the beginning or end of the result set. |
void
|
addRow(MsqlRow row)
|
void
|
cancelRowUpdates()
Clears any changes you have made to the current row. |
void
|
close()
Closes the result set. |
void
|
complete()
Marks the load as completed. |
int
|
findColumn(java.lang.String name)
Attempts to find the column number associated with the name
given. |
java.io.InputStream
|
getAsciiStream(int column)
|
java.io.InputStream
|
getBinaryStream(int column)
|
java.sql.Blob
|
getBlob(int column)
|
boolean
|
getBoolean(int column)
|
byte
|
getByte(int column)
|
byte[]
|
getBytes(int column)
|
void
|
getColumn(int column)
Retrieves the specified column and puts it into the lastColumn
attribute. |
java.sql.ResultSetMetaData
|
getMetaData()
|
int
|
getRow()
|
java.lang.String
|
getString(int column)
|
java.io.InputStream
|
getUnicodeStream(int column)
Deprecated. |
java.lang.String
|
getUpdate(int col)
Provides the update value for the specified column. |
boolean
|
isLast()
This is an expensive operation and should be avoided. |
java.sql.ResultSetMetaData
|
loadMetaData()
|
void
|
loadResults()
Runs the thread for loading data from the database. |
boolean
|
next()
Moves to the next row of data for processing. |
boolean
|
previous()
Moves to the previous row of data for processing. |
MsqlRow
|
readRow(byte[] data)
|
void
|
refreshRow()
Restores the current row to its original values. |
boolean
|
relative(int count)
Moves the result set forward the specified number of rows relative
to the current row. |
boolean
|
rowDeleted()
|
boolean
|
rowInserted()
|
boolean
|
rowUpdated()
|
void
|
setColumn(int column,
java.lang.String value)
Changes the specified column. |
void
|
updateRow()
Adds to the functionality in MsqlResultSet by
resetting the row state. |
boolean
|
wasNull()
|
Methods inherited from class com.imaginary.sql.msql.MsqlResultSet |
afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, complete, deleteRow, first, getArray, getArray, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBlob, getBlob, getBoolean, getByte, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getEncoding, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getObject, getObject, getObject, getObject, getRef, getRef, getShort, getShort, getStatement, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUpdate, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, last, moveToCurrentRow, moveToInsertRow, refreshRow, rowDeleted, rowInserted, rowUpdated, setColumn, setFetchDirection, setFetchSize, setType, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
lastColumn
protected java.lang.String lastColumn
absolute
public boolean absolute(int row)
throws java.sql.SQLException
- Positions the result set to an absolute position relative to
either the beginning or end of the result set.
- Parameters:
row
- positive indicates the absolute row number from the
start, negative indicates the absolute row number from the end- Returns:
- true if the positioning points to a row
- Throws:
- java.sql.SQLException - a database error occurred,
the result set is TYPE_FORWARD_ONLY, or row is 0
addRow
protected void addRow(MsqlRow row)
cancelRowUpdates
public void cancelRowUpdates()
throws java.sql.SQLException
- Clears any changes you have made to the current row.
- Throws:
- java.sql.SQLException - a database error occurred
- Overrides:
- cancelRowUpdates in class MsqlResultSet
close
public void close()
throws java.sql.SQLException
- Closes the result set.
- Throws:
- java.sql.SQLException - thrown for errors on closing
- Overrides:
- close in class MsqlResultSet
complete
public void complete()
- Marks the load as completed.
- Overrides:
- complete in class MsqlResultSet
findColumn
public int findColumn(java.lang.String name)
throws java.sql.SQLException
- Attempts to find the column number associated with the name
given. It is recommended to avoid this method (as well as
any method accessing a column by name) as it is very, very slow.
It will first search for a match in the form of table.column.
If you specify only the column, however, it will then look for
a match solely on column name.
- Parameters:
name
- the name of the desired column- Returns:
- the column number for the specified column name
- Throws:
- java.sql.SQLException - thrown on a read error
getAsciiStream
public java.io.InputStream getAsciiStream(int column)
throws java.sql.SQLException
- Parameters:
column
- the column number for the desired column- Returns:
- an ASCII input stream for the desired column
- Throws:
- java.sql.SQLException - thrown when the column cannot be read
getBinaryStream
public java.io.InputStream getBinaryStream(int column)
throws java.sql.SQLException
- Parameters:
column
- the number of the desired column- Returns:
- the column as an InputStream
- Throws:
- java.sql.SQLException - thrown in the event of an error
reading the column
getBlob
public java.sql.Blob getBlob(int column)
throws java.sql.SQLException
- Parameters:
ccolumn
- the column number of the desired column- Returns:
- the column as a JDBC 2.0 Blob
- Throws:
- java.sql.SQLException - a database error occurred
- Overrides:
- getBlob in class MsqlResultSet
getBoolean
public boolean getBoolean(int column)
throws java.sql.SQLException
- Parameters:
column
- the number of the desired column- Returns:
- the column as a boolean
- Throws:
- java.sql.SQLException - thrown in the event of an error
reading the column
getByte
public byte getByte(int column)
throws java.sql.SQLException
- Parameters:
column
- the number of the desired column- Returns:
- the column as a byte
- Throws:
- java.sql.SQLException - thrown in the event of an error
reading the column
getBytes
public byte[] getBytes(int column)
throws java.sql.SQLException
- Parameters:
column
- the number of the desired column- Returns:
- the column as a byte array
- Throws:
- java.sql.SQLException - thrown in the event of an error
reading the column
getColumn
protected void getColumn(int column)
throws java.sql.SQLException
- Retrieves the specified column and puts it into the lastColumn
attribute.
- Parameters:
column
- the column being retrieved- Throws:
- java.sql.SQLException - the cursor is on a non-existent row
getMetaData
public java.sql.ResultSetMetaData getMetaData()
throws java.sql.SQLException
- Returns:
- the meta data associated with this result set
- Throws:
- java.sql.SQLException - the meta data could not be loaded
getRow
public int getRow()
throws java.sql.SQLException
- Returns:
- the current row number
- Throws:
- java.sql.SQLException - this is never thrown
getString
public java.lang.String getString(int column)
throws java.sql.SQLException
- Parameters:
column
- the number of the desired column- Returns:
- the column as a Java String
- Throws:
- java.sql.SQLException - thrown in the event of an error
reading the column
getUnicodeStream
public java.io.InputStream getUnicodeStream(int column)
throws java.sql.SQLException
- Deprecated. use getCharacterStream()
- Parameters:
column
- the number of the desired column- Returns:
- the column as an InputStream
- Throws:
- java.sql.SQLException - thrown in the event of an error
reading the column
getUpdate
protected java.lang.String getUpdate(int col)
throws java.sql.SQLException
- Provides the update value for the specified column.
- Parameters:
col
- the column whose updated values are sought- Returns:
- the update value for the specified column
- Throws:
- java.sql.SQLException - a database error occurred or an
incorrect encoding is specified for this result set
- Overrides:
- getUpdate in class MsqlResultSet
isLast
public boolean isLast()
throws java.sql.SQLException
- This is an expensive operation and should be avoided.
- Returns:
- true if the current row is the last row
- Throws:
- java.sql.SQLException - this is never thrown
loadMetaData
protected java.sql.ResultSetMetaData loadMetaData()
throws java.sql.SQLException
loadResults
protected void loadResults()
throws java.sql.SQLException
- Runs the thread for loading data from the database.
next
public boolean next()
throws java.sql.SQLException
- Moves to the next row of data for processing. If there are no
more rows to be processed, then it will return false.
- Returns:
- true if there are results to be processed, false otherwise
- Throws:
- java.sql.SQLException - thrown if a read error occurs
previous
public boolean previous()
throws java.sql.SQLException
- Moves to the previous row of data for processing. If there is no
previous row to be processed, then it will return false. An exception
will be thrown if the result set type equals TYPE_FORWARD_ONLY which
is the default.
- Returns:
- true if there are results to be processed, false otherwise
- Throws:
- java.sql.SQLException - thrown if a read error occurs
readRow
protected MsqlRow readRow(byte[] data)
throws java.sql.SQLException
refreshRow
public void refreshRow()
throws java.sql.SQLException
- Restores the current row to its original values. This does not
go back to the database, so any modifications to the row by
other transactions will not be noted.
- Throws:
- java.sql.SQLException - could not refresh row
- Overrides:
- refreshRow in class MsqlResultSet
relative
public boolean relative(int count)
throws java.sql.SQLException
- Moves the result set forward the specified number of rows relative
to the current row.
- Parameters:
count
- the number of rows to move forward- Returns:
- true if the result set remains on a row, false otherwise
- Throws:
- java.sql.SQLException - a database error occurred, the
result set is TYPE_FORWARD_ONLY, or there is no current row
rowDeleted
public boolean rowDeleted()
throws java.sql.SQLException
- Returns:
- true if the current row is marked for deletion
- Throws:
- java.sql.SQLException - a database error occurred
- Overrides:
- rowDeleted in class MsqlResultSet
rowInserted
public boolean rowInserted()
throws java.sql.SQLException
- Returns:
- true if the current row is an insert
- Throws:
- java.sql.SQLException - a database error occurred
- Overrides:
- rowInserted in class MsqlResultSet
rowUpdated
public boolean rowUpdated()
throws java.sql.SQLException
- Returns:
- true if the current row has been updated
- Throws:
- java.sql.SQLException - a database error occurred
- Overrides:
- rowUpdated in class MsqlResultSet
setColumn
protected void setColumn(int column,
java.lang.String value)
throws java.sql.SQLException
- Changes the specified column.
- Parameters:
column
- the column being retrieved- Throws:
- java.sql.SQLException - the cursor is on a non-existent row or
the result set is not updatable
- Overrides:
- setColumn in class MsqlResultSet
updateRow
public void updateRow()
throws java.sql.SQLException
- Adds to the functionality in
MsqlResultSet
by
resetting the row state.
- Throws:
- java.sql.SQLException - result set is read only
- Overrides:
- updateRow in class MsqlResultSet
wasNull
public boolean wasNull()
throws java.sql.SQLException
- Returns:
- true if the last value read was null
- Throws:
- java.sql.SQLException - this is never thrown