cfquery
tag.false
.params.key
variable has been created from the URL (for example a URL such as http://localhost/blog/viewauthor/7
.)findOne()
method like so:cfquery
result (which could be empty if nothing was found based on your criteria).SELECT
clause of the SQL statement.select
argument, Wheels will assume that you want all columns returned and create a SELECT
clause looking something like this:artist
model is mapped to the artists
table and will prepend the table name to the column names accordingly.include
argument below) and there are ambiguous column names, Wheels will sort this out for you by prepending the model name to the column name.name
in both the artists
and albums
tables. The SELECT
clause will be created like this:SELECT
clause, you can do so by specifying the table names (i.e. author.firstName
) in the select
argument or by using alias names (i.e., firstname AS firstName
). If Wheels comes across the use of any of these techniques, it will assume you know what you're doing and pass on the select argument straight to the SELECT
clause with no changes.WHERE
clause of the SQL statement. Wheels will also convert all your input to cfqueryparam
tags for you automatically.where
argument, but the following SQL will work: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND,
and OR
. (Note that it's a requirement to write SQL keywords in upper case.) In addition to this, you can use parentheses to group conditional SQL statements together.BETWEEN
operator, you can get around this by using >=
and <=
.NOT BETWEEN
:ORDER
clause of the SQL statement. If you don't specify an order at all, none will be used. (Makes sense, eh?) So in those cases, the database engine will decide in what order to return the records. Note that it's a requirement to write the SQL keywords ASC
and DESC
in upper case.page
argument) without specifying the order, Wheels will order the results by the primary key column. This is because pagination relies on having unique records to order by.Author
has many Articles
, then you can return all authors and articles in the same call by doing this:cachedwithin
attribute of the cfquery
tag.returnAs
argument. If you want an array of objects back from a findAll() call, for example, you can do this:object
or query
. On the findAll() method, you can set it to objects
(note the plural) or query
.CreateObject()
function. Be careful when setting returnAs
to objects
. You won't want to create a lot of objects in your array and slow down your application unless you absolutely need to.findAll()
call to use, you can specify a structure of arguments for each model/index you'd like to use. Only MySQL and SQLServer support index hints.