== Retrieving Query Lists ==
There are several ways in which to retrieve Queries from Transfer, where sometimes getting an object is not appropriate.
This can be particularly true when needing to retrieve a large number of values, and performance is a concern.
All 'list*()' functions, except 'listByQuery()' will not retrieve relationships, due to performance concerns. If you are looking to retrieve data with/by a relationship, use [[Retrieving_Query_Lists#Transfer.listByQuery(query)|listByQuery()]]
=== Transfer.list(class, [orderProperty], [orderASC], [useAliases]) ===
([http://docs.transfer-orm.com/html/transferapi/transfer/com/Transfer.html#list() API])
Queries the database for all the records of a given class in the database and returns them
Column names are aliased to the property names set in the configuration file, unless otherwise specified by setting 'useAliases=false'.
qCategories = transfer.list("system.Category", "orderIndex");
=== Transfer.listByProperty(class, property, value, [orderProperty], [orderASC], [useAliases]) ===
([http://docs.transfer-orm.com/html/transferapi/transfer/com/Transfer.html#listByProperty() API])
Queries the database for all the records of a given class in the database, filtered by a property of the class, and returns them.
Column names are aliased to the property names set in the configuration file, unless otherwise specified by setting 'useAliases=false'.
qAddresses = transfer.listByProperty("user.address", "state", "NY");
=== Transfer.listByPropertyMap(class, propertyMap, [orderProperty], [orderASC], [useAliases]) ===
([http://docs.transfer-orm.com/html/transferapi/transfer/com/Transfer.html#listByPropertyMap() API])
Queries the database for all the records of a given class in the database, filtered by a struct of values, where the struct key is the object property, and the value is the value to filter by.
Column names are aliased to the property names set in the configuration file, unless otherwise specified by setting 'useAliases=false'.
map = StructNew();
StructInsert(map, "state", "NY");
StructInsert(map, "city", "Albany");
qAddresses = transfer.listByPropertyMap("user.address", map, "lastName", false);
=== Transfer.listByQuery(query) ===
([http://docs.transfer-orm.com/html/transferapi/transfer/com/Transfer.html#listByQuery() API])
Queries the database and returns the results based on the TQL query that is passed to it.
It should be noted that TQL Query Objects are reused after they are executed, so they will lose their state after the listByQuery() operation.
query = transfer.createQuery("from post.Post as Post join user.User orderBy Post.DateTime");
qPosts = transfer.listByQuery(query);
For information on TQL and the TQL Query object, see [[Transfer Query Language]].
[[Category:TQL]]