Source Code Cross Referenced for LanguageConnectionContext.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » sql » conn » 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 » db derby 10.2 » org.apache.derby.iapi.sql.conn 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:
0003:           Derby - Class org.apache.derby.iapi.sql.conn.LanguageConnectionContext
0004:
0005:           Licensed to the Apache Software Foundation (ASF) under one or more
0006:           contributor license agreements.  See the NOTICE file distributed with
0007:           this work for additional information regarding copyright ownership.
0008:           The ASF licenses this file to you under the Apache License, Version 2.0
0009:           (the "License"); you may not use this file except in compliance with
0010:           the License.  You may obtain a copy of the License at
0011:
0012:              http://www.apache.org/licenses/LICENSE-2.0
0013:
0014:           Unless required by applicable law or agreed to in writing, software
0015:           distributed under the License is distributed on an "AS IS" BASIS,
0016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0017:           See the License for the specific language governing permissions and
0018:           limitations under the License.
0019:
0020:         */
0021:
0022:        package org.apache.derby.iapi.sql.conn;
0023:
0024:        import org.apache.derby.iapi.services.context.Context;
0025:        import org.apache.derby.iapi.services.context.ContextManager;
0026:        import org.apache.derby.iapi.db.Database;
0027:        import org.apache.derby.iapi.error.StandardException;
0028:        import org.apache.derby.iapi.sql.compile.CompilerContext;
0029:        import org.apache.derby.iapi.sql.dictionary.DataDictionary;
0030:        import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
0031:        import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
0032:        import org.apache.derby.iapi.sql.compile.OptimizerFactory;
0033:        import org.apache.derby.iapi.types.DataValueFactory;
0034:
0035:        import org.apache.derby.iapi.sql.depend.Provider;
0036:        import org.apache.derby.iapi.sql.execute.ConstantAction;
0037:        import org.apache.derby.iapi.sql.execute.CursorActivation;
0038:        import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;
0039:        import org.apache.derby.iapi.sql.execute.ExecutionContext;
0040:        import org.apache.derby.iapi.sql.execute.ExecutionStmtValidator;
0041:        import org.apache.derby.iapi.sql.Activation;
0042:        import org.apache.derby.iapi.sql.LanguageFactory;
0043:        import org.apache.derby.iapi.sql.PreparedStatement;
0044:        import org.apache.derby.iapi.sql.ResultSet;
0045:        import org.apache.derby.iapi.sql.ParameterValueSet;
0046:
0047:        import org.apache.derby.iapi.store.access.TransactionController;
0048:        import org.apache.derby.iapi.store.access.AccessFactory;
0049:        import org.apache.derby.iapi.db.TriggerExecutionContext;
0050:        import org.apache.derby.iapi.services.i18n.LocaleFinder;
0051:        import org.apache.derby.iapi.sql.execute.RunTimeStatistics;
0052:        import org.apache.derby.catalog.UUID;
0053:
0054:        import java.util.Locale;
0055:        import java.util.Hashtable;
0056:        import java.util.Vector;
0057:
0058:        /**
0059:         * LanguageConnectionContext keeps the result sets,
0060:         * and activations in use by the current connection.
0061:         * <p>
0062:         * More stable items, like other factories, are accessible through
0063:         * the LanguageConnectionFactory or the LanguageFactory.
0064:         *
0065:         * @see LanguageConnectionFactory
0066:         * @see org.apache.derby.iapi.sql.LanguageFactory
0067:         */
0068:        public interface LanguageConnectionContext extends Context {
0069:
0070:            /**
0071:             * this is the ID we expect these contexts
0072:             * to be stored into a context manager under.
0073:             */
0074:            public static final String CONTEXT_ID = org.apache.derby.iapi.reference.ContextId.LANG_CONNECTION;
0075:
0076:            public static final int OUTERMOST_STATEMENT = 1;
0077:
0078:            // Constants describing how this connection handles schemas
0079:            public static final int SQL92_SCHEMAS = 0;
0080:            public static final int USER_NAME_SCHEMA = 1; // User names are schema names.
0081:            public static final int NO_SCHEMAS = 2; // Schemas not implemented.
0082:
0083:            /* String for logStatementText output */
0084:            public static final String xidStr = "(XID = ";
0085:            public static final String lccStr = "(SESSIONID = ";
0086:            public static final String dbnameStr = "(DATABASE = ";
0087:            public static final String drdaStr = "(DRDAID = ";
0088:
0089:            // Lock Management
0090:
0091:            public static final int SINGLE_TRANSACTION_LOCK = 1;
0092:            public static final int MULTI_TRANSACTION_LOCK = 2;
0093:
0094:            // controls casing of NON-delimited identifiers. ANSI casing forces all
0095:            // non-delimited identifiers to be lower case.
0096:
0097:            public static final int UNKNOWN_CASING = -1;
0098:            public static final int ANSI_CASING = 0;
0099:            public static final int ANTI_ANSI_CASING = 1;
0100:
0101:            /**
0102:             * Initialize. For use after pushing the contexts that initialization needs.
0103:             *
0104:             * @param sqlConnection	Whether or not this is called from a sql connection.
0105:             *
0106:             * @exception StandardException thrown if something goes wrong
0107:             */
0108:            void initialize(boolean sqlConnection) throws StandardException;
0109:
0110:            /**
0111:             * Get value of logStatementText.
0112:             * (Whether or not to write info on currently
0113:             * executing statement to error log.)
0114:             *
0115:             * @return value of logStatementText
0116:             */
0117:            public boolean getLogStatementText();
0118:
0119:            /**
0120:             * Set value of logStatementText
0121:             * (Whether or not to write info on currently
0122:             * executing statement to error log.)
0123:             *
0124:             * @param logStatementText	Whether or not logStatementText property is set.
0125:             */
0126:            public void setLogStatementText(boolean logStatementText);
0127:
0128:            /**
0129:             * Get value of logQueryPlan.
0130:             * (Whether or not to write query plan info on currently
0131:             * executing statement to error log.)
0132:             *
0133:             * @return value of logQueryPlan
0134:             */
0135:            public boolean getLogQueryPlan();
0136:
0137:            /**
0138:             * get the lock escalation threshold to use with this connection.
0139:             */
0140:            int getLockEscalationThreshold();
0141:
0142:            /**
0143:             * Add the activation to those known about by this connection.
0144:             *
0145:             */
0146:            void addActivation(Activation a) throws StandardException;
0147:
0148:            /**
0149:             * Make a note that some activations are marked unused
0150:             */
0151:            void notifyUnusedActivation();
0152:
0153:            /**
0154:             * Remove the activation from those known about by this connection.
0155:             *
0156:             * @exception StandardException thrown if something goes wrong
0157:             */
0158:            void removeActivation(Activation a) throws StandardException;
0159:
0160:            /**
0161:             * Return the number of activation known for this connection.
0162:             *
0163:             */
0164:            int getActivationCount();
0165:
0166:            /**
0167:             * See if a given cursor is available for use.  This is used
0168:             * to locate the cursor during its execution.
0169:             *
0170:             * @return the activation for the given cursor, null if none exists.
0171:             */
0172:            CursorActivation lookupCursorActivation(String cursorName);
0173:
0174:            /**
0175:             * Return the last activation added
0176:             * This is used to find the drop activation in dropViewCascade
0177:             * so we can add warning messages to the activation
0178:             *
0179:             */
0180:            public Activation getLastActivation();
0181:
0182:            /**
0183:            	Get a connection unique system generated name for a cursor.
0184:             */
0185:            public String getUniqueCursorName();
0186:
0187:            /**
0188:            	Get a connection unique system generated name for an unnamed savepoint.
0189:             */
0190:            public String getUniqueSavepointName();
0191:
0192:            /**
0193:            	Get a connection unique system generated id for an unnamed savepoint.
0194:             */
0195:            public int getUniqueSavepointID();
0196:
0197:            /**
0198:             * Check if there are any global temporary tables declared for this connection.
0199:             * @return true if there are declared temp tables for this connectoin else false
0200:             *
0201:             */
0202:            public boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection();
0203:
0204:            /**
0205:             * Mark the passed temporary table as modified in the current unit of work. That information will be used at rollback time
0206:             * The compile phase will generate code to call this method if the DML is on a temporary table
0207:             *
0208:             * @param tableName Mark the passed temporary table name as modified
0209:             */
0210:            public void markTempTableAsModifiedInUnitOfWork(String tableName);
0211:
0212:            /**
0213:             * Add the declared global temporary table to the list of temporary tables known by this connection.
0214:             * @param td Corresponding to the temporary table
0215:             *
0216:             */
0217:            public void addDeclaredGlobalTempTable(TableDescriptor td)
0218:                    throws StandardException;
0219:
0220:            /**
0221:             * Drop (mark the declared global temporary table for dropping) from the list of temporary tables known by this connection.
0222:             * @param tableName look for this table name in the saved list and drop it if found
0223:             * @return true if dropped the temporary table. False if no such temporary table exists.
0224:             *
0225:             * @see org.apache.derby.impl.sql.conn.TempTableInfo
0226:             */
0227:            public boolean dropDeclaredGlobalTempTable(String tableName);
0228:
0229:            /**
0230:             * Get table descriptor for the declared global temporary table from the list of temporary
0231:             * tables known by this connection.
0232:             * @param tableName Get table descriptor for the passed table name
0233:             * @return TableDescriptor if found the temporary table. Else return null
0234:             *
0235:             */
0236:            public TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(
0237:                    String tableName);
0238:
0239:            /**
0240:            	Reset the connection before it is returned (indirectly) by
0241:            	a PooledConnection object. See EmbeddedConnection.
0242:             */
0243:            public void resetFromPool() throws StandardException;
0244:
0245:            /**
0246:            	Do a commit, as internally needed by Cloudscape.  E.g.
0247:             	a commit for sync, or a commit for autocommit.  Skips
0248:            	checks that a user isn't doing something bad like issuing
0249:            	a commit in a nested xact.
0250:
0251:            	@param	commitStore	true if we should commit the Store transaction
0252:
0253:            	@exception StandardException thrown if something goes wrong
0254:             */
0255:            void internalCommit(boolean commitStore) throws StandardException;
0256:
0257:            /**
0258:            	Similar to internalCommit() but has logic for an unsynchronized commit
0259:
0260:            	@param	commitflag	the flags to pass to commitNoSync in the store's
0261:            						TransactionController
0262:
0263:            	@exception StandardException	thrown if something goes wrong
0264:             */
0265:            void internalCommitNoSync(int commitflag) throws StandardException;
0266:
0267:            /**
0268:            	Do a commit, as issued directly by a user (e.g. via Connection.commit()
0269:            	or the JSQL 'COMMIT' statement.
0270:
0271:            	@exception StandardException thrown if something goes wrong
0272:             */
0273:            void userCommit() throws StandardException;
0274:
0275:            /**
0276:            	Commit a distrubuted transaction.
0277:
0278:            	@param onePhase if true, allow it to commit without first going thru a
0279:            	prepared state.
0280:
0281:            	@exception StandardException	thrown if something goes wrong
0282:             */
0283:            void xaCommit(boolean onePhase) throws StandardException;
0284:
0285:            /**
0286:            	Do a rollback, as internally needed by Cloudscape.  E.g.
0287:             	a rollback for sync, or a rollback for an internal error.  Skips
0288:            	checks that a user isn't doing something bad like issuing
0289:            	a rollback in a nested xact.
0290:
0291:            	@exception StandardException thrown if something goes wrong
0292:             */
0293:            void internalRollback() throws StandardException;
0294:
0295:            /**
0296:            	Do a rollback, as issued directly by a user (e.g. via Connection.rollback()
0297:            	or the JSQL 'ROLLBACK' statement.
0298:
0299:            	@exception StandardException thrown if something goes wrong
0300:             */
0301:            void userRollback() throws StandardException;
0302:
0303:            /**
0304:             * Let the context deal with a rollback to savepoint
0305:             *
0306:             * @param	savepointName	Name of the savepoint that needs to be rolled back
0307:             * @param	refreshStyle	boolean indicating whether or not the controller should close
0308:             * open conglomerates and scans. Also used to determine if language should close
0309:             * open activations.
0310:             * @param	kindOfSavepoint	 A NULL value means it is an internal savepoint (ie not a user defined savepoint)
0311:             * Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint
0312:             *   A String value for kindOfSavepoint would mean it is SQL savepoint
0313:             *   A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint
0314:             *
0315:             * @exception StandardException thrown if something goes wrong
0316:             */
0317:            void internalRollbackToSavepoint(String savepointName,
0318:                    boolean refreshStyle, Object kindOfSavepoint)
0319:                    throws StandardException;
0320:
0321:            /**
0322:             * Let the context deal with a release of a savepoint
0323:             *
0324:             * @param	savepointName	Name of the savepoint that needs to be released
0325:             * @param	kindOfSavepoint	 A NULL value means it is an internal savepoint (ie not a user defined savepoint)
0326:             * Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint
0327:             *   A String value for kindOfSavepoint would mean it is SQL savepoint
0328:             *   A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint
0329:             *
0330:             * @exception StandardException thrown if something goes wrong
0331:             */
0332:            void releaseSavePoint(String savepointName, Object kindOfSavepoint)
0333:                    throws StandardException;
0334:
0335:            /**
0336:            	Roll back a distrubuted transaction.
0337:
0338:            	@exception StandardException	thrown if something goes wrong
0339:             */
0340:            void xaRollback() throws StandardException;
0341:
0342:            /**
0343:              Sets a savepoint. Causes the Store to set a savepoint.
0344:
0345:              @param	savepointName	name of savepoint
0346:              @param	kindOfSavepoint	 A NULL value means it is an internal savepoint (ie not a user defined savepoint)
0347:              Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint
0348:              A String value for kindOfSavepoint would mean it is SQL savepoint
0349:              A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint
0350:
0351:            	@exception StandardException thrown if something goes wrong
0352:             */
0353:            void languageSetSavePoint(String savepointName,
0354:                    Object kindOfSavepoint) throws StandardException;
0355:
0356:            /**
0357:            	Returns true if any transaction is blocked (even if not by this one)
0358:
0359:             */
0360:            boolean anyoneBlocked();
0361:
0362:            /**
0363:            	Sets the transaction controller to use with this language connection
0364:            	context.
0365:
0366:            	@param	tran	the transaction to use with this language connection context
0367:             */
0368:            void setTransaction(TransactionController tran);
0369:
0370:            /**
0371:             * Begin a nested transaction.
0372:             *
0373:             * @param readOnly The nested transaction would be read only if param value true
0374:             *
0375:             * @exception StandardException on error.
0376:             * @see TransactionController#startNestedUserTransaction
0377:             */
0378:
0379:            void beginNestedTransaction(boolean readOnly)
0380:                    throws StandardException;
0381:
0382:            /**
0383:             * commit a nested transaction.
0384:             * We do not provide a abortNestedTransaction. 
0385:             * If a nested xaction is aborted, then this results in the parent xaction
0386:             * also being aborted. This is not what we need for releasing
0387:             * compile time locks or autoincrement-- hence we do not provide 
0388:             * abortNestedTransaction. 
0389:             *
0390:             * @exception StandardException thrown on erro
0391:             *
0392:             * @see TransactionController#startNestedUserTransaction
0393:             */
0394:            void commitNestedTransaction() throws StandardException;
0395:
0396:            /**
0397:            	Get the transaction controller to use with this language connection
0398:            	context at compile time.
0399:             */
0400:            TransactionController getTransactionCompile();
0401:
0402:            /**
0403:            	Get the transaction controller to use with this language connection
0404:            	context during execute time.
0405:             */
0406:
0407:            TransactionController getTransactionExecute();
0408:
0409:            /**
0410:             * Get the system schema name.
0411:             *
0412:             * @return a String containing the system schema name.
0413:             */
0414:            public String getSystemSchemaName() throws StandardException;
0415:
0416:            /**
0417:             * Get the SYSIBM schema name.
0418:             *
0419:             * @return a String containing the SYSIBM schema name.
0420:             */
0421:            public String getSysIBMSchemaName() throws StandardException;
0422:
0423:            /**
0424:             * Get the SYSCS_DIAG schema name.
0425:             *
0426:             * @return a String containing the SYSIBM schema name.
0427:             */
0428:            public String getSystemDiagSchemaName() throws StandardException;
0429:
0430:            /**
0431:             * Get the SYSCS_UTIL schema name.
0432:             *
0433:             * @return a String containing the SYSIBM schema name.
0434:             */
0435:            public String getSystemUtilSchemaName() throws StandardException;
0436:
0437:            /**
0438:            	Get the data dictionary 
0439:
0440:            	@return the data dictionary
0441:
0442:             */
0443:            public DataDictionary getDataDictionary();
0444:
0445:            /**
0446:            	Get the data value factory to use with this language connection
0447:            	context.
0448:             */
0449:            DataValueFactory getDataValueFactory();
0450:
0451:            /**
0452:            	Get the language factory to use with this language connection
0453:            	context.
0454:             */
0455:            LanguageFactory getLanguageFactory();
0456:
0457:            /**
0458:             * get the optimizer factory to use with this language connection context.
0459:             */
0460:            OptimizerFactory getOptimizerFactory();
0461:
0462:            /**
0463:            	Get the language connection factory to use with this language connection
0464:            	context.
0465:             */
0466:            LanguageConnectionFactory getLanguageConnectionFactory();
0467:
0468:            /**
0469:             *	Get the Authorization Id
0470:             *
0471:             * @return String	the authorization id
0472:             */
0473:            public String getAuthorizationId();
0474:
0475:            /**
0476:             * Get the declared global temporary tables schema name.
0477:             *
0478:             * @return a String containing the declared global temporary tables schema name.
0479:             */
0480:            public String getDeclaredGlobalTemporaryTablesSchemaName()
0481:                    throws StandardException;
0482:
0483:            /**
0484:             *	Get the current default schema
0485:             *
0486:             * @return SchemaDescriptor	the current schema
0487:             */
0488:            public SchemaDescriptor getDefaultSchema();
0489:
0490:            /**
0491:             *	Set the current default schema
0492:             *
0493:             * @param sd the new default schema
0494:             *
0495:             * @exception StandardException thrown on failure
0496:             */
0497:            public void setDefaultSchema(SchemaDescriptor sd)
0498:                    throws StandardException;
0499:
0500:            /**
0501:             *	Get the current schema name
0502:             *
0503:             * @return SchemaDescriptor	the current schema
0504:             */
0505:            public String getCurrentSchemaName();
0506:
0507:            /**
0508:             * Get the identity column value most recently generated.
0509:             *
0510:             * @return the generated identity column value
0511:             */
0512:            public Long getIdentityValue();
0513:
0514:            /**
0515:             * Set the field of most recently generated identity column value.
0516:             *
0517:             * @param val the generated identity column value
0518:             */
0519:            public void setIdentityValue(long val);
0520:
0521:            /**
0522:             * Verify that there are no activations with open result sets
0523:             * on the specified prepared statement.
0524:             *
0525:             * @param pStmt		The prepared Statement
0526:             * @param provider	The object precipitating a possible invalidation
0527:             * @param action	The action causing the possible invalidation
0528:             *
0529:             * @return Nothing.
0530:             *
0531:             * @exception StandardException thrown on failure
0532:             */
0533:            boolean verifyNoOpenResultSets(PreparedStatement pStmt,
0534:                    Provider provider, int action) throws StandardException;
0535:
0536:            /**
0537:             * Verify that there are no activations with open held result sets.
0538:             *
0539:             * @return boolean  Found no open resultsets.
0540:             *
0541:             * @exception StandardException thrown on failure
0542:             */
0543:            public boolean verifyAllHeldResultSetsAreClosed()
0544:                    throws StandardException;
0545:
0546:            /**
0547:             * Push a CompilerContext on the context stack with
0548:             * the current default schema as the default schema
0549:             * which we compile against.
0550:             *
0551:             * @return the compiler context
0552:             *
0553:             * @exception StandardException thrown on failure
0554:             */
0555:            public CompilerContext pushCompilerContext();
0556:
0557:            /**
0558:             * Push a CompilerContext on the context stack with
0559:             * the passed in default schema as the default schema
0560:             * we compile against.
0561:             *
0562:             * @param sd the default schema 
0563:             *
0564:             * @return the compiler context
0565:             *
0566:             * @exception StandardException thrown on failure
0567:             */
0568:            public CompilerContext pushCompilerContext(SchemaDescriptor sd);
0569:
0570:            /**
0571:             * Pop a CompilerContext off the context stack.
0572:             *
0573:             * @param compilerContext  The compiler context.
0574:             *
0575:             * @exception StandardException thrown on failure
0576:             */
0577:            public void popCompilerContext(CompilerContext compilerContext);
0578:
0579:            /**
0580:             * Push a StatementContext on the context stack.
0581:             *
0582:             * @param isAtomic whether a commit/rollback is permitted
0583:             *	from a nested connection under this statement
0584:             *
0585:             * @param stmtText the text of the statement.  Needed for any language
0586:             * 	statement (currently, for any statement that can cause a trigger
0587:             * 	to fire).  Please set this unless you are some funky jdbc setXXX
0588:             *	method or something.
0589:             *
0590:             * @param pvs parameter value set, if it has one
0591:             *
0592:             * @param rollbackParentContext True if 1) the statement context is
0593:             * 	NOT a top-level context, AND 2) in the event of a statement-level
0594:             *	exception, the parent context needs to be rolled back, too.
0595:             *
0596:             * @param timeoutMillis Timeout value for this statement, in milliseconds.
0597:             *  Zero means no timeout.
0598:             *
0599:             * @return StatementContext	The statement context.
0600:             *
0601:             */
0602:            StatementContext pushStatementContext(boolean isAtomic,
0603:                    boolean isForReadOnly, String stmtText,
0604:                    ParameterValueSet pvs, boolean rollbackParentContext,
0605:                    long timeoutMillis);
0606:
0607:            /**
0608:             * Pop a StatementContext of the context stack.
0609:             *
0610:             * @param statementContext  The statement context.
0611:             * @param error				The error, if any  (Only relevant for DEBUG)
0612:             */
0613:            public void popStatementContext(StatementContext statementContext,
0614:                    Throwable error);
0615:
0616:            /**
0617:             * Push a new execution statement validator.  An execution statement 
0618:             * validator is an object that validates the current statement to
0619:             * ensure that it is permitted given the current execution context.
0620:             * An example of a validator a trigger ExecutionStmtValidator that
0621:             * doesn't allow ddl on the trigger target table.
0622:             * <p>
0623:             * Multiple ExecutionStmtValidators may be active at any given time.
0624:             * This mirrors the way there can be multiple connection nestings
0625:             * at a single time.  The validation is performed by calling each
0626:             * validator's validateStatement() method.  This yields the union
0627:             * of all validations.
0628:             *
0629:             * @param validator the validator to add
0630:             */
0631:            public void pushExecutionStmtValidator(
0632:                    ExecutionStmtValidator validator);
0633:
0634:            /**
0635:             * Remove the validator.  Does an object identity (validator == validator)
0636:             * comparison.  Asserts that the validator is found.
0637:             *
0638:             * @param validator the validator to remove
0639:             *
0640:             * @exception StandardException on error
0641:             */
0642:            public void popExecutionStmtValidator(
0643:                    ExecutionStmtValidator validator) throws StandardException;
0644:
0645:            /**
0646:             * Validate a statement.  Does so by stepping through all the validators
0647:             * and executing them.  If a validator throws and exception, then the
0648:             * checking is stopped and the exception is passed up.
0649:             *
0650:             * @param constantAction the constantAction that is about to be executed (and
0651:             *	should be validated
0652:             *
0653:             * @exception StandardException on validation failure
0654:             */
0655:            public void validateStmtExecution(ConstantAction constantAction)
0656:                    throws StandardException;
0657:
0658:            /**
0659:             * Push a new trigger execution context.
0660:             * <p>
0661:             * Multiple TriggerExecutionContexts may be active at any given time.
0662:             *
0663:             * @param tec the trigger execution context
0664:             *
0665:             * @exception StandardException on trigger recursion error
0666:             */
0667:            public void pushTriggerExecutionContext(TriggerExecutionContext tec)
0668:                    throws StandardException;
0669:
0670:            /**
0671:             * Remove the tec.  Does an object identity (tec == tec)
0672:             * comparison.  Asserts that the tec is found.
0673:             *
0674:             * @param tec the tec to remove
0675:             *
0676:             * @exception StandardException on error
0677:             */
0678:            public void popTriggerExecutionContext(TriggerExecutionContext tec)
0679:                    throws StandardException;
0680:
0681:            /**
0682:             * Get the topmost tec.  
0683:             *
0684:             * @return the tec
0685:             */
0686:            public TriggerExecutionContext getTriggerExecutionContext();
0687:
0688:            /**
0689:             * Set the trigger table descriptor.  Used to compile
0690:             * statements that may special trigger pseudo tables.
0691:             *
0692:             * @param td the table that the trigger is 
0693:             * defined upon
0694:             *
0695:             */
0696:            public void pushTriggerTable(TableDescriptor td);
0697:
0698:            /**
0699:             * Remove the trigger table descriptor.
0700:             *
0701:             * @param td the table to remove from the stack.
0702:             */
0703:            public void popTriggerTable(TableDescriptor td);
0704:
0705:            /**
0706:             * Get the topmost trigger table descriptor
0707:             *
0708:             * @return the table descriptor, or null if we
0709:             * aren't in the middle of compiling a create
0710:             * trigger.
0711:             */
0712:            public TableDescriptor getTriggerTable();
0713:
0714:            /**
0715:             * Increment the DataDictionary bind count.  This is for keeping track
0716:             * of nested binding, which can happen if SQL statements are bound from
0717:             * within static initializers.
0718:             *
0719:             * @return	The new bind count
0720:             */
0721:            int incrementBindCount();
0722:
0723:            /**
0724:             * Decrement the DataDictionary bind count.
0725:             *
0726:             * @return	The new bind count
0727:             */
0728:            int decrementBindCount();
0729:
0730:            /**
0731:             * Get the DataDictionary bind count.
0732:             *
0733:             * @return	The current bind count.
0734:             */
0735:            int getBindCount();
0736:
0737:            /**
0738:             * Remember that the DataDictionary is in write mode, so we can take
0739:             * it out of write mode at the end of the transaction.
0740:             */
0741:            void setDataDictionaryWriteMode();
0742:
0743:            /**
0744:             * Return true if the data dictionary is in write mode (that is, this
0745:             * context was informed that is is in write mode by the method call
0746:             * setDataDictionaryWriteMode().
0747:             */
0748:            boolean dataDictionaryInWriteMode();
0749:
0750:            /**
0751:             * Turn RUNTIMESTATISTICS  on or off.
0752:             */
0753:            public void setRunTimeStatisticsMode(boolean onOrOff);
0754:
0755:            /**
0756:             * Get the RUNTIMESTATISTICS mode.
0757:             */
0758:            public boolean getRunTimeStatisticsMode();
0759:
0760:            /**
0761:             * Turn STATISTICS TIMING on or off.
0762:             */
0763:            public void setStatisticsTiming(boolean onOrOff);
0764:
0765:            /**
0766:             * Get the STATISTICS TIMING mode.
0767:             */
0768:            public boolean getStatisticsTiming();
0769:
0770:            /** 
0771:             * Set the RUNTIMESTATISTICS object. 
0772:             */
0773:            public void setRunTimeStatisticsObject(
0774:                    RunTimeStatistics runTimeStatisticsObject);
0775:
0776:            /** 
0777:             * Get the RUNTIMESTATISTICS object. 
0778:             */
0779:            public RunTimeStatistics getRunTimeStatisticsObject();
0780:
0781:            /**
0782:             *	Reports how many statement levels deep we are.
0783:             *
0784:             *	@return	a statement level >= OUTERMOST_STATEMENT
0785:             */
0786:            public int getStatementDepth();
0787:
0788:            /**
0789:              Returns the Database of this connection.
0790:             */
0791:            public Database getDatabase();
0792:
0793:            /**
0794:             * Returns true if isolation level has been set using JDBC/SQL.
0795:             */
0796:            public boolean isIsolationLevelSetUsingSQLorJDBC();
0797:
0798:            /**
0799:             * Reset the isolation level flag used to keep correct isolation level
0800:             * state in BrokeredConnection. This resetting will happen at the start 
0801:             * and end of a global transaction, after the BrokeredConection's 
0802:             * isolation level state is brought upto date with the EmbedConnection's
0803:             * isolation state.
0804:             * The flag gets set to true when isolation level is set using JDBC/SQL.
0805:             */
0806:            public void resetIsolationLevelFlagUsedForSQLandJDBC();
0807:
0808:            /**
0809:             * Set current isolation level.
0810:             *
0811:             * @param isolationLevel	The new isolationLevel.
0812:             */
0813:            public void setIsolationLevel(int isolationLevel)
0814:                    throws StandardException;
0815:
0816:            /**
0817:             * Get the current isolation level.
0818:             *
0819:             * @return The current isolation level.
0820:             */
0821:            public int getCurrentIsolationLevel();
0822:
0823:            /**
0824:             * Get the current isolation level in DB2 format.
0825:             *
0826:             * @return The current isolation level as a 2 character string.
0827:             */
0828:            public String getCurrentIsolationLevelStr();
0829:
0830:            public void setPrepareIsolationLevel(int isolationLevel);
0831:
0832:            /**
0833:             * Get the prepare isolation level.
0834:             * If the isolation level has been explicitly set with a SQL statement or
0835:             * embedded call to setTransactionIsolation, this will return
0836:             * ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL 
0837:             * SET ISOLATION always takes priority.
0838:             * 
0839:             */
0840:            public int getPrepareIsolationLevel();
0841:
0842:            /**
0843:             * Set the readOnly status for the current connection. This can
0844:             * only be called when the current transaction has not done
0845:             * any work.
0846:             *
0847:             * @param onOrOff true sets the connection to be readOnly and
0848:             *                false sets it to readWrite.
0849:             *
0850:             * @exception StandardException The call failed and the readOnly
0851:             *                status has not changed.
0852:             */
0853:            public void setReadOnly(boolean onOrOff) throws StandardException;
0854:
0855:            /**
0856:             * Get the readOnly status for the current connection. 
0857:             */
0858:            public boolean isReadOnly();
0859:
0860:            /**
0861:             * Get an Authorizer for this connection.
0862:             */
0863:            public Authorizer getAuthorizer();
0864:
0865:            /**
0866:             *	Get the current ExecutionContext.
0867:             */
0868:            ExecutionContext getExecutionContext();
0869:
0870:            /**
0871:             *	Get the current StatementContext.
0872:             */
0873:            StatementContext getStatementContext();
0874:
0875:            /** Get the AccessFactory cached in this LanguageConnectionContext */
0876:            AccessFactory getAccessFactory();
0877:
0878:            /**
0879:             * Return a PreparedStatement object for the query.
0880:             * This method first tries to locate the PreparedStatement object from a statement
0881:             * cache.  If the statement is not found in the cache, the query will be compiled and
0882:             * put into the cache.
0883:             * @param compilationSchema schema
0884:             * @param sqlText sql query string
0885:             * @param isForReadOnly read only status for resultset. Set to true if the concurrency mode for the resultset 
0886:             *                      is CONCUR_READ_ONLY
0887:             * @param allowInternalSyntax If true, then this query is allowed to use internal 
0888:             *                      sql syntax. One instance where this will be true is if a
0889:             *                      metadata query is getting executed.
0890:             */
0891:            public PreparedStatement prepareInternalStatement(
0892:                    SchemaDescriptor compilationSchema, String sqlText,
0893:                    boolean isForReadOnly, boolean allowInternalSyntax)
0894:                    throws StandardException;
0895:
0896:            /**
0897:             * Return a PreparedStatement object for the query.
0898:             * This method first tries to locate the PreparedStatement object from a statement
0899:             * cache.  If the statement is not found in the cache, the query will be compiled and 
0900:             * put into the cache.
0901:             * The schema used when compiling the statement is the same schema as returned by
0902:             * getDefaultSchema().  For internal statements, the read only status is set to
0903:             * true.
0904:             * Calling this method is equivalent to calling 
0905:             * prepareExternalStatement(lcc.getDefaultSchema(), sqlText, true);
0906:             * 
0907:             * @param sqlText sql query string
0908:             */
0909:            public PreparedStatement prepareInternalStatement(String sqlText)
0910:                    throws StandardException;
0911:
0912:            /**
0913:             * Control whether or not optimizer trace is on.
0914:             *
0915:             * @param onOrOff    Whether to turn optimizer trace on (true) or off (false).
0916:             *
0917:             * @return Whether or not the call was successful.  (false will be returned when optimizer tracing is not supported.)
0918:             */
0919:            public boolean setOptimizerTrace(boolean onOrOff);
0920:
0921:            /** 
0922:             * Get whether or not optimizer trace is on.
0923:             *
0924:             * @return Whether or not optimizer trace is on.
0925:             */
0926:            public boolean getOptimizerTrace();
0927:
0928:            /**
0929:             * Control whether or not optimizer trace is generated in html.
0930:             *
0931:             * @param onOrOff    Whether or not optimizer trace will be in html (true) or not (false).
0932:             *
0933:             * @return Whether or not the call was successful.  (false will be returned when optimizer tracing is not supported.)
0934:             */
0935:            public boolean setOptimizerTraceHtml(boolean onOrOff);
0936:
0937:            /** 
0938:             * Get whether or not optimizer trace html is on.
0939:             *
0940:             * @return Whether or not optimizer trace html is on.
0941:             */
0942:            public boolean getOptimizerTraceHtml();
0943:
0944:            /**
0945:             * Get the optimizer trace output for the last optimized query as a String.  If optimizer trace
0946:             * html is on, then the String will contain the html tags.
0947:             *
0948:             * @return The optimizer trace output for the last optimized query as a String.
0949:             *    Null will be returned if optimizer trace output is off or not supported 
0950:             *    or no trace output was found or an exception occurred.
0951:             */
0952:            public String getOptimizerTraceOutput();
0953:
0954:            /**
0955:             * Set the optimizer trace output to the specified String.
0956:             * (Done at the beginning of each statement.)
0957:             */
0958:            public void setOptimizerTraceOutput(String startingText);
0959:
0960:            /**
0961:             * Append the latest output to the optimizer trace output.
0962:             */
0963:            public void appendOptimizerTraceOutput(String output);
0964:
0965:            /**
0966:             *	Reports whether there is any outstanding work in the transaction.
0967:             *
0968:             *	@return		true if there is outstanding work in the transaction
0969:             *				false otherwise
0970:             */
0971:            public boolean isTransactionPristine();
0972:
0973:            /**
0974:             *	Get the lock handle for the current transaction.
0975:             *
0976:             *	@param	lockScope	SINGLE_TRANSACTION_LOCK or MULTI_TRANSACTION_LOCK
0977:             *
0978:             *	@return	the current lock handle
0979:             *
0980:             * @exception StandardException thrown if something goes wrong
0981:             */
0982:            public Object getLockObject(int lockScope) throws StandardException;
0983:
0984:            /**
0985:             *	Get casing for delimited identifiers. This feature is here to
0986:             *	support the Plugin.
0987:             *
0988:             *	@return	ANSI_CASING or ANTI_ANSI_CASING.
0989:             *
0990:             * @exception StandardException thrown if something goes wrong
0991:             */
0992:            public int getIdentifierCasing() throws StandardException;
0993:
0994:            /**
0995:             * Convert an identifier to the proper case for this connection. This method
0996:             * is here to support the Plugin.
0997:             *
0998:             * @param id an identifier string
0999:             * @return  the string converted to upper or lower case, as appropriate
1000:             *
1001:             * @exception StandardException thrown if something goes wrong
1002:             */
1003:            public String convertIdentifierCase(String id)
1004:                    throws StandardException;
1005:
1006:            /**
1007:             * Returns the last autoincrement value inserted by this connection.
1008:             * If no values have been inserted into the given column a NULL value
1009:             * is returned.
1010:             * 
1011:             * @param schemaName
1012:             * @param tableName
1013:             * @param columnName
1014:             */
1015:            public Long lastAutoincrementValue(String schemaName,
1016:                    String tableName, String columnName);
1017:
1018:            /**
1019:             * Sets autoincrementUpdate-- this variable allows updates to autoincrement
1020:             * columns if it is set to true. The default is ofcourse false; i.e 
1021:             * ai columns cannot be directly modified by the user. This is set to 
1022:             * true by AlterTableConstantAction, when a new ai column is being added 
1023:             * to an existing table.
1024:             * 
1025:             * @param flag 	the value for autoincrementUpdate (TRUE or FALSE)
1026:             * @see org.apache.derby.impl.sql.execute.AlterTableConstantAction#updateNewAutoincrementColumn
1027:             *
1028:             */
1029:            public void setAutoincrementUpdate(boolean flag);
1030:
1031:            /**
1032:             * Returns the current value of autoincrementUpdate.
1033:             *
1034:             * @return true if updates to autoincrement columns is permitted.
1035:             */
1036:            public boolean getAutoincrementUpdate();
1037:
1038:            /**
1039:             * copy a hashtable of autoincrement key value pairs into the cache of 
1040:             * ai values stored in the language connection context.
1041:             */
1042:            public void copyHashtableToAIHT(Hashtable from);
1043:
1044:            /**
1045:             * returns the <b>next</b> value to be inserted into an autoincrement col.
1046:             * This is used internally by the system to generate autoincrement values
1047:             * which are going to be inserted into a autoincrement column. This is
1048:             * used when as autoincrement column is added to a table by an alter 
1049:             * table statemenet and during bulk insert.
1050:             *
1051:             * @param schemaName
1052:             * @param tableName
1053:             * @param columnName identify the column uniquely in the system.
1054:             *
1055:             * @exception StandardException on error.
1056:             */
1057:            public long nextAutoincrementValue(String schemaName,
1058:                    String tableName, String columnName)
1059:                    throws StandardException;
1060:
1061:            /**
1062:             * Flush the cache of autoincrement values being kept by the lcc.
1063:             * This will result in the autoincrement values being written to the
1064:             * SYSCOLUMNS table as well as the mapping used by lastAutoincrementValue
1065:             * 
1066:             * @param tableUUID the table which is being flushed; we need this value to
1067:             * identify the table for which the autoincrement counter is being
1068:             * maintained.
1069:             *
1070:             * @exception StandardException thrown on error.
1071:             *
1072:             * @see LanguageConnectionContext#lastAutoincrementValue
1073:             * @see org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext#lastAutoincrementValue
1074:             * @see org.apache.derby.iapi.db.ConnectionInfo#lastAutoincrementValue
1075:             */
1076:            public void autoincrementFlushCache(UUID tableUUID)
1077:                    throws StandardException;
1078:
1079:            /**
1080:             * Create an autoincrement counter to be used on behalf of a SQL-J 
1081:             * statement. The counter is identified by (schemaName, tableName,
1082:             * columnName). The counter must be freed up by calling 
1083:             * autoincrementFlushCache at the end of the statement. It is expected
1084:             * that a ai-counter with the same signaure doesn't exist when the 
1085:             * method is called.
1086:             * 
1087:             * @param 		s					SchemaName
1088:             * @param		t					TableName
1089:             * @param		c					ColumnName
1090:             * @param		initialValue		initial value of the counter.
1091:             * @param		increment			increment for the counter.
1092:             * @param		position			column position (1-based).
1093:             */
1094:            public void autoincrementCreateCounter(String s, String t,
1095:                    String c, Long initialValue, long increment, int position);
1096:
1097:            /**
1098:             * Get the instance number of this LCC.
1099:             *
1100:             * @return instance number of this LCC.
1101:             */
1102:            public int getInstanceNumber();
1103:
1104:            /**
1105:             * Get the DRDA ID of this LCC.
1106:             *
1107:             * @return DRDA ID this LCC.
1108:             */
1109:            public String getDrdaID();
1110:
1111:            /**
1112:             * Set the DRDA ID of this LCC.
1113:             *
1114:             * @param drdaID DRDA ID.
1115:             */
1116:            public void setDrdaID(String drdaID);
1117:
1118:            /**
1119:             * Get the database name of this LCC.
1120:             *
1121:             * @return database name of this LCC.
1122:             */
1123:            public String getDbname();
1124:
1125:            /**
1126:             * Check if in SQL standard mode, with support for Grant & Revoke
1127:             *
1128:             * @return True if SQL standard permissions are being used
1129:             */
1130:            public boolean usesSqlAuthorization();
1131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.