source: trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/database/GS3SQLWhere.java@ 5800

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

Adding gs3build code

  • Property svn:keywords set to Author Date Id Revision
File size: 1.0 KB
Line 
1package org.greenstone.gsdl3.gs3build.database;
2
3import java.util.List;
4import java.util.ArrayList;
5
6public class GS3SQLWhere implements GS3SQLWhereElement
7 { String condition;
8 List elements;
9
10 public GS3SQLWhere(GS3SQLWhereElement element)
11 { this.condition = "AND";
12 this.elements = new ArrayList();
13 this.elements.add(element);
14 }
15
16 public GS3SQLWhere(GS3SQLWhereElement element, String condition, GS3SQLWhereElement other)
17 { this.elements = new ArrayList();
18 this.elements.add(element);
19 this.elements.add(other);
20 this.condition = condition;
21 }
22
23 public void add(GS3SQLWhereElement element)
24 { this.elements.add(element);
25 }
26
27 public String toString()
28 { StringBuffer reply = new StringBuffer();
29
30 for (int i = 0; i < this.elements.size(); i ++)
31 {
32 if (i != 0) {
33 reply.append(" ");
34 reply.append(this.condition);
35 reply.append(" ");
36 }
37 reply.append(this.elements.get(i).toString());
38 }
39 return reply.toString();
40 }
41 }
42
43
Note: See TracBrowser for help on using the repository browser.