Re: Seriously PO'd - cfqueryparam and/or struct dereference flakes out
ColdFusion on knows that an error occurred in that query. The error was returned to CF from the JDBC drivers which in turn received the error from the DB server. As I understand it, ColdFusion reported what it was told to report by a third-party server. Wil Genovese Sr. Web Application Developer/ Systems Administrator Wil Genovese Consulting wilg...@trunkful.com www.trunkful.com On Jun 25, 2010, at 11:47 AM, Marc Funaro wrote: Thanks everyone, You were all correct - god help me I was actually focusing on the error CF gave me, trusting that alone. Go figure. What a rotten thing to do! :) A different value was the culprit, and the suggestion below absolutely applies. Thank you all so much -- this is what happens when we get tired, and I always appreciate the fresh perspective of the community during such times! It's a bit more code, but if you switch to having a cfargument tag for each parameter and enforce the type there, you can pass in your struct as an argument collection. You'll get a more meaningful error that way. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334855 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Seriously PO'd - cfqueryparam and/or struct dereference flakes out
Are your integer fields datatype int in your database? I think a similar error could occur if your integer fields were changed to varchar or a different non-integer based field. Paul Alkema http://paulalkema.com/ -Original Message- From: Brad Wood [mailto:b...@bradwood.com] Sent: Thursday, June 24, 2010 9:57 PM To: cf-talk Subject: Re: Seriously PO'd - cfqueryparam and/or struct dereference flakes out It's a bit more code, but if you switch to having a cfargument tag for each parameter and enforce the type there, you can pass in your struct as an argument collection. You'll get a more meaningful error that way. Sent from my HTC on the Now Network from Sprint! - Reply message - From: Marc Funaro subscripti...@advantex.net Date: Thu, Jun 24, 2010 5:43 pm Subject: Seriously PO'd - cfqueryparam and/or struct dereference flakes out To: cf-talk cf-talk@houseoffusion.com The function below was written literally MONTHS ago. Worked fine the whole time, even today... then suddenly it's throwing the error: Invalid data '' for CFSQLTYPE CF_SQL_INTEGER. The error points to the line in the WHERE clause, referencing a.articleId. Next, I purposely set the output=true on this function, and did a cfdump of #a.articleId# -- it's definitely a valid integer. but it's now choking on it for some reason. as a test, i hard coded an article id into the where clause, removing the cfqueryparam. with a hard coded number, it chokes on the next cfqueryparam up. if i reference #a.articleId# directly (outside of cfqueryparam), I also get the same error. how can a.articleId suddenly become '' right after dumping it and successfully showing it to be an integer?? I've restarted both the cf server and the database server, wondering if there was some sort of strange hangup there... no joy. I'm losing my mind... help!! cffunction name=updateArticle returntype=void access=private output=true cfargument name=structArticle required=true type=Struct hint=A structure containing all fields of an article, and the values to be saved. cfset var a = arguments.structArticle cfset var qUpdateArticle = !--- uncommenting this line gives me a valid integer on screen --- !--- cfdump var=#a.articleId#cfabort --- cfquery name=qUpdateArticle datasource=#request.dsn# UPDATE Article SET categoryId = cfqueryparam value=#a.categoryId# cfsqltype=cf_sql_integer /, title = cfqueryparam value=#a.title# cfsqltype=cf_sql_varchar /, byLine = cfqueryparam value=#a.byLine# cfsqltype=cf_sql_varchar /, imageId = cfqueryparam value=#a.imageId# cfsqltype=cf_sql_integer /, imageCaption = cfqueryparam value=#a.imageCaption# cfsqltype=cf_sql_varchar /, abstract = cfqueryparam value=#a.abstract# cfsqltype=cf_sql_varchar /, body = cfqueryparam value=#a.body# cfsqltype=cf_sql_varchar /, isLead = cfqueryparam value=#a.isLead# cfsqltype=cf_sql_bit /, publishDateTime = cfqueryparam value=#a.publishDateTime# cfsqltype=cf_sql_timestamp / WHERE articleId = cfqueryparam value=#a.articleId# cfsqltype=cf_sql_integer / /cfquery /cffunction ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334845 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Seriously PO'd - cfqueryparam and/or struct dereference flakes out
Have you looked at the datasource to see if there is an issue with the data? Since you said it worked fine for months. -Original Message- From: Marc Funaro [mailto:subscripti...@advantex.net] Sent: Thursday, June 24, 2010 3:43 PM To: cf-talk Subject: Seriously PO'd - cfqueryparam and/or struct dereference flakes out The function below was written literally MONTHS ago. Worked fine the whole time, even today... then suddenly it's throwing the error: Invalid data '' for CFSQLTYPE CF_SQL_INTEGER. The error points to the line in the WHERE clause, referencing a.articleId. Next, I purposely set the output=true on this function, and did a cfdump of #a.articleId# -- it's definitely a valid integer. but it's now choking on it for some reason. as a test, i hard coded an article id into the where clause, removing the cfqueryparam. with a hard coded number, it chokes on the next cfqueryparam up. if i reference #a.articleId# directly (outside of cfqueryparam), I also get the same error. how can a.articleId suddenly become '' right after dumping it and successfully showing it to be an integer?? I've restarted both the cf server and the database server, wondering if there was some sort of strange hangup there... no joy. I'm losing my mind... help!! cffunction name=updateArticle returntype=void access=private output=true cfargument name=structArticle required=true type=Struct hint=A structure containing all fields of an article, and the values to be saved. cfset var a = arguments.structArticle cfset var qUpdateArticle = !--- uncommenting this line gives me a valid integer on screen --- !--- cfdump var=#a.articleId#cfabort --- cfquery name=qUpdateArticle datasource=#request.dsn# UPDATE Article SET categoryId = cfqueryparam value=#a.categoryId# cfsqltype=cf_sql_integer /, title = cfqueryparam value=#a.title# cfsqltype=cf_sql_varchar /, byLine = cfqueryparam value=#a.byLine# cfsqltype=cf_sql_varchar /, imageId = cfqueryparam value=#a.imageId# cfsqltype=cf_sql_integer /, imageCaption = cfqueryparam value=#a.imageCaption# cfsqltype=cf_sql_varchar /, abstract = cfqueryparam value=#a.abstract# cfsqltype=cf_sql_varchar /, body = cfqueryparam value=#a.body# cfsqltype=cf_sql_varchar /, isLead = cfqueryparam value=#a.isLead# cfsqltype=cf_sql_bit /, publishDateTime = cfqueryparam value=#a.publishDateTime# cfsqltype=cf_sql_timestamp / WHERE articleId = cfqueryparam value=#a.articleId# cfsqltype=cf_sql_integer / /cfquery /cffunction ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334846 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Seriously PO'd - cfqueryparam and/or struct dereference flakes out
Thanks everyone, You were all correct - god help me I was actually focusing on the error CF gave me, trusting that alone. Go figure. What a rotten thing to do! :) A different value was the culprit, and the suggestion below absolutely applies. Thank you all so much -- this is what happens when we get tired, and I always appreciate the fresh perspective of the community during such times! It's a bit more code, but if you switch to having a cfargument tag for each parameter and enforce the type there, you can pass in your struct as an argument collection. You'll get a more meaningful error that way. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334851 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Seriously PO'd - cfqueryparam and/or struct dereference flakes out
The function below was written literally MONTHS ago. Worked fine the whole time, even today... then suddenly it's throwing the error: Invalid data '' for CFSQLTYPE CF_SQL_INTEGER. The error points to the line in the WHERE clause, referencing a.articleId. Next, I purposely set the output=true on this function, and did a cfdump of #a.articleId# -- it's definitely a valid integer. but it's now choking on it for some reason. as a test, i hard coded an article id into the where clause, removing the cfqueryparam. with a hard coded number, it chokes on the next cfqueryparam up. if i reference #a.articleId# directly (outside of cfqueryparam), I also get the same error. how can a.articleId suddenly become '' right after dumping it and successfully showing it to be an integer?? I've restarted both the cf server and the database server, wondering if there was some sort of strange hangup there... no joy. I'm losing my mind... help!! cffunction name=updateArticle returntype=void access=private output=true cfargument name=structArticle required=true type=Struct hint=A structure containing all fields of an article, and the values to be saved. cfset var a = arguments.structArticle cfset var qUpdateArticle = !--- uncommenting this line gives me a valid integer on screen --- !--- cfdump var=#a.articleId#cfabort --- cfquery name=qUpdateArticle datasource=#request.dsn# UPDATE Article SET categoryId = cfqueryparam value=#a.categoryId# cfsqltype=cf_sql_integer /, title = cfqueryparam value=#a.title# cfsqltype=cf_sql_varchar /, byLine = cfqueryparam value=#a.byLine# cfsqltype=cf_sql_varchar /, imageId = cfqueryparam value=#a.imageId# cfsqltype=cf_sql_integer /, imageCaption = cfqueryparam value=#a.imageCaption# cfsqltype=cf_sql_varchar /, abstract = cfqueryparam value=#a.abstract# cfsqltype=cf_sql_varchar /, body = cfqueryparam value=#a.body# cfsqltype=cf_sql_varchar /, isLead = cfqueryparam value=#a.isLead# cfsqltype=cf_sql_bit /, publishDateTime = cfqueryparam value=#a.publishDateTime# cfsqltype=cf_sql_timestamp / WHERE articleId = cfqueryparam value=#a.articleId# cfsqltype=cf_sql_integer / /cfquery /cffunction ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334818 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Seriously PO'd - cfqueryparam and/or struct dereference flakes out
When CF throws an error on a stored proc, it will usually reference the last line of the stored proc, not necessarily which line has bad data. If I were you, I would dump the values that are being sent into the stored proc and review to see if any of it is null or blank (or string) going into any of the integer declared procparams. Hope this helps, William -- William E. Seiter On Jun 24, 2010, Marc Funaro subscripti...@advantex.net wrote: The function below was written literally MONTHS ago. Worked fine the whole time, even today... then suddenly it's throwing the error: Invalid data '' for CFSQLTYPE CF_SQL_INTEGER. The error points to the line in the WHERE clause, referencing a.articleId. Next, I purposely set the output=true on this function, and did a cfdump of #a.articleId# -- it's definitely a valid integer. but it's now choking on it for some reason. as a test, i hard coded an article id into the where clause, removing the cfqueryparam. with a hard coded number, it chokes on the next cfqueryparam up. if i reference #a.articleId# directly (outside of cfqueryparam), I also get the same error. how can a.articleId suddenly become '' right after dumping it and successfully showing it to be an integer?? I've restarted both the cf server and the database server, wondering if there was some sort of strange hangup there... no joy. I'm losing my mind... help!! cffunction name=updateArticle returntype=void access=private output=true cfargument name=structArticle required=true type=Struct hint=A structure containing all fields of an article, and the values to be saved. cfset var a = arguments.structArticle cfset var qUpdateArticle = !--- uncommenting this line gives me a valid integer on screen --- !--- cfdump var=#a.articleId#cfabort --- cfquery name=qUpdateArticle datasource=#request.dsn# UPDATE Article SET categoryId = cfqueryparam value=#a.categoryId# cfsqltype=cf_sql_integer /, title = cfqueryparam value=#a.title# cfsqltype=cf_sql_varchar /, byLine = cfqueryparam value=#a.byLine# cfsqltype=cf_sql_varchar /, imageId = cfqueryparam value=#a.imageId# cfsqltype=cf_sql_integer /, imageCaption = cfqueryparam value=#a.imageCaption# cfsqltype=cf_sql_varchar /, abstract = cfqueryparam value=#a.abstract# cfsqltype=cf_sql_varchar /, body = cfqueryparam value=#a.body# cfsqltype=cf_sql_varchar /, isLead = cfqueryparam value=#a.isLead# cfsqltype=cf_sql_bit /, publishDateTime = cfqueryparam value=#a.publishDateTime# cfsqltype=cf_sql_timestamp / WHERE articleId = cfqueryparam value=#a.articleId# cfsqltype=cf_sql_integer / /cfquery /cffunction ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334821 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Seriously PO'd - cfqueryparam and/or struct dereference flakes out
The line number given is always the last line of the query. Make sure all the other values are what they are supposed to be. Wil Genovese Sr. Web Application Developer/ Systems Administrator Wil Genovese Consulting wilg...@trunkful.com www.trunkful.com On Jun 24, 2010, at 5:43 PM, Marc Funaro wrote: The function below was written literally MONTHS ago. Worked fine the whole time, even today... then suddenly it's throwing the error: Invalid data '' for CFSQLTYPE CF_SQL_INTEGER. The error points to the line in the WHERE clause, referencing a.articleId. Next, I purposely set the output=true on this function, and did a cfdump of #a.articleId# -- it's definitely a valid integer. but it's now choking on it for some reason. as a test, i hard coded an article id into the where clause, removing the cfqueryparam. with a hard coded number, it chokes on the next cfqueryparam up. if i reference #a.articleId# directly (outside of cfqueryparam), I also get the same error. how can a.articleId suddenly become '' right after dumping it and successfully showing it to be an integer?? I've restarted both the cf server and the database server, wondering if there was some sort of strange hangup there... no joy. I'm losing my mind... help!! cffunction name=updateArticle returntype=void access=private output=true cfargument name=structArticle required=true type=Struct hint=A structure containing all fields of an article, and the values to be saved. cfset var a = arguments.structArticle cfset var qUpdateArticle = !--- uncommenting this line gives me a valid integer on screen --- !--- cfdump var=#a.articleId#cfabort --- cfquery name=qUpdateArticle datasource=#request.dsn# UPDATE Article SET categoryId = cfqueryparam value=#a.categoryId# cfsqltype=cf_sql_integer /, title = cfqueryparam value=#a.title# cfsqltype=cf_sql_varchar /, byLine = cfqueryparam value=#a.byLine# cfsqltype=cf_sql_varchar /, imageId = cfqueryparam value=#a.imageId# cfsqltype=cf_sql_integer /, imageCaption = cfqueryparam value=#a.imageCaption# cfsqltype=cf_sql_varchar /, abstract = cfqueryparam value=#a.abstract# cfsqltype=cf_sql_varchar /, body = cfqueryparam value=#a.body# cfsqltype=cf_sql_varchar /, isLead = cfqueryparam value=#a.isLead# cfsqltype=cf_sql_bit /, publishDateTime = cfqueryparam value=#a.publishDateTime# cfsqltype=cf_sql_timestamp / WHERE articleId = cfqueryparam value=#a.articleId# cfsqltype=cf_sql_integer / /cfquery /cffunction ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334824 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Seriously PO'd - cfqueryparam and/or struct dereference flakes out
Dump #a# and look at the other values that your query expects to be integers (a.categoryid and a.imageid). CF only knows your query had an error. The reported line number when errors fall between cfquery tags is rarely the line with the actual issue. .:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Marc Funaro [mailto:subscripti...@advantex.net] Sent: Thursday, June 24, 2010 6:43 PM To: cf-talk Subject: Seriously PO'd - cfqueryparam and/or struct dereference flakes out The function below was written literally MONTHS ago. Worked fine the whole time, even today... then suddenly it's throwing the error: Invalid data '' for CFSQLTYPE CF_SQL_INTEGER. The error points to the line in the WHERE clause, referencing a.articleId. Next, I purposely set the output=true on this function, and did a cfdump of #a.articleId# -- it's definitely a valid integer. but it's now choking on it for some reason. as a test, i hard coded an article id into the where clause, removing the cfqueryparam. with a hard coded number, it chokes on the next cfqueryparam up. if i reference #a.articleId# directly (outside of cfqueryparam), I also get the same error. how can a.articleId suddenly become '' right after dumping it and successfully showing it to be an integer?? I've restarted both the cf server and the database server, wondering if there was some sort of strange hangup there... no joy. I'm losing my mind... help!! cffunction name=updateArticle returntype=void access=private output=true cfargument name=structArticle required=true type=Struct hint=A structure containing all fields of an article, and the values to be saved. cfset var a = arguments.structArticle cfset var qUpdateArticle = !--- uncommenting this line gives me a valid integer on screen --- !--- cfdump var=#a.articleId#cfabort --- cfquery name=qUpdateArticle datasource=#request.dsn# UPDATE Article SET categoryId = cfqueryparam value=#a.categoryId# cfsqltype=cf_sql_integer /, title = cfqueryparam value=#a.title# cfsqltype=cf_sql_varchar /, byLine = cfqueryparam value=#a.byLine# cfsqltype=cf_sql_varchar /, imageId = cfqueryparam value=#a.imageId# cfsqltype=cf_sql_integer /, imageCaption = cfqueryparam value=#a.imageCaption# cfsqltype=cf_sql_varchar /, abstract = cfqueryparam value=#a.abstract# cfsqltype=cf_sql_varchar /, body = cfqueryparam value=#a.body# cfsqltype=cf_sql_varchar /, isLead = cfqueryparam value=#a.isLead# cfsqltype=cf_sql_bit /, publishDateTime = cfqueryparam value=#a.publishDateTime# cfsqltype=cf_sql_timestamp / WHERE articleId = cfqueryparam value=#a.articleId# cfsqltype=cf_sql_integer / /cfquery /cffunction ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334826 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Seriously PO'd - cfqueryparam and/or struct dereference flakes out
It's a bit more code, but if you switch to having a cfargument tag for each parameter and enforce the type there, you can pass in your struct as an argument collection. You'll get a more meaningful error that way. Sent from my HTC on the Now Network from Sprint! - Reply message - From: Marc Funaro subscripti...@advantex.net Date: Thu, Jun 24, 2010 5:43 pm Subject: Seriously PO'd - cfqueryparam and/or struct dereference flakes out To: cf-talk cf-talk@houseoffusion.com The function below was written literally MONTHS ago. Worked fine the whole time, even today... then suddenly it's throwing the error: Invalid data '' for CFSQLTYPE CF_SQL_INTEGER. The error points to the line in the WHERE clause, referencing a.articleId. Next, I purposely set the output=true on this function, and did a cfdump of #a.articleId# -- it's definitely a valid integer. but it's now choking on it for some reason. as a test, i hard coded an article id into the where clause, removing the cfqueryparam. with a hard coded number, it chokes on the next cfqueryparam up. if i reference #a.articleId# directly (outside of cfqueryparam), I also get the same error. how can a.articleId suddenly become '' right after dumping it and successfully showing it to be an integer?? I've restarted both the cf server and the database server, wondering if there was some sort of strange hangup there... no joy. I'm losing my mind... help!! cffunction name=updateArticle returntype=void access=private output=true cfargument name=structArticle required=true type=Struct hint=A structure containing all fields of an article, and the values to be saved. cfset var a = arguments.structArticle cfset var qUpdateArticle = !--- uncommenting this line gives me a valid integer on screen --- !--- cfdump var=#a.articleId#cfabort --- cfquery name=qUpdateArticle datasource=#request.dsn# UPDATE Article SET categoryId = cfqueryparam value=#a.categoryId# cfsqltype=cf_sql_integer /, title = cfqueryparam value=#a.title# cfsqltype=cf_sql_varchar /, byLine = cfqueryparam value=#a.byLine# cfsqltype=cf_sql_varchar /, imageId = cfqueryparam value=#a.imageId# cfsqltype=cf_sql_integer /, imageCaption = cfqueryparam value=#a.imageCaption# cfsqltype=cf_sql_varchar /, abstract = cfqueryparam value=#a.abstract# cfsqltype=cf_sql_varchar /, body = cfqueryparam value=#a.body# cfsqltype=cf_sql_varchar /, isLead = cfqueryparam value=#a.isLead# cfsqltype=cf_sql_bit /, publishDateTime = cfqueryparam value=#a.publishDateTime# cfsqltype=cf_sql_timestamp / WHERE articleId = cfqueryparam value=#a.articleId# cfsqltype=cf_sql_integer / /cfquery /cffunction ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334834 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm