Lastly we return the rsReturn
variable to the caller. You will note that this has changed the variable type to a ColdFusion query which is the name for the returned recordset from <cfquery>
.
Now we need to create a calling page. We have to see what is coming back from the database and how it looks inside ColdFusion. Here is the code to our calling page.
<!--- Example: 2_4.cfm ---> <!--- Processing ---> <cfscript> objProduct = createObject("component","product_2").init(); rsProducts = objProduct.getRecordset(); </cfscript> <!--- Content ---> <cfdump var="#rsProducts#">
We see something new in the recordset dump since ColdFusion version 8. This version includes the attributes for cached, execution time, and the SQL that was run to produce the query. These can be very helpful for development, debugging, and logging. You will also see that the result set displays each row in a table. Each of the fields returned from the database...