Java Doc for Constraint.java in  » Database-DBMS » hsql » org » hsqldb » 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 DBMS » hsql » org.hsqldb 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.hsqldb.Constraint

Constraint
class Constraint (Code)
Implementation of a table constraint with references to the indexes used by the constraint.


author:
   Thomas Mueller (Hypersonic SQL Group)
version:
   1.8.0
since:
   Hypersonic SQL



Field Summary
final static  intCASCADESET_NULLNO_ACTIONSET_DEFAULTINIT_DEFERREDINIT_IMMEDIATENOT_DEFERRABLE
    
final static  intFOREIGN_KEYMAINUNIQUECHECKPRIMARY_KEY
    
 HsqlNameconstName
    
 intconstType
    
 ConstraintCorecore
    

Constructor Summary
 Constraint(HsqlName name, Table t, Index index, int type)
    
 Constraint(HsqlName name, Constraint fkconstraint)
    
 Constraint(HsqlName pkname, HsqlName name, Table mainTable, Table refTable, int[] mainCols, int[] refCols, Index mainIndex, Index refIndex, int deleteAction, int updateAction)
     Constructor for foreign key constraints.
 Constraint(HsqlName name, int[] mainCols, Table refTable, int[] refCols, int type, int deleteAction, int updateAction)
    

Method Summary
 voidcheckCheckConstraint(Session session, Object[] row)
    
 voidcheckInsert(Session session, Object[] row)
     Checks for foreign key or check constraint violation when inserting a row into the child table.
static  voidcheckReferencedRows(Session session, Table table, int[] rowColArray, Index mainIndex)
     Check used before creating a new foreign key cosntraint, this method checks all rows of a table to ensure they all have a corresponding row in the main table.
 RowIteratorfindFkRef(Session session, Object[] row, boolean delete)
     New method to find any referencing row for a foreign key (finds row in child table).
 intgetDeleteAction()
    
 StringgetFkName()
    
 TablegetMain()
    
 int[]getMainColumns()
    
 IndexgetMainIndex()
    
 HsqlNamegetName()
     Returns the HsqlName.
 StringgetPkName()
    
 TablegetRef()
    
 int[]getRefColumns()
    
 IndexgetRefIndex()
    
 intgetType()
    
 intgetUpdateAction()
    
 booleanhasColumn(Table table, String colname)
    
 booleanhasColumn(int colIndex)
    
 booleanhasMainRef(Session session, Object[] row)
     For the candidate table row, finds any referring node in the main table. This is used to check referential integrity when updating a node.
 booleanisEquivalent(int[] col, int type)
     Compares this with another constraint column set.
 booleanisEquivalent(Table tablemain, int[] colmain, Table tableref, int[] colref)
     Compares this with another constraint column set.
 booleanisIndexFK(Index index)
     Returns true if an index is part this constraint and the constraint is set for a foreign key.
 booleanisIndexUnique(Index index)
     Returns true if an index is part this constraint and the constraint is set for a unique constraint.
 voidreplaceTable(Table oldt, Table newt, int colindex, int adjust)
     Used to update constrains to reflect structural changes in a table.

Field Detail
CASCADESET_NULLNO_ACTIONSET_DEFAULTINIT_DEFERREDINIT_IMMEDIATENOT_DEFERRABLE
final static int CASCADESET_NULLNO_ACTIONSET_DEFAULTINIT_DEFERREDINIT_IMMEDIATENOT_DEFERRABLE(Code)



FOREIGN_KEYMAINUNIQUECHECKPRIMARY_KEY
final static int FOREIGN_KEYMAINUNIQUECHECKPRIMARY_KEY(Code)



constName
HsqlName constName(Code)



constType
int constType(Code)



core
ConstraintCore core(Code)




Constructor Detail
Constraint
Constraint(HsqlName name, Table t, Index index, int type)(Code)
Constructor declaration for PK and UNIQUE



Constraint
Constraint(HsqlName name, Constraint fkconstraint)(Code)
Constructor for main constraints (foreign key references in PK table)



Constraint
Constraint(HsqlName pkname, HsqlName name, Table mainTable, Table refTable, int[] mainCols, int[] refCols, Index mainIndex, Index refIndex, int deleteAction, int updateAction) throws HsqlException(Code)
Constructor for foreign key constraints.
Parameters:
  pkname - name in the main (referenced) table, used internally
Parameters:
  name - name in the referencing table, public name of the constraint
Parameters:
  mainTable - referenced table
Parameters:
  refTable - referencing talbe
Parameters:
  mainCols - array of column indexes in main table
