| java.lang.Object prefuse.data.io.sql.DatabaseDataSource
DatabaseDataSource | public class DatabaseDataSource (Code) | | 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.
author: jeffrey heer |
Method Summary | |
public synchronized Table | getData(String query) Executes a query and returns the results in a Table instance. | public synchronized Table | getData(String query, String keyField) Executes a query and returns the results in a Table instance.
Parameters: query - the text SQL query to execute Parameters: keyField - the field to treat as a primary key, ensuring that thisfield is indexed in the resulting table instance. | public synchronized Table | getData(Table t, String query) Executes a query and returns the results in a Table instance.
Parameters: t - the Table to store the results in. | public synchronized Table | getData(Table t, String query, String keyField) Executes a query and returns the results in a Table instance.
Parameters: t - the Table to store the results in. | public synchronized Table | getData(Table t, String query, String keyField, Object lock) Executes a query and returns the results in a Table instance.
Parameters: t - the Table to store the results in. | protected int | getExistingRow(Table t, ResultSet rset, String keyField) See if a retrieved database row is already represented in the given
Table. | public Schema | getSchema(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. | public void | loadData(Table t, String query) Asynchronously executes a query and stores the results in the given
table instance. | public void | loadData(Table t, String query, String keyField) Asynchronously executes a query and stores the results in the given
table instance. | public void | loadData(Table t, String query, Object lock) Asynchronously executes a query and stores the results in the given
table instance. | public void | loadData(Table t, String query, String keyField, Object lock) Asynchronously executes a query and stores the results in the given
table instance. | public void | loadData(Table t, String query, String keyField, Object lock, DataSourceWorker.Listener listener) Asynchronously executes a query and stores the results in the given
table instance. | protected Table | process(Table t, ResultSet rset, String key, Object lock) Process the results of a SQL query, putting retrieved data into a
Table instance. |
DatabaseDataSource | DatabaseDataSource(Connection conn, SQLDataHandler handler)(Code) | | Creates a new DatabaseDataSource for reading data from a SQL relational
database. This constructor is only package visible and is not intended
for use by application level code. Instead, the
ConnectionFactory class should be used to create any number of
DatabaseDataSource connections.
|
getData | public synchronized Table getData(String query) throws DataIOException(Code) | | Executes a query and returns the results in a Table instance.
Parameters: query - the text SQL query to execute a Table of the query results throws: DataIOException - if an error occurs while executing the query or adding the query results in a prefuse Table. |
getData | public synchronized Table getData(String query, String keyField) throws DataIOException(Code) | | Executes a query and returns the results in a Table instance.
Parameters: query - the text SQL query to execute Parameters: keyField - the field to treat as a primary key, ensuring that thisfield is indexed in the resulting table instance. a Table of the query results throws: DataIOException - if an error occurs while executing the query or adding the query results in a prefuse Table. |
getData | public synchronized Table getData(Table t, String query) throws DataIOException(Code) | | Executes a query and returns the results in a Table instance.
Parameters: t - the Table to store the results in. If this value is null, anew table will automatically be created. Parameters: query - the text SQL query to execute a Table of the query results throws: DataIOException - if an error occurs while executing the query or adding the query results in a prefuse Table. |
getData | public synchronized Table getData(Table t, String query, String keyField) throws DataIOException(Code) | | Executes a query and returns the results in a Table instance.
Parameters: t - the Table to store the results in. If this value is null, anew table will automatically be created. Parameters: query - the text SQL query to execute Parameters: keyField - used to determine if the row already exists in the table a Table of the query results throws: DataIOException - if an error occurs while executing the query or adding the query results in a prefuse Table. |
getData | public synchronized Table getData(Table t, String query, String keyField, Object lock) throws DataIOException(Code) | | Executes a query and returns the results in a Table instance.
Parameters: t - the Table to store the results in. If this value is null, anew table will automatically be created. Parameters: query - the text SQL query to execute Parameters: keyField - used to determine if the row already exists in the table Parameters: lock - an optional Object to use as a lock when performing dataprocessing. This lock will be synchronized on whenever the Table ismodified. a Table of the query results throws: DataIOException - if an error occurs while executing the query or adding the query results in a prefuse Table. |
getExistingRow | protected int getExistingRow(Table t, ResultSet rset, String keyField) throws SQLException(Code) | | See if a retrieved database row is already represented in the given
Table.
Parameters: t - the prefuse Table to check for an existing row Parameters: rset - the ResultSet, set to a particular row, which may ormay not have a matching row in the prefuse Table Parameters: keyField - the key field to look up to check for an existing row the index of the existing row, or -1 if no match is found throws: SQLException - |
getSchema | public Schema getSchema(ResultSetMetaData metadata, SQLDataHandler handler) throws SQLException(Code) | | 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.
Parameters: metadata - the SQL result set metadata Parameters: handler - the data value handler the schema determined by the metadata and handler throws: SQLException - if an error occurs accessing the metadata |
loadData | public void loadData(Table t, String query)(Code) | | Asynchronously executes a query and stores the results in the given
table instance. All data processing is done in a separate thread of
execution.
Parameters: t - the Table in which to store the results Parameters: query - the query to execute |
loadData | public void loadData(Table t, String query, String keyField)(Code) | | Asynchronously executes a query and stores the results in the given
table instance. All data processing is done in a separate thread of
execution.
Parameters: t - the Table in which to store the results Parameters: query - the query to execute Parameters: keyField - the primary key field, comparisons on this field areperformed to recognize data records already present in the table. |
loadData | public void loadData(Table t, String query, Object lock)(Code) | | Asynchronously executes a query and stores the results in the given
table instance. All data processing is done in a separate thread of
execution.
Parameters: t - the Table in which to store the results Parameters: query - the query to execute Parameters: lock - an optional Object to use as a lock when performing dataprocessing. This lock will be synchronized on whenever the Table ismodified. |
loadData | public void loadData(Table t, String query, String keyField, Object lock)(Code) | | Asynchronously executes a query and stores the results in the given
table instance. All data processing is done in a separate thread of
execution.
Parameters: t - the Table in which to store the results Parameters: query - the query to execute Parameters: keyField - the primary key field, comparisons on this field areperformed to recognize data records already present in the table. Parameters: lock - an optional Object to use as a lock when performing dataprocessing. This lock will be synchronized on whenever the Table ismodified. |
loadData | public void loadData(Table t, String query, String keyField, Object lock, DataSourceWorker.Listener listener)(Code) | | Asynchronously executes a query and stores the results in the given
table instance. All data processing is done in a separate thread of
execution.
Parameters: t - the Table in which to store the results Parameters: query - the query to execute Parameters: keyField - the primary key field, comparisons on this field areperformed to recognize data records already present in the table.A null value will result in no key checking. Parameters: lock - an optional Object to use as a lock when performing dataprocessing. This lock will be synchronized on whenever the Table ismodified. A null value will result in no locking. Parameters: listener - an optional listener that will provide notificationsbefore the query has been issued and after the query has been processed. This is most useful for post-processing operations. |
process | protected Table process(Table t, ResultSet rset, String key, Object lock) throws DataIOException(Code) | | Process the results of a SQL query, putting retrieved data into a
Table instance. If a null table is provided, a new table with the
appropriate schema will be created.
Parameters: t - the Table to store results in Parameters: rset - the SQL query result set a Table containing the query results |
|
|