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


001:        /*
002:
003:           Derby - Class org.apache.derby.iapi.sql.compile.CompilerContext
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.iapi.sql.compile;
023:
024:        import org.apache.derby.iapi.services.context.Context;
025:        import org.apache.derby.iapi.services.compiler.JavaFactory;
026:        import org.apache.derby.iapi.services.loader.ClassFactory;
027:
028:        import org.apache.derby.iapi.error.StandardException;
029:
030:        import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
031:
032:        import org.apache.derby.iapi.sql.ParameterValueSet;
033:
034:        import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
035:        import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
036:        import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
037:        import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
038:
039:        import org.apache.derby.iapi.sql.depend.Dependent;
040:        import org.apache.derby.iapi.sql.depend.Provider;
041:        import org.apache.derby.iapi.sql.depend.ProviderList;
042:
043:        import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;
044:
045:        import org.apache.derby.iapi.types.DataTypeDescriptor;
046:
047:        import org.apache.derby.iapi.store.access.StoreCostController;
048:        import org.apache.derby.iapi.store.access.SortCostController;
049:
050:        import java.util.List;
051:        import java.util.Vector;
052:        import java.sql.SQLWarning;
053:
054:        /**
055:         * CompilerContext stores the parser and type id factory to be used by
056:         * the compiler.  Stack compiler contexts when a new, local parser is needed
057:         * (if calling the compiler recursively from within the compiler,
058:         * for example).
059:         * CompilerContext objects are private to a LanguageConnectionContext.
060:         *
061:         * @author ames
062:         *
063:         * History:
064:         *	5/22/97 Moved getExternalInterfaceFactory() to LanguageConnectionContext
065:         *			because it had to be used at execution. - Jeff
066:         */
067:        public interface CompilerContext extends Context {
068:            /////////////////////////////////////////////////////////////////////////////////////
069:            //
070:            //	CONSTANTS
071:            //
072:            /////////////////////////////////////////////////////////////////////////////////////
073:
074:            /**
075:             * this is the ID we expect compiler contexts
076:             * to be stored into a context manager under.
077:             */
078:            String CONTEXT_ID = "CompilerContext";
079:
080:            // bit masks for query fragments which are potentially unreliable. these are used
081:            // by setReliability() and checkReliability().
082:
083:            public static final int DATETIME_ILLEGAL = 0x00000001;
084:            // NOTE: getCurrentConnection() is currently legal everywhere
085:            public static final int CURRENT_CONNECTION_ILLEGAL = 0x00000002;
086:            public static final int FUNCTION_CALL_ILLEGAL = 0x00000004;
087:            public static final int UNNAMED_PARAMETER_ILLEGAL = 0x00000008;
088:            public static final int DIAGNOSTICS_ILLEGAL = 0x00000010;
089:            public static final int SUBQUERY_ILLEGAL = 0x00000020;
090:            public static final int USER_ILLEGAL = 0x00000040;
091:            public static final int COLUMN_REFERENCE_ILLEGAL = 0x00000080;
092:            public static final int IGNORE_MISSING_CLASSES = 0x00000100;
093:            public static final int SCHEMA_ILLEGAL = 0x00000200;
094:            public static final int INTERNAL_SQL_ILLEGAL = 0x00000400;
095:
096:            /**
097:             * Calling procedures that modify sql data from before triggers is illegal. 
098:             * 
099:             */
100:            public static final int MODIFIES_SQL_DATA_PROCEDURE_ILLEGAL = 0x00000800;
101:
102:            /** Standard SQL is legal */
103:            public static final int SQL_LEGAL = (INTERNAL_SQL_ILLEGAL);
104:
105:            /** Any SQL we support is legal */
106:            public static final int INTERNAL_SQL_LEGAL = 0;
107:
108:            public static final int CHECK_CONSTRAINT = (DATETIME_ILLEGAL
109:                    | UNNAMED_PARAMETER_ILLEGAL | DIAGNOSTICS_ILLEGAL
110:                    | SUBQUERY_ILLEGAL | USER_ILLEGAL | SCHEMA_ILLEGAL | INTERNAL_SQL_ILLEGAL);
111:
112:            public static final int DEFAULT_RESTRICTION = (SUBQUERY_ILLEGAL
113:                    | UNNAMED_PARAMETER_ILLEGAL | COLUMN_REFERENCE_ILLEGAL | INTERNAL_SQL_ILLEGAL);
114:
115:            /////////////////////////////////////////////////////////////////////////////////////
116:            //
117:            //	BEHAVIOR
118:            //
119:            /////////////////////////////////////////////////////////////////////////////////////
120:
121:            /**
122:             * Get the Parser from this CompilerContext.
123:             *	 *
124:             * @return	The parser associated with this CompilerContext
125:             *
126:             */
127:
128:            Parser getParser();
129:
130:            /**
131:             * Get the NodeFactory from this CompilerContext.
132:             *
133:             * @return	The NodeFactory associated with this CompilerContext
134:             *
135:             */
136:
137:            NodeFactory getNodeFactory();
138:
139:            /**
140:             * Get the TypeCompilerFactory from this CompilerContext.
141:             *
142:             * @return	The TypeCompilerFactory associated with this CompilerContext
143:             *
144:             */
145:            TypeCompilerFactory getTypeCompilerFactory();
146:
147:            /**
148:            	Return the class factory to use in this compilation.
149:             */
150:            ClassFactory getClassFactory();
151:
152:            /**
153:             * Get the JavaFactory from this CompilerContext.
154:             *
155:             * @return	The JavaFactory associated with this CompilerContext
156:             *
157:             */
158:
159:            JavaFactory getJavaFactory();
160:
161:            /**
162:             * Get the current next column number (for generated column names)
163:             * from this CompilerContext.
164:             *
165:             * @return int	The next column number for the current statement.
166:             *
167:             */
168:
169:            int getNextColumnNumber();
170:
171:            /**
172:             *	Reset compiler context (as for instance, when we recycle a context for
173:             *	use by another compilation.
174:             */
175:            void resetContext();
176:
177:            /**
178:             * Get the current next table number from this CompilerContext.
179:             *
180:             * @return int	The next table number for the current statement.
181:             *
182:             */
183:
184:            int getNextTableNumber();
185:
186:            /**
187:             * Get the number of tables in the current statement from this CompilerContext.
188:             *
189:             * @return int	The number of tables in the current statement.
190:             *
191:             */
192:
193:            int getNumTables();
194:
195:            /**
196:             * Get the current next subquery number from this CompilerContext.
197:             *
198:             * @return int	The next subquery number for the current statement.
199:             *
200:             */
201:
202:            int getNextSubqueryNumber();
203:
204:            /**
205:             * Get the number of subquerys in the current statement from this CompilerContext.
206:             *
207:             * @return int	The number of subquerys in the current statement.
208:             *
209:             */
210:
211:            int getNumSubquerys();
212:
213:            /**
214:             * Get the current next ResultSet number from this CompilerContext.
215:             *
216:             * @return int	The next ResultSet number for the current statement.
217:             *
218:             */
219:
220:            int getNextResultSetNumber();
221:
222:            /**
223:             * Reset the next ResultSet number from this CompilerContext.
224:             */
225:
226:            void resetNextResultSetNumber();
227:
228:            /**
229:             * Get the number of Results in the current statement from this CompilerContext.
230:             *
231:             * @return The number of ResultSets in the current statement.
232:             *
233:             */
234:
235:            int getNumResultSets();
236:
237:            /**
238:             * Get a unique Class name from this CompilerContext.
239:             * Ensures it is globally unique for this JVM.
240:             *
241:             * @return String	A unique-enough class name.
242:             *
243:             */
244:
245:            String getUniqueClassName();
246:
247:            /**
248:             * Set the current dependent from this CompilerContext.
249:             * This should be called at the start of a compile to
250:             * register who has the dependencies needed for the compilation.
251:             *
252:             * @param d	The Dependent currently being compiled.
253:             *
254:             */
255:
256:            void setCurrentDependent(Dependent d);
257:
258:            /**
259:             * Get the current auxiliary provider list from this CompilerContext.
260:             *
261:             * @return	The current AuxiliaryProviderList.
262:             *
263:             */
264:
265:            ProviderList getCurrentAuxiliaryProviderList();
266:
267:            /**
268:             * Set the current auxiliary provider list for this CompilerContext.
269:             *
270:             * @param apl	The new current AuxiliaryProviderList.
271:             *
272:             */
273:
274:            void setCurrentAuxiliaryProviderList(ProviderList apl);
275:
276:            /**
277:             * Add a dependency for the current dependent.
278:             *
279:             * @param p	The Provider of the dependency.
280:             * @exception StandardException thrown on failure.
281:             *
282:             */
283:            void createDependency(Provider p) throws StandardException;
284:
285:            /**
286:             * Add a dependency between two objects.
287:             *
288:             * @param d	The Dependent object.
289:             * @param p	The Provider of the dependency.
290:             * @exception StandardException thrown on failure.
291:             *
292:             */
293:            public void createDependency(Dependent d, Provider p)
294:                    throws StandardException;
295:
296:            /**
297:             * Add an object to the pool that is created at compile time
298:             * and used at execution time.  Use the integer to reference it
299:             * in execution constructs.  Execution code will have to generate:
300:             *	<pre>
301:             *	(#objectType) (this.getPreparedStatement().getSavedObject(#int))
302:             *  <\pre>
303:             *
304:             * @param o object to add to the pool of saved objects
305:             * @return the entry # for the object
306:             */
307:            int addSavedObject(Object o);
308:
309:            /**
310:             *	Get the saved object pool (for putting into the prepared statement).
311:             *  This turns it into its storable form, an array of objects.
312:             *
313:             * @return the saved object pool.
314:             */
315:            Object[] getSavedObjects();
316:
317:            /**
318:             *	Set the saved object pool (for putting into the prepared statement).
319:             *
320:             * @param objs	 The new saved objects
321:             */
322:            public void setSavedObjects(Object[] objs);
323:
324:            /**
325:             * Set the in use state for the compiler context.
326:             *
327:             * @param inUse	 The new inUse state for the compiler context.
328:             */
329:            public void setInUse(boolean inUse);
330:
331:            /**
332:             * Return the in use state for the compiler context.
333:             *
334:             * @return boolean	The in use state for the compiler context.
335:             */
336:            public boolean getInUse();
337:
338:            /**
339:             * Mark this CompilerContext as the first on the stack, so we can avoid
340:             * continually popping and pushing a CompilerContext.
341:             */
342:            public void firstOnStack();
343:
344:            /**
345:             * Is this the first CompilerContext on the stack?
346:             */
347:            public boolean isFirstOnStack();
348:
349:            /**
350:             * Sets which kind of query fragments are NOT allowed. Basically,
351:             * these are fragments which return unstable results. CHECK CONSTRAINTS
352:             * and CREATE PUBLICATION want to forbid certain kinds of fragments.
353:             *
354:             * @param reliability	bitmask of types of query fragments to be forbidden
355:             *						see the reliability bitmasks above
356:             *
357:             */
358:            public void setReliability(int reliability);
359:
360:            /**
361:             * Return the reliability requirements of this clause. See setReliability()
362:             * for a definition of clause reliability.
363:             *
364:             * @return a bitmask of which types of query fragments are to be forbidden
365:             */
366:            public int getReliability();
367:
368:            /**
369:             * Get the compilation schema descriptor for this compilation context.
370:               Will be null if no default schema lookups have occured. Ie.
371:               the statement is independent of the current schema.
372:             * 
373:             * @return the compilation schema descirptor
374:             */
375:            public SchemaDescriptor getCompilationSchema();
376:
377:            /**
378:             * Set the compilation schema descriptor for this compilation context.
379:             *
380:             * @param newDefault compilation schema
381:             * 
382:             * @return the previous compilation schema descirptor
383:             */
384:            public SchemaDescriptor setCompilationSchema(
385:                    SchemaDescriptor newDefault);
386:
387:            /**
388:             * Get a StoreCostController for the given conglomerate.
389:             *
390:             * @param conglomerateNumber	The conglomerate for which to get a
391:             *								StoreCostController.
392:             *
393:             * @return	The appropriate StoreCostController.
394:             *
395:             * @exception StandardException		Thrown on error
396:             */
397:            public StoreCostController getStoreCostController(
398:                    long conglomerateNumber) throws StandardException;
399:
400:            /**
401:             * Get a SortCostController.
402:             *
403:             * @exception StandardException		Thrown on error
404:             */
405:            public SortCostController getSortCostController()
406:                    throws StandardException;
407:
408:            /**
409:             * Set the parameter list.
410:             *
411:             * @param parameterList	The parameter list.
412:             */
413:            public void setParameterList(Vector parameterList);
414:
415:            /**
416:             * Get the parameter list.
417:             *
418:             * @return	The parameter list.
419:             */
420:            public Vector getParameterList();
421:
422:            /**
423:             * If callable statement uses ? = form
424:             */
425:            public void setReturnParameterFlag();
426:
427:            /**
428:             * Is the callable statement uses ? for return parameter.
429:             *
430:             * @return	true if ? = call else false
431:             */
432:            public boolean getReturnParameterFlag();
433:
434:            /**
435:             * Get the array of DataTypeDescriptor representing the types of
436:             * the ? parameters.
437:             *
438:             * @return	The parameter descriptors
439:             */
440:
441:            public DataTypeDescriptor[] getParameterTypes();
442:
443:            /**
444:             * Get the cursor info stored in the context.
445:             *
446:             * @return the cursor info
447:             */
448:            public Object getCursorInfo();
449:
450:            /**
451:             * Set params
452:             *
453:             * @param cursorInfo the cursor info
454:             */
455:            public void setCursorInfo(Object cursorInfo);
456:
457:            /**
458:             * Set the isolation level for the scans in this query.
459:             *
460:             * @param isolationLevel	The isolation level to use.
461:             */
462:            public void setScanIsolationLevel(int isolationLevel);
463:
464:            /**
465:             * Get the isolation level for the scans in this query.
466:             *
467:             * @return	The isolation level for the scans in this query.
468:             */
469:            public int getScanIsolationLevel();
470:
471:            /**
472:             * Set the isolation level on entry to this CC so that it can be restored on exit.
473:             *
474:             * @param isolationLevel	The isolation level on entry.
475:             */
476:            public void setEntryIsolationLevel(int isolationLevel);
477:
478:            /**
479:             * Get the entry isolation level from this CC.
480:             *
481:             * @return	The entry isolation level.
482:             */
483:            public int getEntryIsolationLevel();
484:
485:            /**
486:             * Get the next equivalence class for equijoin clauses.
487:             *
488:             * @return The next equivalence class for equijoin clauses.
489:             */
490:            public int getNextEquivalenceClass();
491:
492:            /**
493:            	Add a compile time warning.
494:             */
495:            public void addWarning(SQLWarning warning);
496:
497:            /**
498:            	Get the chain of compile time warnings.
499:             */
500:            public SQLWarning getWarnings();
501:
502:            /**
503:             * Sets the current privilege type context and pushes the previous on onto a stack.
504:             * Column and table nodes do not know how they are
505:             * being used. Higher level nodes in the query tree do not know what is being
506:             * referenced. Keeping the context allows the two to come together.
507:             *
508:             * @param privType One of the privilege types in 
509:             *						org.apache.derby.iapi.sql.conn.Authorizer.
510:             */
511:            public void pushCurrentPrivType(int privType);
512:
513:            public void popCurrentPrivType();
514:
515:            /**
516:             * Add a column privilege to the list of used column privileges.
517:             *
518:             * @param column
519:             */
520:            public void addRequiredColumnPriv(ColumnDescriptor column);
521:
522:            /**
523:             * Add a table or view privilege to the list of used table privileges.
524:             *
525:             * @param table
526:             */
527:            public void addRequiredTablePriv(TableDescriptor table);
528:
529:            /**
530:             * Add a schema privilege to the list of used privileges.
531:             *
532:             * @param schema	Schema name of the object that is being accessed
533:             * @param aid		Requested authorizationId for new schema
534:             * @param privType	CREATE_SCHEMA_PRIV, MODIFY_SCHEMA_PRIV or DROP_SCHEMA_PRIV
535:             */
536:            public void addRequiredSchemaPriv(String schema, String aid,
537:                    int privType);
538:
539:            /**
540:             * Add a routine execute privilege to the list of used routine privileges.
541:             *
542:             * @param routine
543:             */
544:            public void addRequiredRoutinePriv(AliasDescriptor routine);
545:
546:            /**
547:             * @return The list of required privileges.
548:             */
549:            public List getRequiredPermissionsList();
550:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.