01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.storage.search.implementation.database;
11:
12: import org.mmbase.bridge.Field;
13: import org.mmbase.storage.search.*;
14:
15: /**
16: *
17: * @author Michiel Meeuwissen
18: * @version $Id: MSSqlSqlHandler.java,v 1.5 2007/06/12 10:59:41 michiel Exp $
19: * @since MMBase-1.8
20: */
21: public class MSSqlSqlHandler extends BasicSqlHandler implements
22: SqlHandler {
23:
24: /**
25: * Don't add UPPER'ed field also unuppered, because MSSql seems to choke in that.
26: *
27: * We can also consider removing that odd behaviour from super.
28: */
29: @Override
30: protected StringBuilder appendSortOrderField(StringBuilder sb,
31: SortOrder sortOrder, boolean multipleSteps) {
32: boolean uppered = false;
33: if (!sortOrder.isCaseSensitive()
34: && sortOrder.getField().getType() == Field.TYPE_STRING) {
35: sb.append("UPPER(");
36: uppered = true;
37: }
38: // Fieldname.
39: appendField(sb, sortOrder, multipleSteps);
40: if (uppered) {
41: sb.append("),");
42: }
43: return sb;
44: }
45:
46: }
|