Package org.odbms

Examples of org.odbms.Query.constrain()


  public void testPersonJoeckel()
  {
    int cnt = 0;

    Query query = db.query(Person.class);
    query.constrain("lastName", OP.EQUALS, FUNCTION.TO_UPPER, "joeckel");
    ObjectSet<Person> joeckels = query.execute();
    for (Person p : joeckels) {
      if (!"Lothar".equals(p.getFirstName()) || !"Joeckel".equals(p.getLastName()))
        fail("Invalid data in firstName || lastName");
      cnt++;
View Full Code Here


   */
  public void testCustomerWithName()
  {
    int cnt = 0;
    Query query = db.query(Customer.class);
    query.constrain("companyName", OP.EQUALS, FUNCTION.TO_UPPER, "MI6");
    ObjectSet<Customer> customers = query.execute();
    for (Customer p : customers) {
      if (!"GOLD4712".equals(p.getCustNr()) || !"MI6".equals(p.getCompanyName()))
        fail("Invalid data in custNr || companyName");
      cnt++;
View Full Code Here

        } else {
          return false;
        }
      }
    }, compByAge);
    query.constrain("DTITLE", OP.CONTAINS, "Band");

    ObjectSet<Disc> discs = query.execute();

    if (cnt.intValue() == 0)
      fail("No rows found");
View Full Code Here

        } else {
          return false;
        }
      }
    });
    query.constrain("DTITLE", OP.STARTS_WITH, "John");

    ObjectSet<Disc> discs = query.execute();
    int processed = 0;
    for (Disc disc : discs) {
      int age = disc.getAge();
View Full Code Here

      public boolean match(Disc disc)
      {
        return disc.getAge() > 10;
      }
    });
    query.constrain("DTITLE", OP.STARTS_WITH, "The");

    Query query2 = db.query(new Predicate<Disc>() {
      public boolean match(Disc disc)
      {
        return disc.getAge() > 10;
View Full Code Here

      public boolean match(Disc disc)
      {
        return disc.getAge() > 10;
      }
    });
    query2.constrain("DGENRE", OP.EQUALS, FUNCTION.TO_UPPER, "JAZZ");

    ObjectSet<Disc> discs = query.AND(query2);

    int processed = 0;
    for (Disc disc : discs) {
View Full Code Here

  }

  private void query()
  {
    Query q1 = db.query(LogEntry.class);
    q1.constrain("date", OP.GREATER, currentTime);

    ObjectSet<LogEntry> entries = q1.execute();

    for (LogEntry entry : entries) {
      System.out.println(entry + " exists=" + entry.getFile().exists());
View Full Code Here

  private void query()
  {
    Query q1 = db.query(LogEntry.class);
    // q1.constrain("date", OP.GREATER, currentTime);
    q1.constrain("date", OP.RANGE, e1.getDate().getTime(), e2.getDate().getTime());

    ObjectSet<LogEntry> entries = q1.execute();

    int cnt = 0;
    for (LogEntry entry : entries) {
View Full Code Here

  /**
   *
   */
  POQQuery1OR() {
    Query q1 = gtm.query(Disc.class);
    q1.constrain("DTITLE", OP.STARTS_WITH, FUNCTION.TO_UPPER, "TINA");
    q1.constrain("DTITLE", OP.CONTAINS, FUNCTION.TO_UPPER, "TURNER");

    Query q2 = gtm.query(Disc.class);
    q2.constrain("DTITLE", OP.STARTS_WITH, FUNCTION.TO_UPPER, "IKE");
    q2.constrain("DTITLE", OP.CONTAINS, FUNCTION.TO_UPPER, "TURNER");
View Full Code Here

   *
   */
  POQQuery1OR() {
    Query q1 = gtm.query(Disc.class);
    q1.constrain("DTITLE", OP.STARTS_WITH, FUNCTION.TO_UPPER, "TINA");
    q1.constrain("DTITLE", OP.CONTAINS, FUNCTION.TO_UPPER, "TURNER");

    Query q2 = gtm.query(Disc.class);
    q2.constrain("DTITLE", OP.STARTS_WITH, FUNCTION.TO_UPPER, "IKE");
    q2.constrain("DTITLE", OP.CONTAINS, FUNCTION.TO_UPPER, "TURNER");

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.