Java Doc for Transaction.java in  » Database-DBMS » mckoi » com » mckoi » database » 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 » mckoi » com.mckoi.database 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.mckoi.database.SimpleTransaction
      com.mckoi.database.Transaction

Transaction
public class Transaction extends SimpleTransaction (Code)
An open transaction that manages all data access to the TableDataConglomerate. A transaction sees a view of the data as it was when the transaction was created. It also sees any modifications that were made within the context of this transaction. It does not see modifications made by other open transactions.

A transaction ends when it is committed or rollbacked. All operations on this transaction object only occur within the context of this transaction and are not permanent changes to the database structure. Only when the transaction is committed are changes reflected in the master data.
author:
   Tobias Downer


Inner Class :public static class ColumnGroup
Inner Class :public static class CheckExpression
Inner Class :public static class ColumnGroupReference

Field Summary
final public static  StringCASCADE
    
final public static  shortINITIALLY_DEFERRED
     The type of deferrance.
final public static  shortINITIALLY_IMMEDIATE
    
final public static  shortNOT_DEFERRABLE
    
final public static  StringNO_ACTION
     Foreign key referential trigger actions.
final public static  StringSET_DEFAULT
    
final public static  StringSET_NULL
    

Constructor Summary
 Transaction(TableDataConglomerate conglomerate, long commit_id, ArrayList visible_tables, ArrayList table_indices)
     Constructs the transaction.

Method Summary
public  voidaddCheckConstraint(TableName table_name, Expression expression, short deferred, String constraint_name)
     Adds a check expression that becomes perminent when the transaction is committed.
public  voidaddForeignKeyConstraint(TableName table, String[] cols, TableName ref_table, String[] ref_cols, String delete_rule, String update_rule, short deferred, String constraint_name)
     Adds a foreign key constraint to the database which becomes perminent when the transaction is committed.
 voidaddInternalTableInfo(InternalTableInfo info)
     Adds an internal table container (InternalTableInfo) used to resolve internal tables.
public  voidaddPrimaryKeyConstraint(TableName table_name, String[] cols, short deferred, String constraint_name)
     Adds a primary key constraint that becomes perminent when the transaction is committed.
public  voidaddSelectedFromTable(TableName table_name)
     Called by the query evaluation layer when information is selected from this table as part of this transaction.
public  voidaddUniqueConstraint(TableName table_name, String[] cols, short deferred, String constraint_name)
     Adds a unique constraint to the database which becomes perminant when the transaction is committed.
public  voidalterCreateTable(DataTableDef table_def, int data_sector_size, int index_sector_size)
     Given a DataTableDef, if the table exists then it is updated otherwise if it doesn't exist then it is created.

This should only be used as very fine grain optimization for creating/ altering tables.

public  voidalterTable(TableName table_name, DataTableDef table_def, int data_sector_size, int index_sector_size)
     Alter the table with the given name to the new definition and give the copied table a new data sector size.
public  voidalterTable(TableName table_name, DataTableDef table_def)
     Alters the table with the given name within this transaction to the specified table definition.
public  voidcheckAllConstraints(TableName table_name)
     Checks all the rows in the table for immediate constraint violations and when the transaction is next committed check for all deferred constraint violations.
public  voidcloseAndCommit()
     Closes and marks a transaction as committed.
public  voidcloseAndRollback()
     Closes and rolls back a transaction as if the commands the transaction ran never happened.
public  voidcompactTable(TableName table_name)
     Compacts the table with the given name within this transaction.
public  voidcopyTable(MasterTableDataSource src_master_table, IndexSet index_set)
     Generates an exact copy of the table within this transaction.
public  MutableTableDataSourcecreateMutableTableDataSourceAtCommit(MasterTableDataSource master)
     Overwritten from SimpleTransaction. Returns a new MutableTableDataSource for the view of the MasterTableDataSource at the start of this transaction.
public  voidcreateSchema(String name, String type)
     Create a new schema in this transaction.
