OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / libcore / luni / src / main / java / java / sql / SQLIntegrityConstraintViolationException.java
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
18 package java.sql;
19
20 /**
21  * An exception, which is subclass of SQLNonTransientException, is thrown when
22  * various the an integrity constraint (foreign key, primary key or unique key)
23  * has been violated.
24  */
25 public class SQLIntegrityConstraintViolationException extends
26         SQLNonTransientException {
27
28     private static final long serialVersionUID = 8033405298774849169L;
29
30     /**
31      * Creates an SQLIntegrityConstraintViolationException object. The Reason
32      * string is set to null, the SQLState string is set to null and the Error
33      * Code is set to 0.
34      */
35     public SQLIntegrityConstraintViolationException() {
36         super();
37     }
38
39     /**
40      * Creates an SQLIntegrityConstraintViolationException object. The Reason
41      * string is set to the given reason string, the SQLState string is set to
42      * null and the Error Code is set to 0.
43      *
44      * @param reason
45      *            the string to use as the Reason string
46      */
47     public SQLIntegrityConstraintViolationException(String reason) {
48         super(reason, null, 0);
49     }
50
51     /**
52      * Creates an SQLIntegrityConstraintViolationException object. The Reason
53      * string is set to the given reason string, the SQLState string is set to
54      * the given SQLState string and the Error Code is set to 0.
55      *
56      * @param reason
57      *            the string to use as the Reason string
58      * @param sqlState
59      *            the string to use as the SQLState string
60      */
61     public SQLIntegrityConstraintViolationException(String reason,
62             String sqlState) {
63         super(reason, sqlState, 0);
64     }
65
66     /**
67      * Creates an SQLIntegrityConstraintViolationException object. The Reason
68      * string is set to the given reason string, the SQLState string is set to
69      * the given SQLState string and the Error Code is set to the given error
70      * code value.
71      *
72      * @param reason
73      *            the string to use as the Reason string
74      * @param sqlState
75      *            the string to use as the SQLState string
76      * @param vendorCode
77      *            the integer value for the error code
78      */
79     public SQLIntegrityConstraintViolationException(String reason,
80             String sqlState, int vendorCode) {
81         super(reason, sqlState, vendorCode);
82     }
83
84     /**
85      * Creates an SQLIntegrityConstraintViolationException object. The Reason
86      * string is set to the null if cause == null or cause.toString() if
87      * cause!=null,and the cause Throwable object is set to the given cause
88      * Throwable object.
89      *
90      * @param cause
91      *            the Throwable object for the underlying reason this
92      *            SQLException
93      */
94     public SQLIntegrityConstraintViolationException(Throwable cause) {
95         super(cause);
96     }
97
98     /**
99      * Creates an SQLIntegrityConstraintViolationException object. The Reason
100      * string is set to the given and the cause Throwable object is set to the
101      * given cause Throwable object.
102      *
103      * @param reason
104      *            the string to use as the Reason string
105      * @param cause
106      *            the Throwable object for the underlying reason this
107      *            SQLException
108      */
109     public SQLIntegrityConstraintViolationException(String reason,
110             Throwable cause) {
111         super(reason, cause);
112     }
113
114     /**
115      * Creates an SQLIntegrityConstraintViolationException object. The Reason
116      * string is set to the given reason string, the SQLState string is set to
117      * the given SQLState string and the cause Throwable object is set to the
118      * given cause Throwable object.
119      *
120      * @param reason
121      *            the string to use as the Reason string
122      * @param sqlState
123      *            the string to use as the SQLState string
124      * @param cause
125      *            the Throwable object for the underlying reason this
126      *            SQLException
127      */
128     public SQLIntegrityConstraintViolationException(String reason,
129             String sqlState, Throwable cause) {
130         super(reason, sqlState, cause);
131     }
132
133     /**
134      * Creates an SQLIntegrityConstraintViolationException object. The Reason
135      * string is set to the given reason string, the SQLState string is set to
136      * the given SQLState string , the Error Code is set to the given error code
137      * value, and the cause Throwable object is set to the given cause Throwable
138      * object.
139      *
140      * @param reason
141      *            the string to use as the Reason string
142      * @param sqlState
143      *            the string to use as the SQLState string
144      * @param vendorCode
145      *            the integer value for the error code
146      * @param cause
147      *            the Throwable object for the underlying reason this
148      *            SQLException
149      */
150     public SQLIntegrityConstraintViolationException(String reason,
151             String sqlState, int vendorCode, Throwable cause) {
152         super(reason, sqlState, vendorCode, cause);
153     }
154 }