queryKeyExists

Determines whether the specified column (key) is present in a query.

queryKeyExists(query, key) → returns boolean

Member Function Syntax

query.keyExists(key)

This function requires Adobe ColdFusion 2016 and up. Not supported on Lucee, OpenBD, etc.

Argument Reference for the queryKeyExists function

query

Required: Yes
Query Object to test.

key

Required: Yes
Key to test

Examples sample code invoking the queryKeyExists function


Check to see if column exists in Query

Uses the member function syntax

news = queryNew("id,title",
    "integer,varchar",
    [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]);
writeOutput(news.keyExists("title"));

Expected Result: YES


Fork me on GitHub