>>> Not that I want to work too hard to paw fresh kitty litter over this
>
>and I look at it as "If it allows such a core thing to go wrong...what the 
>hell else will it do" (I've seen the "gotcha" page..yikes)
>
>
>Yep Dave..I've chatted with local developers that use the MySQL/PHP (so 
>called "free" approach) and they actually have to code constraints into the 
>app!!!  My my...that just makes maintenance so much cheaper in the long run 
>(yes folks that is sarcasm) ;-)

Either they're using an older version of MySQL OR they're not familiar with 
creating contraints. I'm using 4.0.20-Max with 40+ InnoDB tables on Red Hat ES2 
with CFMX 6.1 J2EE on JBoss 3.2.5 and all the RI is built into the database.

Using <cftransaction>, <cftry> and <cfcatch> I track all error messages from 
the db. No transaction is committed when a foreign key constraint fails OR when 
you try to enter a NULL in a NOT NULL column. 

Since an empty string is different from a NULL value, I ensure that all 
parameters sent to a query are converted to NULLs when the string is empty to 
help enforce data integrity:

<cfif form.foo IS "">
        <cfqueryparam value="" cfsqltype="CF_SQL_VARCHAR" null="Yes">
<cfelse>
        <cfqueryparam value="#form.foo#" cfsqltype="CF_SQL_VARCHAR" 
maxlength="20">
</cfif>

FWIW, I recently picked up some freelance work with PHP. Pretty much learned 
what I needed in a couple of nights. I just thought to myself, "What would 
Coldfusion do?" and looked up the similar functions in PHP. :D 

My 2 cents.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208138
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to