public  voidcreateSequenceGenerator(TableName name, long start_value, long increment_by, long min_value, long max_value, long cache, boolean cycle)
     Creates a new sequence generator with the given TableName and initializes it with the given details.
public  voidcreateTable(DataTableDef table_def, int data_sector_size, int index_sector_size)
     Creates a new table within this transaction with the given sector size.
public  voidcreateTable(DataTableDef table_def)
     Creates a new table within this transaction.
 voiddatabaseObjectCreated(TableName table_name)
     Notifies this transaction that a database object with the given name has successfully been created.
 voiddatabaseObjectDropped(TableName table_name)
     Notifies this transaction that a database object with the given name has successfully been dropped.
 voiddispose()
     Disposes this transaction without rolling back or committing the changes.
public  voiddropAllConstraintsForTable(TableName table_name)
     Drops all the constraints defined for the given table.
public  booleandropCheckConstraintForTable(TableName table, String constraint_name)
     Drops a single named check constraint from the given table.
public  booleandropForeignKeyReferenceConstraintForTable(TableName table, String constraint_name)
     Drops a single named foreign key reference from the given table.
public  intdropNamedConstraint(TableName table_name, String constraint_name)
     Drops the named constraint from the transaction.
public  booleandropPrimaryKeyConstraintForTable(TableName table_name, String constraint_name)
     Drops the primary key constraint for the given table.
public  voiddropSchema(String name)
     Drops a schema from this transaction.
public  voiddropSequenceGenerator(TableName name)
     Drops an existing sequence generator with the given name.
public  voiddropTable(TableName table_name)
     Drops a table within this transaction.
public  booleandropUniqueConstraintForTable(TableName table, String constraint_name)
     Drops a single named unique constraint from the given table.
public  voidfinalize()
     Finalize, we should close the transaction.
 ArrayListgetAllNamesCreated()
     Returns the normalized list of database object names created in this transaction.
 ArrayListgetAllNamesDropped()
     Returns the normalized list of database object names dropped in this transaction.
 longgetCommitID()
     Returns the 'commit_id' which is the last commit that occured before this transaction was created.

NOTE: Don't make this synchronized over anything.

final  TableDataConglomerategetConglomerate()
     Returns the TableDataConglomerate of this transaction.
protected  DataTableDefgetDynamicDataTableDef(TableName table_name)
     Returns the DataTableDef for the given internal table.
protected  MutableTableDataSourcegetDynamicTable(TableName table_name)
     Returns an instance of MutableDataTableSource that represents the contents of the internal table with the given name.
protected  TableName[]getDynamicTableList()
     Returns a list of all dynamic table names.
public  StringgetDynamicTableType(TableName table_name)
     Returns a string type describing the type of the dynamic table.
public  StringgetPersistantVar(String variable)
     Returns the value of the persistent variable with the given name or null if it doesn't exist.
public  SchemaDef[]getSchemaList()
     Returns an array of SchemaDef objects for each schema currently setup in the database.
protected  booleanisDynamicTable(TableName table_name)
     Returns true if the given table name represents a dynamically generated system table.
 voidliveCopyAllDataTo(TableDataConglomerate dest_conglomerate)
     Copies all the tables within this transaction view to the destination conglomerate object.
public static  CheckExpression[]queryTableCheckExpressions(SimpleTransaction transaction, TableName table_name)
     Returns a set of check expressions that are constrained over all new columns added to the given table in this transaction.
public static  ColumnGroupReference[]queryTableForeignKeyReferences(SimpleTransaction transaction, TableName table_name)
     Returns an array of column references in the given table that represent foreign key references.
public static  ColumnGroupReference[]queryTableImportedForeignKeyReferences(SimpleTransaction transaction, TableName ref_table_name)
     Returns an array of column references in the given table that represent foreign key references that reference columns in the given table.
public static  ColumnGroupqueryTablePrimaryKeyGroup(SimpleTransaction transaction, TableName table_name)
     Returns a set of primary key groups that are constrained to be unique for the given table in this transaction (there can be only 1 primary key defined for a table).
