1 5 package com.jofti.query; 6 7 import com.jofti.api.IndexQuery; 8 import com.jofti.core.QueryId; 9 import com.jofti.core.QueryType; 10 11 66 public class SQLQuery implements IndexQuery, QueryId { 67 68 int hashCode =0; 69 String query = null; 70 static final QueryType QUERY_ID=QueryType.UNPARSED_QUERY; 71 72 private static final String TERMINATOR =";"; 73 74 public SQLQuery(String query){ 75 this.query = query + TERMINATOR; 76 } 77 78 public String getQuery(){ 79 return this.query; 80 } 81 82 public QueryType getQueryType() 83 { 84 return QUERY_ID; 85 } 86 87 public int hashCode(){ 88 if (hashCode ==0){ 89 hashCode = query.hashCode(); 90 } 91 return hashCode; 92 } 93 94 public boolean equals(Object obj){ 95 return query.equals(obj); 96 } 97 98 public IndexQuery setParameter(String name, Object value) { 99 throw new UnsupportedOperationException ("Parameters are not supported for sql queries"); 100 } 101 104 public IndexQuery setParameter(int position, Object value) { 105 throw new UnsupportedOperationException ("Parameters are not supported for sql queries"); 106 107 } 108 109 public IndexQuery setFirstResult(int firstResult) { 110 throw new UnsupportedOperationException ("result limits are not supported for sql queries"); 111 112 } 113 public IndexQuery setMaxResults(int maxResults) { 114 throw new UnsupportedOperationException ("result limits are not supported for sql queries"); 115 116 } 117 } 118 | Popular Tags |