public class BasicQuery
extends javax.swing.JFrame
implements java.lang.Runnable, java.awt.event.ActionListener, java.awt.event.WindowListener, java.util.Observer, java.awt.event.KeyListener
Execute arbitrary SQL against database accessible with any JDBC-compliant driver.
Copyright: Copyright (c) 2004-2014, David Read
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Modifier and Type | Class and Description |
---|---|
private class |
BasicQuery.ExportResultsAsTriplesListener
Handle menu selection for exporting the results to triples
|
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
private javax.swing.JRadioButton |
asDescribe
Modes of SQL operation
|
private javax.swing.JRadioButton |
asQuery
Modes of SQL operation
|
private javax.swing.JRadioButton |
asUpdate
Modes of SQL operation
|
private javax.swing.JCheckBox |
autoCommit
Connection feature settings
|
private static int |
BLOB_LOAD_BLOCK_SIZE
Bloxk size used when storing a BLOB field to a file
|
private ColoredCellRenderer |
cellRenderer
Renderer for result cells
|
private static int |
COLOR_CODING_COLOR_1_START
Position of the red color value
|
private static int |
COLOR_CODING_COLOR_2_START
Position of the green color value
|
private static int |
COLOR_CODING_COLOR_3_END
End of the blue color value
|
private static int |
COLOR_CODING_COLOR_3_START
Position of the blue color value
|
private static int |
COLOR_CODING_NUMERIC_BASE
Numeric base for the color coding value
|
private static int |
COLOR_GREEN_B_VALUE
For color green: blue component value
|
private static int |
COLOR_GREEN_G_VALUE
For color green: green component value
|
private static int |
COLOR_GREEN_R_VALUE
For color green: red component value
|
private static int |
COLOR_YELLOW_B_VALUE
For color yellow: blue component value
|
private static int |
COLOR_YELLOW_G_VALUE
For color yellow: green component value
|
private static int |
COLOR_YELLOW_R_VALUE
For color yellow: red component value
|
private static int |
COLUMN_DATA_TYPE_BLOB
Column data type: BLOB
|
private static int |
COLUMN_DATA_TYPE_DATE
Column data type: date
|
private static int |
COLUMN_DATA_TYPE_DATETIME
Column data type: datetime
|
private static int |
COLUMN_DATA_TYPE_DOUBLE
Column data type: double
|
private static int |
COLUMN_DATA_TYPE_INT
Column data type: integer
|
private static int |
COLUMN_DATA_TYPE_LONG
Column data type: long
|
private static int |
COLUMN_DATA_TYPE_STRING
Column data type: string
|
private static java.lang.String |
COMMENT_PREFIX
Prefix to comment-out queries
|
private javax.swing.JButton |
commentToggle
Comment or un-comment the currently selected SQL statement
|
private javax.swing.JCheckBoxMenuItem |
configDisplayClientInfo
Menu item - choose whether to display the client system information in the
status text area
|
private javax.swing.JCheckBoxMenuItem |
configDisplayColumnDataType
Menu item - choose whether to display the column data type in the results
table
|
private javax.swing.JRadioButtonMenuItem |
configDisplayDBServerInfoLong
Menu item - choose to display server information in long format
|
private javax.swing.JRadioButtonMenuItem |
configDisplayDBServerInfoNone
Menu item - choose to not display any server information
|
private javax.swing.JRadioButtonMenuItem |
configDisplayDBServerInfoShort
Menu item - choose to display server information in brief format
|
private javax.swing.JMenuItem |
configFont
Menu item - set the font
|
private javax.swing.JCheckBoxMenuItem |
configHistoryAssocSQLAndConnect
Menu item - choose whether SQL statements and connection settings are
linked
|
private javax.swing.JRadioButtonMenuItem |
configLanguageDefault
Menu item - choose to use the system default language
|
private javax.swing.JRadioButtonMenuItem |
configLanguageEnglish
Menu item - choose to use English
|
private javax.swing.JRadioButtonMenuItem |
configLanguageFrench
Menu item - choose to use French
|
private javax.swing.JRadioButtonMenuItem |
configLanguageGerman
Menu item - choose to use German
|
private javax.swing.JRadioButtonMenuItem |
configLanguageItalian
Menu item - choose to use Italian
|
private javax.swing.JRadioButtonMenuItem |
configLanguagePortuguese
Menu item - choose to use Portuguese
|
private javax.swing.JRadioButtonMenuItem |
configLanguageSpanish
Menu item - choose to use Spanish
|
private javax.swing.JCheckBoxMenuItem |
configParseSemicolons
Menu item - choose whether to parse SQL statements on semicolons
|
private javax.swing.JCheckBoxMenuItem |
configSavePassword
Menu item - choose whether to save the password in the properties file
|
private javax.swing.JRadioButtonMenuItem |
configTableColoringGreenBar
Menu item - choose to color the result table with alternating green/white
background
|
private javax.swing.JRadioButtonMenuItem |
configTableColoringNone
Menu item - choose to leave the result table uncolored (white background)
|
private javax.swing.JRadioButtonMenuItem |
configTableColoringUserDefined
Menu item - choose to color the result table with a user defined pattern
background
|
private javax.swing.JRadioButtonMenuItem |
configTableColoringYellowBar
Menu item - choose to color the result table with alternating yellow/white
background
|
private java.sql.Connection |
conn
Database connection
|
private static int |
CONN_POOL_EVICT_IDLE_TIME_MS
Maximum age for a connection before evicting it
|
private static int |
CONN_POOL_MAX_IDLE_CONNECTIONS
Maximum number of connections to hold in the pool
|
private static int |
CONN_POOL_MAX_WAIT_MS
Maximum wait time for a connection to be available from the pool
|
private static int |
CONN_POOL_NUM_TESTS_PER_EVICT_RUN
Number of connections in the connection pool to test per eviction run
|
private static int |
CONN_POOL_TIME_BETWEEN_EVICT_RUNS_MS
Time to wait between connection pool eviction runs
|
private javax.swing.JComboBox |
connectString
Set of defined connection strings
|
private java.lang.String |
dbDriverDir
Directory containing DB driver files
|
private static java.lang.String |
DBPOOL_NAME
Name of the DB connection pool
|
private static java.lang.String |
DBRESULTS_NAME
File containing query results, when enabled
|
private static java.lang.String |
DBSERVERINFO_BRIEF
Display brief form of DB information
|
private static java.lang.String |
DBSERVERINFO_LONG
Display long form of DB information
|
private static java.lang.String |
DBSTATS_NAME
File containing statistics, when enabled
|
private static java.lang.String |
DEFAULT_DBDRIVERDIR
Default directory name for DB driver files
|
private static java.lang.String |
DEFAULTWARNSELECTPATTERNS
Default select warning statement keywords
|
private static java.lang.String |
DEFAULTWARNUPDATEPATTERNS
Default update warning statement keywords
|
private static int |
DESC_TABLE_COLUMN_COUNT
Number of columns reported for a table describe
|
private static int |
DESC_TABLE_LENGTH_COLUMN
Table describe: Column containing the column length
|
private static int |
DESC_TABLE_NAME_COLUMN
Table describe: Column containing the column name
|
private static int |
DESC_TABLE_NULLS_OK_COLUMN
Table describe: Column containing the nulls-allowed indicator
|
private static int |
DESC_TABLE_PRECISION_COLUMN
Table describe: Column containing the column precision
|
private static int |
DESC_TABLE_SCALE_COLUMN
Table describe: Column containing the column scale
|
private static int |
DESC_TABLE_TYPE_COLUMN
Table describe: Column containing the column name
|
private javax.swing.JMenuItem |
editCopy
Menu item - copy selected rows to the clipboard
|
private javax.swing.JMenuItem |
editSelectAll
Menu item - select all displayed rows
|
private javax.swing.JMenuItem |
editSort
Menu item - sort by selected column(s)
|
private javax.swing.JButton |
execute
Execute the currently entered/selected SQL statement
|
private java.io.File |
exportFile
File for exporting results
|
private static int |
FILE_EXPORT_CSV
File export format: CSV
|
private static int |
FILE_EXPORT_TRIPLES
File export format: Triples
|
private javax.swing.JCheckBoxMenuItem |
fileExportsRaw
Menu item - choose whether to export result raw (unquoted)
|
private javax.swing.JCheckBoxMenuItem |
fileLogResults
Menu item - choose whether to log SQL execution results
|
private javax.swing.JCheckBoxMenuItem |
fileLogStats
Menu item - choose whether to log SQL execution statistics
|
private static java.lang.String |
FILENAME_CONNECTSTRINGS
File containing connection strings
|
private static java.lang.String |
FILENAME_DEFAULTQUERIES
Default file for storing queries
|
private static java.lang.String |
FILENAME_DRIVERS
Database drivers file
|
private static java.lang.String |
FILENAME_LOGGER
Logging configuration file
|
private javax.swing.JCheckBoxMenuItem |
fileNoCRAddedToExportRows
Menu item - choose whether to add a carriage return to exported rows
|
private javax.swing.JMenuItem |
fileOpenSQL
Menu item - open a SQL statement file
|
private javax.swing.JMenuItem |
fileSaveAsCSV
Menu item - write current results to a CSV file
|
private javax.swing.JMenuItem |
fileSaveAsTriples
Menu item - write current results to an ontology file
|
private javax.swing.JMenuItem |
fileSaveBLOBs
Menu item - choose whether to export BLOBs to files when exporting results
|
private java.lang.Thread |
flashRunIndicator
Thread to animate the query execution indicator
|
private javax.swing.JMenuItem |
helpAbout
Menu item - display the About dialog box
|
private javax.swing.JMenuItem |
helpParameterizedSQL
Menu item - display help on the parameterized SQL statement syntax
|
private static java.lang.String |
LANG_DEFAULT
Interface: Use default language (e.g.
|
private static java.lang.String |
LANG_ENGLISH
Interface: Use English
|
private static java.lang.String |
LANG_FRENCH
Interface: Use French
|
private static java.lang.String |
LANG_GERMAN
Interface: Use German
|
private static java.lang.String |
LANG_ITALIAN
Interface: Use Italian
|
private static java.lang.String |
LANG_PORTUGUESE
Interface: Use Portuguese
|
private static java.lang.String |
LANG_SPANISH
Interface: Use Spanish
|
private java.lang.String |
lastConnection
Last connection string used
|
private java.lang.String |
lastPassword
Last password
|
private java.lang.String |
lastUserId
Last user id
|
private java.lang.String |
latestChosenQueryFileFilterDescription
The query file filter description last used by the user
|
private java.io.File |
latestFileDirectory
Latest directory used when choosing a file
|
private boolean |
loadedDBDriver
Indicator that a DB driver was loaded
|
private static org.apache.log4j.Logger |
LOGGER
Logger
|
private java.util.Map<java.lang.String,java.lang.String> |
mapOfCurrentTables
Collection of tables currently used by the latest query
|
private static int |
MAX_DIGITS_FOR_INT
Maximum number of digits in a value before storing as a long
|
private static int |
MAX_SCROLL_PANE_DIVISOR_FOR_MAX_HEIGHT
Fraction of available window for the scroll pane
|
private javax.swing.JComboBox |
maxRows
Selection for maximum number of rows to retrieve and display
|
private javax.swing.JTextPane |
message
The status text pane
|
private javax.swing.text.StyledDocument |
messageDocument
The status document backing the status text pane
|
private java.util.Map<java.lang.String,javax.swing.text.AttributeSet> |
messageStyles
Collection of message styles used in status output text pane
|
private int |
modeOfCurrentTable
Is the select output to render data or metadata
|
private javax.swing.JButton |
nextInList
Select the next SQL statement in the list of stored statements
|
private javax.swing.JButton |
nextQuery
Buttons to move through history of executed queries
|
private static java.lang.String |
PARAM_TOKEN_END
Token suffix for a parameter
|
private static int |
PARAM_TOKEN_END_LENGTH
Length of the parameter token suffix
|
private static java.lang.String |
PARAM_TOKEN_START
Token prefix for a parameter
|
private static int |
PARAM_TOKEN_START_LENGTH
Length of the parameter token prefix
|
private static java.lang.String |
PARAMVALUE_NO
The Yes (True) value for a parameter
|
private static java.lang.String |
PARAMVALUE_YES
The No (False) value for a parameter
|
private javax.swing.JPasswordField |
password
Password to authenticate with the DB server
|
private javax.swing.JCheckBox |
poolConnect
Connection feature settings
|
private javax.swing.JButton |
previousQuery
Buttons to move through history of executed queries
|
private static java.lang.String |
PROP_ASSOCSQLURL
Property name - associate query and connection setting
|
private static java.lang.String |
PROP_AUTOCOMMIT
Property name - connection autocommit setting
|
private static java.lang.String |
PROP_CONNECTION
Property name - last connection string used
|
private static java.lang.String |
PROP_DBDRIVERDIR
Property name - directory containing DB driver files
|
private static java.lang.String |
PROP_DISPLAYCLIENTINFO
Property name - display client information setting
|
private static java.lang.String |
PROP_DISPLAYCOLUMNDATATYPE
Property name - display column type setting
|
private static java.lang.String |
PROP_DISPLAYDBSERVERINFO
Property name - display DB server information setting
|
private static java.lang.String |
PROP_EXPORTNOCR
Property name - export without CR setting
|
private static java.lang.String |
PROP_EXPORTRAW
Property name - export raw query results setting
|
private static java.lang.String |
PROP_FONT_BOLD
Property name - font bold setting
|
private static java.lang.String |
PROP_FONT_FAMILY
Property name - font setting
|
private static java.lang.String |
PROP_FONT_ITALIC
Property name - font italic setting
|
private static java.lang.String |
PROP_FONT_SIZE
Property name - fint size setting
|
private static java.lang.String |
PROP_HEIGHT
Property name - last window height
|
private static java.lang.String |
PROP_LANGUAGE
Property name - interface language setting
|
private static java.lang.String |
PROP_LATEST_DIRECTORY
Latest directory used when choosing a file
|
private static java.lang.String |
PROP_LOGRESULTS
Property name - log query results setting
|
private static java.lang.String |
PROP_LOGSTATS
Property name - log statistics setting
|
private static java.lang.String |
PROP_MAXIMIZED
Property name - last window maximized setting
|
private static java.lang.String |
PROP_MAXROWS
Property name - maximum number of display rows setting
|
private static java.lang.String |
PROP_PARSESEMICOLON
Property name - parse queries on semicolon setting
|
private static java.lang.String |
PROP_PASSWORD
Property name - password
|
private static java.lang.String |
PROP_POOLING
Property name - connection pooling enabled
|
private static java.lang.String |
PROP_READONLY
Property name - connection readonly setting
|
private static java.lang.String |
PROP_SAVEPASSWORD
Property name - save password setting
|
private static java.lang.String |
PROP_SQL
Property name - last SQL statement executed
|
private static java.lang.String |
PROP_SQLFILENAME
Propert name - last SQL statement file used
|
private static java.lang.String |
PROP_SYSTEM_DEFAULTCOUNTRY
System property supplying user's configured country code
|
private static java.lang.String |
PROP_SYSTEM_DEFAULTLANGUAGE
System property supplying user's configured language code
|
private static java.lang.String |
PROP_TABLE_COLOR_USERDEF
Property name - user defined row coloring setting
|
private static java.lang.String |
PROP_TABLE_COLORING
Property name - row coloring setting
|
private static java.lang.String |
PROP_UPPERLEFTX
Property name - last window upper left corner X position
|
private static java.lang.String |
PROP_UPPERLEFTY
Property name - last window upper left corner Y position
|
private static java.lang.String |
PROP_USERID
Property name - user id
|
private static java.lang.String |
PROP_WARNSELECTPATTERNS
Property name - keywords that should not occur in a select statement
|
private static java.lang.String |
PROP_WARNUPDATEPATTERNS
Property name - keywords that should not occur in an update statement
|
private static java.lang.String |
PROP_WIDTH
Property name - last window width
|
private static int |
QUERY_AREA_COLUMNS
Minimum width, in characters, for the query input text area
|
private static int |
QUERY_AREA_ROWS
Rows for the query input text area
|
private static int |
QUERY_EXECUTION_TIMER_UPDATE_DELAY_MS
Time, in milliseconds, to delay between updates of the query execution
timer display
|
private javax.swing.JMenuItem |
queryDescribeStar
Menu item - create a describe statement with the table name based on the
currently selected cell
|
private java.lang.String |
queryFilename
Filename for current set of queries
|
private javax.swing.JMenuItem |
queryMakeInsert
Menu item - create an insert statement template listing all fields using
the current result set
|
private javax.swing.JMenuItem |
queryMakeUpdate
Menu item - create an update statement template listing all fields using
the current result set
|
private javax.swing.JMenuItem |
queryMakeVerboseSelect
Menu item - create a select statement that lists all columns using the
current result set
|
private javax.swing.JMenuItem |
queryRunAll
Menu item - run all stored SQL statements (e.g.
|
private javax.swing.JComboBox |
querySelection
Set of defined queries
|
private javax.swing.JMenuItem |
querySelectStar
Menu item - create a "select *" statement with the table name based on the
currently selected cell
|
private javax.swing.JMenuItem |
querySetOrder
Menu item - edit the order of the list of currently stored SQL statements
(e.g.
|
private javax.swing.JTextArea |
queryText
SQL input text area
|
private javax.swing.JCheckBox |
readOnly
Connection feature settings
|
private javax.swing.JButton |
remove
Remove the currently selected SQL statement from the collection of stored
statements
|
private static int |
RESULT_PROCESSING_ROWS_PER_STATUS_MESSAGE
Number of rows to write between status message updates
|
private javax.swing.JLabel |
runIndicator
Indicator for executing query
|
private java.lang.Thread |
runningQuery
Currently executing query thread
|
private int |
runType
Run mode (select, update, describe)
|
private static int |
RUNTYPE_ALL
Query run mode - all statements
|
private static int |
RUNTYPE_SINGLE
Query run mode - single statement
|
private static int |
RUNTYPE_TRIPLE_EXPORT
Query run mode - export results as triples
|
private java.lang.String |
scWarnSelectPatterns
Query mode warning patterns for a select statement.
|
private java.lang.String |
scWarnUpdatePatterns
Query mode warning patterns for an update statement.
|
private static int |
SECONDS_PER_HOUR
Number of seconds in an hour
|
private static int |
SECONDS_PER_MINUTE
Number of seconds in a minute
|
private static long |
serialVersionUID
Serial version id - update if the serialization of this classes changes
|
private static java.lang.String |
STYLE_BOLD
Bold text style
|
private static java.lang.String |
STYLE_GREEN
Green text
|
private static java.lang.String |
STYLE_NORMAL
Normal text style
|
private static java.lang.String |
STYLE_RED
Red text
|
private static java.lang.String |
STYLE_SUBTLE
Subtle text style
|
private static java.lang.String |
STYLE_SUBTLE_UL
Subtle and underlined text style
|
private static java.lang.String |
STYLE_YELLOW
Yellow text
|
private javax.swing.JTable |
table
SQL results table
|
private static java.lang.String |
TABLECOLORING_GREENBAR
Table row alternating green and white
|
private static java.lang.String |
TABLECOLORING_NONE
Table rows not colored (background white)
|
private static java.lang.String |
TABLECOLORING_USERDEFINED
Table row coloring is user defined
|
private static java.lang.String |
TABLECOLORING_YELLOWBAR
Table row alternating yellow and white
|
private static int |
TEXT_WRAP_MAX_LINE_LENGTH
Maximum length for a line before inserting a carriage return
|
private static int |
TEXT_WRAP_MIN_LINE_LENGTH_BEFORE_WRAP
Minimum length for a line before inserting a carriage return
|
private javax.swing.JLabel |
timeIndicator
Elapsed time for running query
|
private java.lang.Thread |
timeRunIndicator
Thread to maintain the query timer display
|
private static int |
USER_DEFINED_COLORING_COLOR_CODE_LENGTH
Color code length
|
private static int |
USER_DEFINED_COLORING_COLORS_PER_ENTRY
Colors per user-defined color entry
|
private java.lang.String |
userDefTableColoring
User defined result row coloring pattern
|
private javax.swing.JTextField |
userId
User Id to authenticate with the DB server
|
private static java.lang.String |
VERSION
Program version - MUST be in ##.##.## format
|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
BasicQuery(boolean wantGUI)
Constructs a Basic Query instance
|
Modifier and Type | Method and Description |
---|---|
private void |
about()
Displays an information message in a dialog box giving details about the
BasicQuery that has been executed
|
void |
actionPerformed(java.awt.event.ActionEvent evt)
Depending on which option the user has invoked the
appropriate action is performed
|
private void |
addDisplayRowColor(java.lang.String foregroundColor,
java.lang.String backgroundColor)
Does the actual parsing of foreground and background colors.
|
private void |
addToCombo(javax.swing.JComboBox combo,
java.lang.Object newData)
Adds a new object in the combo box
|
private void |
changeLanguage()
Does a shutdown and startup of the application so that it will
redraw its interface.
|
private void |
checkForNewString(javax.swing.JComboBox combo)
Checks whether an input (query or connect string) is already in its
associated combo box.
|
private void |
checkForNewVersion()
Check for a new version.
|
private void |
chooseFileForSave(javax.swing.table.TableModel model,
int fileType)
Exports the results to a file
|
private void |
chooseFont()
Allow the user to select a font (including size/bold/italic).
|
private void |
cleanUp()
Cleanup environment.
|
private boolean |
commentedQuery()
Looks for queries that have been commented out
|
private void |
commentToggle()
Uncomments the selected query statement if it is commented or
comments the statement if it is uncommented and replaces the query in
the combo box.
|
private javax.swing.JMenu |
configurationMenu()
Configuration menu setup
|
private void |
configurePool(org.apache.commons.pool.impl.GenericObjectPool connectionPool,
java.lang.String connectURI,
java.lang.String pUserId,
java.lang.String pPassword)
Configures the database connection pool and sets the pool configuration.
|
private void |
copySelectionToClipboard()
Copy the selected data cells to the clipboard
|
private void |
displayResultsAsTable(boolean batch)
Displays the query results in the JTable.
|
private javax.swing.JMenu |
editMenu()
Edit menu setup
|
private void |
execute(java.lang.String rawSqlStatement,
ListTableModel<java.lang.Object> model,
java.io.File tripleFile)
Populates model with the query results.
|
private javax.swing.JMenu |
fileMenu()
File menu setup
|
private java.lang.String |
fixAccessorName(java.lang.String rawAccessorName)
Convert an accessor name (e.g.
|
private java.lang.String[][] |
getColumnNamesForTable()
Gets the column name for the column that is being selected in the table
|
private DynamicClassLoader |
getDBClassLoader()
Adds packages (JARs) to the classpath.
|
private org.apache.commons.pool.ObjectPool |
getDBPool()
Gets the driver for the database pool
|
private java.util.List<java.lang.Object> |
getOutParams(java.sql.CallableStatement stmt,
java.util.List<StatementParameter> params)
Takes a callable statement and retrieves the out parameters, displaying
them in the message area of the GUI.
|
private Query |
getQuery()
Assumes that selected item in the combo box is a string and returns
the query object.Otherwise it converts the string to a query object
and returns it.
|
private java.lang.Object |
getResultField(java.sql.ResultSet result,
int columnNumber,
int columnType)
Get a field from the result set
|
private javax.swing.border.Border |
getStandardBorder()
Sets the Border style and color to black for the interface
|
private java.lang.String |
getTablesInQuery()
Gets the names of the tables that are referenced during the query
|
private javax.swing.JMenu |
helpMenu()
Help menu setup
|
private void |
helpParameterizedSQL()
Supply a brief usage summary for the parameterized SQL syntax.
|
private void |
histMaintQueryDeleted(int queryIndex)
Maintain the query history list when an entry is deleted from the
collection stored of SQL queries.
|
private void |
histMaintQueryExecuted(javax.swing.table.TableModel results)
Add latest query index to the history of executed queries
The query is added after the currently selected query in the history list.
|
private void |
histSelectNext()
Set the currently selected query to the next SQL index in the history list.
|
private void |
histSelectPrev()
Set the currently selected query to the previous SQL index in the history
list.
|
private boolean |
isOkayQueryType(java.lang.String saQuery)
Test that SQL agrees with query type selected, otherwise warn user.
|
void |
keyPressed(java.awt.event.KeyEvent arg0) |
void |
keyReleased(java.awt.event.KeyEvent arg0) |
void |
keyTyped(java.awt.event.KeyEvent arg0) |
private javax.swing.JMenu |
languageMenu()
Language selection menu
|
private void |
loadCombo(javax.swing.JComboBox combo,
java.lang.String fileName)
Adds the data from the supplied file to the query selection
(or connect URLs) combobox.
|
private void |
loadConfig()
Adds a list of queries and connection URLs to the appropriate
combo boxes
|
private void |
loadConnectStrings()
Loads the connect strings from an external file
|
private void |
loadDriver(java.lang.String driverClass,
java.lang.String productName,
DynamicClassLoader dbClassLoader)
Loads the driver into the JVM making it available for usage by the
driver class
|
private void |
loadDrivers()
Loads the drivers to allow connection to the database.
|
private void |
loadMenu()
Creates the various menu options and attaches the mnemonics and
registers listeners.
|
private void |
loadProperties()
Sets the configuration based on the values in the configuration file.
|
private void |
loadQueries()
Loads default queries (to give a new user some idea of how the interface
works) if there are no queries stored in the external query file.
|
static void |
main(java.lang.String[] args)
Main startup method for the BasicQuery application.
|
private void |
makeInsert()
Create an insert statement depending on the tables and the columns that
were selected.The insert statement is then listed in the querySelection
comboBox as the selected item.
|
private java.lang.String |
makeParams(java.lang.String rawSqlStatement,
java.util.List<StatementParameter> params)
Takes a SQL statement and determines whether the syntax for using
in/out parameters has been used.
|
private void |
makeUpdate()
Create an update statement depending on the tables and the columns that
were selected.The update statement is then listed in the querySelection
comboBox as the selected item.
|
private void |
makeVerboseSelect()
Write a select statement depending on the tables and the columns that
were selected.The select statement is then listed in the querySelection
comboBox as the selected item.
|
private void |
messageOut(java.lang.String text)
writes the string onto the message document, displayed in the lower
portion of the GUI.
|
private void |
messageOut(java.lang.String text,
java.lang.String style)
Writes the output message onto the message document
|
private void |
messageOut(java.lang.String text,
java.lang.String style,
boolean newLine)
Places a message in the message display area using the style supplied.
|
private void |
nextQuerySelection()
Advance the list of queries to the next query if the list is not
already at the end.
|
private void |
noDBDriverWarning()
Notify user if no DB drivers have been loaded.
|
private void |
notifyNewerVersion(NewVersionInformation newVersionInformation)
Notify the user that a newer version of the program has been released.
|
private void |
openSQLFile()
Open or create a SQL statement file.
|
private void |
processParameter(java.lang.String param,
java.util.List<StatementParameter> params)
Parse a parameter.
|
private void |
processStatement()
Run the current SQL statement independently
|
private void |
processStatement(boolean batch)
Run the current SQL statement either independently or as part of a batch of
statements
|
private javax.swing.JMenu |
queryMenu()
Query menu set
|
private void |
queryStar(int mode)
Create the query 'select * from' for selected the column in the table
|
private void |
rebuildSQLListing(java.util.List<java.lang.Object> queries)
Reloads the list of queries in the combobox.
|
private void |
removeDBPool()
Closes the database connection pool
|
private void |
removeSelectedQuery()
Removes a query from the comboBox
|
private void |
reorderQueries()
Allow the user to place the queries into a particluar order.
|
private void |
replaceInCombo(javax.swing.JComboBox combo,
int position,
java.lang.Object newData)
Replaces an existing object with a new one
|
private void |
reportConnectionStats(java.sql.Connection pConn)
Outputs Connection Meta Data to the message area.
|
private void |
reportResults(java.lang.String query,
javax.swing.table.TableModel model)
Log the results of executing the SQL to a flat file
|
private void |
reportStats(java.lang.String sqlStatement,
java.util.Date connAsk,
java.util.Date connGot,
java.util.Date stmtGot,
java.util.Date queryStart,
java.util.Date queryReady,
java.util.Date queryRSFetched,
java.util.Date queryRSProcessed,
long rows,
int cols,
javax.swing.table.TableModel model,
java.util.List<java.lang.Object> outParams)
Reports statistics on various data such as the date a query was executed
and
the date the results were fetched.
|
void |
run()
Executes the query(ies).
|
private void |
runAllQueries()
Executes all the queries
|
private void |
runIt(int statementRunType)
Run a SQL statement on its own thread.
|
private void |
saveBLOBs()
Gets each cell of the selected row - if the object stored in the cell
is of type java.sql.Blob, the object is written to disk by calling
writeBlob(String, java.sql.Blob) on the DB connection.
|
private void |
saveConfig()
Writes the list of queries or connection URLs to the appropriate
combo boxes
|
private void |
saveProperties()
Saves the current settings into the properties file.
|
private void |
saveResultAsCSV(javax.swing.table.TableModel model,
java.io.File fileToWrite)
Saves the Result in a file with the .csv extension
|
private void |
saveResultsAsTriples(javax.swing.table.TableModel model,
java.io.File fileToWrite)
Saves the Result in a file to a Turtle file with the .ttl extension
|
private void |
selectAllData()
Select all the data in the result table
|
private void |
selectMode(int mode)
Selects the Query action that is specified by the mode
|
private void |
setDefaults()
Set default values at startup.
|
private void |
setExportAvailable(boolean available)
Enable or disable the export menu items based on the latest query
|
private void |
setFontFromConfig(java.util.Properties props)
Set the fonts for the interface from the configuration in the properties
collection
|
private void |
setPrevNextIndication()
Activate/deactivate the previous and next query history indicators based
on the number of history entries and the current position within the
history
list.
|
private void |
setQueryFilename(java.lang.String pathToSQLFile)
Builds the GUI window title - including the currently open SQL statement
file.
|
private void |
setup()
Builds the GUI for the application
|
private void |
setupCall(java.sql.CallableStatement stmt,
java.util.List<StatementParameter> params)
Setup a callable statement for execution.
|
private void |
setupComponents()
Setup instance components
|
private void |
setupDBPool(java.lang.String connectURI,
java.lang.String pUserId,
java.lang.String pPassword)
Sets the database connection pool.
|
private void |
setupFont(java.awt.Font font)
Set the font for the message area and table to match the frame's font.
|
private void |
setupLanguage()
Setup the correct locale based on the user language choice.
|
private void |
setupLogger()
Configure the logger
|
private void |
setupResultsTableColoring()
Configure the data display based on the user-chosen row formatting.
|
private void |
setupSelectedQuery()
Sets the selected query as the text in the querytext area
|
private void |
setupTextStyles()
Sets-up the collection of text styles that can be used to format the
information in the message area.
|
private void |
setupUserDefinedColoring()
Parse the color definition placed in the properties file, if one
is provided.
|
private void |
sortSelectedColumns()
Sort a table model based on the selected columns.
|
void |
update(java.util.Observable o,
java.lang.Object arg) |
private void |
userMessage(java.lang.String pMessage,
java.lang.String title,
int messageType)
Displays a popup message dialog.
|
private void |
userMessage(java.lang.String pMessage,
java.lang.String title,
int messageType,
boolean reformatMessage)
Displays a popup message dialog.
|
private int |
whichModeValue()
Finds the Mode Value depending on the query option selected
|
void |
windowActivated(java.awt.event.WindowEvent evt)
Invoked when the Window is set to be the active Window.
|
void |
windowClosed(java.awt.event.WindowEvent evt)
Invoked when a window has been closed as the result of calling
dispose on the window.
|
void |
windowClosing(java.awt.event.WindowEvent evt)
Invoked when the user attempts to close the window from the
window's system menu.Exits the application once the window
is closed
|
void |
windowDeactivated(java.awt.event.WindowEvent evt)
Invoked when a Window is no longer the active Window
|
void |
windowDeiconified(java.awt.event.WindowEvent evt)
Invoked when a window is changed from a minimized to a normal state.
|
void |
windowIconified(java.awt.event.WindowEvent evt)
Invoked when a window is changed from a normal to a minimized state
|
void |
windowOpened(java.awt.event.WindowEvent evt)
Creates a new thread that attaches focus to the window that has been
opened and also places the cursor on the textfield for the userid
|
private java.lang.String |
writeBlob(java.lang.String rawColName,
java.sql.Blob blob)
Writes the contents of BLOB to disk.
|
private void |
writeDataAsCSV(java.lang.String query,
javax.swing.table.TableModel model,
java.lang.String filePath,
boolean append)
Writes the data onto a file that is specified by the filePath
|
private void |
writeDataAsCSV(java.lang.String query,
javax.swing.table.TableModel model,
java.lang.String filePath,
java.sql.ResultSet result,
int[] myType,
boolean append)
Writes the data onto a file that is specified by the filePath
This version writes the data from the ResultSet instance
so that the results do not need to be loaded into memory.
|
private void |
writeOutCombo(javax.swing.JComboBox combo,
java.lang.String fileName)
Writes all the queries in the query selection (or connection URLS) combobox
to the supplied file in a print formatted representation.
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private static final long serialVersionUID
private static final java.lang.String VERSION
private static final org.apache.log4j.Logger LOGGER
private static final java.lang.String FILENAME_DRIVERS
private static final java.lang.String FILENAME_LOGGER
private static final java.lang.String FILENAME_DEFAULTQUERIES
private static final java.lang.String FILENAME_CONNECTSTRINGS
private static final java.lang.String DBPOOL_NAME
private static final java.lang.String DBSTATS_NAME
private static final java.lang.String DBRESULTS_NAME
private static final java.lang.String PROP_USERID
private static final java.lang.String PROP_PASSWORD
private static final java.lang.String PROP_AUTOCOMMIT
private static final java.lang.String PROP_READONLY
private static final java.lang.String PROP_POOLING
private static final java.lang.String PROP_CONNECTION
private static final java.lang.String PROP_SQL
private static final java.lang.String PROP_SQLFILENAME
private static final java.lang.String PROP_MAXROWS
private static final java.lang.String PROP_LOGSTATS
private static final java.lang.String PROP_LOGRESULTS
private static final java.lang.String PROP_EXPORTRAW
private static final java.lang.String PROP_EXPORTNOCR
private static final java.lang.String PROP_ASSOCSQLURL
private static final java.lang.String PROP_PARSESEMICOLON
private static final java.lang.String PROP_SAVEPASSWORD
private static final java.lang.String PROP_UPPERLEFTX
private static final java.lang.String PROP_UPPERLEFTY
private static final java.lang.String PROP_WIDTH
private static final java.lang.String PROP_HEIGHT
private static final java.lang.String PROP_MAXIMIZED
private static final java.lang.String PROP_DBDRIVERDIR
private static final java.lang.String PROP_WARNUPDATEPATTERNS
private static final java.lang.String PROP_WARNSELECTPATTERNS
private static final java.lang.String PROP_DISPLAYDBSERVERINFO
private static final java.lang.String PROP_DISPLAYCLIENTINFO
private static final java.lang.String PROP_DISPLAYCOLUMNDATATYPE
private static final java.lang.String PROP_TABLE_COLORING
private static final java.lang.String PROP_TABLE_COLOR_USERDEF
private static final java.lang.String PROP_LANGUAGE
private static final java.lang.String PROP_FONT_FAMILY
private static final java.lang.String PROP_FONT_SIZE
private static final java.lang.String PROP_FONT_BOLD
private static final java.lang.String PROP_FONT_ITALIC
private static final java.lang.String PROP_LATEST_DIRECTORY
private static final java.lang.String DEFAULT_DBDRIVERDIR
private static final java.lang.String DEFAULTWARNUPDATEPATTERNS
private static final java.lang.String DEFAULTWARNSELECTPATTERNS
private static final java.lang.String STYLE_NORMAL
private static final java.lang.String STYLE_BOLD
private static final java.lang.String STYLE_GREEN
private static final java.lang.String STYLE_YELLOW
private static final java.lang.String STYLE_RED
private static final java.lang.String STYLE_SUBTLE
private static final java.lang.String STYLE_SUBTLE_UL
private static final java.lang.String TABLECOLORING_GREENBAR
private static final java.lang.String TABLECOLORING_YELLOWBAR
private static final java.lang.String TABLECOLORING_USERDEFINED
private static final java.lang.String TABLECOLORING_NONE
private static final java.lang.String DBSERVERINFO_LONG
private static final java.lang.String DBSERVERINFO_BRIEF
private static final java.lang.String PARAMVALUE_NO
private static final java.lang.String PARAMVALUE_YES
private static final int RUNTYPE_SINGLE
private static final int RUNTYPE_ALL
private static final int RUNTYPE_TRIPLE_EXPORT
private static final java.lang.String PROP_SYSTEM_DEFAULTLANGUAGE
private static final java.lang.String PROP_SYSTEM_DEFAULTCOUNTRY
private static final java.lang.String LANG_DEFAULT
private static final java.lang.String LANG_ENGLISH
private static final java.lang.String LANG_FRENCH
private static final java.lang.String LANG_GERMAN
private static final java.lang.String LANG_ITALIAN
private static final java.lang.String LANG_PORTUGUESE
private static final java.lang.String LANG_SPANISH
private static final java.lang.String COMMENT_PREFIX
private static final int QUERY_AREA_ROWS
private static final int QUERY_AREA_COLUMNS
private static final int MAX_SCROLL_PANE_DIVISOR_FOR_MAX_HEIGHT
private static final int USER_DEFINED_COLORING_COLORS_PER_ENTRY
private static final int USER_DEFINED_COLORING_COLOR_CODE_LENGTH
private static final int COLOR_CODING_NUMERIC_BASE
private static final int COLOR_CODING_COLOR_1_START
private static final int COLOR_CODING_COLOR_2_START
private static final int COLOR_CODING_COLOR_3_START
private static final int COLOR_CODING_COLOR_3_END
private static final int CONN_POOL_MAX_WAIT_MS
private static final int CONN_POOL_MAX_IDLE_CONNECTIONS
private static final int CONN_POOL_TIME_BETWEEN_EVICT_RUNS_MS
private static final int CONN_POOL_NUM_TESTS_PER_EVICT_RUN
private static final int CONN_POOL_EVICT_IDLE_TIME_MS
private static final int TEXT_WRAP_MIN_LINE_LENGTH_BEFORE_WRAP
private static final int TEXT_WRAP_MAX_LINE_LENGTH
private static final int MAX_DIGITS_FOR_INT
private static final int DESC_TABLE_COLUMN_COUNT
private static final int DESC_TABLE_NAME_COLUMN
private static final int DESC_TABLE_TYPE_COLUMN
private static final int DESC_TABLE_LENGTH_COLUMN
private static final int DESC_TABLE_PRECISION_COLUMN
private static final int DESC_TABLE_SCALE_COLUMN
private static final int DESC_TABLE_NULLS_OK_COLUMN
private static final int COLUMN_DATA_TYPE_STRING
private static final int COLUMN_DATA_TYPE_INT
private static final int COLUMN_DATA_TYPE_LONG
private static final int COLUMN_DATA_TYPE_DOUBLE
private static final int COLUMN_DATA_TYPE_DATE
private static final int COLUMN_DATA_TYPE_DATETIME
private static final int COLUMN_DATA_TYPE_BLOB
private static final java.lang.String PARAM_TOKEN_START
private static final java.lang.String PARAM_TOKEN_END
private static final int PARAM_TOKEN_START_LENGTH
private static final int PARAM_TOKEN_END_LENGTH
private static final int BLOB_LOAD_BLOCK_SIZE
private static final int QUERY_EXECUTION_TIMER_UPDATE_DELAY_MS
private static final int RESULT_PROCESSING_ROWS_PER_STATUS_MESSAGE
private static final int SECONDS_PER_HOUR
private static final int SECONDS_PER_MINUTE
private static final int COLOR_GREEN_R_VALUE
private static final int COLOR_GREEN_G_VALUE
private static final int COLOR_GREEN_B_VALUE
private static final int COLOR_YELLOW_R_VALUE
private static final int COLOR_YELLOW_G_VALUE
private static final int COLOR_YELLOW_B_VALUE
private static final int FILE_EXPORT_CSV
private static final int FILE_EXPORT_TRIPLES
private javax.swing.JTable table
private ColoredCellRenderer cellRenderer
private int modeOfCurrentTable
private java.util.Map<java.lang.String,java.lang.String> mapOfCurrentTables
private java.lang.String userDefTableColoring
private javax.swing.JComboBox querySelection
private java.lang.String queryFilename
private java.lang.String latestChosenQueryFileFilterDescription
private javax.swing.JTextArea queryText
private javax.swing.JComboBox connectString
private javax.swing.JTextField userId
private javax.swing.JPasswordField password
private javax.swing.JRadioButton asQuery
private javax.swing.JRadioButton asUpdate
private javax.swing.JRadioButton asDescribe
private javax.swing.JCheckBox autoCommit
private javax.swing.JCheckBox readOnly
private javax.swing.JCheckBox poolConnect
private javax.swing.JComboBox maxRows
private javax.swing.JButton previousQuery
private javax.swing.JButton nextQuery
private java.util.Map<java.lang.String,javax.swing.text.AttributeSet> messageStyles
private javax.swing.JButton execute
private javax.swing.JButton remove
private javax.swing.JButton commentToggle
private javax.swing.JButton nextInList
private javax.swing.JTextPane message
private javax.swing.text.StyledDocument messageDocument
private javax.swing.JMenuItem fileOpenSQL
private javax.swing.JCheckBoxMenuItem fileLogStats
private javax.swing.JCheckBoxMenuItem fileLogResults
private javax.swing.JMenuItem fileSaveAsCSV
private javax.swing.JMenuItem fileSaveAsTriples
private javax.swing.JMenuItem fileSaveBLOBs
private javax.swing.JCheckBoxMenuItem fileExportsRaw
private javax.swing.JCheckBoxMenuItem fileNoCRAddedToExportRows
private javax.swing.JMenuItem editSort
private javax.swing.JMenuItem editSelectAll
private javax.swing.JMenuItem editCopy
private javax.swing.JMenuItem queryMakeVerboseSelect
private javax.swing.JMenuItem queryMakeInsert
private javax.swing.JMenuItem queryMakeUpdate
private javax.swing.JMenuItem querySelectStar
private javax.swing.JMenuItem queryDescribeStar
private javax.swing.JMenuItem querySetOrder
private javax.swing.JMenuItem queryRunAll
private javax.swing.JCheckBoxMenuItem configHistoryAssocSQLAndConnect
private javax.swing.JCheckBoxMenuItem configParseSemicolons
private javax.swing.JCheckBoxMenuItem configSavePassword
private javax.swing.JCheckBoxMenuItem configDisplayColumnDataType
private javax.swing.JCheckBoxMenuItem configDisplayClientInfo
private javax.swing.JMenuItem configFont
private javax.swing.JRadioButtonMenuItem configDisplayDBServerInfoShort
private javax.swing.JRadioButtonMenuItem configDisplayDBServerInfoLong
private javax.swing.JRadioButtonMenuItem configDisplayDBServerInfoNone
private javax.swing.JRadioButtonMenuItem configTableColoringNone
private javax.swing.JRadioButtonMenuItem configTableColoringGreenBar
private javax.swing.JRadioButtonMenuItem configTableColoringYellowBar
private javax.swing.JRadioButtonMenuItem configTableColoringUserDefined
private javax.swing.JRadioButtonMenuItem configLanguageDefault
private javax.swing.JRadioButtonMenuItem configLanguageEnglish
private javax.swing.JRadioButtonMenuItem configLanguageItalian
private javax.swing.JRadioButtonMenuItem configLanguageSpanish
private javax.swing.JRadioButtonMenuItem configLanguageFrench
private javax.swing.JRadioButtonMenuItem configLanguageGerman
private javax.swing.JRadioButtonMenuItem configLanguagePortuguese
private javax.swing.JMenuItem helpAbout
private javax.swing.JMenuItem helpParameterizedSQL
private java.sql.Connection conn
private java.lang.String lastConnection
private java.lang.String lastUserId
private java.lang.String lastPassword
private int runType
private java.lang.Thread runningQuery
private javax.swing.JLabel runIndicator
private javax.swing.JLabel timeIndicator
private java.lang.Thread flashRunIndicator
private java.lang.Thread timeRunIndicator
private java.lang.String dbDriverDir
private boolean loadedDBDriver
private java.lang.String scWarnUpdatePatterns
private java.lang.String scWarnSelectPatterns
private java.io.File exportFile
private java.io.File latestFileDirectory
public BasicQuery(boolean wantGUI)
wantGUI
- If true, the GUI is presented.private void setupLanguage()
private void changeLanguage()
private void setupLogger()
private DynamicClassLoader getDBClassLoader()
private javax.swing.border.Border getStandardBorder()
private void setupComponents()
private void setup()
private void setupUserDefinedColoring()
private void addDisplayRowColor(java.lang.String foregroundColor, java.lang.String backgroundColor)
foregroundColor
- String The foregound color as RGB hexbackgroundColor
- String The background color as RGB hexprivate void setupTextStyles()
private void saveProperties()
private void loadProperties()
private void setFontFromConfig(java.util.Properties props)
props
- The properties collection with font informationprivate void setDefaults()
private void setupDBPool(java.lang.String connectURI, java.lang.String pUserId, java.lang.String pPassword)
connectURI
- The url specifying the database to which it connectspUserId
- The user id fieldpPassword
- The password fieldprivate void configurePool(org.apache.commons.pool.impl.GenericObjectPool connectionPool, java.lang.String connectURI, java.lang.String pUserId, java.lang.String pPassword) throws java.lang.Exception
connectionPool
- The ObjectPoolconnectURI
- The url specifying the database to which it
connects using JDBCpUserId
- The user id attributepPassword
- The password attributejava.lang.Exception
- Throws an SQL exception that provides
information on a database access error
or other errorsprivate void removeDBPool()
private org.apache.commons.pool.ObjectPool getDBPool()
private javax.swing.JMenu fileMenu()
private javax.swing.JMenu editMenu()
private javax.swing.JMenu queryMenu()
private javax.swing.JMenu languageMenu()
private javax.swing.JMenu configurationMenu()
private javax.swing.JMenu helpMenu()
private void loadMenu()
private void loadDrivers()
private void messageOut(java.lang.String text, java.lang.String style)
text
- The string to be insertedstyle
- The message display styleprivate void messageOut(java.lang.String text, java.lang.String style, boolean newLine)
text
- String The message to displaystyle
- String The predefined style to use for the textnewLine
- boolean Whether to force a newline after the messageprivate void messageOut(java.lang.String text)
text
- The string that is to be insertedprivate void loadDriver(java.lang.String driverClass, java.lang.String productName, DynamicClassLoader dbClassLoader)
driverClass
- String specifying the class name for the driverproductName
- String specifying the product name - oracle,sybase or
mySqldbClassLoader
- The classloader for accessing DB driversprivate void loadConnectStrings()
private void loadQueries()
private void checkForNewString(javax.swing.JComboBox combo)
combo
- JComboBox which has a list of the query statements or connect
strings.private int whichModeValue()
private void selectMode(int mode)
mode
- The integer value for the mode that is selectedprivate Query getQuery()
private void addToCombo(javax.swing.JComboBox combo, java.lang.Object newData)
combo
- The JComboBoxnewData
- The Object that is to be addedprivate void replaceInCombo(javax.swing.JComboBox combo, int position, java.lang.Object newData)
combo
- The JComboBoxposition
- The int value of the positon where the
repalcement occursnewData
- The new Object that is to be inserted in the comboboxprivate void processStatement()
private void processStatement(boolean batch)
batch
- Whether the statement is run as part of a batchprivate void displayResultsAsTable(boolean batch)
batch
- If true, prevents error pop-up dialog boxes from being createdprivate void userMessage(java.lang.String pMessage, java.lang.String title, int messageType, boolean reformatMessage)
pMessage
- The message to be displayed to the user.title
- The title of the message dialogmessageType
- The message type as defined in JOptionPanereformatMessage
- Whether to insert line breaks within the messageprivate void userMessage(java.lang.String pMessage, java.lang.String title, int messageType)
pMessage
- The message to be displayed to the user.title
- The title of the message dialogmessageType
- The message type as defined in JOptionPaneprivate boolean commentedQuery()
private boolean isOkayQueryType(java.lang.String saQuery)
saQuery
- The SQL being executedprivate void execute(java.lang.String rawSqlStatement, ListTableModel<java.lang.Object> model, java.io.File tripleFile)
rawSqlStatement
- The SQL statement to executemodel
- The model to populate with the resultstripleFile
- The location to write the results to as triples.private void reportConnectionStats(java.sql.Connection pConn)
pConn
- Connection The DB connectionprivate java.lang.String fixAccessorName(java.lang.String rawAccessorName)
rawAccessorName
- String The name of the accessor methodprivate java.util.List<java.lang.Object> getOutParams(java.sql.CallableStatement stmt, java.util.List<StatementParameter> params)
stmt
- CallableStatement just executedparams
- List of parameters used in the callable statementprivate java.lang.String makeParams(java.lang.String rawSqlStatement, java.util.List<StatementParameter> params)
rawSqlStatement
- The SQL statement to be processed for parametersparams
- The collection of parameters found in the SQL statementprivate void processParameter(java.lang.String param, java.util.List<StatementParameter> params)
param
- The parameter as supplied in the input SQL statementparams
- The collection of parameters. The parameter decoded from the
param input is added to this list.private void setupCall(java.sql.CallableStatement stmt, java.util.List<StatementParameter> params)
stmt
- The callable statementparams
- The list of parametersprivate void reportResults(java.lang.String query, javax.swing.table.TableModel model)
query
- The SQL statementmodel
- The table model containing the resultsprivate void reportStats(java.lang.String sqlStatement, java.util.Date connAsk, java.util.Date connGot, java.util.Date stmtGot, java.util.Date queryStart, java.util.Date queryReady, java.util.Date queryRSFetched, java.util.Date queryRSProcessed, long rows, int cols, javax.swing.table.TableModel model, java.util.List<java.lang.Object> outParams)
sqlStatement
- The SQL statementconnAsk
- The time when the connection was requestedconnGot
- The time when the connection was returnedstmtGot
- The time when the statement was returnedqueryStart
- The time when query exeution beganqueryReady
- The time when the query finished exeutingqueryRSFetched
- The time when the result set had been completely fetchedqueryRSProcessed
- The time when the result set had been completely processedrows
- The number of rows in the result setcols
- The number of columns in the result setmodel
- The table model for the resultsoutParams
- The output parameters defined for this SQL statementprivate void removeSelectedQuery()
private void saveConfig()
private void loadConfig()
private void loadCombo(javax.swing.JComboBox combo, java.lang.String fileName)
combo
- The JComboBox - it can be the combobox that contains
all the queries or the combobox with the URLsfileName
- The name of the file that contains the queries or the
connect URLsprivate void writeOutCombo(javax.swing.JComboBox combo, java.lang.String fileName)
combo
- The JComboBox - it can be the combobox that contains
all the queries or the combobox with the URLsfileName
- The fileName to be written to contain the queries or the
connect URLsprivate void saveBLOBs()
private java.lang.String writeBlob(java.lang.String rawColName, java.sql.Blob blob)
rawColName
- The column that contains the BLOB objectblob
- The BLOB object that is written onto the fileprivate void queryStar(int mode)
mode
- The integer value for the different modesprivate void makeInsert()
private void makeUpdate()
private void makeVerboseSelect()
private java.lang.String getTablesInQuery()
private java.lang.String[][] getColumnNamesForTable()
private void chooseFileForSave(javax.swing.table.TableModel model, int fileType)
model
- The model for the current resultsfileType
- The export file typeprivate void saveResultAsCSV(javax.swing.table.TableModel model, java.io.File fileToWrite)
model
- The model for the current resultsfileToWrite
- The file to write the result toprivate void saveResultsAsTriples(javax.swing.table.TableModel model, java.io.File fileToWrite)
model
- The model for the current resultsfileToWrite
- The file to write the result toprivate void writeDataAsCSV(java.lang.String query, javax.swing.table.TableModel model, java.lang.String filePath, boolean append)
query
- The SQL statementmodel
- The model for the current resultsfilePath
- A String that denotes the filepathappend
- Whether to append the current results into the fileprivate java.lang.Object getResultField(java.sql.ResultSet result, int columnNumber, int columnType)
result
- The result setcolumnNumber
- The column to read data fromcolumnType
- The data type for the column being readprivate void writeDataAsCSV(java.lang.String query, javax.swing.table.TableModel model, java.lang.String filePath, java.sql.ResultSet result, int[] myType, boolean append)
query
- The SQL statement for the current datamodel
- The model for the current datafilePath
- A String that denotes the filepathresult
- The result set for the querymyType
- The data type ids for the columns in the result setappend
- Whether to append the data in the fileprivate void setupSelectedQuery()
public void run()
run
in interface java.lang.Runnable
private void runAllQueries()
private void commentToggle()
private void setQueryFilename(java.lang.String pathToSQLFile)
pathToSQLFile
- The path to the currently open SQL statement fileprivate void openSQLFile()
private void histMaintQueryExecuted(javax.swing.table.TableModel results)
results
- The table model with the current query resultsprivate void setPrevNextIndication()
private void histMaintQueryDeleted(int queryIndex)
queryIndex
- The index of the deleted query in the stored query list.private void histSelectPrev()
private void histSelectNext()
private void reorderQueries()
private void rebuildSQLListing(java.util.List<java.lang.Object> queries)
queries
- List The collection of queriesprivate void sortSelectedColumns()
private void runIt(int statementRunType)
statementRunType
- The type of query execution -- single or
multiple statementprivate void noDBDriverWarning()
private void about()
private void helpParameterizedSQL()
private void nextQuerySelection()
private void selectAllData()
private void setExportAvailable(boolean available)
available
- Whether the export options should be enabledprivate void copySelectionToClipboard()
private void setupResultsTableColoring()
private void chooseFont()
private void setupFont(java.awt.Font font)
font
- Font The font to use for the message and table displays.private void checkForNewVersion()
private void notifyNewerVersion(NewVersionInformation newVersionInformation)
newVersionInformation
- Information about the new version of the programprivate void cleanUp()
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
evt
- Specifies the action event that has taken placepublic void windowActivated(java.awt.event.WindowEvent evt)
windowActivated
in interface java.awt.event.WindowListener
evt
- The event that specifies that the window is activatedpublic void windowClosed(java.awt.event.WindowEvent evt)
windowClosed
in interface java.awt.event.WindowListener
evt
- The Window eventpublic void windowClosing(java.awt.event.WindowEvent evt)
windowClosing
in interface java.awt.event.WindowListener
evt
- The event that specifies the closing of the windowpublic void windowDeactivated(java.awt.event.WindowEvent evt)
windowDeactivated
in interface java.awt.event.WindowListener
evt
- The event that specifies that the window is deactivatedpublic void windowDeiconified(java.awt.event.WindowEvent evt)
windowDeiconified
in interface java.awt.event.WindowListener
evt
- The event that specifies that the window is deiconifiedpublic void windowIconified(java.awt.event.WindowEvent evt)
windowIconified
in interface java.awt.event.WindowListener
evt
- The event that specifies that the window is iconifiedpublic void windowOpened(java.awt.event.WindowEvent evt)
windowOpened
in interface java.awt.event.WindowListener
evt
- The event that specifies the opening of the windowpublic void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
public void keyPressed(java.awt.event.KeyEvent arg0)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent arg0)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent arg0)
keyTyped
in interface java.awt.event.KeyListener
public static final void main(java.lang.String[] args)
args
- Input arguments -- not currently used