﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on NHibernate's Xml In</title><description>Initially I called in BigIn, but that sounds... not nice.
</description><link>http://ayende.com/2583/nhibernates-xml-in#comment7</link><guid>http://ayende.com/2583/nhibernates-xml-in#comment7</guid><pubDate>Tue, 26 Jun 2007 04:27:27 GMT</pubDate></item><item><title>James Kovacs commented on NHibernate's Xml In</title><description>Interesting technique and nice that you use the simpler method if less than 2100 parameters or a non-SQL2K5 database. My only complaint is the XmlIn naming. You are letting an implementation detail leak into your naming. Shouldn't this be called something like "In" so that similar hacks, though not necessarily XML-based, could be implemented for other databases?
</description><link>http://ayende.com/2583/nhibernates-xml-in#comment6</link><guid>http://ayende.com/2583/nhibernates-xml-in#comment6</guid><pubDate>Tue, 26 Jun 2007 04:22:45 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate's Xml In</title><description>Yves,
  
There are several reasons, the first is that it can blow up very fast, because NH is keeping cached plans.
  
The second is the DB compiled plans cache.
  
The third and most important is that you now opens yourself to SQL vulnerability.
</description><link>http://ayende.com/2583/nhibernates-xml-in#comment5</link><guid>http://ayende.com/2583/nhibernates-xml-in#comment5</guid><pubDate>Mon, 25 Jun 2007 17:39:15 GMT</pubDate></item><item><title>Yves Reynhout commented on NHibernate's Xml In</title><description>Why not use literals instead of parameters? So instead of '... IN (@P1, @P2, @P3, ....)' have it emit '... IN (213, 267, 3080, ...)'. I don't know much about NHibernate, but I would be surprised if one could not hook into its sql generation infrastructure.
</description><link>http://ayende.com/2583/nhibernates-xml-in#comment4</link><guid>http://ayende.com/2583/nhibernates-xml-in#comment4</guid><pubDate>Mon, 25 Jun 2007 15:52:47 GMT</pubDate></item><item><title>Evan commented on NHibernate's Xml In</title><description>I'm going to hit a similar situation this iteration.. a treeview where the user can select multiple leaves (of users), then create an aggregate report off the selected users...
  
  
This is way cool!
  
  
</description><link>http://ayende.com/2583/nhibernates-xml-in#comment3</link><guid>http://ayende.com/2583/nhibernates-xml-in#comment3</guid><pubDate>Fri, 22 Jun 2007 01:11:54 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate's Xml In</title><description>Ben, how are you going to get the data for the subquery in the first place?
  
That is really a monster one, and I would rather not run it overmuch.
  
I thought about using string splitting, but that seems like a hack .The XML is also a hack, but less so.
</description><link>http://ayende.com/2583/nhibernates-xml-in#comment2</link><guid>http://ayende.com/2583/nhibernates-xml-in#comment2</guid><pubDate>Thu, 21 Jun 2007 14:25:01 GMT</pubDate></item><item><title>Ben Scheirman commented on NHibernate's Xml In</title><description>I don't see why a subquery wouldn't work there, but maybe I don't understand the problem...
  
  
SELECT * FROM CustomerOrders
  
WHERE CustomerID IN (
  
    SELECT FriendD 
  
    FROM Associations
  
    WHERE AssociationID = @x
  
  
    UNION
  
  
    SELECT ColleagueID
  
    FROM Associations WHERE AssociationID= @x
  
  
    UNION
  
  
     ..... more queries
  
  
)
  
  
That would work with 2100 results from the inner query, wouldn't it?  
  
Another way would be to coalesce the different columns into a single comma separated string and perform IN on that... can't think of the query off the top of my head, but that's possible as well.
  
</description><link>http://ayende.com/2583/nhibernates-xml-in#comment1</link><guid>http://ayende.com/2583/nhibernates-xml-in#comment1</guid><pubDate>Thu, 21 Jun 2007 13:38:47 GMT</pubDate></item></channel></rss>