public class InstanceQuery extends DatabaseUtils implements OptionHandler, InstanceQueryAdapter
jdbcDriver=jdbc.idbDriver
jdbcURL=jdbc:idb=experiments.prp
Command line use just outputs the instances to System.out.
Valid options are:-Q <query> SQL query to execute.
-S Return sparse rather than normal instances.
-U <username> The username to use for connecting.
-P <password> The password to use for connecting.
-D Enables debug output.
BOOL, BYTE, DATE, DOUBLE, EXP_INDEX_TABLE, EXP_RESULT_COL, EXP_RESULT_PREFIX, EXP_SETUP_COL, EXP_TYPE_COL, FLOAT, INTEGER, LONG, PROPERTY_FILE, SHORT, STRING, TEXT, TIME, TIMESTAMP
Constructor and Description |
---|
InstanceQuery()
Sets up the database drivers
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
customPropsFileTipText()
The tip text for this property.
|
java.io.File |
getCustomPropsFile()
Returns the custom properties file in use, if any.
|
java.lang.String[] |
getOptions()
Gets the current settings of InstanceQuery
|
java.lang.String |
getQuery()
Get the query to execute against the database
|
java.lang.String |
getRevision()
Returns the revision string.
|
boolean |
getSparseData()
Gets whether data is to be returned as a set of sparse instances
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options
|
static void |
main(java.lang.String[] args)
Test the class from the command line.
|
java.lang.String |
queryTipText()
Returns the tip text for this property
|
Instances |
retrieveInstances()
Makes a database query using the query set through the -Q option to convert
a table into a set of instances
|
static Instances |
retrieveInstances(InstanceQueryAdapter adapter,
java.sql.ResultSet rs) |
Instances |
retrieveInstances(java.lang.String query)
Makes a database query to convert a table into a set of instances
|
void |
setCustomPropsFile(java.io.File value)
Sets the custom properties file to use.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setQuery(java.lang.String q)
Set the query to execute against the database
|
void |
setSparseData(boolean s)
Sets whether data should be encoded as sparse instances
|
java.lang.String |
sparseDataTipText()
Returns the tip text for this property
|
arrayToString, attributeCaseFix, close, close, connectToDatabase, createExperimentIndex, createExperimentIndexEntry, createResultsTable, databaseURLTipText, debugTipText, disconnectFromDatabase, execute, experimentIndexExists, getDatabaseURL, getDebug, getKeywords, getKeywordsMaskChar, getPassword, getResultFromTable, getResultSet, getResultsTableName, getSupportedCursorScrollType, getUsername, initialize, initialize, isConnected, isCursorScrollable, isCursorScrollSensitive, isKeyword, maskKeyword, passwordTipText, processKeyString, putResultInTable, select, setDatabaseURL, setDebug, setKeywords, setKeywordsMaskChar, setPassword, setUsername, tableExists, translateDBColumnType, typeName, update, usernameTipText
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
makeCopy
attributeCaseFix, getDebug, translateDBColumnType
public InstanceQuery() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-Q <query> SQL query to execute.
-S Return sparse rather than normal instances.
-U <username> The username to use for connecting.
-P <password> The password to use for connecting.
-D Enables debug output.
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String queryTipText()
public void setQuery(java.lang.String q)
q
- the query to executepublic java.lang.String getQuery()
public java.lang.String sparseDataTipText()
public void setSparseData(boolean s)
s
- true if data should be encoded as a set of sparse instancespublic boolean getSparseData()
getSparseData
in interface InstanceQueryAdapter
public void setCustomPropsFile(java.io.File value)
value
- the custom props file to load database parameters from, use
null or directory to disable custom properties.DatabaseUtils.initialize(File)
public java.io.File getCustomPropsFile()
public java.lang.String customPropsFileTipText()
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public Instances retrieveInstances() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic static Instances retrieveInstances(InstanceQueryAdapter adapter, java.sql.ResultSet rs) throws java.lang.Exception
java.lang.Exception
public Instances retrieveInstances(java.lang.String query) throws java.lang.Exception
query
- the query to convert to instancesjava.lang.Exception
- if an error occurspublic static void main(java.lang.String[] args)
args
- contains options for the instance querypublic java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class DatabaseUtils