00001 /** 00002 * C-JDBC: Clustered JDBC. 00003 * Copyright (C) 2002-2004 French National Institute For Research In Computer 00004 * Science And Control (INRIA). 00005 * Contact: c-jdbc@objectweb.org 00006 * 00007 * This library is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU Lesser General Public License as published by the 00009 * Free Software Foundation; either version 2.1 of the License, or any later 00010 * version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00015 * for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library; if not, write to the Free Software Foundation, 00019 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00020 * 00021 * Initial developer(s): Emmanuel Cecchet. 00022 * Contributor(s): Mathieu Peltier. 00023 */ 00024 00025 package org.objectweb.cjdbc.common.sql; 00026 00027 import java.io.Serializable; 00028 import java.sql.SQLException; 00029 00030 import org.objectweb.cjdbc.common.sql.schema.DatabaseSchema; 00031 00032 /** 00033 * An <code>UnknownRequest</code> is an SQL request that does not match any 00034 * SQL query known by this software. 00035 * 00036 * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a> 00037 * @author <a href="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a> 00038 * @version 1.0 00039 */ 00040 public class UnknownRequest extends AbstractRequest implements Serializable 00041 { 00042 /** 00043 * Creates a new <code>UnknownRequest</code> instance. 00044 * 00045 * @param sqlQuery the SQL query 00046 * @param escapeProcessing should the driver to escape processing before 00047 * sending to the database? 00048 * @param timeout an <code>int</code> value 00049 * @param lineSeparator the line separator used in the query 00050 */ 00051 public UnknownRequest(String sqlQuery, boolean escapeProcessing, int timeout, 00052 String lineSeparator) 00053 { 00054 super(sqlQuery, escapeProcessing, timeout, lineSeparator); 00055 cacheable = RequestType.UNCACHEABLE; 00056 } 00057 00058 /** 00059 * @return <code>false</code> 00060 * @see org.objectweb.cjdbc.common.sql.AbstractRequest#isReadRequest() 00061 */ 00062 public boolean isReadRequest() 00063 { 00064 return false; 00065 } 00066 00067 /** 00068 * @return <code>false</code> 00069 * @see org.objectweb.cjdbc.common.sql.AbstractRequest#isWriteRequest() 00070 */ 00071 public boolean isWriteRequest() 00072 { 00073 return false; 00074 } 00075 00076 /** 00077 * @return <code>true</code> 00078 * @see org.objectweb.cjdbc.common.sql.AbstractRequest#isUnknownRequest() 00079 */ 00080 public boolean isUnknownRequest() 00081 { 00082 return true; 00083 } 00084 00085 /** 00086 * Throws always an <code>SQLException</code>: it is not possible to parse 00087 * an unknown request because we don't know its syntax or semantic. 00088 * 00089 * @see org.objectweb.cjdbc.common.sql.AbstractRequest#parse(org.objectweb.cjdbc.common.sql.schema.DatabaseSchema, 00090 * int, boolean) 00091 */ 00092 public void parse(DatabaseSchema schema, int granularity, 00093 boolean isCaseSensitive) throws SQLException 00094 { 00095 throw new SQLException("Unable to parse an unknown request"); 00096 } 00097 00098 /** 00099 * Throws always an <code>SQLException</code>: it is not possible to parse 00100 * an unknown request because we don't know its syntax or semantic. 00101 * 00102 * @see AbstractRequest#cloneParsing(AbstractRequest) 00103 */ 00104 public void cloneParsing(AbstractRequest request) 00105 { 00106 throw new RuntimeException( 00107 "Unable to clone the parsing of an unknown request"); 00108 } 00109 }