Skip to content

Commit

Permalink
Redefine SyntaxSQLException's vendor codes (apache#20917)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Sep 11, 2022
1 parent e9b0b03 commit c529653
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| HY004 | 11005 | Unsupported conversion stream charset \`%s\` |
| HY004 | 11006 | Unsupported conversion data type \`%s\` for value \`%s\` |
| 42000 | 12000 | You have an error in your SQL syntax: %s |
| HV008 | 12002 | Column index \`%d\` is out of range |
| 42S02 | 12003 | Can not find column label \`%s\` |
| 0A000 | 12004 | DROP TABLE ... CASCADE is not supported |
| HY000 | 12005 | Could not support variable \`%s\` |
| HY004 | 12010 | SQL String can not be NULL or empty |
| 42000 | 12001 | SQL String can not be NULL or empty |
| 42000 | 12002 | Could not support variable \`%s\` |
| 0A000 | 12003 | DROP TABLE ... CASCADE is not supported |
| 42S02 | 12004 | Can not find column label \`%s\` |
| HV008 | 12005 | Column index \`%d\` is out of range |
| 01000 | 13000 | Circuit break open, the request has been ignored |
| 08000 | 13001 | Can not get %d connections one time, partition succeed connection(%d) have released. Please consider increasing the \`maxPoolSize\` of the data sources or decreasing the \`max-connections-size-per-query\` in properties |
| 08000 | 13002 | Connection has been closed |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| HY004 | 11005 | Unsupported conversion stream charset \`%s\` |
| HY004 | 11006 | Unsupported conversion data type \`%s\` for value \`%s\` |
| 42000 | 12000 | You have an error in your SQL syntax: %s |
| HV008 | 12002 | Column index \`%d\` is out of range |
| 42S02 | 12003 | Can not find column label \`%s\` |
| 0A000 | 12004 | DROP TABLE ... CASCADE is not supported |
| HY000 | 12005 | Could not support variable \`%s\` |
| HY004 | 12010 | SQL String can not be NULL or empty |
| 42000 | 12001 | SQL String can not be NULL or empty |
| 42000 | 12002 | Could not support variable \`%s\` |
| 0A000 | 12003 | DROP TABLE ... CASCADE is not supported |
| 42S02 | 12004 | Can not find column label \`%s\` |
| HV008 | 12005 | Column index \`%d\` is out of range |
| 01000 | 13000 | Circuit break open, the request has been ignored |
| 08000 | 13001 | Can not get %d connections one time, partition succeed connection(%d) have released. Please consider increasing the \`maxPoolSize\` of the data sources or decreasing the \`max-connections-size-per-query\` in properties |
| 08000 | 13002 | Connection has been closed |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.shardingsphere.driver.jdbc.core.datasource.metadata.ShardingSphereDatabaseMetaData;
import org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement;
import org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement;
import org.apache.shardingsphere.driver.jdbc.exception.ConnectionClosedException;
import org.apache.shardingsphere.driver.jdbc.exception.connection.ConnectionClosedException;
import org.apache.shardingsphere.infra.context.ConnectionContext;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.mode.manager.ContextManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package org.apache.shardingsphere.driver.jdbc.core.resultset;

import lombok.EqualsAndHashCode;
import org.apache.shardingsphere.driver.jdbc.exception.ColumnIndexOutOfRangeException;
import org.apache.shardingsphere.driver.jdbc.exception.ColumnLabelNotFoundException;
import org.apache.shardingsphere.driver.jdbc.exception.ResultSetClosedException;
import org.apache.shardingsphere.driver.jdbc.exception.syntax.ColumnIndexOutOfRangeException;
import org.apache.shardingsphere.driver.jdbc.exception.syntax.ColumnLabelNotFoundException;
import org.apache.shardingsphere.driver.jdbc.exception.connection.ResultSetClosedException;
import org.apache.shardingsphere.driver.jdbc.unsupported.AbstractUnsupportedDatabaseMetaDataResultSet;
import org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.util.ResultSetUtil;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.driver.jdbc.adapter.WrapperAdapter;
import org.apache.shardingsphere.driver.jdbc.exception.ColumnIndexOutOfRangeException;
import org.apache.shardingsphere.driver.jdbc.exception.syntax.ColumnIndexOutOfRangeException;
import org.apache.shardingsphere.infra.binder.segment.select.projection.DerivedColumn;
import org.apache.shardingsphere.infra.binder.segment.select.projection.Projection;
import org.apache.shardingsphere.infra.binder.segment.select.projection.impl.AggregationDistinctProjection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet;
import org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSetUtil;
import org.apache.shardingsphere.driver.jdbc.core.statement.metadata.ShardingSphereParameterMetaData;
import org.apache.shardingsphere.driver.jdbc.exception.EmptySQLException;
import org.apache.shardingsphere.driver.jdbc.exception.syntax.EmptySQLException;
import org.apache.shardingsphere.infra.binder.QueryContext;
import org.apache.shardingsphere.infra.binder.SQLStatementContextFactory;
import org.apache.shardingsphere.infra.binder.aware.ParameterAware;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
import org.apache.shardingsphere.driver.jdbc.core.resultset.GeneratedKeysResultSet;
import org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet;
import org.apache.shardingsphere.driver.jdbc.exception.EmptySQLException;
import org.apache.shardingsphere.driver.jdbc.exception.JDBCTransactionAcrossDatabasesException;
import org.apache.shardingsphere.driver.jdbc.exception.syntax.EmptySQLException;
import org.apache.shardingsphere.driver.jdbc.exception.transaction.JDBCTransactionAcrossDatabasesException;
import org.apache.shardingsphere.infra.binder.QueryContext;
import org.apache.shardingsphere.infra.binder.SQLStatementContextFactory;
import org.apache.shardingsphere.infra.binder.decider.context.SQLFederationDeciderContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.driver.jdbc.exception;
package org.apache.shardingsphere.driver.jdbc.exception.connection;

import org.apache.shardingsphere.infra.exception.ConnectionSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.driver.jdbc.exception;
package org.apache.shardingsphere.driver.jdbc.exception.connection;

import org.apache.shardingsphere.infra.exception.ConnectionSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.driver.jdbc.exception;
package org.apache.shardingsphere.driver.jdbc.exception.syntax;

import org.apache.shardingsphere.infra.exception.SyntaxSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
Expand All @@ -28,6 +28,6 @@ public final class ColumnIndexOutOfRangeException extends SyntaxSQLException {
private static final long serialVersionUID = 3599337605134702447L;

public ColumnIndexOutOfRangeException(final int columnIndex) {
super(XOpenSQLState.INVALID_COLUMN_NUMBER, 2, "Column index `%d` is out of range", columnIndex);
super(XOpenSQLState.INVALID_COLUMN_NUMBER, 5, "Column index `%d` is out of range", columnIndex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.driver.jdbc.exception;
package org.apache.shardingsphere.driver.jdbc.exception.syntax;

import org.apache.shardingsphere.infra.exception.SyntaxSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
Expand All @@ -28,6 +28,6 @@ public final class ColumnLabelNotFoundException extends SyntaxSQLException {
private static final long serialVersionUID = -4634399403612501335L;

public ColumnLabelNotFoundException(final String columnLabel) {
super(XOpenSQLState.NOT_FOUND, 3, "Can not find column label `%s`", columnLabel);
super(XOpenSQLState.NOT_FOUND, 4, "Can not find column label `%s`", columnLabel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.driver.jdbc.exception;
package org.apache.shardingsphere.driver.jdbc.exception.syntax;

import org.apache.shardingsphere.infra.exception.SyntaxSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
Expand All @@ -28,6 +28,6 @@ public final class EmptySQLException extends SyntaxSQLException {
private static final long serialVersionUID = -5723825491720138339L;

public EmptySQLException() {
super(XOpenSQLState.GENERAL_ERROR, 10, "SQL String can not be NULL or empty");
super(XOpenSQLState.SYNTAX_ERROR, 1, "SQL String can not be NULL or empty");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.driver.jdbc.exception;
package org.apache.shardingsphere.driver.jdbc.exception.transaction;

import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import org.apache.shardingsphere.transaction.exception.TransactionSQLException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public final class UnsupportedDropCascadeTableException extends SyntaxSQLExcepti
private static final long serialVersionUID = -5995575055241171117L;

public UnsupportedDropCascadeTableException() {
super(XOpenSQLState.FEATURE_NOT_SUPPORTED, 4, "DROP TABLE ... CASCADE is not supported");
super(XOpenSQLState.FEATURE_NOT_SUPPORTED, 3, "DROP TABLE ... CASCADE is not supported");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public final class UnsupportedVariableException extends SyntaxSQLException {
private static final long serialVersionUID = 1955281568807066737L;

public UnsupportedVariableException(final String variable) {
super(XOpenSQLState.GENERAL_ERROR, 5, "Could not support variable `%s`", variable);
super(XOpenSQLState.SYNTAX_ERROR, 2, "Could not support variable `%s`", variable);
}
}

0 comments on commit c529653

Please sign in to comment.