1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package java.sql;
19
20/**
21 * An exception, which is subclass of SQLException, is thrown when various data
22 * errors arise. These errors including division by 0 and invalid arguments to
23 * functions
24 */
25public class SQLDataException extends SQLNonTransientException {
26
27    private static final long serialVersionUID = -6889123282670549800L;
28
29    /**
30     * Creates an SQLDataException object. The Reason string is set to null, the
31     * SQLState string is set to null and the Error Code is set to 0.
32     */
33    public SQLDataException() {
34    }
35
36    /**
37     * Creates an SQLDataException object. The Reason string is set to the given
38     * reason string, the SQLState string is set to null and the Error Code is
39     * set to 0.
40     *
41     * @param reason
42     *            the string to use as the Reason string
43     */
44    public SQLDataException(String reason) {
45        super(reason, null, 0);
46    }
47
48    /**
49     * Creates an SQLDataException object. The Reason string is set to the given
50     * reason string, the SQLState string is set to the given SQLState string
51     * and the Error Code is set to 0.
52     *
53     * @param reason
54     *            the string to use as the Reason string
55     * @param sqlState
56     *            the string to use as the SQLState string
57     */
58    public SQLDataException(String reason, String sqlState) {
59        super(reason, sqlState, 0);
60    }
61
62    /**
63     * Creates an SQLDataException object. The Reason string is set to the given
64     * reason string, the SQLState string is set to the given SQLState string
65     * and the Error Code is set to the given error code value.
66     *
67     * @param reason
68     *            the string to use as the Reason string
69     * @param sqlState
70     *            the string to use as the SQLState string
71     * @param vendorCode
72     *            the integer value for the error code
73     */
74    public SQLDataException(String reason, String sqlState, int vendorCode) {
75        super(reason, sqlState, vendorCode);
76    }
77
78    /**
79     * Creates an SQLDataException object. The Reason string is set to the null
80     * if cause == null or cause.toString() if cause!=null,and the cause
81     * Throwable object is set to the given cause Throwable object.
82     *
83     * @param cause
84     *            the Throwable object for the underlying reason this
85     *            SQLException
86     */
87    public SQLDataException(Throwable cause) {
88        super(cause);
89    }
90
91    /**
92     * Creates an SQLDataException object. The Reason string is set to the given
93     * and the cause Throwable object is set to the given cause Throwable
94     * object.
95     *
96     * @param reason
97     *            the string to use as the Reason string
98     * @param cause
99     *            the Throwable object for the underlying reason this
100     *            SQLException
101     */
102    public SQLDataException(String reason, Throwable cause) {
103        super(reason, cause);
104    }
105
106    /**
107     * Creates an SQLDataException object. The Reason string is set to the given
108     * reason string, the SQLState string is set to the given SQLState string
109     * and the cause Throwable object is set to the given cause Throwable
110     * object.
111     *
112     * @param reason
113     *            the string to use as the Reason string
114     * @param sqlState
115     *            the string to use as the SQLState string
116     * @param cause
117     *            the Throwable object for the underlying reason this
118     *            SQLException
119     */
120    public SQLDataException(String reason, String sqlState, Throwable cause) {
121        super(reason, sqlState, cause);
122    }
123
124    /**
125     * Creates an SQLDataException object. The Reason string is set to the given
126     * reason string, the SQLState string is set to the given SQLState string ,
127     * the Error Code is set to the given error code value, and the cause
128     * Throwable object is set to the given cause Throwable object.
129     *
130     * @param reason
131     *            the string to use as the Reason string
132     * @param sqlState
133     *            the string to use as the SQLState string
134     * @param vendorCode
135     *            the integer value for the error code
136     * @param cause
137     *            the Throwable object for the underlying reason this
138     *            SQLException
139     */
140    public SQLDataException(String reason, String sqlState, int vendorCode,
141            Throwable cause) {
142        super(reason, sqlState, vendorCode, cause);
143    }
144}
145