If you are also looking to trap the error in CF, <cfcatch type="database">
is generic to DB related issues.
If you are trying to cater to a particular error code, you will have to
parse the cfcatch structure.
cfcatch has a key for specific database features:
cfcatch.sql
cfcatch.queryError
The more generic keys are:
cfcatch.message
cfcatch.detail
hth,
T
----- Original Message -----
From: "Cameron Childress" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, June 18, 2007 1:50 PM
Subject: Re: [ACFUG Discuss] Catching SQL Errors
I think that you're going to find what you want in a CFTRY/CFCATCH
combo. You can drop TRY/CATCH blocks around your SQL operations and
catch different types of errors, handling them in different ways. In a
development environment, try the following and see if it gives what
you need:
<cftry>
<cfquery>bad SQL goes here</cfquery>
<cfcatch>
<cfdump var="#cfcatch#"/>
<cfabort>
</cfcatch>
</cftry>
you can do whatever you want in that catch block, including logging
the error, the SQL statement, or emailing things to yourself.
-Cameron
On 6/18/07, Fennell, Mark P. <[EMAIL PROTECTED]> wrote:
Does anyone know of a simple way to catch the SQL command which causes an
error?
For example, I have request_error.cfm that records the error.diagnostics
and
the error.template as well as decodes most errors to let the user know
why
they've been bad. But, I'd like to be able to see the statement that
generates the error especially if it's a "inserted value too large for
column" or something else that would indicate user-induced problems.
Thanks.
mf
ps. Red Hat Linux Advanced Server release 2.1AS, CFMX 7.0.0.91690, Oracle
9.2.0.4
mark fennell
athens regional medical center
athens, ga
--------------------------------------------------------------------------------------------------------------
This email is intended only for the named recipient(s). It may contain
information that is proprietary, confidential or otherwise prohibited
from
disclosure. If you are not the named addressee, you are not authorized
to
read, print, retain, copy or disseminate this message or any part of it.
If
you have received this message in error, please reply immediately by
email
or telephone me at 706-475-4357 and delete all copies of the message.
--------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------
Annual Sponsor - Figleaf Software
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform
For more info, see http://www.acfug.org/mailinglists
Archive @
http://www.mail-archive.com/discussion%40acfug.org/
List hosted by FusionLink
-------------------------------------------------------------
--
Cameron Childress
Sumo Consulting Inc
http://www.sumoc.com
---
cell: 678.637.5072
aim: cameroncf
email: [EMAIL PROTECTED]
-------------------------------------------------------------
Annual Sponsor FigLeaf Software - http://www.figleaf.com
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform
For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------
-------------------------------------------------------------
Annual Sponsor FigLeaf Software - http://www.figleaf.com
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform
For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------