KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > expressions > SQLModifyStatement


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.expressions;
23
24 import java.util.*;
25 import oracle.toplink.essentials.internal.helper.*;
26 import oracle.toplink.essentials.internal.databaseaccess.DatabaseCall;
27 import oracle.toplink.essentials.queryframework.SQLCall;
28 import oracle.toplink.essentials.internal.sessions.AbstractRecord;
29 import oracle.toplink.essentials.internal.sessions.AbstractSession;
30
31 /**
32  * <p><b>Purpose</b>: Mirror SQL behavior.
33  * <p><b>Responsibilities</b>:<ul>
34  * <li> Mirror SQL behavior.
35  * <li> Print as SQL string.
36  * </ul>
37  * @author Dorin Sandu
38  * @since TOPLink/Java 1.0
39  */

40 public abstract class SQLModifyStatement extends SQLStatement {
41     protected DatabaseTable table;
42     protected AbstractRecord modifyRow;
43     protected Vector returnFields;
44
45     public AbstractRecord getModifyRow() {
46         return modifyRow;
47     }
48
49     public Vector getReturnFields() {
50         return returnFields;
51     }
52
53     public DatabaseTable getTable() {
54         return table;
55     }
56
57     public void setModifyRow(AbstractRecord row) {
58         modifyRow = row;
59     }
60
61     public void setReturnFields(Vector fields) {
62         returnFields = fields;
63     }
64
65     public void setTable(DatabaseTable table) {
66         this.table = table;
67     }
68
69     public DatabaseCall buildCall(AbstractSession session) {
70         SQLCall sqlCall = buildCallWithoutReturning(session);
71         if ((getReturnFields() == null) || getReturnFields().isEmpty()) {
72             return sqlCall;
73         } else {
74             return session.getPlatform().buildCallWithReturning(sqlCall, getReturnFields());
75         }
76     }
77
78     protected SQLCall buildCallWithoutReturning(AbstractSession session) {
79         return null;
80     }
81 }
82
Popular Tags