Parameters:
  refCols - array of column indexes in referencing table
Parameters:
  mainIndex - index on the main table
Parameters:
  refIndex - index on the referencing table
Parameters:
  deleteAction - triggered action on delete
Parameters:
  updateAction - triggered action on update
exception:
  HsqlException -



Constraint
Constraint(HsqlName name, int[] mainCols, Table refTable, int[] refCols, int type, int deleteAction, int updateAction)(Code)
temp constraint constructor




Method Detail
checkCheckConstraint
void checkCheckConstraint(Session session, Object[] row) throws HsqlException(Code)



checkInsert
void checkInsert(Session session, Object[] row) throws HsqlException(Code)
Checks for foreign key or check constraint violation when inserting a row into the child table.



checkReferencedRows
static void checkReferencedRows(Session session, Table table, int[] rowColArray, Index mainIndex) throws HsqlException(Code)
Check used before creating a new foreign key cosntraint, this method checks all rows of a table to ensure they all have a corresponding row in the main table.



findFkRef
RowIterator findFkRef(Session session, Object[] row, boolean delete) throws HsqlException(Code)
New method to find any referencing row for a foreign key (finds row in child table). If ON DELETE CASCADE is supported by this constraint, then the method finds the first row among the rows of the table ordered by the index and doesn't throw. Without ON DELETE CASCADE, the method attempts to finds any row that exists, in which case it throws an exception. If no row is found, null is returned. (fredt@users)
Parameters:
  row - array of objects for a database row
Parameters:
  forDelete - should we allow 'ON DELETE CASCADE' or 'ON UPDATE CASCADE' Node object or null
throws:
  HsqlException -



getDeleteAction
int getDeleteAction()(Code)
The ON DELETE triggered action of (foreign key) constraint



getFkName
String getFkName()(Code)
probably a misnomer, but DatabaseMetaData.getCrossReference specifies it this way (I suppose because most FKs are declared against the PK of another table) name of the index for the referencing foreign key



getMain
Table getMain()(Code)
Returns the main table



getMainColumns
int[] getMainColumns()(Code)
Returns the main table column index array



getMainIndex
Index getMainIndex()(Code)
Returns the main index



getName
HsqlName getName()(Code)
Returns the HsqlName.



getPkName
String getPkName()(Code)
probably a misnomer, but DatabaseMetaData.getCrossReference specifies it this way (I suppose because most FKs are declared against the PK of another table) name of the index refereneced by a foreign key



getRef
Table getRef()(Code)
Returns the reference table



getRefColumns
int[] getRefColumns()(Code)
Returns the reference table column index array



getRefIndex
Index getRefIndex()(Code)
Returns the reference index



getType
int getType()(Code)
Returns the type of constraint



getUpdateAction
int getUpdateAction()(Code)
The ON UPDATE triggered action of (foreign key) constraint



hasColumn
boolean hasColumn(Table table, String colname)(Code)
Only for check constraints



hasColumn
boolean hasColumn(int colIndex)(Code)



hasMainRef
boolean hasMainRef(Session session, Object[] row) throws HsqlException(Code)
For the candidate table row, finds any referring node in the main table. This is used to check referential integrity when updating a node. We have to make sure that the main table still holds a valid main record. If a valid row is found the corresponding Node is returned. Otherwise a 'INTEGRITY VIOLATION' Exception gets thrown.



isEquivalent
boolean isEquivalent(int[] col, int type)(Code)
Compares this with another constraint column set. This implementation only checks UNIQUE constraints.



isEquivalent
boolean isEquivalent(Table tablemain, int[] colmain, Table tableref, int[] colref)(Code)
Compares this with another constraint column set. This implementation only checks FOREIGN KEY constraints.



isIndexFK
boolean isIndexFK(Index index)(Code)
Returns true if an index is part this constraint and the constraint is set for a foreign key. Used for tests before dropping an index.



isIndexUnique
boolean isIndexUnique(Index index)(Code)
Returns true if an index is part this constraint and the constraint is set for a unique constraint. Used for tests before dropping an index.



replaceTable
void replaceTable(Table oldt, Table newt, int colindex, int adjust) throws HsqlException(Code)
Used to update constrains to reflect structural changes in a table. Prior checks must ensure that this method does not throw.
Parameters:
  oldt - reference to the old version of the table
Parameters:
  newt - referenct to the new version of the table
Parameters:
  colindex - index at which table column is added or removed
Parameters:
  adjust - -1, 0, +1 to indicate if column is added or removed
throws:
  HsqlException -



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.