Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/sql/SQLSyntaxErrorException.java
38829 views
/*1* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.sql;2627/**28* The subclass of {@link SQLException} thrown when the SQLState class value29* is '<i>42</i>', or under vendor-specified conditions. This indicates that the30* in-progress query has violated SQL syntax rules.31* <p>32* Please consult your driver vendor documentation for the vendor-specified33* conditions for which this <code>Exception</code> may be thrown.34* @since 1.635*/36public class SQLSyntaxErrorException extends SQLNonTransientException {3738/**39* Constructs a <code>SQLSyntaxErrorException</code> object.40* The <code>reason</code>, <code>SQLState</code> are initialized41* to <code>null</code> and the vendor code is initialized to 0.42*43* The <code>cause</code> is not initialized, and may subsequently be44* initialized by a call to the45* {@link Throwable#initCause(java.lang.Throwable)} method.46* <p>47* @since 1.648*/49public SQLSyntaxErrorException() {50super();51}5253/**54* Constructs a <code>SQLSyntaxErrorException</code> object55* with a given <code>reason</code>. The <code>SQLState</code>56* is initialized to <code>null</code> and the vendor code is initialized57* to 0.58*59* The <code>cause</code> is not initialized, and may subsequently be60* initialized by a call to the61* {@link Throwable#initCause(java.lang.Throwable)} method.62* <p>63* @param reason a description of the exception64* @since 1.665*/66public SQLSyntaxErrorException(String reason) {67super(reason);68}6970/**71* Constructs a <code>SQLSyntaxErrorException</code> object72* with a given <code>reason</code> and <code>SQLState</code>.73*74* The <code>cause</code> is not initialized, and may subsequently be75* initialized by a call to the76* {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code77* is initialized to 0.78* <p>79* @param reason a description of the exception80* @param SQLState an XOPEN or SQL:2003 code identifying the exception81* @since 1.682*/83public SQLSyntaxErrorException(String reason, String SQLState) {84super(reason, SQLState);85}8687/**88* Constructs a <code>SQLSyntaxErrorException</code> object89* with a given <code>reason</code>, <code>SQLState</code> and90* <code>vendorCode</code>.91*92* The <code>cause</code> is not initialized, and may subsequently be93* initialized by a call to the94* {@link Throwable#initCause(java.lang.Throwable)} method.95* <p>96* @param reason a description of the exception97* @param SQLState an XOPEN or SQL:2003 code identifying the exception98* @param vendorCode a database vendor specific exception code99* @since 1.6100*/101public SQLSyntaxErrorException(String reason, String SQLState, int vendorCode) {102super(reason, SQLState, vendorCode);103}104105/**106* Constructs a <code>SQLSyntaxErrorException</code> object107* with a given <code>cause</code>.108* The <code>SQLState</code> is initialized109* to <code>null</code> and the vendor code is initialized to 0.110* The <code>reason</code> is initialized to <code>null</code> if111* <code>cause==null</code> or to <code>cause.toString()</code> if112* <code>cause!=null</code>.113* <p>114* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating115* the cause is non-existent or unknown.116* @since 1.6117*/118public SQLSyntaxErrorException(Throwable cause) {119super(cause);120}121122/**123* Constructs a <code>SQLSyntaxErrorException</code> object124* with a given125* <code>reason</code> and <code>cause</code>.126* The <code>SQLState</code> is initialized to <code>null</code>127* and the vendor code is initialized to 0.128* <p>129* @param reason a description of the exception.130* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating131* the cause is non-existent or unknown.132* @since 1.6133*/134public SQLSyntaxErrorException(String reason, Throwable cause) {135super(reason, cause);136}137138/**139* Constructs a <code>SQLSyntaxErrorException</code> object140* with a given141* <code>reason</code>, <code>SQLState</code> and <code>cause</code>.142* The vendor code is initialized to 0.143* <p>144* @param reason a description of the exception.145* @param SQLState an XOPEN or SQL:2003 code identifying the exception146* @param cause the (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating147* the cause is non-existent or unknown.148* @since 1.6149*/150public SQLSyntaxErrorException(String reason, String SQLState, Throwable cause) {151super(reason, SQLState, cause);152}153154/**155* Constructs a <code>SQLSyntaxErrorException</code> object156* with a given157* <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>158* and <code>cause</code>.159* <p>160* @param reason a description of the exception161* @param SQLState an XOPEN or SQL:2003 code identifying the exception162* @param vendorCode a database vendor-specific exception code163* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating164* the cause is non-existent or unknown.165* @since 1.6166*/167public SQLSyntaxErrorException(String reason, String SQLState, int vendorCode, Throwable cause) {168super(reason, SQLState, vendorCode, cause);169}170171private static final long serialVersionUID = -1843832610477496053L;172}173174175