Examples of Limit


Examples of com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit

    public static boolean visit(MappingVisitor visitor, MySqlSelectQueryBlock x) {
        Integer maxLimit = visitor.getEngine().getMaxLimit();

        if (maxLimit != null) {
            if (x.getLimit() == null) {
                Limit limit = new Limit();
                limit.setRowCount(new SQLIntegerExpr(maxLimit));
                x.setLimit(limit);
            } else {
                SQLNumericLiteralExpr rowCountExpr = (SQLNumericLiteralExpr) x.getLimit().getRowCount();
                int rowCount = rowCountExpr.getNumber().intValue();
                if (rowCount > maxLimit.intValue()) {
View Full Code Here

Examples of com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit

        Integer maxLimit = engine.getMaxLimit();

        if (maxLimit != null) {
            if (query.getLimit() == null) {
                Limit limit = new Limit();
                limit.setRowCount(new SQLIntegerExpr(maxLimit));
                query.setLimit(limit);
            } else {
                SQLNumericLiteralExpr rowCountExpr = (SQLNumericLiteralExpr) query.getLimit().getRowCount();
                int rowCount = rowCountExpr.getNumber().intValue();
                if (rowCount > maxLimit.intValue()) {
View Full Code Here

Examples of com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit

    private static String limitMySqlQueryBlock(MySqlSelectQueryBlock queryBlock, String dbType, int offset, int count) {
        if (queryBlock.getLimit() != null) {
            throw new IllegalArgumentException("limit already exists.");
        }

        Limit limit = new Limit();
        if (offset > 0) {
            limit.setOffset(new SQLNumberExpr(offset));
        }
        limit.setRowCount(new SQLNumberExpr(count));
        queryBlock.setLimit(limit);

        return SQLUtils.toSQLString(queryBlock, dbType);
    }
View Full Code Here

Examples of com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit

        Integer maxLimit = engine.getMaxLimit();

        if (maxLimit != null) {
            if (query.getLimit() == null) {
                Limit limit = new Limit();
                limit.setRowCount(new SQLIntegerExpr(maxLimit));
                query.setLimit(limit);
            } else {
                SQLNumericLiteralExpr rowCountExpr = (SQLNumericLiteralExpr) query.getLimit().getRowCount();
                int rowCount = rowCountExpr.getNumber().intValue();
                if (rowCount > maxLimit.intValue()) {
View Full Code Here

Examples of com.alu.e3.data.model.Limit

    HashSet<Integer> lockedSet = new HashSet<Integer>();
   
    try {
      // step1 : test if call is success
      Iterator<CallDescriptor> it = authIdentity.getCallDescriptors().iterator();
      Limit limit = new Limit();

      while (it.hasNext()) {
        CallDescriptor callDescriptor = it.next();
        Integer bucketID = callDescriptor.getBucketId();
        Integer contextId = callDescriptor.getContextId();

        this.dataManager.fillLimitsById(contextId, limit);

        if ((limit.getQuotaPerDay()!=null) || (limit.getQuotaPerWeek()!=null) || (limit.getQuotaPerMonth()!=null)
            || (limit.getRateLimitPerMinute()!=null) || (limit.getRateLimitPerSecond()!=null)) {     
         
          LockCounter lock = this.gdm.getLockForBucket(bucketID);
         
          synchronized (lock) {
         
            lockedSet.add(bucketID);

            GatewayRate gr = gatewayRateValidator.getRateForBucket(bucketID, limit, mustResetRateLimit);
           
            gatewayRateValidator.updateRateLimitAndQuotaValues(gr, limit, currentTime);
           
            params.gr = gr;
            params.limit = limit;
            params.callDescriptor = callDescriptor;
           
            gatewayRateValidator.checkRateLimitAndQuota(apiCallStatus, params);
           
            this.gdm.releaseLockForBucket(bucketID, lock);
            lockedSet.remove(bucketID);
          }
        }
      }
     
      // TODO: maybe increment always in previous loop and decrement all gr only if call was failed
      // step2: save data for call success or fail
      it = authIdentity.getCallDescriptors().iterator();
      while (it.hasNext())
      {
        CallDescriptor callDescriptor = it.next();
        Integer bucketID = callDescriptor.getBucketId();
        Integer contextId = callDescriptor.getContextId();
        this.dataManager.fillLimitsById(contextId, limit);

        if ((limit.getQuotaPerDay()!=null) || (limit.getQuotaPerWeek()!=null) || (limit.getQuotaPerMonth()!=null)
            || (limit.getRateLimitPerMinute()!=null) || (limit.getRateLimitPerSecond()!=null))
        { 
          LockCounter lock = this.gdm.getLockForBucket(bucketID);

          synchronized (lock) {
           
View Full Code Here

Examples of com.googlecode.gql4j.GqlQuery.Limit

 
  @Test
  public void testLimit_1() {
    ParseResult actual = GqlQuery.parse("SELECT * from a limit 5");
    ParseResult expected = new ParseResult().setSelect(new Select(false)).setFrom(new From("a"
        )).setLimit(new Limit(5));
    assertEquals(expected, actual);
  }
View Full Code Here

Examples of com.googlecode.gql4j.GqlQuery.Limit

 
  @Test
  public void testOffset_1() {
    ParseResult actual = GqlQuery.parse("SELECT * from a limit 5 offset 10");
    ParseResult expected = new ParseResult().setSelect(new Select(false)).setFrom(new From("a"
        )).setLimit(new Limit(5)).setOffset(new Offset(10));
    assertEquals(expected, actual);
  }
View Full Code Here

Examples of com.jcabi.github.Limit

    @Override
    @NotNull(message = "limit is never NULL")
    public Limit get(@NotNull(message = "resource shouldn't be NULL")
        final String resource) {
        // @checkstyle AnonInnerLength (50 lines)
        return new Limit() {
            @Override
            public Github github() {
                return MkLimits.this.github();
            }
            @Override
View Full Code Here

Examples of com.jetdrone.vertx.yoke.middleware.Limit

    @Test
    public void testJsonBodyLengthLimit() {

        Yoke yoke = new Yoke(this);
        yoke.use(new Limit(5L));
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                fail("Body should have been too long");
View Full Code Here

Examples of eu.admire.dispel.modifiers.Limit

   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String getText(Object object) {
    Limit limit = (Limit)object;
    return getString("_UI_Limit_type") + " " + limit.getElements();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.