Migrating ColdFusion 5 Applications
Trademarks Afterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver, Authorware, Authorware Attain, Authorware Interactive Studio, Authorware Star, Authorware Synergy, Backstage, Backstage Designer, Backstage Desktop Studio, Backstage Enterprise Studio, Backstage Internet Studio, ColdFusion, Design in Motion, Director, Director Multimedia Studio, Doc Around the Clock, Dreamweaver, Dreamweaver Attain, Drumbeat, Drumbeat 2000, Extreme 3D, Fireworks,
CONTENTS ABOUT THIS BOOK . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Developer resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi About Macromedia ColdFusion MX documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Printed and online documentation set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Viewing online documentation. . . . . . . . . . . . . . . . . . . .
Case in forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 Objects for date/time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 Date pivot point for two-digit years . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 Request variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ABOUT THIS BOOK Migrating ColdFusion 5 Applications provides migration and incompatibility information for anyone who is migrating applications from ColdFusion Server 5 to ColdFusion MX. For information about migrating from earlier versions of ColdFusion, see the Support section of the Macromedia website (http://www.macromedia.com/support). Contents • Developer resources ................................................................................................
Developer resources Macromedia, Inc. is committed to setting the standard for customer support in developer education, documentation, technical support, and professional services. The Macromedia website is designed to give you quick access to the entire range of online resources. The following table shows the locations of these resources: Resource Description URL Macromedia website General information about Macromedia products and services http://www.macromedia.
About Macromedia ColdFusion MX documentation The ColdFusion documentation is designed to provide support for the complete spectrum of participants. The print and online versions are organized to let you quickly locate the information that you need. The ColdFusion online documentation is provided in HTML and Adobe Acrobat formats.
Viewing online documentation All ColdFusion documentation is available online in HTML and Adobe Acrobat Portable Document Format (PDF) files. To view the HTML documentation, open the following URL on the web server running ColdFusion: http://web_root/cfdocs/dochome.htm. ColdFusion documentation in Acrobat format is available on the ColdFusion product CD-ROM.
MIGRATING COLDFUSION 5 APPLICATIONS This chapter describes the known compatibility issues between ColdFusion Server 5 and ColdFusion MX. For late-breaking known compatibility issues, see the “Migrating ColdFusion 5 Applications” section of the Release Notes on the Macromedia website. • Migrating to ColdFusion MX.................................................................................. 2 • Planning your migration........................................................................................
Migrating to ColdFusion MX When you migrate your existing ColdFusion Server 5 applications to ColdFusion MX, you might encounter a few incompatibilities between ColdFusion 5 and ColdFusion MX. Macromedia strongly encourages you to develop a migration plan for porting existing ColdFusion 5 applications to ColdFusion MX. For more information, see “Planning your migration” on page 3.
Planning your migration To facilitate the migration process, Macromedia recommends that you develop a structured migration strategy. The migration steps offered here are provided as examples. Because every application is different, you must tailor your own migration strategy to meet your environment’s needs. Adapt the following steps to fit your needs: 1 Study the migration section of the release notes and this book to anticipate the compatibility issues that might affect your system.
Using the ColdFusion Code Compatibility Analyzer To isolate compatibility issues between ColdFusion MX and ColdFusion Server 5, use the Code Compatibility Analyzer to check your ColdFusion pages for potential incompatibilities. Based on diagnostic information, the Code Compatibility Analyzer issues error and information messages to alert you to possible compatibility issues.
Using the settings migration wizard If you have ColdFusion 5 installed on the same computer as ColdFusion MX, you are prompted to migrate your ColdFusion settings into ColdFusion MX. For Windows, you are prompted immediately after you finish the installation; for UNIX, you are prompted the first time that you open the ColdFusion MX Administrator.
Migrating settings later in Windows To run the settings migration wizard later, you must configure the software to prompt you again to perform the migration. To migrate settings later in Windows: 1 Close the ColdFusion Administrator if it is open. 2 Change the value of the following registry key from 0 to 1: HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\Install Data\Neo\migrate 3 Restart the ColdFusion Administrator. You are prompted again to perform the migration.
CFML tags and attributes The following table describes the tags and attributes in ColdFusion MX that differ from ColdFusion Server 5: For more information Tag Status Compatibility issue cfapplet Changed Can now be used outside the context of cfform. See cfapplet in CFML Reference. cfapplication Changed Setting clientstorage = "registry" is obsolete in UNIX versions of ColdFusion MX. See cfapplication in CFML Reference.
For more information Tag Status Compatibility issue cfcatch Changed cfcatch.Message gets the current values every time an See the section about CFCATCH variables in exception is thrown, and ColdFusion MX ignores any cfset assignment to a cfcatch member. CFML Reference. To remedy this, construct a new message or variable to make extensions to changes in cfcatch values. cfcatch.Message returns a different SQLState value for Type 4 database drivers; this affects the NativeErrorCode variable as well.
For more information Tag Status Compatibility issue cfform Changed ColdFusion MX only uses the cfinput tag’s checked attribute if the corresponding form field value is undefined. ColdFusion 5 used the checked attribute if the field was undefined, or if it was defined but not equal to any of the specified options. See cfform in CFML Reference. For example, if you use a cfparam tag to default form.foo to "false" before the following cfinput tags, then neither of the options are checked.
For more information Tag Status Compatibility issue cfldap Changed You can no longer sort cfldap query results on the client See cfldap in CFML side using the sort attribute. The sort attribute triggers Reference. a server-side sort. If the LDAP server does not support server-side sorting, cfldap throws an error. The sort order depends on the LDAP server; for example, iPlanet Directory Server 5.0, Novell 6.
For more information Tag Status Compatibility issue cfprocparam Changed The maxrows attribute is obsolete in ColdFusion MX. If you have ref cursors in packages or stored procedures, use cfprocresult instead. This causes Datadirect JDBC to place the Oracle ref cursors into a result set. (Note: you cannot use this method with the Oracle ThinClient JDBC drivers.) See cfprocparam and cfprocresult in CFML Reference. The cfprocparam tag ignores the dbvarname attribute for all drivers.
For more information Tag Status Compatibility issue cfreport Changed See cfreport in This tag no longer manages the data connection for a Crystal report. Passes datasource, username, and CFML Reference. password attributes to the Crystal Reports server for it to manage the data connection directly. cfservlet Deprecated Will be obsolete in later versions of ColdFusion MX. In cfservlet tags, you can only call servlets that were created in JRun version 3.1 or earlier. See cfservlet in CFML Reference.
CFML functions and variables The following table describes other CFML functions and variables in ColdFusion MX that differ from ColdFusion Server 5: Function Status Issue For more information ArrayAvg(), ArrayMin(), Changed ArrayMax(), ArraySum() Returns “0” when used with an empty array. ColdFusion 5 returns infinity (1.#INF). See ArrayAvg(), ArrayMin(), ArrayMax(), and ArraySum() in CFML Reference.
Function Status Issue IsWDDX() Changed Returns No for arrays and other complex values. ColdFusion 5 returns an error. (Both versions accept a basic value, such as a string, number, logical value, or date and time value. ) Len() Changed When calculating a length, a string-processing function processes an ASCII 0 (NUL) character and continues to process subsequent characters of the string, if any.
Function Status Issue For more information REFind REReplace() REFindNoCase() REReplaceNoCase() Changed See REFind(), Excludes questionable punctuation, such as +, $, and =, in the [[:punct:]] class of REReplace(), REFindNoCase(), and regular expression functions. REReplaceNoCase() in Recognizes accented letters in the CFML Reference. appropriate character classes, such as :upper:, :lower:, :alpha:, and so on.
Database operations ColdFusion MX uses JDBC drivers to interact with databases; for example, to query, write, and update a database. (JDBC is an Application Programming Interface (API) for Java programs to access data.) To connect to Open Database Connectivity (ODBC) data sources, you can use the bundled Merant Type 4 database drivers or the SQL Link Type 3 database drivers. ColdFusion MX no longer uses the JDBC-ODBC bridge driver.
QueryColumn object The QueryColumn object is even more like an array than in ColdFusion 5, as shown by the following examples: • The QueryColumn object is derived by referencing a query using associative array notation; for example: query1['firstName'] • You can set a query column to an array element; for example: • The following code returns True in ColdFusion MX, and False in ColdFusion 5: #isArray(query1['firstName'])# • The following code works in ColdFusion MX,
Localization This section describes the changes between ColdFusion 5 and ColdFusion MX that affect locale functions. It contains the following topics: • Extended character code support • Changes to formatting functions • Other locale-specific changes Note: Results from localization functions might differ, depending on your Java Runtime Environment (JRE). The contents of this section reflect tests on the SUN JRE version 1.4 and the IBM JRE version 1.3.0.
Locale Newly supported currency formats Italian(Swiss) 123'456.78 SFr. 123'456.78 CHF123'456.78 Norwegian(Bokmal), Norwegian(Nynorsk) 123 456,78 kr 123 456,78 NOK123 456,78 Portuguese(Standard) 123.456,78 Esc. PTE123.456,78 Portuguese(Brazilian)* 12 de outubro de 1954 05h04min30s PST Spanish(Mexican) 123,456.78 $123,456.78 MXN123,456.
Changes to formatting functions for different locales The following table shows the locales in which one or more functions produce slightly different results between ColdFusion 5 and ColdFusion MX: ColdFusion 5 results ColdFusion MX results Locale Function English(Australian) LSCurrencyFormat(123456.78,"international") USD123,456.78 AUD123,456.78 LSCurrencyFormat("-1234.56","none") -1,234.56 English(Canadian) (1,234.56) LSCurrencyFormat(123456.78,"international") USD123,456.78 CAD123,456.
Locale Function ColdFusion 5 results ColdFusion MX results Spanish(Mexican) LSCurrencyFormat(123456.78,"none") 12.345.678 123,456.78 LSCurrencyFormat(123456.78,"local") 12.345.678 pta 123,456.78 LSCurrencyFormat(123456.78,"international") ESP12.345.678 MXN123,456.78 LSCurrencyFormat("-1234.56","none") -123.456 (1,234.56) Spanish (Standard), Spanish(Modern)† LSCurrencyFormat(123456.78,"local") 12.345.678 pta 123.457 Pts LSCurrencyFormat(123456.78,"none") 12.345.678 123.
Changes to formatting functions for every locale The following table outlines changes to formatting functions that apply to every locale: Function Description of change IsDateFormat() When no mask is specified, ColdFusion MX returns the Java medium date format for the locale.
Function Description of change LSParseDateTime() In earlier versions, you could not pass in a time zone value such as “EST”. Now you can, but ColdFusion MX processes this information as follows: • If the time zone specified in the date/time string parameter is different from the time zone setting of the computer hosting ColdFusion MX, ColdFusion MX changes the time value in the parameter to its equivalent value in the computer’s time zone.
Other changes This section describes other changes between ColdFusion 5 and ColdFusion MX. Character encoding ColdFusion MX uses the UTF-8 character set encoding as its default encoding. ColdFusion 5 used the ISO-8859-1 character set encoding. This can affect the way that characters in the range 128–255 are displayed in the browser. To restore the ColdFusion 5 default encoding, place the following cfcontent tag in your page (or in the application’s Application.
Operators Following are changes in operands between ColdFusion 5 and ColdFusion MX: • Exponent results differ; for example, ColdFusion 5 returns an error for 0 ^ 3, and ColdFusion MX only returns “1”. • ColdFusion MX supports the dot notation as a dot operator. For example, if your ColdFusion 5 application has a variable called last.name, ColdFusion MX reads this code and creates a struct called last with a key called name.
Objects for date/time ColdFusion MX no longer strips milliseconds off of date/time objects; to do this, use the date formatting functions. Date pivot point for two-digit years When ColdFusion processes a date that has does not include the century, ColdFusion determines the century. To do this, ColdFusion compares the date to when it processes the date. With a few exceptions, ColdFusion MX uses 20 as the date pivot point for calculating the century in a two-digit year. ColdFusion 5 uses 29.
thisTag scope In ColdFusion 5, you can change system values in the thisTag scope that persist throughout the execution of the tag. This is fixed in ColdFusion MX; it throws an exception if you try to set thisTag.hasendtag or thisTag.executionmode. Caching In ColdFusion MX, in the Caching page of the ColdFusion Administrator, the Template Cache Size (Number of Templates) option displays the number of templates in the cache. In ColdFusion 5, it displays the size of the cached templates in kilobytes.
Tag and function examples This section provides remedies for some of the compatibility issues listed in “CFML tags and attributes” on page 7 and “CFML functions and variables” on page 13. Note: For the most current information on ColdFusion MX compatibility, see the Support section of the Macromedia website (http://www.macromedia.com/support). Using cfregistry in ColdFusion MX The cfregistry tag is deprecated for UNIX and Linux platforms.
Branch = "HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\ Collections" Entry = "RootDirectory" Type = "STRING" Variable = "CFRootDir"> PAGE 38Incompatible example The following example to retrieve ColdFusion mappings throws an error because ColdFusion MX does not store ColdFusion mappings in the registry.
Using the cfindex tag in ColdFusion MX To populate a collection with the contents of the query results, you can now use the cfindex tag with the query attribute and type = "file" or type = "path", for all actions that require information from the key attribute. You can also still use type = “custom”. When you use type = "file" or type = "path" with a query, the action attribute queries to get filenames or file paths from the key attribute, and passes the query results to its actions.
32 Migrating ColdFusion 5 Applications
INDEX A advanced security feature 24 array functions 13 ASCII 0 (NUL) 14 attributes 7 AuthenticatedContext 13 AuthenticatedUser 13 C caching 7 cfapplet 7 cfapplication 7 cfauthenticate 7 cfcache 7 cfcatch 8 cfchart 9 cfchartdata 9 cfchartseries 9 cfcol 8 cfcollection 8 cfdirectory 8 cferror 8 cfform 9 cfgraph 9 cfgraphdata 9 cfgridupdate 11 cfhttp 9 cfimpersonate 7 cfindex 9, 31 cfinput 9 cfinsert 11 cfldap 10 cflog 10 cfloop 10 cfmail 10 CFML data types 25 functions and variables 13 tags and attributes
L R LDAP directory servers, accessing 10 Len 14 ListSetAt 14 ListSort 14 ListSort() 30 locales determining 23 formatting functions 19 overview 18 logging 10, 27 LSCurrencyFormat 14, 20, 22 LSDateFormat 22 LsDateFormat 22 LSEuroCurrencyFormat 22 LSIsCurrency 18, 22 LSIsDate 14, 22 LSParseDateTime 14, 23 LSTimeFormat 22 registry operations 7, 11 regular expression functions 15 request variable 26 M mail, format of 10 migrating functions and variables 13 overview 2 planning 3 tag and function examples 28