All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scalar.db.storage.jdbc.query.SelectWithTop Maven / Gradle / Ivy

Go to download

A universal transaction manager that achieves database-agnostic transactions and distributed transactions that span multiple databases

There is a newer version: 3.14.0
Show newest version
package com.scalar.db.storage.jdbc.query;

import javax.annotation.concurrent.ThreadSafe;

@ThreadSafe
public class SelectWithTop extends SimpleSelectQuery {

  private final int limit;

  public SelectWithTop(Builder builder, int limit) {
    super(builder);
    assert limit > 0;
    this.limit = limit;
  }

  @Override
  public String sql() {
    // This inserts "TOP ${limit}" clause, specific to SqlServer, right after the "SELECT" clause of
    // the query returned by super.sql()
    return new StringBuilder(super.sql()).insert(7, "TOP " + limit + " ").toString();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy