Overview ColdFusion Open BlueDragon Lucee

Passes queries or SQL statements to a data source. It is recommended that you use the cfqueryparam tag within every cfquery tag, to help secure your databases from unauthorized users


Name Required Type Default Description
background No If set, will throw this query to the background spooling agent for running later
blockfactor No Numeric Maximum rows to get at a time from server. Range: 1 - 100. Might not be supported by some database systems.
cachedafter No DateTime Date value (for example, April 16, 1999, 4-16-99). If date of original query is after this date, CFML uses cached query data. To use cached data, current query must use same SQL statement, data source, query name, user name, password. A date/time object is in the range 100 AD-9999 AD. When specifying a date value as a string, you must enclose it in quotation marks.
cachedwithin No Timespan Timespan, using the CreateTimeSpan function. If original query date falls within the time span, cached query data is used. CreateTimeSpan defines a period from the present, back. Takes effect only if query caching is enabled in the Administrator. To use cached data, the current query must use the same SQL statement, data source, query name, user name, and password.
cacheId No String Id with which query result should be stored in cache.
cachename No This is specific to JTags, and allows you to give the cache a specific name
cacheRegion No String Name of cache region in which query result should be stored.
clientinfo No Struct Contains clientinfo properties to be set on the database connection
connectstring No The contents of a connection string to send to the ODBC server. When connecting to a data source defined in the ColdFusion Administrator, you can use this attribute to specify additional connection details or to override connection information specified in the Administrator. If you are dynamically connecting to a datasource by specifying dbType = "dynamic", the connection string must specify all required ODBC connection attributes.
datasource No String Name of data source from which query gets data.
dbname No The database name, Sybase System 11 driver and SQLOLEDB provider only. If specified, dbName overrides the default database specified in the data source.
dbserver No For native database drivers and the SQLOLEDB provider, specifies the name of the database server computer. If specified, dbServer overrides the server specified in the data source.
dbtype No String query. Use this value to specify the results of a query as input.
debug No Boolean false Yes: If debugging is enabled, but the Administrator Database Activity option is not enabled, displays SQL submitted to datasource and number of records returned by query. No: If the Administrator Database Activity option is enabled, suppresses display.
fetchclientinfo No Boolean Flag to indicate if clientinfo properties should be added to the result variable
lazy No if "lazy" is set to true (default "false") Railo does not initially load all the data from the datasource, in that case the data are only loaded when requested, so this means the data are depending on the datasource connection. if the datasource connection is gone and the data are not requested yet, railo throws a error if you try to access the data. lazy is only working when the following attributes are not used: cachewithin,cacheafter,result
maxrows No Numeric -1 Maximum number of rows to return in record set. -1 returns all records.
name No String Name of query. Used in page to reference query record set. Must begin with a letter. Can include letters, numbers, and underscores.
ormoptions No Struct A struct that takes orm options for executing HQL. Applies only if dbtype is set to hql.
params No experimentell
password No String Overrides password in data source setup.
preservesinglequotes No A flag to preserve the quotes within the CFQUERY body
provider No COM provider, OLE-DB only.
providerdsn No Data source name for the COM provider, OLE-DB only.
psq No preserve single quote or not
region No The cache region to use
result No String Specifies a name for the structure in which cfquery returns the result variables. * SQL: The SQL statement that was executed. (string) * Cached: If the query was cached. (boolean) * SqlParameters: An ordered Array of cfqueryparam values. (array) * RecordCount: Total number of records in the query. (numeric) * ColumnList: Column list, comma seperated. (numeric) * ExecutionTime: Execution time for the SQL request. (numeric)
returntype No one of the following values: - query: default for all dbtype expect "hql", returns a query object - array_of_entity: works only with dbtype "hql" and is also the default value for dbtype "hql"
timeout No Numeric Maximum number of seconds that each action of a query is permitted to execute before returning an error. The cumulative time may exceed this value. For JDBC statements, CFML sets this attribute. For other drivers, check driver documentation.
timezone No the timezone used to convert a date object to a timestamp (string), this value is needed when your database runs in another timezone and you are not using cfqueryparam to to insert dates.
unique No Specifies if the object parameter is unique, used only for dbtype=orm or hql
username No String Overrides username in data source setup.