01: /*
02: $Header: /cvsroot/xorm/xorm/src/org/xorm/query/RawCondition.java,v 1.1 2002/10/24 06:57:36 wbiggs Exp $
03:
04: This file is part of XORM.
05:
06: XORM is free software; you can redistribute it and/or modify
07: it under the terms of the GNU General Public License as published by
08: the Free Software Foundation; either version 2 of the License, or
09: (at your option) any later version.
10:
11: XORM is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU General Public License for more details.
15:
16: You should have received a copy of the GNU General Public License
17: along with XORM; if not, write to the Free Software
18: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: package org.xorm.query;
21:
22: import java.util.Collection;
23:
24: /**
25: * RawConditions represent queries in some native query format against
26: * a set of tables. At execution time, any instances of names surrounded
27: * by curly braces will be substituted with the String value provided
28: * by the bound query (but only if the RawCondition is attached to an
29: * instance of DataQuery directly).
30: *
31: * The main use of this class is to provide a means of passing native
32: * SQL queries to the datastore, but it could be used or extended for other
33: * text-based query languages as well.
34: */
35: public class RawCondition extends Condition {
36: private Collection tables;
37: private String rawQuery;
38:
39: public RawCondition(Collection tables, String rawQuery) {
40: this .tables = tables;
41: this .rawQuery = rawQuery;
42: }
43:
44: public String getRawQuery() {
45: return rawQuery;
46: }
47:
48: public Collection getTables() {
49: return tables;
50: }
51:
52: public String convertOperand(Object operand) {
53: return (operand == null) ? "null" : operand.toString();
54: }
55: }
|