Contents |
TQL Custom Tags
Custom tags for performing TQL based operations.
Documentation on Transfer Query Language
These custom tags can be used to perform both listByQuery' and readByQuery' operations via a alternate syntax than their CFC based implementations.
query
Tag for performing a TQL query.
Syntax
<query
transfer = transfer cfc
name = "name of the query"
action = list|read
class = "transfer class"
cacheEvaluation = true|false
distinctMode = true|false
aliasColumns = true|false
>
</query>
Attributes
| Attribute | Req/Opt | Default | Description |
|---|---|---|---|
| transfer | Required | - | The Transfer library, as returned from transferFactory.getTransfer() |
| name | Required | - | If action=list, then the name of the variables to return the query to If action=read, then the name of the variable to return the TransferObject to |
| action | Optional | 'list' | list: performs a listByQuery() operation. read: performs a readByQuery() operation. |
| class | Required only if action=read | - | The class to read when performing the readByQuery() operation. |
| cacheEvaluation | Optional | true | Whether or not to cache the evaluation of the TQL, which is good for performance. |
| distinctMode | Optional | false | Whether or not to have the resultant SQL run as SELECT DISTINCT...
|
| aliasColumns | Optional | true | Whether or not to alias the the column names on the resultant Query object with the property names configured in the Transfer Configuration File. |
queryparam
Tag for setting dynamic values within the TQL query.
Syntax
<query .... >
<--- tql --->
<queryparam
value = "the value of the parameter"
type = string|date|boolean|numeric|GUID|UUID|binary
list = true|false
isNull = true|false
>
<--- tql --->
</query>
Attributes
| Attribute | Req/Opt | Default | Description |
|---|---|---|---|
| value | Required, unless isNull = true | - | The value of the parameter |
| type | Optional | string | The type of the value for the parameter, either string, numeric, boolean, GUID, UUID or binary. |
| list | Optional | false | Whether or not the value is a delimited list of values, and should be handled separately. |
| isNull | Optional | false | Whether the passed in value is actully NULL or not.
|
Examples
<cfimport prefix="report" taglib="/transfer/tags">
<--- Do list operations --->
<t:query name="result" transfer="#getTransfer()#">
select
u.firstName, u.lastName
from
user.User as u
where
u.email like <t:queryparam value="%example.com" type="string">
</t:query>
<--- Do read operations --->
<--- Get a single record as a TransferObject --->
<t:query name="user" action="read" class="user.User" transfer="#getTransfer()#">
from
user.User as u
where
u.email = <t:queryparam value="user@foo.com" type="string">
</t:query>
Categories:
Wiki Menu
User Login