AdobeStock_455007340

The CFQUERY RESULT Structure

Home » The CFQUERY RESULT Structure

If you have not tried this one yet, you must. Really. This is one gem that has, for the most part, slipped under the radar.
...

In addition to the actual query, can return a structure containing query information (including the SQL executed).

8 responses to “The CFQUERY RESULT Structure”

  1. mingala Avatar
    mingala

    I’m assuming this is for CF7? MX 6.1 doesn’t seem to like the "result" attribute.

  2. Tony Weeg Avatar
    Tony Weeg

    yes. its only for 7.
    tw

  3. Raymond Camden Avatar
    Raymond Camden

    Also note that you can get additional meta info for a query by calling getMetaData on the query object. See my blog post from last week.

  4. Joel Cox Avatar
    Joel Cox

    Seems both of these also work for stored procedures, although the result only returns execution time.
    I can see the getMetaData function being useful for writing generic data display screens, etc.

  5. David Avatar
    David

    hi, Ben, we know cf6 supports mysql from 3.x to 4.x very well in double bytes, but cf7 only supports mysql 3.x , and we can let it support mysql 4.x by using the newest connecter-J ,but when I use
    "useUnicode=true&characterEncoding=gb2312" to connect with mysql, that does not work,I have tried to connect it with "useUnicode=true&characterEncoding=UTF8", and that also just outputs arsy-varsy code. Could help me?

  6. bk Avatar
    bk

    While we’re on the subject, the interested parties
    should note that there’s an error in the help
    page that Macromedia has released for cfquery’s
    "result" attribute. It says
    <cfquery
    name = "query_name"
    dataSource = "ds_name"
    dbtype = "query"
    username = "username"
    password = "password"
    maxRows = "number"
    blockFactor = "blocksize"
    timeout = "seconds"
    cachedAfter = "date"
    cachedWithin = "timespan"
    Either of the following:
    debug = "yes" or "no" or: debug
    >
    result = "result_name"
    </cfquery>
    The CFMX7 help-extensions for Homesite and Dreamweaver MX contain this error.

  7. WILLIAMBQ Avatar
    WILLIAMBQ

    You can however, use the var dump on the name of the query in CF 5 as well… pretty handy.

  8. WILLIAMBQ Avatar
    WILLIAMBQ

    You can also access the query collection, sort of like you might with an ADO recordset, inside another query ad hoc like this: #queryname.columnname[i]#. Pretty handy in CF 5 hosting sich’es where you can’t query a query, have subqueries, etc.

Leave a Reply