Java Doc for TableDataSet.java in  » Database-ORM » Torque » com » workingdogs » village » 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 ORM » Torque » com.workingdogs.village 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.workingdogs.village.DataSet
      com.workingdogs.village.TableDataSet

TableDataSet
public class TableDataSet extends DataSet (Code)
This class is used for doing select/insert/delete/update on the database. A TableDataSet cannot be used to join multiple tables for an update, if you need join functionality on a select, you should use a QueryDataSet.

Here is an example usage for this code that gets the first 10 records where column "a" = 1:

 KeyDef kd = new KeyDef().setAttrib("column");
 TableDataSet tds = new TableDataSet(connection, "table_name", kd );
 tds.where ("a=1" ); // WHERE a = 1
 tds.fetchRecords(10); // fetch first 10 records where column a=1
 for ( int i=0;i< tds.size(); i++ )
 {
 Record rec = tds.getRecord(i); // zero based
 String columnA = rec.getValue("a");
 if ( columnA.equals ("1") )
 System.out.print ("We got a column!");
 }
 tds.close();
 

It is important to remember to always close() the TableDataSet when you are finished with it.

As you can see, using a TableDataSet makes doing selects from the database trivial. You do not need to write any SQL and it makes it easy to cache a TableDataSet for future use within your application.


author:
   Jon S. Stevens
version:
   $Revision: 568 $



Constructor Summary
public  TableDataSet()
     Default constructor.
public  TableDataSet(Connection conn, String tableName)
     Creates a new TableDataSet object.
public  TableDataSet(Connection conn, Schema schema, KeyDef keydef)
     Creates a new TableDataSet object.
public  TableDataSet(Connection conn, String tableName, KeyDef keydef)
     Creates a new TableDataSet object.
public  TableDataSet(Connection conn, String tableName, String columns)
     Creates a new TableDataSet object.
public  TableDataSet(Connection conn, String tableName, String columns, KeyDef keydef)
     Creates a new TableDataSet object.

Method Summary
public  Stringattributes()
     this is a string that contains the columns for the table that this TableDataSet represents.
public  StringdebugInfo()
     Hell if I know what this does.
public  DataSetfetchRecords()
    
public  DataSetfetchRecords(int max)
    
public  DataSetfetchRecords(int start, int max)
     Fetch start to max records.
 StringgetOrder()
     Gets the value of the SQL portion of ORDER.
 StringgetOther()
     Gets the value of the SQL portion of OTHER.
public  StringgetSelectString()
     Builds the select string that was used to populate this TableDataSet.
 StringgetWhere()
     Gets the value of the SQL portion of WHERE.
public  KeyDefkeydef()
    
public  StringoptimisticLockingCol()
     Gets the table column used for optomistic locking.
public  TableDataSetorder(String order)
    
public  TableDataSetother(String other)
    
public  voidrefresh(Connection conn)
     This method refreshes all of the Records stored in this TableDataSet.
public  booleanrefreshOnSave()
     Setting this causes each Record to refresh itself when a save() is performed on it.
public  voidremoveDeletedRecords()
     Removes any records that are marked as a zombie.
public  ResultSetresultSet()
    
public  intsave()
     Saves all the records in the DataSet.
public  intsave(boolean intransaction)
     Saves all the records in the DataSet with the intransaction boolean value.
public  intsave(Connection conn, boolean intransaction)
     Saves all the records in the DataSet with the given connection and intransaction boolean value.
public  intsaveWithoutStatusUpdate(Connection conn)
    
public  Schemaschema()
    
public  voidsetOptimisticLockingColumn(String olc)
     Sets the table column used for optomistic locking.
public  voidsetRefreshOnSave(boolean val)
     Setting this causes each Record to refresh itself when a save() is performed on it.
public  StringtableName()
     The name of the table for which this TableDataSet was created.
public  TableDataSettableQualifier(String tq)
     This sets additional SQL for the table name.
public  voidupdateStatus()
    
public  TableDataSetwhere(String where)
    


Constructor Detail
TableDataSet
public TableDataSet() throws SQLException, DataSetException(Code)
Default constructor.
exception:
  SQLException -
exception:
  DataSetException -



TableDataSet
public TableDataSet(Connection conn, String tableName) throws SQLException, DataSetException(Code)
Creates a new TableDataSet object.
Parameters:
  conn - TODO: DOCUMENT ME!
Parameters:
  tableName - TODO: DOCUMENT ME!
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



TableDataSet
public TableDataSet(Connection conn, Schema schema, KeyDef keydef) throws SQLException, DataSetException(Code)
Creates a new TableDataSet object.
Parameters:
  conn - TODO: DOCUMENT ME!