public static  ColumnGroup[]queryTableUniqueGroups(SimpleTransaction transaction, TableName table_name)
     Returns a set of unique groups that are constrained to be unique for the given table in this transaction.
public static  TableName[]queryTablesRelationallyLinkedTo(SimpleTransaction transaction, TableName table)
     Returns the list of tables (as a TableName array) that are dependant on the data in the given table to maintain referential consistancy.
public  SchemaDefresolveSchemaCase(String name, boolean ignore_case)
     Resolves the case of the given schema name if the database is performing case insensitive identifier matching.
public  booleanschemaExists(String name)
     Returns true if the schema exists within this transaction.
 voidsetErrorOnDirtySelect(boolean status)
     Sets the transaction error on dirty select for this transaction.
public  voidsetPersistentVar(String variable, String value)
     Sets a persistent variable of the database that becomes a committed change once this transaction is committed.
 booleantransactionErrorOnDirtySelect()
     Returns true if the conglomerate commit procedure should check for dirty selects and produce a transaction error.

Field Detail
CASCADE
final public static String CASCADE(Code)



INITIALLY_DEFERRED
final public static short INITIALLY_DEFERRED(Code)
The type of deferrance.



INITIALLY_IMMEDIATE
final public static short INITIALLY_IMMEDIATE(Code)



NOT_DEFERRABLE
final public static short NOT_DEFERRABLE(Code)



NO_ACTION
final public static String NO_ACTION(Code)
Foreign key referential trigger actions.



SET_DEFAULT
final public static String SET_DEFAULT(Code)



SET_NULL
final public static String SET_NULL(Code)




Constructor Detail
Transaction
Transaction(TableDataConglomerate conglomerate, long commit_id, ArrayList visible_tables, ArrayList table_indices)(Code)
Constructs the transaction.




Method Detail
addCheckConstraint
public void addCheckConstraint(TableName table_name, Expression expression, short deferred, String constraint_name)(Code)
Adds a check expression that becomes perminent when the transaction is committed. A check expression is an expression that must evaluate to true for all records added/updated in the database.

NOTE: Security checks for adding constraints must be checked for at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




addForeignKeyConstraint
public void addForeignKeyConstraint(TableName table, String[] cols, TableName ref_table, String[] ref_cols, String delete_rule, String update_rule, short deferred, String constraint_name)(Code)
Adds a foreign key constraint to the database which becomes perminent when the transaction is committed. A foreign key represents a referential link from one table to another (may be the same table). The 'table_name', 'cols' args represents the object to link from. The 'ref_table', 'ref_cols' args represents the object to link to. The update rules are for specifying cascading delete/update rules. The deferred arg is for IMMEDIATE/DEFERRED checking.

NOTE: Security checks for adding constraints must be checked for at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




addInternalTableInfo
void addInternalTableInfo(InternalTableInfo info)(Code)
Adds an internal table container (InternalTableInfo) used to resolve internal tables. This is intended as a way for the DatabaseConnection layer to plug in 'virtual' tables, such as those showing connection statistics, etc. It also allows modelling database objects as tables, such as sequences, triggers, procedures, etc.



addPrimaryKeyConstraint
public void addPrimaryKeyConstraint(TableName table_name, String[] cols, short deferred, String constraint_name)(Code)
Adds a primary key constraint that becomes perminent when the transaction is committed. A primary key represents a set of columns in a table that are constrained to be unique and can not be null. If the constraint name parameter is 'null' a primary key constraint is created with a unique constraint name.

NOTE: Security checks for adding constraints must be checked for at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




addSelectedFromTable
public void addSelectedFromTable(TableName table_name)(Code)
Called by the query evaluation layer when information is selected from this table as part of this transaction. When there is a select query on a table, when the transaction is committed we should look for any concurrently committed changes to the table. If there are any, then any selects on the table should be considered incorrect and cause a commit failure.



addUniqueConstraint
public void addUniqueConstraint(TableName table_name, String[] cols, short deferred, String constraint_name)(Code)
Adds a unique constraint to the database which becomes perminant when the transaction is committed. Columns in a table that are defined as unique are prevented from being duplicated by the engine.

