I see two things here worth paying attention to.

For the original poster, if you're getting value too large for column type errors, you're not performing proper data validation of length, range and type of data. This should be addressed. Of course you can make mistakes in your data validation on table creation and have these problems too, I'm just making an educated guess based on what I usually see.

Ajas, you need to be careful using email to report these errors. This is a denial of service attack waiting to happen if someone can force numerous errors in a short period of time. Just something to consider...

-dhs

Dean H. Saxe, CISSP, CEH
[EMAIL PROTECTED]
"Great spirits have often encountered violent opposition from weak minds."
    --Einstein


On Jun 18, 2007, at 2:06 PM, Ajas Mohammed wrote:

I dont know if this is what you want but if you want to view the sql statement that is causing the error, then the best option is <cfdump var = "#error#">. I usually mail this info to my email adrr and it really helps me to understand what is going on with the query.

But if you want to show information to the user, I am not sure how that can be achieved.

Thanks,

Ajas.




On 6/18/07, Teddy R Payne <[EMAIL PROTECTED]> wrote:
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
-------------------------------------------------------------






--
<Ajas Mohammed />
http://ajashadi.blogspot.com
No matter what, find a way. Because thats what winners do.
-------------------------------------------------------------
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
-------------------------------------------------------------

Reply via email to