public class DatabaseEditor extends javax.swing.JFrame
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
DatabaseEditor.DatabaseTableEntry
This class is a pure data structure.
|
(package private) class |
DatabaseEditor.EditWindow
An undoable text edit window
This is the base class for all of the text windows.
|
(package private) class |
DatabaseEditor.FindReplace
This class provides a search and replace function for table
entries.
|
(package private) static class |
DatabaseEditor.RowProc
Abstract class to operate on rows of a table.
|
(package private) class |
DatabaseEditor.Search
This class searches many cells in a table column.
|
(package private) class |
DatabaseEditor.Table
This class implements a window displaying the contents of a
database table, view, or result set.
|
(package private) class |
DatabaseEditor.UndoableTextArea
This class is identical to a JTextArea but also has undo / redo
capability.
|
javax.swing.JFrame.AccessibleJFramejava.awt.Window.AccessibleAWTWindow, java.awt.Window.Type| Modifier and Type | Field and Description |
|---|---|
(package private) java.io.File |
backupFile |
(package private) static int |
BUFSIZ |
(package private) java.sql.Connection |
conn |
(package private) static java.lang.String |
currentDirectory |
(package private) static java.nio.charset.Charset |
dbCharset |
(package private) java.util.ArrayList<javax.swing.JFrame> |
dependents |
(package private) java.io.File |
editFile |
(package private) static java.nio.charset.Charset |
fileCharset |
(package private) boolean |
hidden |
(package private) javax.swing.JList<java.lang.Object> |
list |
(package private) static long |
serialVersionUID |
(package private) java.util.ArrayList<DatabaseEditor.DatabaseTableEntry> |
tables |
(package private) static int[][] |
trans |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabledCROSSHAIR_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_CURSORBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description |
|---|
DatabaseEditor(java.sql.Connection conn,
java.lang.String db,
boolean hidden)
Create a database editor
|
| Modifier and Type | Method and Description |
|---|---|
(package private) static java.io.File |
chooseFile(java.lang.String approve,
java.lang.String[]... filters)
Bring up a file browser to choose a file.
|
(package private) static void |
close(java.io.Closeable file)
Closes a closable closable file/object ignoring null arguments
and handling exceptions.
|
(package private) void |
dumpDatabase(java.io.OutputStream out)
Dump the main database
|
(package private) static java.lang.String |
escapeString(java.lang.String s,
char quote)
if null return "null" otherwise surround string with the quote
character and escape quote characters with a double quote
character.
|
(package private) int |
findIgnoreCase(boolean ignoreCase,
java.lang.String s1,
java.lang.String s2,
int fromIndex)
Finds String in another String ignoring case if ignoreCase is
true.
|
(package private) int |
getEndOfSqlStatement(java.lang.String s,
int start)
Find the end of an SQL staement starting at character position
start.
|
(package private) java.lang.String |
getWithCharset(java.sql.ResultSet rs,
int i)
Gets an item from a ResultSet using the statically defined
character set.
|
(package private) static boolean |
IdChar(char c) |
(package private) void |
initList(boolean hidden)
Using the sqlite_master and sqlite_temp_master tables construct a
list of all tables in the attached databases.
|
(package private) static int |
lineNumber(java.lang.String s,
int charPos)
Returns the line number of a character position in a string
|
static void |
main(java.lang.String[] args)
View or edit a sqlite database.
|
(package private) void |
makeCommandWindow(java.lang.String title,
java.lang.String contents)
Make a command window for executing sql statements.
|
(package private) static void |
makeTableList(java.lang.String db)
Bring up a database editor
|
(package private) void |
putWithCharset(java.sql.PreparedStatement stat,
int i,
java.lang.String data)
Sets a ? item in a PreparedStatement from a string using the java
default character set
This method originally created blobs created by setBytes causing
problems when comparing with numerical values.
|
(package private) void |
queryTable(java.lang.String query,
DatabaseEditor.RowProc rowProc)
Queries a database and calls a method on each row of the result set.
|
(package private) java.lang.String |
readFileIntoString(java.io.File file)
Read an entire file into a String using fileCharset for
conversion.
|
(package private) void |
runSchemaDumpQuery(java.io.OutputStream out,
java.lang.String query)
Dump table etc.
|
(package private) void |
runTableDumpQuery(java.io.OutputStream out,
java.lang.String query)
Run query and output result followed by a ';' for each
row.
|
(package private) void |
showTable(java.lang.String tableName)
Show the table with the given name
|
(package private) static boolean |
stringCompare(java.lang.String s,
int position,
java.lang.String query)
Check to see if the String query is at position in String s.
|
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, updateaddNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecoratedaddPropertyChangeListener, 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, toFrontadd, 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, validateTreeaction, 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, transferFocusUpCyclestatic final long serialVersionUID
java.sql.Connection conn
java.util.ArrayList<javax.swing.JFrame> dependents
static java.nio.charset.Charset dbCharset
static java.nio.charset.Charset fileCharset
static final int BUFSIZ
java.io.File editFile
java.io.File backupFile
static final int[][] trans
static java.lang.String currentDirectory
java.util.ArrayList<DatabaseEditor.DatabaseTableEntry> tables
javax.swing.JList<java.lang.Object> list
boolean hidden
DatabaseEditor(java.sql.Connection conn, java.lang.String db, boolean hidden)
conn - the database connectiondb - the name of the databasehidden - true if showing hidden tables (always called with false)static void close(java.io.Closeable file)
file - the file/object to be closedjava.lang.String getWithCharset(java.sql.ResultSet rs, int i) throws java.sql.SQLException
rs - the result set to usei - the column number to fetchjava.sql.SQLException - Throws if problem with SQLite.void putWithCharset(java.sql.PreparedStatement stat, int i, java.lang.String data) throws java.sql.SQLException
stat - the prepared statement with ?i - the index of the ? to be setdata - the string of data or nulljava.sql.SQLException - thrown if problems with SQLitejava.lang.String readFileIntoString(java.io.File file)
file - the name of the file to be read instatic java.lang.String escapeString(java.lang.String s, char quote)
s - the String to escapequote - the quote characterint findIgnoreCase(boolean ignoreCase, java.lang.String s1, java.lang.String s2, int fromIndex)
ignoreCase - true if case is to be ignoreds1 - String to searchs2 - String to search forfromIndex - location to start searchvoid showTable(java.lang.String tableName)
tableName - the table to displayvoid makeCommandWindow(java.lang.String title, java.lang.String contents)
title - the title of the windowcontents - the initial contents of the command windowvoid queryTable(java.lang.String query, DatabaseEditor.RowProc rowProc)
query - the query (select statement) to executerowProc - a class encapsulating the method to run on each rowvoid runTableDumpQuery(java.io.OutputStream out, java.lang.String query)
out - the OutputStream to be used for outputquery - the query stringvoid runSchemaDumpQuery(java.io.OutputStream out, java.lang.String query)
out - the OutputStream to be used for outputquery - the query stringvoid dumpDatabase(java.io.OutputStream out)
out - the OutputStream to be used for outputstatic boolean IdChar(char c)
static int lineNumber(java.lang.String s, int charPos)
s - the string to searchcharPos - the position in the stringstatic boolean stringCompare(java.lang.String s, int position, java.lang.String query)
s - the base String to checkposition - character position in s to checkquery - the string to matchint getEndOfSqlStatement(java.lang.String s, int start)
s - the String of SQL statementsstart - the character position of the beginning of the SQL statementstatic java.io.File chooseFile(java.lang.String approve, java.lang.String[]... filters)
approve - the label in the approve buttonfilters - a description of the filters to be usedstatic void makeTableList(java.lang.String db)
db - the name of the database to displayvoid initList(boolean hidden)
hidden - true if listing hidden tablespublic static void main(java.lang.String[] args)
args - The command line arguments.