|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
BF on CF Adobe ColdFusion 8 Tips
A compilation of Ben Forta's blog entries from his ColdFusion 8 user group tour
By: Ben Forta
Jun. 13, 2007 06:00 PM
In addition to the <CFLOOP> enhancements, we've also added lots of new file i/o functions that you can use to access and manipulate files directly. The new functions include:
This feature was first demonstrated at a usergroup presentation in Connecticut: a new tag in ColdFusion 8 named <CFDBINFO> that returns information about databases (and data sources, and tables, and columns, and stored procedures, and more). This first code snippet shows how to obtain a list of tables in a specified data source (using the default database): <cfdbinfo type="tables" datasource="myDSN" name="tables"> To get column details you can do the following: <cfdbinfo type="columns" datasource="myDSN" table="myTables" name="columns"> This would return a query containing column names, type, size, default values, whether it allows NULL values, key associations, and more. As you can see, <CFDBINFO> accepts a TYPE attribute that tells it what information you want, and the following types are supported:
ColdFusion MX7 introduced the ability to asynchronously spawn ColdFusion requests using an event gateway. While many take advantage of this capability, it has some significant limitations, the biggest of which is that threads can only be spawned; there is no way to monitor spawned threads or wait for them to finish. (The other limitation is that the functionality is only available in ColdFusion Enterprise.) ColdFusion 8 provides far more sophisticated multi-threading capabilities via the new <CFTHREAD> tag. This tag is used to perform several actions:
• Many requests process user submissions, for example, a user uploaded file. The way most ColdFusion applications work today is that the file is processed on the server (parsing it, converting it, saving it, etc.) while the user waits. But in truth, there is no reason users should have to wait for your application to finish its processing. A better user experience would be to receive the file in the action page, spawn a new thread to actually process it, and return control back to the user instantly. This creates a far more responsive user experience. The code to spawn a thread is very simple: <!--- Use a separate thread to perform file processing ---> Here a thread named "threadFile" is spawned. An argument (the file to be processed) is passed to <CFTHREAD>, and so that attribute is available within the thread in the ATTRIBUTES scope. Within threads there are several important scopes. Any locally defined variables are implicitly thread local. THREAD is a special scope (a sub-scope of VARIABLES) that is available to all threads spawned by a single parent. ATTRIBUTES is used to access any variables passed as attributes to <CFTHREAD>. Reader Feedback: Page 1 of 1
Your Feedback
Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
||||||||||||||||||||||||||||||||||||||||||||||||||||