Blog Resume site ⇢

  • Migrating to Railo

    It's very likely that successful long-living project will face porting issue. Platforms and tools evolve, competition always threatening. Making application working on several project can save investment and widen client base. Porting Coldfusion web-application has it's tricks, here are some of them.

    Linux vs. Windows
    • File names are case sensitive. This means that you cannot name application.cfm (.cfc) and get away with it. Coldfusion seeks for file named Application.cfm - with uppercase A. While you may not noticed this problem in case-blind Windows, on Linux Coldfusion server will not call application.cfm before requested page and you will end with uninitialized variables or Session scope. Same issue will affect your styles and JS files - if filenames not properly cased, webserver won't serve them to client.
    • Component names are case sensitive too. If you have ChildComponent.cfc <cfcomponent name="ChildComponent" extends="ParentComponent">, make sure that ParentComponent.cfc file is named in correct case (as in extends clause)
    • MySQL database and table names are case sensitive. Every MySQL database is a folder. Every MySQL table is a file. This mean case-sensivity will affect your SQL queries as well. If your table named `users`, SQL code SELECT * FROM Users will fail.
    MySQL vs. MS SQL
    • Built-in functions - obviously, built-in functions will be named differently, but act the same ("synonyms"), or named similarly, but act differently or accept different arguments ("homonyms"). Sample synonyms are IFNULL/ISNULL, NOW/GETDATE. DATEDIFF is typical homonym function.
    • Replacement functions - some functions spell and working same in both MySQL and MS SQL, for example COALESCE - it can be used to replace IFNULL/ISNULL function calls.
    • Specific syntax for custom functions - if function name and parenthesis are divided by space, MySQL will try to search custom function instead of built-in function, so COALESCE () and COALESCE() and in fact two different calls. MS SQL doesn't have this behaviour.
    • Table-valued functions - MySQL doesn't support them. You will have to use temporary tables or sub-queries instead.
    • SQL syntax - even basic SQL operation can be different: MS SQL will work with "DELETE table" statement, but MySQL should be given "DELETE FROM table" statement. MySQL as of version 5.1 doesn't support FULL OUTER JOIN. In MS SQL you can use "+" operator to join strings, in MySQL you'll have to call CONCAT() built-in function.
    • No data - MySQL will drop "warning zero rows fetched, selected, or processed" if function not return any data.
    • Stored procedures in MySQL do not support default values - you will have to rewrite all <cfstoredproc&;gt; to have all arguments passed, even if argument is NULL.
    • Multiple SQL statements in CFQUERY - MySQL will not allow multiple statements in CFQUERY, you'll have to rewrite them into several CFQUERYs.
    Railo vs. Coldfusion
    • application.cfm (with lowercase a) is ok for Railo.
    • Railo is (yet) weak in generating PDFs and charts.
    • URL and POST in CFOUTPUT or CFLOOP by Query where URL or POST are field names are always recognized as scopes in Railo. Coldfusion in its turn will first look for a Query field. To avoid confusion, always supercede variables will explicit scope - queryName.URL, or variables.URL, but not just URL.
    • Railo will not forgive this clause <CFSET #variablename# = #variablevalue# /> - so you should write <CFSET variables[variablename] = variablevalue /> instead.
    • Variables with dots in names in URL or POSTscopes will be interpreted as Structures in Railo, but not in Coldfusion. For example, when form has image as submit button, browser will send two variables buttonname.x and buttonname.y to describe mouse click position. Railo will interpret this as structure variable URL.buttonname with two keys - x and y. Coldfusion will interpret as two variables URL.buttonname.x and URL.buttonname.y . See this image of two URL scope dumps - Railo and Coldfusion, both times random number was passed to URL.

    This list can be updated in future.