Helma Logo
main list history
previous version  overview  next version

Version 5 by hannes on 02. April 2009, 10:37

<b>Update:</b> this the functionality described in this proposal has been implemented as by HopObject.getCollection() - see *Creating Collections programmatically*.

I've been thinking about a query feature that allows to build HopObject collection on the fly. Under the hood, the query object would be a HopObject with a custom DbMapping. The SQL query would probably be built using a subnodeRelation built from properties of the query object's filter property. These filter conditions could cover a number of common comparison operators:

* columnname - add equal to clause for the column
* columnname_not_equal - add not equal to clause for the column
* columnname_less_than - add less than clause for the column
* columnname_greater_than - add greater than clause for the column
* columnname_less_or_equal - add a less than or equal to clause for the column
* columnname_greater_or_equal - add a greater than or equal for the column
* columnname_like - add like clause for the column
* columnname_not_like - add not like clause for the column
* columnname_is_null - add is null clause for the column
* columnname_not_null - add is not null clause for the column

Query objects could be created by a constructor or factory function passing the arguments as object literals.

  var q = new HopQuery({
    type: Page,
    filter: {
        createtime_greater_than: t1,
        createtime_less_or_equal: t2,
        type_like: "update:%"
    },
    order: "createtime desc"
  });

     removed
     added