Java Doc for DataStore.java in  » Database-Client » SQL-Workbench » workbench » storage » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » SQL Workbench » workbench.storage 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   workbench.storage.DataStore

DataStore
public class DataStore (Code)
A class to cache the result of a database query. If the underlying SELECT used only one table, then the DataStore can be updated and the changes can be saved back to the database. For updating or deleting rows, key columns are required For inserting new rows, no keys are required.
See Also:   workbench.storage.ResultInfo
author:
   support@sql-workbench.net


Field Summary
final public static  IntegerROW_MODIFIED
    
final public static  IntegerROW_NEW
    
final public static  IntegerROW_ORIGINAL
    

Constructor Summary
public  DataStore(String[] aColNames, int[] colTypes)
    
public  DataStore(String[] colNames, int[] colTypes, int[] colSizes)
    
public  DataStore(ResultSet aResultSet, WbConnection aConn)
     Create a DataStore based on the contents of the given ResultSet.
 DataStore(ResultInfo metaData)
    
public  DataStore(ResultSet aResult)
     Initialize this DataStore based on the given ResultSet but without reading the data.
public  DataStore(ResultSet aResult, boolean readData)
     Initialize this DataStore based on the given ResultSet The ResultSet has to be closed by the caller.
public  DataStore(ResultSet aResult, WbConnection conn, boolean readData)
    
public  DataStore(ResultSet aResult, boolean readData, int maxRows)
     Create a DataStore based on the given ResultSet.
public  DataStore(ResultSet aResult, boolean readData, RowActionMonitor aMonitor)
     Create a DataStore based on the given ResultSet.
public  DataStore(ResultSet aResult, boolean readData, RowActionMonitor aMonitor, int maxRows, WbConnection conn)
     Create a DataStore based on the given ResultSet.
public  DataStore(ResultSetMetaData metaData, WbConnection aConn)
     Create an empty DataStore based on the information given in the MetaData object.

Method Summary
public  intaddRow(ResultSet rs)
     Adds the next row from the result set to the DataStore.
public  intaddRow()
     Adds a new empty row to the DataStore.
public  intaddRow(RowData row)
    
public  voidapplyFilter(FilterExpression filterExpression)
     Applies a filter based on the given workbench.storage.filter.FilterExpression to this datastore.
public  booleancanSaveAsSqlInsert()
     Returns true if the current data can be converted to SQL INSERT statements.
public  voidcancelRetrieve()
     If the DataStore is beeing initialized with a ResultSet, this cancels the processing of the ResultSet.
public  voidcancelUpdate()
     Cancels a currently running update.
public  booleancheckUpdateTable()
    
public  booleancheckUpdateTable(WbConnection aConn)
    
public  voidclearFilter()
     Restores all rows that were filtered.
public  ObjectconvertCellValue(Object aValue, int aColumn)
    
public  voiddeleteRow(int aRow)
    
public  voiddeleteRowWithDependencies(int aRow)
    
public  intduplicateRow(int aRow)
    
public  ClassgetColumnClass(int aColumn)
    
public  StringgetColumnClassName(int aColumn)
    
public  intgetColumnCount()
    
public  intgetColumnDisplaySize(int aColumn)
     Return the suggested display size of the column.
public  intgetColumnIndex(String aName)
     Returns the index of the column with the given name.
public  StringgetColumnName(int aColumn)
     Return the name of the given column
Parameters:
  aColumn - The index of the column in this DataStore.
public  intgetColumnType(int aColumn)
    
public  ColumnIdentifier[]getColumns()
    
public  StringgetGeneratingSql()
    
public  StringgetInsertTable()
     Return the table that should be used when generating INSERTs ("copy as INSERT") Normally this is the update table.
public  List<ColumnIdentifier>getMissingPkColumns()
    
public  intgetModifiedCount()
    
protected  RowDatagetNextDeletedRow()
    
public  WbConnectiongetOriginalConnection()
     Return the connection that was used to retrieve the result.
protected  ObjectgetOriginalValue(int aRow, int aColumn)
    
public  List<ColumnData>getPkValues(int aRow)
     Returns a list with the value of all PK columns for the given row.
