Adobe COLDFUSION 9 Manual page 279

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Reviewing the code
The following table describes the code and its function:
Code
<cfstoredproc procedure = "foo_proc" dataSource =
"MY_SYBASE_TEST" username = "sa" password = "" returnCode =
"Yes">
<cfprocresult name = RS1>
<cfprocresult name = RS3 resultSet = 3>
<cfprocparam type = "IN" CFSQLType = CF_SQL_INTEGER value =
"1">
<cfprocparam type = "OUT" CFSQLType = CF_SQL_DATE variable =
FOO>
<!--- Close the cfstoredproc tag. --->
</cfstoredproc>
<cfoutput>
The output param value: '#foo#'<br>
</cfoutput>
<h3>The Results Information</h3>
<cfoutput query = RS1>
#name#,#DATE_COL#<br>
</cfoutput>
<br>
<cfoutput>
<hr>
Record Count: #RS1.recordCount#<br>
Columns: #RS1.columnList#<br>
<hr>
</cfoutput>
<cfoutput query = RS3>
#col1#,#col2#,#col3#<br>
</cfoutput>
<br>
<cfoutput>
<hr><br>
Record Count: #RS3.recordCount#<br>
Columns: #RS3.columnList#<br>
<hr>
The return code for the stored procedure is:
'#cfstoredproc.statusCode#'<br>
</cfoutput>
For more information on creating stored procedures, see your database management software documentation. For
more information on using the
Using the cfquery tag cachedWithin attribute
The
tag
cfquery
cachedWithin
of time. This way, ColdFusion accesses the database on the first page request, and does not query the database on
further requests until the specified time expires. Using the
accessing databases that do not change rapidly.
This technique is useful if the database contents only change at specific, known times, or if the database does not
change frequently and the purpose of the query does not require up- to-date results.
Use the
function to specify the
CreateTimeSpan
format). For example, the following code caches the results of getting the contents of the Employees table of the
cfdocexamples data source for one hour.
tag, see the CFML Reference.
cfstoredproc
attribute tells ColdFusion to save the results of a database query for a specific period
cachedWithin
cachedWithin
Last updated 8/5/2010
Description
Runs the stored procedure foo_proc on the
MY_SYBASE_TEST data source. Populates the
cfstoredprocstatusCode
code returned by stored procedure.
Gets two record sets from the stored procedure: the first
and third result sets it returns.
Specifies two parameters for the stored procedure, an
input parameter and an output parameter. Sets the
input parameter to 1 and the ColdFusion variable that
gets the output to FOO.
Ends the
cfstoredproc
tag body.
Displays the results of running the stored procedure:
The output parameter value,
The contents of the two columns in the first record set
identified by the name and DATE_COL variables. You
set the values of these variables elsewhere on the
page.
The number of rows and the names of the columns in
the first record set
The contents of the columns in the other record set
identified by the col1, col2, and col3 variables.
The number of rows and the names of the columns in
the record set.
The status value returned by the stored procedure.
attribute significantly limits the overhead of
attribute value (in days, hours, minutes, seconds
274
variable with the status

Advertisement

Table of Contents
loading

Table of Contents