Source Code Cross Referenced for SQLQuery.java in  » Search-Engine » Jofti » com » jofti » query » 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 » Search Engine » Jofti » com.jofti.query 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 13-Jul-2005
003:         *
004:         */
005:        package com.jofti.query;
006:
007:        import com.jofti.api.IndexQuery;
008:        import com.jofti.core.QueryId;
009:        import com.jofti.core.QueryType;
010:
011:        /**
012:         * 
013:         *
014:         * Basic usage is "select ${classname} where ${propertyname} [=,<,>,!=,>=,<=] 'value'"
015:         * <p>
016:         * multiproperty queries are of the form<br>
017:         * "select ${classname} where ${propertyname} [=,<,>,!=,>=,<=] 'value' [and,or] ${propertyname} [=,<,>,!=,>=,<=] 'value'"
018:         * <p>
019:         * compound queries are supported as ${query} [and,or] ${query}
020:         * <p>
021:         * ordering for compound queries is achieved through use of bracket groups<br>
022:         * "select ${classname} where ($propertyname} [=,<,>,!=,>=,<=] 'value' [and,or] ${propertyname} [=,<,>,!=,>=,<=] 'value') [and,or] ${propertyname} [=,<,>,!=,>=,<=] 'value'"
023:         <p>
024:         * 
025:         * multiclass queries are of the form
026:         * <p>
027:         * select ${classname} as A, ${classname} as B where A.${propertyname} [=,<,>,!=,>=,<=] 'value' [and.or] B.${propertyname}  [=,<,>,!=,>=,<=] 'value'"
028:         * <p>
029:         * 
030:         * All values are created using a reflective String constructor .So if you want to Compare an Integer(22) you just specify
031:         * value=22  - the value type is chosen based on the declared type of the field.
032:         * <p>
033:         * For primitive wrappers in the JVM the propertyname is always the literal string 'VALUE' (case insensitive)
034:         * * 		<li>
035:         * 			java.lang.String.class,
036:         java.lang.Integer.class,
037:         java.lang.Double.class,
038:         java.lang.Float.class,
039:         java.lang.Long.class,
040:         java.lang.Short.class,
041:         java.math.BigInteger.class,
042:         java.math.BigDecimal.class,
043:         java.util.Date.class,
044:         java.net.URI.class 
045:         </li>  
046:         * <p>
047:         * For example to query an integer you would write
048:         * <p>
049:         * select java.lang.Integer where VALUE = 20
050:         * <p>
051:         * or <br>
052:         * select java.lang.Integer as i where i.VALUE =20
053:         * <p>
054:         * 
055:         * Dates are constructed using the default encoding of the JVM. So a UK encoding would be:
056:         * <p>
057:         * select java.util.Date where value <='4/10/1901 00:00:00' 
058:         * <p>
059:         * For user defined classes in order to query the property type must have a String constructor and must 
060:         * implement equals and hashCode correctly.
061:         *  <p>
062:         *  
063:         *  @author Steve Woodcock
064:         *  @version 1.0
065:         */
066:        public class SQLQuery implements  IndexQuery, QueryId {
067:
068:            int hashCode = 0;
069:            String query = null;
070:            static final QueryType QUERY_ID = QueryType.UNPARSED_QUERY;
071:
072:            private static final String TERMINATOR = ";";
073:
074:            public SQLQuery(String query) {
075:                this .query = query + TERMINATOR;
076:            }
077:
078:            public String getQuery() {
079:                return this .query;
080:            }
081:
082:            public QueryType getQueryType() {
083:                return QUERY_ID;
084:            }
085:
086:            public int hashCode() {
087:                if (hashCode == 0) {
088:                    hashCode = query.hashCode();
089:                }
090:                return hashCode;
091:            }
092:
093:            public boolean equals(Object obj) {
094:                return query.equals(obj);
095:            }
096:
097:            public IndexQuery setParameter(String name, Object value) {
098:                throw new UnsupportedOperationException(
099:                        "Parameters are not supported for sql queries");
100:            }
101:
102:            /* (non-Javadoc)
103:             * @see com.jofti.api.IndexQuery#setParameter(int, java.lang.Object)
104:             */
105:            public IndexQuery setParameter(int position, Object value) {
106:                throw new UnsupportedOperationException(
107:                        "Parameters are not supported for sql queries");
108:
109:            }
110:
111:            public IndexQuery setFirstResult(int firstResult) {
112:                throw new UnsupportedOperationException(
113:                        "result limits are not supported for sql queries");
114:
115:            }
116:
117:            public IndexQuery setMaxResults(int maxResults) {
118:                throw new UnsupportedOperationException(
119:                        "result limits are not supported for sql queries");
120:
121:            }
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.