public  List<ColumnData>getPkValues(int aRow, boolean originalValues)
     Returns a list with the value of all PK columns for the given row.
public  RowActionMonitorgetProgressMonitor()
     Getter for property progressMonitor.
public  ResultInfogetResultInfo()
    
public  RowDatagetRow(int aRow)
    
public  intgetRowCount()
    
public  IntegergetRowStatus(int aRow)
     Return the status object for the given row.
public  List<DmlStatement>getUpdateStatements(WbConnection aConnection)
     Returns a List of workbench.storage.DmlStatement s which would be executed in order to store the current content of the DataStore.
public  TableIdentifiergetUpdateTable()
    
public  ObjectgetValue(int aRow, int aColumn)
     Returns the current value of the specified column in the specified row.
public  ObjectgetValue(int aRow, String columnName)
     Returns the current value of the named column in the specified row.
public  intgetValueAsInt(int aRow, int aColumn, int aDefault)
     Return the value of a column as an int value.
public  longgetValueAsLong(int aRow, int aColumn, long aDefault)
     Return the value of a column as an long value.
public  StringgetValueAsString(int aRow, String colName)
     Returns the value of the given row/column as a String.
public  StringgetValueAsString(int aRow, int aColumn)
     Returns the value of the given row/column as a String.
public  booleanhasDeletedRows()
    
public  booleanhasPkColumns()
    
public  booleanhasUpdateableColumns()
    
public  booleanhasUpdatedRows()
     Returns true if at least one row has been updated.
public  voidinitData(ResultSet aResultSet)
     Read the column definitions from the result set's meta data and store the data from the ResultSet in this DataStore with no maximum The ResultSet must be closed by the caller.
public  voidinitData(ResultSet aResultSet, int maxRows)
     Read the column definitions from the result set's meta data and store the data from the ResultSet in this DataStore (up to maxRows) The ResultSet must be closed by the caller.
Parameters:
  aResultSet - the ResultSet to read
Parameters:
  maxRows - max.
public  intinsertRowAfter(int anIndex)
     Inserts a row after the given row number.
public  booleanisCancelled()
     Checks if the last ResultSet processing was cancelled.
public  booleanisFiltered()
    
public  booleanisModified()
    
public  booleanisRowModified(int aRow)
     Returns true if the given row has been modified.
public  booleanisUpdateable()
    
public  booleanlastUpdateHadErrors()
    
public  booleanneedPkForUpdate()
     Returns true if key columns are needed to save the changes to the database.
public  booleanpkColumnsComplete()
    
public  voidreset()
    
public  voidresetCancelStatus()
    
public  voidresetDmlSentStatus()
     Clears the flag for all modified rows that indicates any pending update has already been sent to the database.
public  voidresetStatus()
     Reset all rows to not modified.
public  voidresetStatusForSentRows()
    
protected  voidresetUpdateRowCounters()
    
public  voidrestoreOriginalValues()
     Restore the original values as retrieved from the database.
public  voidsetAllowUpdates(boolean aFlag)
    
public  voidsetColumnSizes(int[] sizes)
    
public  voidsetGeneratingSql(String aSql)
     Define the (SELECT) statement that was used to produce this DataStore's result set.
public  voidsetInputValue(int row, int col, Object value)
     Set a value received from a user input.
public  voidsetOriginalConnection(WbConnection aConn)
    
public  voidsetPKColumns(ColumnIdentifier[] pkColumns)
    
public  voidsetProgressMonitor(RowActionMonitor aMonitor)
     Setter for property progressMonitor.
public  voidsetRowNull(int aRow)
    
public  voidsetUpdateTable(String aTablename, WbConnection aConn)
    
public  voidsetUpdateTable(TableIdentifier tbl)
    
public  voidsetUpdateTable(TableIdentifier tbl, WbConnection conn)
     Sets the table to be updated for this DataStore.
public  voidsetUpdateTableToBeUsed(TableIdentifier tbl)
     Prepare the information which table should be updated.
public  voidsetValue(int aRow, int aColumn, Object aValue)
     Set the value for the given column.