Parameters:
  schema - TODO: DOCUMENT ME!
Parameters:
  keydef - TODO: DOCUMENT ME!
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



TableDataSet
public TableDataSet(Connection conn, String tableName, KeyDef keydef) throws SQLException, DataSetException(Code)
Creates a new TableDataSet object.
Parameters:
  conn - TODO: DOCUMENT ME!
Parameters:
  tableName - TODO: DOCUMENT ME!
Parameters:
  keydef - TODO: DOCUMENT ME!
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



TableDataSet
public TableDataSet(Connection conn, String tableName, String columns) throws SQLException, DataSetException(Code)
Creates a new TableDataSet object.
Parameters:
  conn - TODO: DOCUMENT ME!
Parameters:
  tableName - TODO: DOCUMENT ME!
Parameters:
  columns - TODO: DOCUMENT ME!
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



TableDataSet
public TableDataSet(Connection conn, String tableName, String columns, KeyDef keydef) throws SQLException, DataSetException(Code)
Creates a new TableDataSet object.
Parameters:
  conn - TODO: DOCUMENT ME!
Parameters:
  tableName - TODO: DOCUMENT ME!
Parameters:
  columns - TODO: DOCUMENT ME!
Parameters:
  keydef - TODO: DOCUMENT ME!
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!




Method Detail
attributes
public String attributes()(Code)
this is a string that contains the columns for the table that this TableDataSet represents. columns separated by ","



debugInfo
public String debugInfo()(Code)
Hell if I know what this does. TODO: DOCUMENT ME!



fetchRecords
public DataSet fetchRecords() throws SQLException, DataSetException(Code)
Use the TDS fetchRecords instead of the DataSet.fetchRecords an instance of myself
exception:
  SQLException -
exception:
  DataSetException -



fetchRecords
public DataSet fetchRecords(int max) throws SQLException, DataSetException(Code)
Use the TDS fetchRecords instead of the DataSet.fetchRecords
Parameters:
  max - an instance of myself
exception:
  SQLException -
exception:
  DataSetException -



fetchRecords
public DataSet fetchRecords(int start, int max) throws SQLException, DataSetException(Code)
Fetch start to max records. start is at Record 0
Parameters:
  start -
Parameters:
  max - an instance of myself
exception:
  SQLException -
exception:
  DataSetException -



getOrder
String getOrder()(Code)
Gets the value of the SQL portion of ORDER. string



getOther
String getOther()(Code)
Gets the value of the SQL portion of OTHER. string



getSelectString
public String getSelectString() throws DataSetException(Code)
Builds the select string that was used to populate this TableDataSet. SQL select string
throws:
  DataSetException - TODO: DOCUMENT ME!



getWhere
String getWhere()(Code)
Gets the value of the SQL portion of WHERE. string



keydef
public KeyDef keydef()(Code)
Returns the KeyDef for the DataSet a keydef



optimisticLockingCol
public String optimisticLockingCol()(Code)
Gets the table column used for optomistic locking. string



order
public TableDataSet order(String order) throws DataSetException(Code)
Sets the value for the SQL portion of the ORDER statement
Parameters:
  order - TODO: DOCUMENT ME! instance of self
throws:
  DataSetException - TODO: DOCUMENT ME!



other
public TableDataSet other(String other) throws DataSetException(Code)
Sets the value for the SQL portion of the OTHER statement
Parameters:
  other - TODO: DOCUMENT ME! instance of self
throws:
  DataSetException - TODO: DOCUMENT ME!



refresh
public void refresh(Connection conn) throws SQLException, DataSetException(Code)
This method refreshes all of the Records stored in this TableDataSet.
Parameters:
  conn - TODO: DOCUMENT ME!
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



refreshOnSave
public boolean refreshOnSave()(Code)
Setting this causes each Record to refresh itself when a save() is performed on it.

Default value is false.

true if it is on; false otherwise



removeDeletedRecords
public void removeDeletedRecords() throws DataSetException(Code)
Removes any records that are marked as a zombie.
throws:
  DataSetException - TODO: DOCUMENT ME!



resultSet
public ResultSet resultSet() throws SQLException, DataSetException(Code)
Returns the ResultSet for the DataSet a ResultSet
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



save
public int save() throws SQLException, DataSetException(Code)
Saves all the records in the DataSet. total number of records updated/inserted/deleted
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



save
public int save(boolean intransaction) throws SQLException, DataSetException(Code)
Saves all the records in the DataSet with the intransaction boolean value.
Parameters:
  intransaction - TODO: DOCUMENT ME! total number of records updated/inserted/deleted
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



