>admin API perhaps?

It seems as if the admin may use the <cfcollection action="list" /> command.
I've got 64 collections on my box and this tag takes like 20 seconds to run.
It takes forever for the admin page to load.

I looked on CFLIB.org for an existing UDF and found one, but it uses the
<cfcollection action="list"> action as well--which takes way to long to run.

What I did was re-write the UDF to the code at the bottom of this message.
What this code does is attempt to use <cfsearch /> to search a collection.
If an error is thrown that has the string "does not exist" then I return
false, otherwise the function returns true. 

This seems to runs much more efficiently in my tests.

-Dan

<cffunction name="collectionExists" returnType="boolean" output="false"
hint="This returns a yes/no value that checks for the existence of a named
collection.">
        <cfargument name="collection" type="string" required="yes">

        <!---// by default return true //--->
        <cfset var bExists = true />

        <!---// if you can't search the collection, then assume it doesn't
exist //--->
        <cftry>
                <cfsearch
                        name="SearchItems"
                        collection="#arguments.collection#"
                        type="explicit"
                        criteria=""
                        />
                <cfcatch type="any">
                        <!---// if the message contains the string "does not
exist", then the collection can't be found //--->
                        <cfif cfcatch.message contains "does not exist">
                                <cfset bExists = false />
                        </cfif>
                </cfcatch>
        </cftry>

        <!---// returns true if search was successful and false if an error
occurred //--->
        <cfreturn bExists />

</cffunction>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229375
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to