public  voidsort(SortDefinition sortDef)
    
public  voidsortByColumn(int col, boolean ascending)
    
public  booleansqlHasUpdateTable()
     Checks if the underlying SQL statement references only one table.
public synchronized  intupdateDb(WbConnection aConnection, JobErrorHandler errorHandler)
     Save the changes to this DataStore to the database.
public  voidupdatePkInformation()
     Check if the currently defined updateTable has any Primary keys defined in the database.

Field Detail
ROW_MODIFIED
final public static Integer ROW_MODIFIED(Code)



ROW_NEW
final public static Integer ROW_NEW(Code)



ROW_ORIGINAL
final public static Integer ROW_ORIGINAL(Code)




Constructor Detail
DataStore
public DataStore(String[] aColNames, int[] colTypes)(Code)
Create a DataStore which is not based on a result set and contains the columns defined in the given array The column types need to match the values from from java.sql.Types
Parameters:
  aColNames - the column names
Parameters:
  colTypes - data types for each column (matching java.sql.Types.XXXX)



DataStore
public DataStore(String[] colNames, int[] colTypes, int[] colSizes)(Code)
Create a DataStore which is not based on a result set and contains the columns defined in the given array The column types need to match the values from from java.sql.Types
Parameters:
  colNames - the column names
Parameters:
  colTypes - data types for each column (matching java.sql.Types.XXXX)
Parameters:
  colSizes - display size for each column
See Also:   DataStore.getColumnDisplaySize(int)
See Also:   workbench.gui.components.DataStoreTableModel.getColumnWidth(int)



DataStore
public DataStore(ResultSet aResultSet, WbConnection aConn) throws SQLException(Code)
Create a DataStore based on the contents of the given ResultSet. The ResultSet has to be closed by the caller.
See Also:   DataStore.initData(ResultSet,int)



DataStore
DataStore(ResultInfo metaData)(Code)



DataStore
public DataStore(ResultSet aResult) throws SQLException(Code)
Initialize this DataStore based on the given ResultSet but without reading the data. This is equivalent to calling new DataStore(result, false) The ResultSet has to be closed by the caller.
Parameters:
  aResult - the ResultSet to process
throws:
  java.sql.SQLException -
See Also:   DataStore.DataStore(ResultSet,boolean)



DataStore
public DataStore(ResultSet aResult, boolean readData) throws SQLException(Code)
Initialize this DataStore based on the given ResultSet The ResultSet has to be closed by the caller.
Parameters:
  aResult - the ResultSet to process
Parameters:
  readData - if true, the ResultSet will be processed, otherwise only the MetaData will be read
throws:
  java.sql.SQLException -
See Also:   DataStore.initData(ResultSet,int)



DataStore
public DataStore(ResultSet aResult, WbConnection conn, boolean readData) throws SQLException(Code)



DataStore
public DataStore(ResultSet aResult, boolean readData, int maxRows) throws SQLException(Code)
Create a DataStore based on the given ResultSet.
Parameters:
  aResult - the result set to use
Parameters:
  readData - if true the data from the ResultSet should be read into memory, otherwise only MetaData information is read
Parameters:
  maxRows - limit number of rows to maxRows if the JDBC driver does not already limit them



DataStore
public DataStore(ResultSet aResult, boolean readData, RowActionMonitor aMonitor) throws SQLException(Code)
Create a DataStore based on the given ResultSet.
Parameters:
  aResult - the result set to use
Parameters:
  readData - if true the data from the ResultSet should be read into memory, otherwise only MetaData information is read
Parameters:
  aMonitor - if not null, the loading process is displayed through this monitor



DataStore
public DataStore(ResultSet aResult, boolean readData, RowActionMonitor aMonitor, int maxRows, WbConnection conn) throws SQLException(Code)
Create a DataStore based on the given ResultSet.
Parameters:
  aResult - the result set to use
Parameters:
  readData - if true the data from the ResultSet should be read into memory, otherwise only MetaData information is read
Parameters:
  aMonitor - if not null, the loading process is displayed through this monitor
