136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe/*
236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * Licensed to the Apache Software Foundation (ASF) under one or more
336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * contributor license agreements.  See the NOTICE file distributed with
436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * this work for additional information regarding copyright ownership.
536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * The ASF licenses this file to You under the Apache License, Version 2.0
636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * (the "License"); you may not use this file except in compliance with
736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * the License.  You may obtain a copy of the License at
836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe *
936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe *     http://www.apache.org/licenses/LICENSE-2.0
1036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe *
1136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * Unless required by applicable law or agreed to in writing, software
1236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * distributed under the License is distributed on an "AS IS" BASIS,
1336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * See the License for the specific language governing permissions and
1536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * limitations under the License.
1636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe */
1736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
1836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpepackage java.sql;
1936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
2036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe/**
2136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * An exception, which is subclass of SQLException, is thrown when various data
2236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * errors arise. These errors including division by 0 and invalid arguments to
2336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe * functions
2436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe */
2536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpepublic class SQLDataException extends SQLNonTransientException {
2636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
2736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    private static final long serialVersionUID = -6889123282670549800L;
2836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
2936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    /**
3036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Creates an SQLDataException object. The Reason string is set to null, the
3136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * SQLState string is set to null and the Error Code is set to 0.
3236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     */
3336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    public SQLDataException() {
3436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    }
3536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
3636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    /**
3736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Creates an SQLDataException object. The Reason string is set to the given
3836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * reason string, the SQLState string is set to null and the Error Code is
3936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * set to 0.
4036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *
4136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param reason
4236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the Reason string
4336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     */
4436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    public SQLDataException(String reason) {
4536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe        super(reason, null, 0);
4636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    }
4736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
4836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    /**
4936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Creates an SQLDataException object. The Reason string is set to the given
5036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * reason string, the SQLState string is set to the given SQLState string
5136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * and the Error Code is set to 0.
5236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *
5336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param reason
5436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the Reason string
5536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param sqlState
5636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the SQLState string
5736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     */
5836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    public SQLDataException(String reason, String sqlState) {
5936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe        super(reason, sqlState, 0);
6036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    }
6136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
6236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    /**
6336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Creates an SQLDataException object. The Reason string is set to the given
6436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * reason string, the SQLState string is set to the given SQLState string
6536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * and the Error Code is set to the given error code value.
6636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *
6736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param reason
6836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the Reason string
6936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param sqlState
7036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the SQLState string
7136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param vendorCode
7236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the integer value for the error code
7336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     */
7436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    public SQLDataException(String reason, String sqlState, int vendorCode) {
7536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe        super(reason, sqlState, vendorCode);
7636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    }
7736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
7836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    /**
7936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Creates an SQLDataException object. The Reason string is set to the null
8036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * if cause == null or cause.toString() if cause!=null,and the cause
8136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Throwable object is set to the given cause Throwable object.
8236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *
8336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param cause
8436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the Throwable object for the underlying reason this
8536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            SQLException
8636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     */
8736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    public SQLDataException(Throwable cause) {
8836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe        super(cause);
8936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    }
9036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
9136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    /**
9236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Creates an SQLDataException object. The Reason string is set to the given
9336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * and the cause Throwable object is set to the given cause Throwable
9436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * object.
9536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *
9636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param reason
9736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the Reason string
9836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param cause
9936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the Throwable object for the underlying reason this
10036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            SQLException
10136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     */
10236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    public SQLDataException(String reason, Throwable cause) {
10336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe        super(reason, cause);
10436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    }
10536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
10636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    /**
10736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Creates an SQLDataException object. The Reason string is set to the given
10836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * reason string, the SQLState string is set to the given SQLState string
10936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * and the cause Throwable object is set to the given cause Throwable
11036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * object.
11136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *
11236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param reason
11336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the Reason string
11436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param sqlState
11536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the SQLState string
11636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param cause
11736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the Throwable object for the underlying reason this
11836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            SQLException
11936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     */
12036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    public SQLDataException(String reason, String sqlState, Throwable cause) {
12136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe        super(reason, sqlState, cause);
12236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    }
12336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe
12436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    /**
12536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Creates an SQLDataException object. The Reason string is set to the given
12636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * reason string, the SQLState string is set to the given SQLState string ,
12736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * the Error Code is set to the given error code value, and the cause
12836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * Throwable object is set to the given cause Throwable object.
12936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *
13036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param reason
13136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the Reason string
13236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param sqlState
13336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the string to use as the SQLState string
13436b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param vendorCode
13536b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the integer value for the error code
13636b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     * @param cause
13736b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            the Throwable object for the underlying reason this
13836b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     *            SQLException
13936b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe     */
14036b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    public SQLDataException(String reason, String sqlState, int vendorCode,
14136b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe            Throwable cause) {
14236b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe        super(reason, sqlState, vendorCode, cause);
14336b3cdfbcd219d0308753d919638262c16fd34daJeremy Sharpe    }
14432c2297a959b72abdb18743f0519e1d8b7c7ea88Elliott Hughes}
145