NOTE: Security checks for adding constraints must be checked for at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




alterCreateTable
public void alterCreateTable(DataTableDef table_def, int data_sector_size, int index_sector_size)(Code)
Given a DataTableDef, if the table exists then it is updated otherwise if it doesn't exist then it is created.

This should only be used as very fine grain optimization for creating/ altering tables. If in the future the underlying table model is changed so that the given 'sector_size' value is unapplicable, then the value will be ignored.




alterTable
public void alterTable(TableName table_name, DataTableDef table_def, int data_sector_size, int index_sector_size)(Code)
Alter the table with the given name to the new definition and give the copied table a new data sector size. If the table does not exist then an exception is thrown.

This copies all columns that were in the original table to the new altered table if the name is the same. Any names that don't exist are set to the default value.

This should only be called under an exclusive lock on the connection.




alterTable
public void alterTable(TableName table_name, DataTableDef table_def)(Code)
Alters the table with the given name within this transaction to the specified table definition. If the table does not exist then an exception is thrown.

This should only be called under an exclusive lock on the connection.




checkAllConstraints
public void checkAllConstraints(TableName table_name)(Code)
Checks all the rows in the table for immediate constraint violations and when the transaction is next committed check for all deferred constraint violations. This method is used when the constraints on a table changes and we need to determine if any constraint violations occurred. To the constraint checking system, this is like adding all the rows to the given table.



closeAndCommit
public void closeAndCommit() throws TransactionException(Code)
Closes and marks a transaction as committed. Any changes made by this transaction are seen by all transactions created after this method returns.

This method will fail under the following circumstances:

  1. There are any rows deleted in this transaction that were deleted by another successfully committed transaction.
  2. There were rows added in another committed transaction that would change the result of the search clauses committed by this transaction.
The first check is not too difficult to check for. The second is very difficult however we need it to ensure TRANSACTION_SERIALIZABLE isolation is enforced. We may have to simplify this by throwing a transaction exception if the table has had any changes made to it during this transaction.

This should only be called under an exclusive lock on the connection.




closeAndRollback
public void closeAndRollback()(Code)
Closes and rolls back a transaction as if the commands the transaction ran never happened. This will not throw a transaction exception.

This should only be called under an exclusive lock on the connection.




compactTable
public void compactTable(TableName table_name)(Code)
Compacts the table with the given name within this transaction. If the table doesn't exist then an exception is thrown.



copyTable
public void copyTable(MasterTableDataSource src_master_table, IndexSet index_set)(Code)
Generates an exact copy of the table within this transaction. It is recommended that the table is dropped before the copy is made. The purpose of this method is to generate a temporary table that can be modified without fear of another transaction changing the contents in another transaction. This also provides a convenient way to compact a table because any spare space is removed when the table is copied. It also allows us to make a copy of MasterTableDataSource into a foreign conglomerate which allows us to implement a backup procedure.

This method does NOT assume the given MasterTableDataSource is contained, or has once been contained within this conglomerate.




createMutableTableDataSourceAtCommit
public MutableTableDataSource createMutableTableDataSourceAtCommit(MasterTableDataSource master)(Code)
Overwritten from SimpleTransaction. Returns a new MutableTableDataSource for the view of the MasterTableDataSource at the start of this transaction. Note that this is only ever called once per table accessed in this transaction.



createSchema
public void createSchema(String name, String type)(Code)
Create a new schema in this transaction. When the transaction is committed the schema will become globally accessable. Note that any security checks must be performed before this method is called.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




createSequenceGenerator
public void createSequenceGenerator(TableName name, long start_value, long increment_by, long min_value, long max_value, long cache, boolean cycle)(Code)
Creates a new sequence generator with the given TableName and initializes it with the given details. This does NOT check if the given name clashes with an existing database object.



createTable
public void createTable(DataTableDef table_def, int data_sector_size, int index_sector_size)(Code)
Creates a new table within this transaction with the given sector size. If the table already exists then an exception is thrown.

This should only be called under an exclusive lock on the connection.