Parameters:
  maxRows - limit number of rows to maxRows if the JDBC driver does not already limit them
Parameters:
  conn - the connection that was used to retrieve the result set



DataStore
public DataStore(ResultSetMetaData metaData, WbConnection aConn) throws SQLException(Code)
Create an empty DataStore based on the information given in the MetaData object. The DataStore can be populated with the DataStore.addRow(ResultSet) method.




Method Detail
addRow
public int addRow(ResultSet rs) throws SQLException(Code)
Adds the next row from the result set to the DataStore. No check will be done if the ResultSet matches the current column structure!! int - the new row numberThe new row will be marked as "Not modified".



addRow
public int addRow()(Code)
Adds a new empty row to the DataStore. The new row will be marked as Modified int - the new row number



addRow
public int addRow(RowData row)(Code)



applyFilter
public void applyFilter(FilterExpression filterExpression)(Code)
Applies a filter based on the given workbench.storage.filter.FilterExpression to this datastore. Each row that does not satisfy the workbench.storage.filter.FilterExpression.evaluate(Map) criteria is removed from the active data
Parameters:
  filterExpression - the expression identifying the rows to be kept
See Also:   workbench.storage.filter.FilterExpression
See Also:   DataStore.clearFilter()



canSaveAsSqlInsert
public boolean canSaveAsSqlInsert()(Code)
Returns true if the current data can be converted to SQL INSERT statements. The data can be saved as SQL INSERTs if an update table is defined. If no update table is defined, then this method will call DataStore.checkUpdateTable() and try to determine the table from the used SQL statement. true if an update table is defined



cancelRetrieve
public void cancelRetrieve()(Code)
If the DataStore is beeing initialized with a ResultSet, this cancels the processing of the ResultSet.
See Also:   DataStore.DataStore(java.sql.ResultSet)
See Also:   DataStore.initData(ResultSet)



cancelUpdate
public void cancelUpdate()(Code)
Cancels a currently running update. This has to be called from a different thread than the one from which updatedb() was called
See Also:   DataStore.updateDb(workbench.db.WbConnection,workbench.interfaces.JobErrorHandler)



checkUpdateTable
public boolean checkUpdateTable()(Code)



checkUpdateTable
public boolean checkUpdateTable(WbConnection aConn)(Code)



clearFilter
public void clearFilter()(Code)
Restores all rows that were filtered.



convertCellValue
public Object convertCellValue(Object aValue, int aColumn) throws ConverterException(Code)
Convert the value to the approriate class instance for the given column
Parameters:
  aValue - the value as entered by the user
Parameters:
  aColumn - the column for which this value should be converted an Object of the needed class for the column
See Also:   ValueConverter.convertValue(Objectint)



deleteRow
public void deleteRow(int aRow) throws IndexOutOfBoundsException(Code)
Deletes the given row and saves it in the delete buffer in order to be able to generate a DELETE statement if this DataStore needs updating



deleteRowWithDependencies
public void deleteRowWithDependencies(int aRow) throws IndexOutOfBoundsException, SQLException(Code)



duplicateRow
public int duplicateRow(int aRow)(Code)



getColumnClass
public Class getColumnClass(int aColumn)(Code)



getColumnClassName
public String getColumnClassName(int aColumn)(Code)



getColumnCount
public int getColumnCount()(Code)



getColumnDisplaySize
public int getColumnDisplaySize(int aColumn) throws IndexOutOfBoundsException(Code)
Return the suggested display size of the column. This is delegated to the instance of the workbench.storage.ResultInfo class that is used to store the column meta data
Parameters:
  aColumn - the column index the suggested display size
See Also:   workbench.storage.ResultInfo.getColumnSize(int)
See Also:   workbench.gui.components.DataStoreTableModel.getColumnWidth(int)



getColumnIndex
public int getColumnIndex(String aName)(Code)
Returns the index of the column with the given name.
Parameters:
  aName - The column's name to search for The column's index (first column starts at 0)



getColumnName
public String getColumnName(int aColumn) throws IndexOutOfBoundsException(Code)
Return the name of the given column
Parameters:
  aColumn - The index of the column in this DataStore. The first column index is 0 The name of the column



