KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > commons > dsi > dml > DeleteStatement


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * 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 JavaDoc 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 JavaDoc 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 JavaDoc getTable() throws DataStoreException {
61         String JavaDoc 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 }
Popular Tags