01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
04: * Contact: sequoia@continuent.org
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: *
18: * Initial developer(s): Emmanuel Cecchet.
19: * Contributor(s): ______________________.
20: */package org.continuent.sequoia.controller.requests;
21:
22: import java.sql.SQLException;
23:
24: import org.continuent.sequoia.common.sql.schema.DatabaseSchema;
25:
26: /**
27: * This class defines an UnknownReadRequest used for all SQL statements that are
28: * not SELECT but should be executed as read requests.<br>
29: * An UnknownReadRequest is a request that returns a ResultSet and that we are
30: * not able to parse (we cannot know which tables are accessed, if any).
31: *
32: * @author <a href="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet</a>
33: * @version 1.0
34: */
35: public class UnknownReadRequest extends SelectRequest {
36: private static final long serialVersionUID = -1056060047939721758L;
37:
38: /**
39: * Creates a new <code>UnknownReadRequest</code> object
40: *
41: * @param sqlQuery the SQL query
42: * @param escapeProcessing should the driver to escape processing before
43: * sending to the database ?
44: * @param timeout an <code>int</code> value
45: * @param lineSeparator the line separator used in the query
46: */
47: public UnknownReadRequest(String sqlQuery,
48: boolean escapeProcessing, int timeout, String lineSeparator) {
49: super (sqlQuery, escapeProcessing, timeout, lineSeparator,
50: RequestType.UNKNOWN_READ);
51: setMacrosAreProcessed(true); // no macro processing needed
52: }
53:
54: /**
55: * Request is not parsed (isParsed is just set to true).
56: *
57: * @see AbstractRequest#cloneParsing(AbstractRequest)
58: */
59: public void cloneParsing(AbstractRequest request) {
60: isParsed = true;
61: }
62:
63: /**
64: * Request is not parsed (isParsed is just set to true).
65: *
66: * @see org.continuent.sequoia.controller.requests.AbstractRequest#parse(org.continuent.sequoia.common.sql.schema.DatabaseSchema,
67: * int, boolean)
68: */
69: public void parse(DatabaseSchema schema, int granularity,
70: boolean isCaseSensitive) throws SQLException { // No parsing for unknown read request
71: // Just let database try to execute the request
72: isParsed = true;
73: }
74:
75: /**
76: * Always returns RequestType.UNCACHEABLE
77: *
78: * @see org.continuent.sequoia.controller.requests.AbstractRequest#getCacheAbility()
79: */
80: public int getCacheAbility() {
81: return RequestType.UNCACHEABLE;
82: }
83:
84: /**
85: * Always returns true since the request cannot be parsed anyway.
86: *
87: * @see org.continuent.sequoia.controller.requests.AbstractRequest#isParsed()
88: */
89: public boolean isParsed() {
90: return true;
91: }
92:
93: }
|