getColumnType
public int getColumnType(int aColumn) throws IndexOutOfBoundsException(Code)



getColumns
public ColumnIdentifier[] getColumns()(Code)



getGeneratingSql
public String getGeneratingSql()(Code)



getInsertTable
public String getInsertTable()(Code)
Return the table that should be used when generating INSERTs ("copy as INSERT") Normally this is the update table. If no update table is defined, the table from the SQL statement will be used but no checking for key columns takes place (which might take long)



getMissingPkColumns
public List<ColumnIdentifier> getMissingPkColumns()(Code)



getModifiedCount
public int getModifiedCount()(Code)
Returns the total number of modified, new or deleted rows



getNextDeletedRow
protected RowData getNextDeletedRow()(Code)



getOriginalConnection
public WbConnection getOriginalConnection()(Code)
Return the connection that was used to retrieve the result. Can be null if the DataStore was not populated using a ResultSet



getOriginalValue
protected Object getOriginalValue(int aRow, int aColumn)(Code)



getPkValues
public List<ColumnData> getPkValues(int aRow)(Code)
Returns a list with the value of all PK columns for the given row. The key to the map is the name of the column.
See Also:   workbench.storage.ResultInfo.isPkColumn(int)
See Also:   DataStore.getValue(int,int)



getPkValues
public List<ColumnData> getPkValues(int aRow, boolean originalValues)(Code)
Returns a list with the value of all PK columns for the given row. The key to the map is the name of the column.
See Also:   workbench.storage.ResultInfo.isPkColumn(int)
See Also:   DataStore.getValue(int,int)



getProgressMonitor
public RowActionMonitor getProgressMonitor()(Code)
Getter for property progressMonitor. Value of property progressMonitor.



getResultInfo
public ResultInfo getResultInfo()(Code)



getRow
public RowData getRow(int aRow) throws IndexOutOfBoundsException(Code)



getRowCount
public int getRowCount()(Code)



getRowStatus
public Integer getRowStatus(int aRow) throws IndexOutOfBoundsException(Code)
Return the status object for the given row. The status is one of The status object is used by the workbench.gui.renderer.RowStatusRenderer in the result table to display the approriate icon.
Parameters:
  aRow - the row for which the status should be returned an Integer identifying the status



getUpdateStatements
public List<DmlStatement> getUpdateStatements(WbConnection aConnection) throws SQLException(Code)
Returns a List of workbench.storage.DmlStatement s which would be executed in order to store the current content of the DataStore. The returned list will be empty if no changes were made to the datastore a List of workbench.storage.DmlStatements to be sent to the database
See Also:   workbench.storage.StatementFactory
See Also:   workbench.storage.DmlStatement.getExecutableStatement(SqlLiteralFormatter)



getUpdateTable
public TableIdentifier getUpdateTable()(Code)
Returns the current table to be updated if this DataStore is based on a SELECT query The current update table
See Also:   DataStore.setGeneratingSql(String)



getValue
public Object getValue(int aRow, int aColumn) throws IndexOutOfBoundsException(Code)
Returns the current value of the specified column in the specified row.
Parameters:
  aRow - the row to get the data from (starts at 0)
Parameters:
  aColumn - the column to get the data for (starts at 0) the current value of the column might be different to the valueretrieved from the database!
See Also:   workbench.storage.RowData.getValue(int)
See Also:   DataStore.getRow(int)



getValue
public Object getValue(int aRow, String columnName) throws IndexOutOfBoundsException(Code)
Returns the current value of the named column in the specified row. This is equivalent to calling getRow(row, findColumn(columnName))
Parameters:
  aRow - the row to get the data from (starts at 0)
Parameters:
  columnName - the column to get the data for the current value of the column might be different to the valueretrieved from the database!
See Also:   workbench.storage.RowData.getValue(int)
See Also:   DataStore.getRow(int)
See Also:   DataStore.getColumnIndex(String)
See Also:   DataStore.getValue(int,int)



