> I have implemented the index server query via CF as outlined in
> the article
> by Robert Everland on CF Comet
>
> http://www.cfcomet.com/cfcomet/index_server/index.cfm?ArticleID=03
> 06FEED-E873-4D21-881655F4EFB68127
>
> and am wondering if the MaxRecords can be set before setting the query.
> Yes, it can be done when looping round the recordset and creating the CF
> query but I was hoping to gain a better understanding of the process and
> this is a starting place.
>
> Also it'd be good to know what the parameters indicated in the code are
> doing:
>
> <--SNIP-->
>
>     /* Create an instance of the ADO Connection COM object */
>     MyConnection = CreateObject("COM", "ADODB.Connection");
>
>     /* Set connection variables; the provider will stay the same */
>     MyConnection.Open("provider=msidxs;Data Source=#Catalog#",
> "#UserName#",
> "#Password#", -1);
>
> here
>     /* Execute the SQL against the ADO connection */
>     MyRecordset = MyConnection.Execute(SQL, 0, 8);
>                                             ^  ^
>                                             |  |
>                                             here
>
>     /* Return a collection of the fields returned by the SQL */
>     MyFields = MyRecordset.Fields;
>
> <--SNIP-->
>
> I have a feeling that this might be answered by Robert Everland
> himself ....

OK, here's why/why not to use the MaxRows in CFLOOP and CFOUTPUT;

When data is being transferred from COM or SQL to CF it will send over the
amount of records requested, in this case it's done via
"MyConnection.Execute(SQL, 0, 8)" which whill only send over upto 9 records

If you let it send over all records, they have to be transferred into CF
before it can decide how many rows to display

If you have hundreds of thousands of records being sent to CF, this can be
VERY slow, and then letting CF just show the top 9 is just daft

A similar example is doing it via SQL
<CFQUERY NAME="myQuery" DATASOURCE="myDSN" MAXROWS=10>
        SELECT ID FROM myTable
</CFQUERY>
may return thousands of records into CF before CF trims out the top 10
<CFQUERY NAME="myQuery" DATASOURCE="myDSN">
        SELECT TOP 10 ID FROM myTABLE
</CFQUERY>
will only return the top 10 records to CF, which will be MUCH faster for SQL
and CF

MAXROWS should only be used if you need both the complete list and the top
part of the list

Hope this explains :-/

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to