save
public int save(Connection conn, boolean intransaction) throws SQLException, DataSetException(Code)
Saves all the records in the DataSet with the given connection and intransaction boolean value.
Parameters:
  conn - TODO: DOCUMENT ME!
Parameters:
  intransaction - TODO: DOCUMENT ME! total number of records updated/inserted/deleted
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



saveWithoutStatusUpdate
public int saveWithoutStatusUpdate(Connection conn) throws SQLException, DataSetException(Code)
Not yet implemented
Parameters:
  conn - TODO: DOCUMENT ME! TODO: DOCUMENT ME!
throws:
  SQLException - TODO: DOCUMENT ME!
throws:
  DataSetException - TODO: DOCUMENT ME!



schema
public Schema schema()(Code)
Returns the Schema for the DataSet a Schema



setOptimisticLockingColumn
public void setOptimisticLockingColumn(String olc)(Code)
Sets the table column used for optomistic locking.
Parameters:
  olc - TODO: DOCUMENT ME!



setRefreshOnSave
public void setRefreshOnSave(boolean val)(Code)
Setting this causes each Record to refresh itself when a save() is performed on it.

Default value is false.


Parameters:
  val - TODO: DOCUMENT ME!



tableName
public String tableName() throws DataSetException(Code)
The name of the table for which this TableDataSet was created. string
throws:
  DataSetException - TODO: DOCUMENT ME!



tableQualifier
public TableDataSet tableQualifier(String tq)(Code)
This sets additional SQL for the table name. The string appears after the table name. Sybase users would set this to "HOLDLOCK" to get repeatable reads.

FIXME: Is this right? I don't use Sybase.


Parameters:
  tq - TODO: DOCUMENT ME! an instance of self



updateStatus
public void updateStatus() throws SQLException, DataSetException(Code)
Not yet implemented
exception:
  SQLException -
exception:
  DataSetException -



where
public TableDataSet where(String where) throws DataSetException(Code)
Sets the value for the SQL portion of the WHERE statement
Parameters:
  where - TODO: DOCUMENT ME! instance of self
throws:
  DataSetException - TODO: DOCUMENT ME!



Fields inherited from com.workingdogs.village.DataSet
final protected static int ALL_RECORDS(Code)(Java Doc)
protected Connection conn(Code)(Java Doc)
protected Vector records(Code)(Java Doc)
protected ResultSet resultSet(Code)(Java Doc)
protected Schema schema(Code)(Java Doc)
protected StringBuffer selectString(Code)(Java Doc)
protected Statement stmt(Code)(Java Doc)

Methods inherited from com.workingdogs.village.DataSet
public Record addRecord() throws DataSetException, SQLException(Code)(Java Doc)
public Record addRecord(DataSet ds) throws DataSetException, SQLException(Code)(Java Doc)
public boolean allRecordsRetrieved()(Code)(Java Doc)
public DataSet clearRecords()(Code)(Java Doc)
public void close() throws SQLException, DataSetException(Code)(Java Doc)
public Connection connection() throws SQLException(Code)(Java Doc)
public boolean containsRecord(int pos)(Code)(Java Doc)
public DataSet fetchRecords() throws SQLException, DataSetException(Code)(Java Doc)
public DataSet fetchRecords(int max) throws SQLException, DataSetException(Code)(Java Doc)
public DataSet fetchRecords(int start, int max) throws SQLException, DataSetException(Code)(Java Doc)
Record findRecord(int pos) throws DataSetException(Code)(Java Doc)
String getColumns()(Code)(Java Doc)
public Record getRecord(int pos) throws DataSetException(Code)(Java Doc)
abstract public String getSelectString() throws DataSetException(Code)(Java Doc)
public KeyDef keydef()(Code)(Java Doc)
public int lastFetchSize()(Code)(Java Doc)
public int[] maxColumnWidths(boolean with_heading) throws DataSetException, SQLException(Code)(Java Doc)
public DataSet releaseRecords()(Code)(Java Doc)
public Record removeRecord(Record rec) throws DataSetException(Code)(Java Doc)
public DataSet reset() throws DataSetException, SQLException(Code)(Java Doc)
public ResultSet resultSet() throws SQLException, DataSetException(Code)(Java Doc)
public Schema schema()(Code)(Java Doc)
void setAllRecordsRetrieved(boolean set)(Code)(Java Doc)
public int size()(Code)(Java Doc)
public String tableName() throws DataSetException(Code)(Java Doc)
public String toString()(Code)(Java Doc)

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.