|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hp.ucmdb.discovery.library.clients.query.ResultSet
public abstract class ResultSet
ResultSet
represents the result of a query run by QueryClient
.
The ResultSet
class providews the APIs to iterate through the data
and fetch data by name or index.
Here is example of using SNMPClient
for disks discovery:
client = Framework.getClientFactory(ClientsConsts.SNMP_PROTOCOL_NAME).createClient()
data_name_mib = '1.3.6.1.2.1.25.2.3.1.3,1.3.6.1.2.1.25.2.3.1.4,string,1.3.6.1.2.1.25.2.3.1.5,double,1.3.6.1.2.1.25.2.3.1.6,string,1.3.6.1.2.1.25.2.3.1.7,string,1.3.6.1.2.1.25.2.3.1.2,string,1.3.6.1.2.1.25.2.3.1.4,string'
resultSet = client.executeQuery(data_name_mib)
while resultSet.next():
diskName = resultSet.getString(2)
diskSize = resultSet.getString(3)
diskType = resultSet.getString(6)
Before fetching data from the result set, check that there is data for processing. The next
method also the next row in the result set to be the current row.
There are two implementations for this class:DbResultSet
and QueryResultSet
.
The methods with named columns as arguments, for example getString(String column name)
are implemented
only in the DbResultSet
class.
Close a ResultSet
in your code when no further processing is required on the set.
DbResultSet
,
QueryResultSet
Constructor Summary | |
---|---|
ResultSet(QueryClient client)
|
Method Summary | |
---|---|
abstract java.lang.String[][] |
asTable()
Returns the entire RecordSet |
abstract void |
close()
Closes the ResultSet. |
boolean |
first()
Sets the first row in the ResultSet to be the active record. |
boolean |
getBoolean(int column)
Returns the value of the boolean column specified by the column index. |
boolean |
getBoolean(java.lang.String name)
Returns the value of the boolean column specified by the column name. |
java.util.Date |
getDate(int column)
Returns the value of the column specified by the column index. |
java.util.Date |
getDate(java.lang.String name)
Returns the value of the column specified by the column name. |
double |
getDouble(int column)
Returns the value of the column specified by the column name. |
double |
getDouble(java.lang.String name)
Returns the value of the column specified by the column name. |
float |
getFloat(int column)
Returns the value of the column specified by the column index. |
float |
getFloat(java.lang.String name)
Returns the value of the column specified by the column name. |
int |
getInt(int column)
Returns the value of the column specified by the column index. |
int |
getInt(java.lang.String name)
Returns the value of the column specified by the column name. |
long |
getLong(int column)
Returns the value of the column specified by the column index. |
long |
getLong(java.lang.String name)
Returns the value of the column specified by the column name. |
java.lang.String |
getString(int column)
Returns the value of the specifed column in the current row. |
java.lang.String |
getString(java.lang.String name)
Returns the value of column specified by the column name. |
java.sql.Timestamp |
getTimestamp(int column)
Returns the value of the column specified by the column index. |
java.sql.Timestamp |
getTimestamp(java.lang.String name)
Returns the value of the column specified by the column name. |
boolean |
next()
Sets the next row in the ResultSet to be the active record. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResultSet(QueryClient client)
Method Detail |
---|
public java.lang.String getString(int column) throws java.lang.Exception
column
- The column index (1-based)
java.lang.Exception
public java.lang.String getString(java.lang.String name) throws java.lang.Exception
name
- The column name
java.lang.Exception
public boolean getBoolean(int column) throws java.lang.Exception
column
- The column index (1-based)
java.lang.Exception
public boolean getBoolean(java.lang.String name) throws java.lang.Exception
name
- The column name (1-based)
java.lang.Exception
public int getInt(int column) throws java.lang.Exception
column
- The column index (1-based)
java.lang.Exception
public int getInt(java.lang.String name) throws java.lang.Exception
name
- The column name
java.lang.Exception
public long getLong(int column) throws java.lang.Exception
column
- The column index (1-based)
java.lang.Exception
public long getLong(java.lang.String name) throws java.lang.Exception
name
- The column name
java.lang.Exception
public double getDouble(int column) throws java.lang.Exception
column
- column index (1-based)
java.lang.Exception
public double getDouble(java.lang.String name) throws java.lang.Exception
column
- column index (1-based)
java.lang.Exception
public float getFloat(int column) throws java.lang.Exception
column
- column index (1-based)
java.lang.Exception
public float getFloat(java.lang.String name) throws java.lang.Exception
name
- The column name
java.lang.Exception
public java.sql.Timestamp getTimestamp(int column) throws java.lang.Exception
column
- column index (1-based)
java.lang.Exception
public java.sql.Timestamp getTimestamp(java.lang.String name) throws java.lang.Exception
name
- The column name
java.lang.Exception
public java.util.Date getDate(int column) throws java.lang.Exception
column
- column index (1-based)
java.lang.Exception
public java.util.Date getDate(java.lang.String name) throws java.lang.Exception
name
- The column name
java.lang.Exception
public boolean next() throws java.lang.Exception
java.lang.Exception
public boolean first() throws java.lang.Exception
java.lang.Exception
public abstract void close() throws java.lang.Exception
close
when finished working with a record set that was returned from a database.
java.lang.Exception
public abstract java.lang.String[][] asTable() throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |