1 package org.apache.ojb.broker.accesslayer.sql; 2 3 17 18 import org.apache.ojb.broker.metadata.ClassDescriptor; 19 import org.apache.ojb.broker.metadata.FieldDescriptor; 20 import org.apache.ojb.broker.platforms.Platform; 21 import org.apache.ojb.broker.query.Criteria; 22 import org.apache.ojb.broker.query.Query; 23 import org.apache.ojb.broker.util.SqlHelper.PathInfo; 24 import org.apache.ojb.broker.util.logging.Logger; 25 26 32 public class SqlDeleteByQuery extends SqlQueryStatement 33 { 34 35 39 public SqlDeleteByQuery(Platform pf, ClassDescriptor cld, Query query, Logger logger) 40 { 41 super(pf, cld, query, logger); 42 } 43 44 47 protected String buildStatement() 48 { 49 StringBuffer stmt = new StringBuffer (); 50 StringBuffer where = new StringBuffer (); 51 52 Criteria crit = this.getQuery().getCriteria(); 53 54 stmt.append("DELETE FROM "); 55 stmt.append(getSearchClassDescriptor().getFullTableName()); 56 appendWhereClause(where, crit, stmt); 57 58 return stmt.toString(); 59 } 60 61 64 protected String getColName(TableAlias aTableAlias, PathInfo aPathInfo, boolean translate) 65 { 66 FieldDescriptor fld = null; 67 String result; 68 69 if (translate) 70 { 71 fld = getFieldDescriptor(aTableAlias, aPathInfo); 72 } 73 74 if (fld != null) 75 { 76 result = fld.getColumnName(); 78 } 79 else 80 { 81 result = aPathInfo.column; 82 } 83 84 return result; 85 } 86 87 } 88 | Popular Tags |