getValueAsInt
public int getValueAsInt(int aRow, int aColumn, int aDefault)(Code)
Return the value of a column as an int value. If the object stored in the DataStore is an instance of Number the intValue() of that object will be returned, otherwise the String value of the column will be converted to an integer. If it cannot be converted to an int, the default value will be returned
Parameters:
  aRow - The row
Parameters:
  aColumn - The column to be returned
Parameters:
  aDefault - The default value that will be returned if the the column's value cannot be converted to an int



getValueAsLong
public long getValueAsLong(int aRow, int aColumn, long aDefault)(Code)
Return the value of a column as an long value. If the object stored in the DataStore is an instance of Number the longValue() of that object will be returned, otherwise the String value of the column will be converted to a long. If it cannot be converted to an long, the default value will be returned
Parameters:
  aRow - The row
Parameters:
  aColumn - The column to be returned
Parameters:
  aDefault - The default value that will be returned if the the column's value cannot be converted to a long



getValueAsString
public String getValueAsString(int aRow, String colName) throws IndexOutOfBoundsException(Code)
Returns the value of the given row/column as a String. The value's toString() method is used to convert the value to a String value. Null if the column is null, or the column's value as a String



getValueAsString
public String getValueAsString(int aRow, int aColumn) throws IndexOutOfBoundsException(Code)
Returns the value of the given row/column as a String. The value's toString() method is used to convert the value to a String value. Null if the column is null, or the column's value as a String



hasDeletedRows
public boolean hasDeletedRows()(Code)
Returns true if at least one row has been deleted



hasPkColumns
public boolean hasPkColumns()(Code)



hasUpdateableColumns
public boolean hasUpdateableColumns()(Code)



hasUpdatedRows
public boolean hasUpdatedRows()(Code)
Returns true if at least one row has been updated.



initData
public void initData(ResultSet aResultSet) throws SQLException(Code)
Read the column definitions from the result set's meta data and store the data from the ResultSet in this DataStore with no maximum The ResultSet must be closed by the caller.
Parameters:
  aResultSet - the ResultSet to read
See Also:   DataStore.initData(ResultSet,int)



initData
public void initData(ResultSet aResultSet, int maxRows) throws SQLException(Code)
Read the column definitions from the result set's meta data and store the data from the ResultSet in this DataStore (up to maxRows) The ResultSet must be closed by the caller.
Parameters:
  aResultSet - the ResultSet to read
Parameters:
  maxRows - max. number of rows to read. Zero or lower to read all rows
See Also:   DataStore.initData(ResultSet)



insertRowAfter
public int insertRowAfter(int anIndex)(Code)
Inserts a row after the given row number. If the new Index is greater then the current row count or the new index is < 0 the new row will be added at the end. int - the new row number



isCancelled
public boolean isCancelled()(Code)
Checks if the last ResultSet processing was cancelled. This will only be correct if initData() was called previously true if retrieval was cancelled.
See Also:   DataStore.DataStore(java.sql.ResultSet)
See Also:   DataStore.initData(ResultSet)



isFiltered
public boolean isFiltered()(Code)



isModified
public boolean isModified()(Code)



isRowModified
public boolean isRowModified(int aRow)(Code)
Returns true if the given row has been modified. A new row is considered modified only if setValue() has been called at least once.
Parameters:
  aRow - The row to check



isUpdateable
public boolean isUpdateable()(Code)



lastUpdateHadErrors
public boolean lastUpdateHadErrors()(Code)



needPkForUpdate
public boolean needPkForUpdate()(Code)
Returns true if key columns are needed to save the changes to the database. If only inserted rows are present, then no key is needed. For updated or deleted rows a key is needed



pkColumnsComplete
public boolean pkColumnsComplete()(Code)



reset
public void reset()(Code)
Remove all data from the DataStore



resetCancelStatus
public void resetCancelStatus()(Code)



resetDmlSentStatus
public void resetDmlSentStatus()(Code)
Clears the flag for all modified rows that indicates any pending update has already been sent to the database. This is necessary if an error occurs during update, to ensure the rows are re-send the next time.



resetStatus
public void resetStatus()(Code)
Reset all rows to not modified. After this a call to #isModified() will return false.



