01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19: package org.openharmonise.commons.dsi.dml;
20:
21: import org.openharmonise.commons.dsi.*;
22:
23: /**
24: * A DML delete statement.
25: *
26: * @author Michael Bell
27: * @version $Revision: 1.2 $
28: *
29: */
30: public class DeleteStatement extends AbstractDMLStatement {
31:
32: /**
33: * The name of the table to delete data from.
34: */
35: String m_sTable = null;
36:
37: /**
38: * Constructs a delete statement.
39: *
40: */
41: public DeleteStatement() {
42: }
43:
44: /**
45: * Sets the name table the data has to be deleted from.
46: *
47: * @param sTable the table the data has to be deleted from
48: */
49: public void setTable(String sTable) {
50: m_sTable = sTable;
51: }
52:
53: /**
54: * Returns the name of the table the data has to be deleted from.
55: *
56: * @return the name of the table the data has to be delete from
57: * @throws DataStoreException if an error occurs access the
58: * table name from the where clause
59: */
60: public String getTable() throws DataStoreException {
61: String sRetr = null;
62:
63: if (m_sTable != null) {
64: sRetr = m_sTable;
65: } else if (hasWhereClause()) {
66: sRetr = m_where.getTableName(0);
67: }
68:
69: return sRetr;
70: }
71:
72: /* (non-Javadoc)
73: * @see org.openharmonise.commons.dsi.dml.AbstractDMLStatement#clear()
74: */
75: public void clear() {
76: super.clear();
77: m_sTable = null;
78: }
79: }
|