createTable
public void createTable(DataTableDef table_def)(Code)
Creates a new table within this transaction. If the table already exists then an exception is thrown.

This should only be called under an exclusive lock on the connection.




databaseObjectCreated
void databaseObjectCreated(TableName table_name)(Code)
Notifies this transaction that a database object with the given name has successfully been created.



databaseObjectDropped
void databaseObjectDropped(TableName table_name)(Code)
Notifies this transaction that a database object with the given name has successfully been dropped.



dispose
void dispose()(Code)
Disposes this transaction without rolling back or committing the changes. Care should be taken when using this - it must only be used for simple transactions that are short lived and have not modified the database.



dropAllConstraintsForTable
public void dropAllConstraintsForTable(TableName table_name)(Code)
Drops all the constraints defined for the given table. This is a useful function when dropping a table from the database.

NOTE: Security checks that the user can drop constraints must be checke at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




dropCheckConstraintForTable
public boolean dropCheckConstraintForTable(TableName table, String constraint_name)(Code)
Drops a single named check constraint from the given table. Returns true if the check constraint was dropped (the constraint existed).

NOTE: Security checks that the user can drop constraints must be checke at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




dropForeignKeyReferenceConstraintForTable
public boolean dropForeignKeyReferenceConstraintForTable(TableName table, String constraint_name)(Code)
Drops a single named foreign key reference from the given table. Returns true if the foreign key reference constraint was dropped (the constraint existed).

NOTE: Security checks that the user can drop constraints must be checke at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




dropNamedConstraint
public int dropNamedConstraint(TableName table_name, String constraint_name)(Code)
Drops the named constraint from the transaction. Used when altering table schema. Returns the number of constraints that were removed from the system. If this method returns 0 then it indicates there is no constraint with the given name in the table.

NOTE: Security checks that the user can drop constraints must be checke at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




dropPrimaryKeyConstraintForTable
public boolean dropPrimaryKeyConstraintForTable(TableName table_name, String constraint_name)(Code)
Drops the primary key constraint for the given table. Used when altering table schema. If 'constraint_name' is null this method will search for the primary key of the table name. Returns true if the primary key constraint was dropped (the constraint existed).

NOTE: Security checks that the user can drop constraints must be checke at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




dropSchema
public void dropSchema(String name)(Code)
Drops a schema from this transaction. When the transaction is committed the schema will be dropped perminently. Note that any security checks must be performed before this method is called.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




dropSequenceGenerator
public void dropSequenceGenerator(TableName name)(Code)
Drops an existing sequence generator with the given name.



dropTable
public void dropTable(TableName table_name)(Code)
Drops a table within this transaction. If the table does not exist then an exception is thrown.

This should only be called under an exclusive lock on the connection.




dropUniqueConstraintForTable
public boolean dropUniqueConstraintForTable(TableName table, String constraint_name)(Code)
Drops a single named unique constraint from the given table. Returns true if the unique constraint was dropped (the constraint existed).

NOTE: Security checks that the user can drop constraints must be checke at a higher layer.

NOTE: We must guarentee that the transaction be in exclusive mode before this method is called.




finalize
public void finalize() throws Throwable(Code)
Finalize, we should close the transaction.



getAllNamesCreated
ArrayList getAllNamesCreated()(Code)
Returns the normalized list of database object names created in this transaction.



getAllNamesDropped
ArrayList getAllNamesDropped()(Code)
Returns the normalized list of database object names dropped in this transaction.



getCommitID
long getCommitID()(Code)
Returns the 'commit_id' which is the last commit that occured before this transaction was created.

NOTE: Don't make this synchronized over anything. This is accessed by OpenTransactionList.




getConglomerate
final TableDataConglomerate getConglomerate()(Code)
Returns the TableDataConglomerate of this transaction.



getDynamicDataTableDef
protected DataTableDef getDynamicDataTableDef(TableName table_name)(Code)
Returns the DataTableDef for the given internal table.



getDynamicTable
protected MutableTableDataSource getDynamicTable(TableName table_name)(Code)
Returns an instance of MutableDataTableSource that represents the contents of the internal table with the given name.



