Yes, that works, since it's a table valued function, not a stored procedure (in MSSQL terminology).
I think you may have some luck with a table valued function in a <subselect> mapping. /G 2017-01-31 13:17 GMT+01:00 Jeff Buda <[email protected]>: > I tried the statement below in MS SQL Server and Postgres, both of which > support this syntax: > > > select * from > (select * from my_table_function('a param') as foo > where 1 = 1 > > A casual Google search indicates that Oracle would support that as well. > See here > <http://stackoverflow.com/questions/2059299/table-valued-functions-in-oracle-11g-parameterized-views> > ("SELECT > * FROM table(get_Some_Data(3));"). > > In my case, I'd like the "where 1 = 1" clause to be a more complex > restriction generated from an IQueryOver expression. > > In terms of nHibernate source code, where would one start to introduce > this feature? > > > On Monday, January 30, 2017 at 5:41:46 PM UTC-5, Gunnar Liljas wrote: >> >> That would result in a syntax very few DBMS:es would support, at least >> för stored procedures, which usually can't be used as query sources. >> >> As to using a query as a query source, you can use a <subselect> mapping, >> which maps a (static) query instead of a table. >> >> I many ways, LINQ is the most convenient approach, since an IQueryable >> used as is in one place can easily be extended to act as a query source in >> another place. >> >> /g >> >> >> >> >> >> On Mon, Jan 30, 2017 at 12:40 PM +0100, "Jeff Buda" <[email protected]> >> wrote: >> >> If nHibernate's IQueryOver can create a WHERE clause for a DB table or DB >>> view, why wouldn't it be about to make a WHERE clause for a table returned >>> by a DB stored procedure or named query? I all three cases the data being >>> restricted is a two dimensional collection w/ named columns. >>> >>> The SQL would look something like: >>> >>> SELECT * FROM (table/view/stored procedure/named query projection) WHERE >>> <IQueryOver generated where clause> >>> >>> >>> On Friday, January 27, 2017 at 3:24:58 PM UTC-5, Gunnar Liljas wrote: >>>> >>>> Hi! >>>> >>>> No, that's not possible, and I think the question should be "how would >>>> it do that?". What would the resulting SQL look like? >>>> >>>> /G >>>> >>>> >>>> >>>> 2017-01-27 16:36 GMT+01:00 Jeff Buda <[email protected]>: >>>> >>>>> My product had a filter/search/sort feature that is written in terms >>>>> of IQueryOver. It works well when we limit the contents of a mapped DB >>>>> table or view. >>>>> >>>>> Now I need execute a stored procedure or named query and have the >>>>> existing filter/search/sort code base limit the results of the stored >>>>> procedure. The limiting has to be done in the SQL statement executed on >>>>> the >>>>> DB server. >>>>> >>>>> Does nhibernate support this feature? As far as I can tell it doesn't >>>>> allow one to append a dynamic IQueryOver to a stored procedure. If that's >>>>> true does anyone know why? >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "nhusers" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> Visit this group at https://groups.google.com/group/nhusers. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "nhusers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/nhusers. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
