from foo where id in (?)
It _always_ fails for me.
--
===========================================================================
Raymond Camden, ColdFusion Jedi Master
Email : r...@camdenfamily.com
Blog : www.coldfusionjedi.com
AOL IM : cfjedimaster
Keep up to date with the community: http://www.coldfusionbloggers.org
<cfscript>
query = ORMGetSession().createQuery( "FROM Art WHERE ArtID IN (:mylist)" );
parameters = "1,4,8";
query.setParameterList( "mylist", parameters.split(",") );
writeDump(query.list());
</cfscript>
Whilst this doesn't answer Ray's question it is a possible work around.
What would be really cool is if you passed in an native cf array and
ColdFusion would know that because it was an array it should treat it
as multiple params to bind. If you passed in a string or cf list then
it would treat it as a single param in case you passed a string with a
comma in it (which I supposed could happen if you were searching for a
post title or something).
This code against cfartgallery datasource, does seem to do the trick:
<cfscript>
query = ORMGetSession().createQuery( "FROM Art WHERE ArtID IN (:mylist)" );
parameters = "4,8";
Try:
query.setParameterList( "mylist", parameters.toArray() );
(I've not tried it but it does return a native array - it's just a
native array of Object rather than a native array of int which might
be what it requires so it all depends on whether it can cast the
elements)
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
Try:
query.setParameterList( "mylist", parameters.toArray() );
(I've not tried it but it does return a native array - it's just a
native array of Object rather than a native array of int which might
be what it requires so it all depends on whether it can cast the
elements)
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
I had a suspicion that might happen :(
> on MySQL, and possibly other DBMSs as well. Or maybe one of you Java folks
> knows of a simple method of casting an entire array in one fell swoop? One
Not off the top of my head...