getDynamicTableList
protected TableName[] getDynamicTableList()(Code)
Returns a list of all dynamic table names. This method returns a reference to a static, make sure you don't change the contents of the array!



getDynamicTableType
public String getDynamicTableType(TableName table_name)(Code)
Returns a string type describing the type of the dynamic table.



getPersistantVar
public String getPersistantVar(String variable)(Code)
Returns the value of the persistent variable with the given name or null if it doesn't exist.



getSchemaList
public SchemaDef[] getSchemaList()(Code)
Returns an array of SchemaDef objects for each schema currently setup in the database.



isDynamicTable
protected boolean isDynamicTable(TableName table_name)(Code)
Returns true if the given table name represents a dynamically generated system table.



liveCopyAllDataTo
void liveCopyAllDataTo(TableDataConglomerate dest_conglomerate)(Code)
Copies all the tables within this transaction view to the destination conglomerate object. Some care should be taken with security when using this method. This is useful for generating a backup of the current view of the database that can work without interfering with the general operation of the database.



queryTableCheckExpressions
public static CheckExpression[] queryTableCheckExpressions(SimpleTransaction transaction, TableName table_name)(Code)
Returns a set of check expressions that are constrained over all new columns added to the given table in this transaction. For example, we may want a column called 'serial_number' to be constrained as CHECK serial_number LIKE '___-________-___'.



queryTableForeignKeyReferences
public static ColumnGroupReference[] queryTableForeignKeyReferences(SimpleTransaction transaction, TableName table_name)(Code)
Returns an array of column references in the given table that represent foreign key references. For example, say a foreign reference has been set up in the given table as follows;

 FOREIGN KEY (customer_id) REFERENCES Customer (id)
 

This method will return the column group reference Order(customer_id) -> Customer(id).

This method is used to check that a foreign key reference actually points to a valid record in the referenced table as expected.




queryTableImportedForeignKeyReferences
public static ColumnGroupReference[] queryTableImportedForeignKeyReferences(SimpleTransaction transaction, TableName ref_table_name)(Code)
Returns an array of column references in the given table that represent foreign key references that reference columns in the given table. This is a reverse mapping of the 'queryTableForeignKeyReferences' method. For example, say a foreign reference has been set up in any table as follows;

 [ In table Order ]
 FOREIGN KEY (customer_id) REFERENCE Customer (id)
 

And the table name we are querying is 'Customer' then this method will return the column group reference Order(customer_id) -> Customer(id).

This method is used to check that a reference isn't broken when we remove a record (for example, removing a Customer that has references to it will break integrity).




queryTablePrimaryKeyGroup
public static ColumnGroup queryTablePrimaryKeyGroup(SimpleTransaction transaction, TableName table_name)(Code)
Returns a set of primary key groups that are constrained to be unique for the given table in this transaction (there can be only 1 primary key defined for a table). Returns null if there is no primary key defined for the table.



queryTableUniqueGroups
public static ColumnGroup[] queryTableUniqueGroups(SimpleTransaction transaction, TableName table_name)(Code)
Returns a set of unique groups that are constrained to be unique for the given table in this transaction. For example, if columns ('name') and ('number', 'document_rev') are defined as unique, this will return an array of two groups that represent unique columns in the given table.



queryTablesRelationallyLinkedTo
public static TableName[] queryTablesRelationallyLinkedTo(SimpleTransaction transaction, TableName table)(Code)
Returns the list of tables (as a TableName array) that are dependant on the data in the given table to maintain referential consistancy. The list includes the tables referenced as foreign keys, and the tables that reference the table as a foreign key.

This is a useful query for determining ahead of time the tables that require a read lock when inserting/updating a table. A table will require a read lock if the operation needs to query it for potential referential integrity violations.




resolveSchemaCase
public SchemaDef resolveSchemaCase(String name, boolean ignore_case)(Code)
Resolves the case of the given schema name if the database is performing case insensitive identifier matching. Returns a SchemaDef object that identifiers the schema. Returns null if the schema name could not be resolved.



