Package org.springframework.jdbc

Examples of org.springframework.jdbc.BadSqlGrammarException


          }
        }
        // Next, look for grouped error codes.
        if (Arrays.binarySearch(this.sqlErrorCodes.getBadSqlGrammarCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlEx, false);
          return new BadSqlGrammarException(task, sql, sqlEx);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getInvalidResultSetAccessCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlEx, false);
          return new InvalidResultSetAccessException(task, sql, sqlEx);
        }
View Full Code Here


      }
      else if (ex instanceof SQLInvalidAuthorizationSpecException) {
        return new PermissionDeniedDataAccessException(buildMessage(task, sql, ex), ex);
      }
      else if (ex instanceof SQLSyntaxErrorException) {
        return new BadSqlGrammarException(task, sql, ex);
      }
      else if (ex instanceof SQLFeatureNotSupportedException) {
        return new InvalidDataAccessApiUsageException(buildMessage(task, sql, ex), ex);
      }
    }
View Full Code Here

      String classCode = sqlState.substring(0, 2);
      if (logger.isDebugEnabled()) {
        logger.debug("Extracted SQL state class '" + classCode + "' from value '" + sqlState + "'");
      }
      if (BAD_SQL_GRAMMAR_CODES.contains(classCode)) {
        return new BadSqlGrammarException(task, sql, ex);
      }
      else if (DATA_INTEGRITY_VIOLATION_CODES.contains(classCode)) {
        return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
      }
      else if (DATA_ACCESS_RESOURCE_FAILURE_CODES.contains(classCode)) {
View Full Code Here

          }
        }
        // Next, look for grouped error codes.
        if (Arrays.binarySearch(this.sqlErrorCodes.getBadSqlGrammarCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlEx, false);
          return new BadSqlGrammarException(task, sql, sqlEx);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getInvalidResultSetAccessCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlEx, false);
          return new InvalidResultSetAccessException(task, sql, sqlEx);
        }
View Full Code Here

      }
      else if (ex instanceof SQLNonTransientConnectionException) {
        return new DataAccessResourceFailureException(buildMessage(task, sql, ex), ex);
      }
      else if (ex instanceof SQLSyntaxErrorException) {
        return new BadSqlGrammarException(task, sql, ex);
      }
    }
    else if (ex instanceof SQLRecoverableException) {
      return new RecoverableDataAccessException(buildMessage(task, sql, ex), ex);
    }
View Full Code Here

                if (logger.isWarnEnabled()) {
                    logger.warn("Column \'" + column // NL
                            + "\' must be number, but: " + columnValue);
                }

                throw new BadSqlGrammarException("HashRouter.convert", "Column \'" + column // NL
                        + "\' must be number, but: " + columnValue, null);
            }
        }
    }
View Full Code Here

                if (logger.isWarnEnabled()) {
                    logger.warn("Column \'" + column // NL
                            + "\' must be date/time, but: " + columnValue);
                }

                throw new BadSqlGrammarException("RangeRouter.convert", "Column \'" + column
                        + "\' must be date/time, but: " + columnValue, null);
            }
        }
    }
View Full Code Here

                if (logger.isWarnEnabled()) {
                    logger.warn("Column \'" + column // NL
                            + "\' must be number, but: " + columnValue);
                }

                throw new BadSqlGrammarException("HashRouter.convert", "Column \'" + column // NL
                        + "\' must be number, but: " + columnValue, null);
            }
        }
    }
View Full Code Here

            Object columnValue = null;

            if (column != null) {
                columnValue = findShardParamValue(runtime, column);
                if (columnValue == null) {
                    throw new BadSqlGrammarException("sharding", parseInfo.getSQL(), null);
                }
            }

            // 获得散表的名称
            forwardTableName = routingInfo.getTableRouter().doRoute(columnValue);
View Full Code Here

    }

    // 查找散表参数
    protected static Object findShardParamValue(StatementRuntime runtime, Column column) {
        if (runtime.getMetaData().getShardByIndex() < 0) {
            throw new BadSqlGrammarException("interpreter.findShardParamValue@ShardByIndex < 0", "SQL [" + runtime.getSQL()
                    + "] shardByIndex: " // NL
                    + runtime.getMetaData().getShardByIndex(), null);
        }
        Object value = null;
        int sqlIndex = runtime.getMetaData().getShardByIndex() + 1;
        Map<String, Object> parameters = runtime.getParameters();
        value = parameters.get(":" + sqlIndex);
        if (value == null) {
            throw new BadSqlGrammarException("interpreter.findShardParamValue@ShardParam", "SQL [" + runtime.getSQL()
                    + "] Query without shard parameter: " + runtime.getParameters().toString(), null);
        }
        return value;
    }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.BadSqlGrammarException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.