01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.ejb.query;
12:
13: /**
14: * An update_statement.
15: */
16: public class UpdateNode extends Node {
17:
18: private String schemaName;
19: private String identifier;
20: private SetNode updateList;
21: private Node where;
22:
23: public UpdateNode(String schemaName, String identifier,
24: SetNode updateList, Node where) {
25: this .schemaName = schemaName;
26: this .identifier = identifier;
27: this .updateList = updateList;
28: this .where = where;
29: }
30:
31: public String getSchemaName() {
32: return schemaName;
33: }
34:
35: public String getIdentifier() {
36: return identifier;
37: }
38:
39: public SetNode getUpdateList() {
40: return updateList;
41: }
42:
43: public Node getWhere() {
44: return where;
45: }
46:
47: public Object arrive(NodeVisitor v, Object msg) {
48: return v.arriveUpdateNode(this , msg);
49: }
50:
51: public String toStringImp() {
52: StringBuffer s = new StringBuffer();
53: s.append("UPDATE ");
54: s.append(schemaName);
55: s.append(" AS ");
56: s.append(identifier);
57: s.append("\nSET ");
58: if (updateList != null) {
59: updateList.appendList(s);
60: }
61: if (where != null) {
62: s.append("\nWHERE ");
63: s.append(where);
64: }
65: return s.toString();
66: }
67:
68: public void resolve(ResolveContext rc) {
69: resolve(updateList, rc);
70: if (where != null) {
71: where.resolve(rc);
72: }
73: }
74:
75: }
|