Search in sources :

Example 26 with FullQuery

use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.

the class RangePredicateHelperTest method endRowExclusiveForward.

@Test
public void endRowExclusiveForward() {
    FullQuery.Builder builder = FullQuery.builder();
    RangePredicateHelper.create(false, DBType.ORACLE, builder).endRowExclusive(ROW_NAME);
    FullQuery query = builder.build();
    assertThat(query.getQuery(), equalTo(" AND row_name < ? "));
    assertThat(query.getArgs(), arrayContaining((Object) ROW_NAME));
}
Also used : FullQuery(com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery) Test(org.junit.Test)

Example 27 with FullQuery

use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.

the class RangePredicateHelperTest method startCellTsInclusiveForwardOracle.

@Test
public void startCellTsInclusiveForwardOracle() {
    FullQuery.Builder builder = FullQuery.builder();
    RangePredicateHelper.create(false, DBType.ORACLE, builder).startCellTsInclusive(ROW_NAME, COL_NAME, TS);
    FullQuery query = builder.build();
    assertThat(query.getQuery(), equalTo(" AND (row_name >= ? AND (row_name > ? OR col_name > ? OR (col_name = ? AND ts >= ?)))"));
    assertThat(query.getArgs(), arrayContaining(ROW_NAME, ROW_NAME, COL_NAME, COL_NAME, TS));
}
Also used : FullQuery(com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery) Test(org.junit.Test)

Example 28 with FullQuery

use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.

the class RangePredicateHelperTest method columnSelection.

@Test
public void columnSelection() {
    byte[] colTwo = new byte[] { 7, 8, 9 };
    FullQuery.Builder builder = FullQuery.builder();
    RangePredicateHelper.create(false, DBType.ORACLE, builder).columnSelection(ImmutableList.of(COL_NAME, colTwo));
    FullQuery query = builder.build();
    assertThat(query.getQuery(), equalTo(" AND (col_name = ? OR col_name = ?) "));
    assertThat(query.getArgs(), arrayContaining(COL_NAME, colTwo));
}
Also used : FullQuery(com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery) Test(org.junit.Test)

Example 29 with FullQuery

use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.

the class RangePredicateHelperTest method startCellInclusiveForwardPostgres.

@Test
public void startCellInclusiveForwardPostgres() {
    FullQuery.Builder builder = FullQuery.builder();
    RangePredicateHelper.create(false, DBType.POSTGRESQL, builder).startCellInclusive(ROW_NAME, COL_NAME);
    FullQuery query = builder.build();
    assertThat(query.getQuery(), equalTo(" AND (row_name, col_name) >= (?, ?)"));
    assertThat(query.getArgs(), arrayContaining(ROW_NAME, COL_NAME));
}
Also used : FullQuery(com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery) Test(org.junit.Test)

Example 30 with FullQuery

use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.

the class RangePredicateHelperTest method startCellInclusiveEmptyColName.

@Test
public void startCellInclusiveEmptyColName() {
    FullQuery.Builder builder = FullQuery.builder();
    RangePredicateHelper.create(false, DBType.ORACLE, builder).startCellInclusive(ROW_NAME, PtBytes.EMPTY_BYTE_ARRAY);
    FullQuery query = builder.build();
    assertThat(query.getQuery(), equalTo(" AND row_name >= ? "));
    assertThat(query.getArgs(), arrayContaining((Object) ROW_NAME));
}
Also used : FullQuery(com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery) Test(org.junit.Test)

Aggregations

FullQuery (com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery)45 Test (org.junit.Test)18 AgnosticLightResultRow (com.palantir.nexus.db.sql.AgnosticLightResultRow)1