|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprefuse.data.io.sql.DatabaseDataSource
public class DatabaseDataSource
Sends queries to a relational database and processes the results, storing
the results in prefuse Table instances. This class should not be
instantiated directly. To access a database, the ConnectionFactory
class should be used to retrieve an appropriate instance of this class.
| Field Summary | |
|---|---|
protected java.sql.Connection |
m_conn
|
protected SQLDataHandler |
m_handler
|
protected java.sql.Statement |
m_stmt
|
| Method Summary | |
|---|---|
Table |
getData(java.lang.String query)
Executes a query and returns the results in a Table instance. |
Table |
getData(java.lang.String query,
java.lang.String keyField)
Executes a query and returns the results in a Table instance. |
Table |
getData(Table t,
java.lang.String query)
Executes a query and returns the results in a Table instance. |
Table |
getData(Table t,
java.lang.String query,
java.lang.String keyField)
Executes a query and returns the results in a Table instance. |
Table |
getData(Table t,
java.lang.String query,
java.lang.String keyField,
java.lang.Object lock)
Executes a query and returns the results in a Table instance. |
protected int |
getExistingRow(Table t,
java.sql.ResultSet rset,
java.lang.String keyField)
See if a retrieved database row is already represented in the given Table. |
Schema |
getSchema(java.sql.ResultSetMetaData metadata,
SQLDataHandler handler)
Given the metadata for a SQL result set and a data value handler for that result set, returns a corresponding schema for a prefuse table. |
void |
loadData(Table t,
java.lang.String query)
Asynchronously executes a query and stores the results in the given table instance. |
void |
loadData(Table t,
java.lang.String query,
java.lang.Object lock)
Asynchronously executes a query and stores the results in the given table instance. |
void |
loadData(Table t,
java.lang.String query,
java.lang.String keyField)
Asynchronously executes a query and stores the results in the given table instance. |
void |
loadData(Table t,
java.lang.String query,
java.lang.String keyField,
java.lang.Object lock)
Asynchronously executes a query and stores the results in the given table instance. |
void |
loadData(Table t,
java.lang.String query,
java.lang.String keyField,
java.lang.Object lock,
DataSourceWorker.Listener listener)
Asynchronously executes a query and stores the results in the given table instance. |
protected Table |
process(Table t,
java.sql.ResultSet rset,
java.lang.String key,
java.lang.Object lock)
Process the results of a SQL query, putting retrieved data into a Table instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.sql.Connection m_conn
protected java.sql.Statement m_stmt
protected SQLDataHandler m_handler
| Method Detail |
|---|
public Table getData(java.lang.String query)
throws DataIOException
query - the text SQL query to execute
DataIOException - if an error occurs while executing the query
or adding the query results in a prefuse Table.
public Table getData(java.lang.String query,
java.lang.String keyField)
throws DataIOException
query - the text SQL query to executekeyField - the field to treat as a primary key, ensuring that this
field is indexed in the resulting table instance.
DataIOException - if an error occurs while executing the query
or adding the query results in a prefuse Table.
public Table getData(Table t,
java.lang.String query)
throws DataIOException
t - the Table to store the results in. If this value is null, a
new table will automatically be created.query - the text SQL query to execute
DataIOException - if an error occurs while executing the query
or adding the query results in a prefuse Table.
public Table getData(Table t,
java.lang.String query,
java.lang.String keyField)
throws DataIOException
t - the Table to store the results in. If this value is null, a
new table will automatically be created.query - the text SQL query to executekeyField - used to determine if the row already exists in the table
DataIOException - if an error occurs while executing the query
or adding the query results in a prefuse Table.
public Table getData(Table t,
java.lang.String query,
java.lang.String keyField,
java.lang.Object lock)
throws DataIOException
t - the Table to store the results in. If this value is null, a
new table will automatically be created.query - the text SQL query to executekeyField - used to determine if the row already exists in the tablelock - an optional Object to use as a lock when performing data
processing. This lock will be synchronized on whenever the Table is
modified.
DataIOException - if an error occurs while executing the query
or adding the query results in a prefuse Table.
public void loadData(Table t,
java.lang.String query)
t - the Table in which to store the resultsquery - the query to execute
public void loadData(Table t,
java.lang.String query,
java.lang.String keyField)
t - the Table in which to store the resultsquery - the query to executekeyField - the primary key field, comparisons on this field are
performed to recognize data records already present in the table.
public void loadData(Table t,
java.lang.String query,
java.lang.Object lock)
t - the Table in which to store the resultsquery - the query to executelock - an optional Object to use as a lock when performing data
processing. This lock will be synchronized on whenever the Table is
modified.
public void loadData(Table t,
java.lang.String query,
java.lang.String keyField,
java.lang.Object lock)
t - the Table in which to store the resultsquery - the query to executekeyField - the primary key field, comparisons on this field are
performed to recognize data records already present in the table.lock - an optional Object to use as a lock when performing data
processing. This lock will be synchronized on whenever the Table is
modified.
public void loadData(Table t,
java.lang.String query,
java.lang.String keyField,
java.lang.Object lock,
DataSourceWorker.Listener listener)
t - the Table in which to store the resultsquery - the query to executekeyField - the primary key field, comparisons on this field are
performed to recognize data records already present in the table.
A null value will result in no key checking.lock - an optional Object to use as a lock when performing data
processing. This lock will be synchronized on whenever the Table is
modified. A null value will result in no locking.listener - an optional listener that will provide notifications
before the query has been issued and after the query has been
processed. This is most useful for post-processing operations.
protected Table process(Table t,
java.sql.ResultSet rset,
java.lang.String key,
java.lang.Object lock)
throws DataIOException
t - the Table to store results inrset - the SQL query result set
DataIOException
protected int getExistingRow(Table t,
java.sql.ResultSet rset,
java.lang.String keyField)
throws java.sql.SQLException
t - the prefuse Table to check for an existing rowrset - the ResultSet, set to a particular row, which may or
may not have a matching row in the prefuse TablekeyField - the key field to look up to check for an existing row
java.sql.SQLException
public Schema getSchema(java.sql.ResultSetMetaData metadata,
SQLDataHandler handler)
throws java.sql.SQLException
metadata - the SQL result set metadatahandler - the data value handler
java.sql.SQLException - if an error occurs accessing the metadata
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||