1 23 24 package org.objectweb.medor.query.rdb.lib; 25 26 import java.util.ArrayList ; 27 28 import org.objectweb.jorm.type.api.PType; 29 import org.objectweb.medor.api.MedorException; 30 import org.objectweb.medor.api.QueryLeafException; 31 import org.objectweb.medor.datasource.api.DataStore; 32 import org.objectweb.medor.expression.api.Expression; 33 import org.objectweb.medor.expression.api.ParameterOperand; 34 import org.objectweb.medor.query.api.FilteredQueryTree; 35 import org.objectweb.medor.query.rdb.api.RdbField; 36 import org.objectweb.medor.query.rdb.api.RdbStringQueryLeaf; 37 38 42 public class BasicRdbStringQueryLeaf extends BasicRdbQueryLeaf 43 implements RdbStringQueryLeaf, FilteredQueryTree { 44 45 protected Expression sqlFilter; 46 47 public BasicRdbStringQueryLeaf() { 48 } 49 50 53 public BasicRdbStringQueryLeaf(DataStore ds, 54 String query, 55 String nodeName) { 56 super(nodeName, ds, query); 57 } 58 59 public RdbField addRdbField(String name, PType type, String colName) { 60 RdbField f = new BasicRdbField(name, type, colName, this); 61 name2field.put(f.getName(), f); 62 fields.add(f); 63 return f; 64 } 65 66 public String getSqlRequest(ParameterOperand[] pos, 67 boolean rangeStartAt, 68 boolean rangeSize) { 69 return query; 70 } 71 72 public String getSqlRequest(ParameterOperand[] pos, 73 ArrayList al, 74 boolean rangeStartAt, 75 boolean rangeSize) throws MedorException { 76 if (al == null) { 77 return getSqlRequest(pos, rangeStartAt, rangeSize); 78 } else { 79 throw new MedorException("Request with selectList not supported"); 80 } 81 } 82 83 public String getSelectList(String selectList, 84 ArrayList selectFields, 85 boolean qualified) throws MedorException { 86 throw new QueryLeafException("Unsupported method getSelectList for BasicRdbStringQueryLeaf"); 87 } 88 89 public Expression getQueryFilter() { 90 return sqlFilter; 91 } 92 93 public void setQueryFilter(Expression exp) { 94 this.sqlFilter = exp; 95 } 96 } 97 | Popular Tags |