KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > ejb > query > UpdateNode


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.ejb.query;
13
14 /**
15  * An update_statement.
16  */

17 public class UpdateNode extends Node {
18
19     private String JavaDoc schemaName;
20     private String JavaDoc identifier;
21     private SetNode updateList;
22     private Node where;
23
24     public UpdateNode(String JavaDoc schemaName, String JavaDoc identifier, SetNode updateList,
25             Node where) {
26         this.schemaName = schemaName;
27         this.identifier = identifier;
28         this.updateList = updateList;
29         this.where = where;
30     }
31
32     public String JavaDoc getSchemaName() {
33         return schemaName;
34     }
35
36     public String JavaDoc getIdentifier() {
37         return identifier;
38     }
39
40     public SetNode getUpdateList() {
41         return updateList;
42     }
43
44     public Node getWhere() {
45         return where;
46     }
47
48     public Object JavaDoc arrive(NodeVisitor v, Object JavaDoc msg) {
49         return v.arriveUpdateNode(this, msg);
50     }
51
52     public String JavaDoc toStringImp() {
53         StringBuffer JavaDoc s = new StringBuffer JavaDoc();
54         s.append("UPDATE ");
55         s.append(schemaName);
56         s.append(" AS ");
57         s.append(identifier);
58         s.append("\nSET ");
59         if (updateList != null) {
60             updateList.appendList(s);
61         }
62         if (where != null) {
63             s.append("\nWHERE ");
64             s.append(where);
65         }
66         return s.toString();
67     }
68
69     public void resolve(ResolveContext rc) {
70         resolve(updateList, rc);
71         if (where != null) {
72             where.resolve(rc);
73         }
74     }
75
76 }
77
78
Popular Tags