I’m running into an error, “unhandled error from mysql_next_result()”, that I’ve never seen before and would appreciate any insight someone could provide.
I just upgraded my server to ColdFusion 9. Around the same time I updated some scripts with a new feature that I’m now testing that uses tags surrounded by the @ symbol. In my testing I have found that my scripts work without any of these tags, but fail with them. Unfortunately, since this is handled in a single CFQuery within a CFTransaction block, it’s hard to pinpoint the issue. As near as I can tell the failing query is something like:
INSERT INTO galleries_images (EID, Name, Desc1, Format1, OrderID, category, FullPath, hastags, haskeys, udate)
VALUES (<CFQUERYPARAM CFSQLTYPE="CF_SQL_INTEGER" VALUE="#EID#">,
<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#Name#">,
<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#imageProps[2][2]#">,
<CFQUERYPARAM CFSQLTYPE="CF_SQL_INTEGER" VALUE="0">,
<CFQUERYPARAM CFSQLTYPE="CF_SQL_INTEGER" VALUE="#imageProps[2][4]#">,
<CFQUERYPARAM CFSQLTYPE="CF_SQL_INTEGER" VALUE="#catID.ID#">,
<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#Source_Dir#\#Name#">,
<CFQUERYPARAM CFSQLTYPE="CF_SQL_INTEGER" VALUE="#hastags#">,
<CFQUERYPARAM CFSQLTYPE="CF_SQL_INTEGER" VALUE="#haskeys#">,
Now());
The values for these variables should be roughly:
EID=24
Name=Nick001@ord@001@ord@@tags@Pre-Ceremony@tags@.jpg
imageProps[2][2]=
imageProps[2][4]=001
catID.ID=67
Source_Dir=\Name=01_Nicholas - Camera\Nick001@ord@001@ord@@tags@Pre-Ceremony@tags@.jpg
hastags=0
haskeys=0
The same query (or set of queries, as 50-100 of these run in one CFQuery block) will run perfectly fine with a name and source_dir that has no @ symbols. As these are within CFQueryParam tags I had thought they would be safe to use despite being related to variable declaration within MySQL. Any thoughts?
I tracked down the cause of this, and it was nothing like what I expected. It turns out one of my database fields was 250 characters while the allowable filename length is 255 characters, and that was getting in my way. When I increased the size of the database field everything began working.
I have no idea why I received a mysql_next_result() error instead of something more informative; perhaps it’s a generic error. Hopefully that little tidbit will help someone else in the same situation.