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


001:        /**
002:         * com.mckoi.database.interpret.FromTableDef  31 Oct 2001
003:         *
004:         * Mckoi SQL Database ( http://www.mckoi.com/database )
005:         * Copyright (C) 2000, 2001, 2002  Diehl and Associates, Inc.
006:         *
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License
009:         * Version 2 as published by the Free Software Foundation.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License Version 2 for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * Version 2 along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         *
020:         * Change Log:
021:         * 
022:         * 
023:         */package com.mckoi.database.interpret;
024:
025:        import com.mckoi.database.ExpressionPreparer;
026:        import com.mckoi.database.DatabaseException;
027:        import com.mckoi.database.StatementTree;
028:
029:        /**
030:         * Describes a single table declaration in the from clause of a table
031:         * expression (SELECT).
032:         *
033:         * @author Tobias Downer
034:         */
035:
036:        public final class FromTableDef implements  java.io.Serializable,
037:                Cloneable {
038:
039:            static final long serialVersionUID = -606852454508224625L;
040:
041:            /**
042:             * If this is true, then the table def represents a sub-query table.
043:             * The 'getSubSelectStatement' and 'getAlias' method can be used to
044:             * get the table information.
045:             * <p>
046:             * eg. FROM ( SELECT id, number FROM Part ) AS part_info, ....
047:             */
048:            private boolean subquery_table;
049:
050:            /**
051:             * The unique key name given to this table definition.
052:             */
053:            private String unique_key;
054:
055:            /**
056:             * The name of the table this definition references.
057:             */
058:            private String table_name;
059:
060:            /**
061:             * The alias of the table or null if no alias was defined.
062:             */
063:            private String table_alias;
064:
065:            /**
066:             * The TableSelectExpression if this is a subquery table.
067:             */
068:            private TableSelectExpression subselect_table;
069:
070:            /**
071:             * Constructs the table def.  The constructs a table that is aliased under
072:             * a different name.
073:             */
074:            public FromTableDef(String table_name, String table_alias) {
075:                this .table_name = table_name;
076:                this .table_alias = table_alias;
077:                subselect_table = null;
078:                subquery_table = false;
079:            }
080:
081:            /**
082:             * A simple table definition (not aliased).
083:             */
084:            public FromTableDef(String table_name) {
085:                this (table_name, null);
086:            }
087:
088:            /**
089:             * A table that is a sub-query and given an aliased name.
090:             */
091:            public FromTableDef(TableSelectExpression select, String table_alias) {
092:                this .subselect_table = select;
093:                this .table_name = table_alias;
094:                this .table_alias = table_alias;
095:                subquery_table = true;
096:            }
097:
098:            /**
099:             * A simple sub-query table definition (not aliased).
100:             */
101:            public FromTableDef(TableSelectExpression select) {
102:                this .subselect_table = select;
103:                this .table_name = null;
104:                this .table_alias = null;
105:                subquery_table = true;
106:            }
107:
108:            /**
109:             * Sets the unique key.
110:             */
111:            public void setUniqueKey(String unique_key) {
112:                this .unique_key = unique_key;
113:            }
114:
115:            /**
116:             * Returns the name of the table.
117:             */
118:            public String getName() {
119:                return table_name;
120:            }
121:
122:            /**
123:             * Returns the alias for this table (or null if no alias given).
124:             */
125:            public String getAlias() {
126:                return table_alias;
127:            }
128:
129:            /**
130:             * Returns the unique key.
131:             */
132:            public String getUniqueKey() {
133:                return unique_key;
134:            }
135:
136:            /**
137:             * Returns true if this item in the FROM clause is a subquery table.
138:             */
139:            public boolean isSubQueryTable() {
140:                return subquery_table;
141:            }
142:
143:            /**
144:             * Returns the TableSelectExpression if this is a subquery table.
145:             */
146:            public TableSelectExpression getTableSelectExpression() {
147:                return subselect_table;
148:            }
149:
150:            /**
151:             * Prepares the expressions in this table def.
152:             */
153:            public void prepareExpressions(ExpressionPreparer preparer)
154:                    throws DatabaseException {
155:                if (subselect_table != null) {
156:                    subselect_table.prepareExpressions(preparer);
157:                }
158:            }
159:
160:            /**
161:             * Clones the object (deep clone of immutable members).
162:             */
163:            public Object clone() throws CloneNotSupportedException {
164:                FromTableDef v = (FromTableDef) super .clone();
165:                if (subselect_table != null) {
166:                    v.subselect_table = (TableSelectExpression) subselect_table
167:                            .clone();
168:                }
169:                return v;
170:            }
171:
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.