CFQUERYPARAM
For use within CFQUERY/CFSTOREDPROC tags to describe dynamic variable data that is passed to the query
Usage
<cfqueryparam>
Attributes
Attribute | default | required | summary |
---|---|---|---|
VALUE | ![]() |
The value that this data represents | |
CFSQLTYPE | ![]() |
The type this data should be translated to in the database (CF_SQL_BIGINT, CF_SQL_BIT, CF_SQL_CHAR, CF_SQL_BLOB, CF_SQL_CLOB, CF_SQL_DATE, CF_SQL_DECIMAL, CF_SQL_DOUBLE, CF_SQL_FLOAT, CF_SQL_IDSTAMP, CF_SQL_INTEGER, CF_SQL_LONGVARCHAR, CF_SQL_MONEY, CF_SQL_MONEY4, CF_SQL_NUMERIC, CF_SQL_REAL, CF_SQL_REFCURSOR, CF_SQL_SMALLINT, CF_SQL_TIME, CF_SQL_TIMESTAMP, CF_SQL_TINYINT, CF_SQL_VARCHAR, CF_SQL_BINARY, CF_SQL_VARBINARY, CF_SQL_NCLOB, CF_SQL_NCHAR, CF_SQL_NVARCHAR) | |
NULL | false | Flag to determine if this represents a database NULL | |
LIST | false | Flag to determine if this represents a list | |
SEPARATOR | , | If this is a list, then this is the delimiter for the list | |
DEFAULTLIST | If the list is empty this then this is the default value | ||
MAXLENGTH | -1 | The maximum length this data should be; throws an error if greater than | |
PADDING | The number of characters this data is padded out to | ||
SCALE | 0 | The decimal precision of this data if it is a number |
Extra
Along with the CF_SQL prefixed CFSQLTYPE's you can also use them without the prefix
- CF_SQL_BIGINT - BIGINT
- CF_SQL_BIT - BIT
- CF_SQL_CHAR - CHAR
- CF_SQL_BLOB - BLOB
- CF_SQL_CLOB - CLOB
- CF_SQL_DATE - DATE
- CF_SQL_DECIMAL - DECIMAL
- CF_SQL_DOUBLE - DOUBLE
- CF_SQL_FLOAT - FLOAT
- CF_SQL_IDSTAMP - IDSTAMP
- CF_SQL_INTEGER - INTEGER
- CF_SQL_LONGVARCHAR - LONGVARCHAR
- CF_SQL_MONEY - MONEY
- CF_SQL_MONEY4 - MONEY4
- CF_SQL_NUMERIC - NUMERIC
- CF_SQL_REAL - REAL
- CF_SQL_REFCURSOR - REFCURSOR
- CF_SQL_SMALLINT - SMALLINT
- CF_SQL_TIME - TIME
- CF_SQL_TIMESTAMP - TIMESTAMP
- CF_SQL_TINYINT - TINYINT
- CF_SQL_VARCHAR - VARCHAR
- CF_SQL_BINARY - BINARY
- CF_SQL_VARBINARY - VARBINARY
- CF_SQL_NCLOB - NCLOB
- CF_SQL_NCHAR - NCHAR
- CF_SQL_NVARCHAR - NVARCHAR
Examples
<cfquery name="qry" datasource="datasource"> SELECT * FROM test WHERE age = <cfqueryparam value="27" cfsqltype="cf_sql_integer"> AND name = <cfqueryparam value="Matthew" cfsqltype="cf_sql_varchar"> </cfquery>
<cfquery name="qry" datasource="datasource"> SELECT * FROM test WHERE age = <cfqueryparam value="27" cfsqltype="integer"> AND name = <cfqueryparam value="Matthew" cfsqltype="varchar"> </cfquery>