schemaExists
public boolean schemaExists(String name)(Code)
Returns true if the schema exists within this transaction.



setErrorOnDirtySelect
void setErrorOnDirtySelect(boolean status)(Code)
Sets the transaction error on dirty select for this transaction.



setPersistentVar
public void setPersistentVar(String variable, String value)(Code)
Sets a persistent variable of the database that becomes a committed change once this transaction is committed. The variable can later be retrieved with a call to the 'getPersistantVar' method. A persistant var is created if it doesn't exist in the DatabaseVars table otherwise it is overwritten.



transactionErrorOnDirtySelect
boolean transactionErrorOnDirtySelect()(Code)
Returns true if the conglomerate commit procedure should check for dirty selects and produce a transaction error. A dirty select is when a query reads information from a table that is effected by another table during a transaction. This in itself will not cause data consistancy problems but for strict conformance to SERIALIZABLE isolation level this should return true.

NOTE; We MUST NOT make this method serialized because it is back called from within a commit lock in TableDataConglomerate.




Methods inherited from com.mckoi.database.SimpleTransaction
final public DebugLogger Debug()(Code)(Java Doc)
void addVisibleTable(MasterTableDataSource table, IndexSet index_set)(Code)(Java Doc)
abstract MutableTableDataSource createMutableTableDataSourceAtCommit(MasterTableDataSource master)(Code)(Java Doc)
public long currentUniqueID(TableName table_name)(Code)(Java Doc)
protected void disposeAllIndices()(Code)(Java Doc)
protected MasterTableDataSource findVisibleTable(TableName table_name, boolean ignore_case)(Code)(Java Doc)
void flushSequenceManager(TableName name)(Code)(Java Doc)
protected void flushTableCache(TableName table_name)(Code)(Java Doc)
public DataTableDef getDataTableDef(TableName table_name)(Code)(Java Doc)
protected DataTableDef getDynamicDataTableDef(TableName table_name)(Code)(Java Doc)
protected MutableTableDataSource getDynamicTable(TableName table_name)(Code)(Java Doc)
protected TableName[] getDynamicTableList()(Code)(Java Doc)
protected String getDynamicTableType(TableName table_name)(Code)(Java Doc)
final IndexSet getIndexSetForTable(MasterTableDataSource table)(Code)(Java Doc)
final public TransactionSystem getSystem()(Code)(Java Doc)
public MutableTableDataSource getTable(TableName table_name)(Code)(Java Doc)
public TableDataSource getTableDataSource(TableName table_name)(Code)(Java Doc)
public TableName[] getTableList()(Code)(Java Doc)
public String getTableType(TableName table_name)(Code)(Java Doc)
protected MasterTableDataSource getVisibleTable(int n)(Code)(Java Doc)
protected int getVisibleTableCount()(Code)(Java Doc)
final protected ArrayList getVisibleTables()(Code)(Java Doc)
protected boolean isDynamicTable(TableName table_name)(Code)(Java Doc)
public boolean isReadOnly()(Code)(Java Doc)
public long lastSequenceValue(TableName name)(Code)(Java Doc)
public long nextSequenceValue(TableName name)(Code)(Java Doc)
public long nextUniqueID(TableName table_name)(Code)(Java Doc)
final boolean realTableExists(TableName table_name)(Code)(Java Doc)
void removeVisibleTable(MasterTableDataSource table)(Code)(Java Doc)
public TableName resolveToTableName(String current_schema, String name, boolean case_insensitive)(Code)(Java Doc)
final protected void setIndexSetForTable(MasterTableDataSource table, IndexSet index_set)(Code)(Java Doc)
public void setReadOnly()(Code)(Java Doc)
public void setSequenceValue(TableName name, long value)(Code)(Java Doc)
public void setUniqueID(TableName table_name, long unique_id)(Code)(Java Doc)
public boolean tableExists(TableName table_name)(Code)(Java Doc)
public TableName tryResolveCase(TableName table_name)(Code)(Java Doc)
void updateVisibleTable(MasterTableDataSource table, IndexSet index_set)(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.