QueryExecute

QueryExecute( sql [, params [, options [, name ] ] ] )

Returns: any

Argument Description
sql
string, required

SQL to execute

params
any, optional

Array or Struct of parameter values. When passing an array use ? as place holders.

When passing a struct use :keyName where keyName is the name of the key in the structure corresponding to the parameter.

The struct or array can be a struct with keys such as the following: cfsqltype, list

options
struct, optional

Struct containing query options, all cfquery tag attributes are supported except the name attribute.

name
string, optional

name of the query produced, visible in dumps or debugging output.

Examples

queryExecute(
    sql     = 'SELECT * FROM users  LIMIT 0, 10',
    options = {
        datasource   = "test",
        cachedWithin = CreateTimeSpan(0, 2, 0, 0),
        tags         = 'user_list'
    }
);

See also