source: trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/database/GS3SQLWhereItem.java@ 7305

Last change on this file since 7305 was 5798, checked in by cs025, 21 years ago

Adding gs3build code

  • Property svn:keywords set to Author Date Id Revision
File size: 1.1 KB
Line 
1package org.greenstone.gsdl3.gs3build.database;
2
3import java.util.List;
4import java.util.ArrayList;
5
6public class GS3SQLWhereItem implements GS3SQLWhereElement
7{ String field;
8 String comparison;
9 String value;
10 String type;
11
12 public GS3SQLWhereItem(String field, String comparison, String value, String type)
13 { this.field = field;
14 this.comparison = comparison;
15 this.value = value;
16 this.type = type;
17 }
18
19 public GS3SQLWhereItem(String field, String comparison, String value)
20 { this.field = field;
21 this.comparison = comparison;
22 this.value = value;
23 this.type = GS3SQLField.VARCHAR_TYPE;
24 }
25
26 public String toString()
27 { StringBuffer reply = new StringBuffer();
28
29 reply.append(this.field);
30 if (!this.comparison.equals("=")) {
31 reply.append(" ");
32 }
33 reply.append(this.comparison);
34 if (!this.comparison.equals("=")) {
35 reply.append(" ");
36 }
37 if (type.equals(GS3SQLField.VARCHAR_TYPE)) {
38 reply.append("\"" + this.value + "\"");
39 }
40 else {
41 reply.append(this.value);
42 }
43 return reply.toString();
44 }
45}
46
47
Note: See TracBrowser for help on using the repository browser.