Updating Your Database - Adobe 38043740 - ColdFusion Standard - Mac Development Manual

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Accessing and Using Data
<cfquery name = "getFirst" dataSource = "cfdocexamples">
SELECT * FROM employees
WHERE LastName = <cfqueryparam value = "#LastName#"
</cfquery>
In this case,
cfqueryparam
• It ensures that LastName contains a string.
• It ensures that the string is 17 characters or less.
• It escapes the string with single-quotation marks so that it appears as a single value to the database. Even if a hacker
passes a bad URL, it appears as follows:
WHERE LastName = 'Smith DELETE FROM MyCustomerTable'.
Using cfSqlType
The following table lists the available SQL types against which you can evaluate the
tag:
cfqueryparam
BIGINT
BIT
DECIMAL
DOUBLE
INTEGER
LONGVARCHAR
NUMERIC
REAL
TIME
TIMESTAMP
Note: Specifying the
cfsqltype
performance.

Updating Your Database

Adobe ColdFusion lets you insert, update, and delete information in a database.
About updating your database
ColdFusion was originally developed as a way to readily interact with databases. You can quickly insert, update, and
delete the contents of your database by using ColdFusion forms, which are typically a pair of pages. One page displays
the form with which your end user enters values; the other page performs the action (insert, update, or delete).
Depending on the extent and type of data manipulation, you can use CFML with or without SQL commands. If you
use SQL commands, ColdFusion requires a minimal amount of SQL knowledge.
Inserting data
You usually use two application pages to insert data into a database:
• An insert form
• An insert action page
cfsqltype = "cf_sql_char" maxLength = "17">
performs the following checks:
CHAR
FLOAT
MONEY
REFCURSOR
TINYINT
attribute causes the DBMS to use bind variables, which can greatly enhance
Last updated 1/20/2012
attribute of the
value
DATE
IDSTAMP
MONEY4
SMALLINT
VARCHAR
417

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents