The QUERY section is used by Squirt to generate stub code for querying the database. The QUERY section is detailed within this document.
QUERY.queryname.DO = <table_name>
MANDATORY
<table_name> is the Java-ised table name, i.e. it's the
name of table used in Java as created in DODS. The results of
the query are zero or more DOs of this table.
QUERY.queryname.TYPE = <query_type>
OPTIONAL
<query_type> is one of the following: "EASY", "CUSTOM" or
"OBJECTID". If this option is not specified, then the TYPE
is assumed to be "EASY". This option influences the type of
code to be generated.
QUERY.queryname.PARAMETERS[] = <param_list>
OPTIONAL
<param_list> is a comma separated list of variables passed to
query. The method name for the query is the queryname. If this
option is not set, the query method has no parameters.
QUERY.queryname.PARAMTYPES[] = <param_types>
OPTIONAL
<param_types> is a comma separated list of the java types for
each parameter passed to the query. This list must be
exactly the same length as the PARAMETERS list as each
parameter must have a type. If this option is not set, the query method
must have no parameters.
QUERY.queryname.NULL_ALLOWED[] = <null_allowed>
OPTIONAL
<null_allowed> is a comma separated list that has exactly
the same number of entries as the <param_list> above. Each
entry is either INCLUDE or EXCLUDE. If the entry is INCLUDE,
then the parameter is included in the query even if the
passed value is null. The value of EXCLUDE means that the
parameter is not included in the query if the passed
value is null or empty.
If this option is not set, all parameters are assumed to
have the EXCLUDE option.
QUERY.queryname.UNIQUE = true | false
OPTIONAL
If this option is set, then the query must return zero
or one instance only. If this option is not set, then
false is assumed.
QUERY.queryname.ORDERBY[] = <orderby_list>
OPTIONAL
This option only applies for "EASY" query types. The
<orderby_list> is the list of fields to order by. This
list is currently limited to fields of the result table.
QUERY.queryname.SQL subsection:
OPTIONAL
This subsection details the SQL code for this query.
It's only relevant if the TYPE is "CUSTOM".
QUERY.queryname.SQL.SELECT = <select_code>
QUERY.queryname.SQL.FROM = <from_code>
QUERY.queryname.SQL.WHERE.clause#.CODE = <where_clause_code>
QUERY.queryname.SQL.WHERE.clause#.OPERATOR = <where_clause_operator>
Example: If the SQL query is "SELECT * FROM t_person WHERE Surname LIKE '<Surname>' AND Age > <Age>", then the configuration for the SQL subsection would be:
The code generated will expect 2 String parameters: Surname and Age. These parameters are substituted into the CODE portions. Note that clause1 doesn't need an OPERATOR and in most cases probably will not have one.