resetStatusForSentRows
public void resetStatusForSentRows()(Code)
Clears the modified status for those rows where the update has been sent to the database



resetUpdateRowCounters
protected void resetUpdateRowCounters()(Code)



restoreOriginalValues
public void restoreOriginalValues()(Code)
Restore the original values as retrieved from the database. This will have no effect if DataStore.isModified() returns false
See Also:   DataStore.setValue(int,int,Object)



setAllowUpdates
public void setAllowUpdates(boolean aFlag)(Code)



setColumnSizes
public void setColumnSizes(int[] sizes)(Code)



setGeneratingSql
public void setGeneratingSql(String aSql)(Code)
Define the (SELECT) statement that was used to produce this DataStore's result set. This is used to find the update table later



setInputValue
public void setInputValue(int row, int col, Object value) throws ConverterException(Code)
Set a value received from a user input. This will convert the given value to an object of the correct class



setOriginalConnection
public void setOriginalConnection(WbConnection aConn)(Code)



setPKColumns
public void setPKColumns(ColumnIdentifier[] pkColumns)(Code)



setProgressMonitor
public void setProgressMonitor(RowActionMonitor aMonitor)(Code)
Setter for property progressMonitor.
Parameters:
  aMonitor - New value of property progressMonitor.



setRowNull
public void setRowNull(int aRow)(Code)
Set all values in the given row to NULL



setUpdateTable
public void setUpdateTable(String aTablename, WbConnection aConn)(Code)



setUpdateTable
public void setUpdateTable(TableIdentifier tbl)(Code)



setUpdateTable
public void setUpdateTable(TableIdentifier tbl, WbConnection conn)(Code)
Sets the table to be updated for this DataStore. Upon setting the table, the column definition for the table will be retrieved using workbench.db.DbMetadata To define the table that should be used for updates, but without retrieving its definition (for performance reasons) use DataStore.setUpdateTableToBeUsed(TableIdentifier) any PK column that is not found in the current ResultInfo will be stored and can be retrieved using getMissingPkColumns()
Parameters:
  tbl - the table to be used as the update table
Parameters:
  conn - the connection where this table exists
See Also:   DataStore.setUpdateTableToBeUsed(TableIdentifier)
See Also:   DataStore.getMissingPkColumns()



setUpdateTableToBeUsed
public void setUpdateTableToBeUsed(TableIdentifier tbl)(Code)
Prepare the information which table should be updated. This will not trigger the retrieval of the columns. This table will be used the next time checkUpdateTable() will be called. checkUpdateTable() will not retrieve the table name from the original SQL then.
See Also:   DataStore.setUpdateTable(TableIdentifier)



setValue
public void setValue(int aRow, int aColumn, Object aValue) throws IndexOutOfBoundsException(Code)
Set the value for the given column. This will change the internal state of the DataStore to modified.
Parameters:
  aRow -
Parameters:
  aColumn -
Parameters:
  aValue - The value to be set



sort
public void sort(SortDefinition sortDef)(Code)



sortByColumn
public void sortByColumn(int col, boolean ascending)(Code)



sqlHasUpdateTable
public boolean sqlHasUpdateTable()(Code)
Checks if the underlying SQL statement references only one table. true if only one table is found in the SELECT statement
See Also:   workbench.util.SqlUtil.getTables(String)



updateDb
public synchronized int updateDb(WbConnection aConnection, JobErrorHandler errorHandler) throws SQLException(Code)
Save the changes to this DataStore to the database. The changes are applied in the following order
  • Delete statements
  • Insert statements
  • Update statements
If everything was successful, the changes will be committed automatically If an error occurs a rollback will be sent to the database
Parameters:
  aConnection - the connection where the database should be updated
Parameters:
  errorHandler - callback for error handling the number of rows affected
See Also:   workbench.storage.StatementFactory
See Also:   workbench.storage.DmlStatement.getExecutableStatement(SqlLiteralFormatter)



updatePkInformation
public void updatePkInformation() throws SQLException(Code)
Check if the currently defined updateTable has any Primary keys defined in the database. If it has, a subsequent call to hasPkColumns() returns true



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.