The CF.query ActionScript function

You use the CF.query in your server-side ActionScript to retrieve data from a ColdFusion data source. This function lets you perform queries against any ColdFusion data source.

Note:   CF.query maps closely to the cfquery CFML tag, though it currently supports a subset of the cfquery attributes.

Use the CF.query function to do the following:

For reference information about the CF.query function, see Chapter 5, "ColdFusion ActionScript Functions".

CF.query function syntax

You can write the CF.query ActionScript function using either named arguments or positional arguments. The named argument style is more readable than the positional argument style, even though it is more laborious to code CF.query declarations in this way. Although the positional argument style supports a subset of CF.query arguments, it allows a more compact coding style that is more appropriate for simple expressions of the CF.query function.

CF.query named argument syntax

The CF.query function accepts the following named arguments:

// CF.query named argument syntax
CF.query
  ({
    datasource:"data source name", 
    sql:"SQL stmts", 
    username:"username", 
    password:"password", 
    maxrows:number, 
    timeout:milliseconds 
  })

Note:   The named argument style requires curly braces {} to surround the function arguments.

CF.query positional argument syntax

The positional argument approach supports a subset of CF.query arguments, but it lets you code in a leaner more efficient style. The schema for the positional argument style is as follows:

// CF.query positional argument syntax
CF.query(datasource, sql);
CF.query(datasource, sql, maxrows);
CF.query(datasource, sql, username, password);
CF.query(datasource, sql, username, password, maxrows);

Note:   When using positional arguments, do not use curly braces {}.

For more information about the CF.query function, see "CF.query," in Chapter 5.

Comments