Search in sources :

Example 66 with Statement

use of com.google.api.ads.admanager.axis.v202108.Statement in project googleads-java-lib by googleads.

the class StatementBuilderTest method testLimitOffsetDefaults.

@Test
public void testLimitOffsetDefaults() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement initialOffset = statementBuilder.limit(100).toStatement();
    assertEquals("LIMIT 100", initialOffset.getQuery());
    Statement increasedOffset = statementBuilder.increaseOffsetBy(100).toStatement();
    assertEquals("LIMIT 100 OFFSET 100", increasedOffset.getQuery());
}
Also used : Statement(com.google.api.ads.admanager.axis.v202105.Statement) Test(org.junit.Test)

Example 67 with Statement

use of com.google.api.ads.admanager.axis.v202108.Statement in project googleads-java-lib by googleads.

the class StatementBuilderTest method testBindVariables_number.

@Test
public void testBindVariables_number() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement statement = statementBuilder.where("number = :number").withBindVariableValue("number", 1).toStatement();
    String_ValueMapEntry entry = statement.getValues(0);
    assertEquals("number", entry.getKey());
    assertEquals(NumberValue.class, entry.getValue().getClass());
    assertEquals("1", ((NumberValue) entry.getValue()).getValue());
}
Also used : String_ValueMapEntry(com.google.api.ads.admanager.axis.v202108.String_ValueMapEntry) Statement(com.google.api.ads.admanager.axis.v202108.Statement) Test(org.junit.Test)

Example 68 with Statement

use of com.google.api.ads.admanager.axis.v202108.Statement in project googleads-java-lib by googleads.

the class StatementBuilderTest method testFrom_stripsFrom.

@Test
public void testFrom_stripsFrom() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement statement = statementBuilder.from("FROM line_item").toStatement();
    assertEquals("FROM line_item", statement.getQuery());
}
Also used : Statement(com.google.api.ads.admanager.axis.v202108.Statement) Test(org.junit.Test)

Example 69 with Statement

use of com.google.api.ads.admanager.axis.v202108.Statement in project googleads-java-lib by googleads.

the class StatementBuilderTest method testOrderBy_stripsOrderBy.

@Test
public void testOrderBy_stripsOrderBy() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement statement = statementBuilder.orderBy("ORDER BY id ASC").toStatement();
    assertEquals("ORDER BY id ASC", statement.getQuery());
}
Also used : Statement(com.google.api.ads.admanager.axis.v202108.Statement) Test(org.junit.Test)

Example 70 with Statement

use of com.google.api.ads.admanager.axis.v202108.Statement in project googleads-java-lib by googleads.

the class StatementBuilderTest method testLimit.

@Test
public void testLimit() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement statement = statementBuilder.limit(500).toStatement();
    assertEquals("LIMIT 500", statement.getQuery());
}
Also used : Statement(com.google.api.ads.admanager.axis.v202202.Statement) Test(org.junit.Test)

Aggregations

StatementBuilder (com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder)119 Test (org.junit.Test)61 UpdateResult (com.google.api.ads.admanager.axis.v202108.UpdateResult)18 Statement (com.google.api.ads.admanager.axis.v202105.Statement)16 Statement (com.google.api.ads.admanager.axis.v202108.Statement)16 Statement (com.google.api.ads.admanager.axis.v202111.Statement)16 Statement (com.google.api.ads.admanager.axis.v202202.Statement)13 CustomTargetingServiceInterface (com.google.api.ads.admanager.axis.v202108.CustomTargetingServiceInterface)8 InventoryServiceInterface (com.google.api.ads.admanager.axis.v202108.InventoryServiceInterface)8 AdUnit (com.google.api.ads.admanager.axis.v202108.AdUnit)7 AdUnitPage (com.google.api.ads.admanager.axis.v202108.AdUnitPage)7 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202108.PublisherQueryLanguageServiceInterface)7 ResultSet (com.google.api.ads.admanager.axis.v202108.ResultSet)7 LineItem (com.google.api.ads.admanager.axis.v202108.LineItem)6 LineItemPage (com.google.api.ads.admanager.axis.v202108.LineItemPage)6 LineItemServiceInterface (com.google.api.ads.admanager.axis.v202108.LineItemServiceInterface)6 CustomFieldServiceInterface (com.google.api.ads.admanager.axis.v202108.CustomFieldServiceInterface)5 Creative (com.google.api.ads.admanager.axis.v202108.Creative)4 CreativeServiceInterface (com.google.api.ads.admanager.axis.v202108.CreativeServiceInterface)4 Label (com.google.api.ads.admanager.axis.v202108.Label)4