i've added multi criteria support to ODP and wanted to send you the code
Description
Environment
Attachments
- 26 Mar 2010, 01:46 PM
- 11 Feb 2010, 11:40 AM
Activity

Fabio Maulo August 2, 2010 at 1:57 PM
As required by reporter in https://nhibernate.jira.com/browse/NH-2170#icft=NH-2170

ns March 26, 2010 at 1:46 PM
my changes weren't on the most recent code, so to help you with the merging:
MultiCriteriaImpl
changes the BindParameters method (and the inner methods) because for oracle we gotta skip the cursor parameter when binding...
changed the CombineCriteriaQueries method so that it lets the driver prepare the statement to be batched for multi querying
it also lets the driver add a prefix and suffix to the sql (BEGIN, END; for oracle, string.Empty for any other driver)
MultiQueryImpl
the same stuff - the bind parameters method was changed in the same way and the Aggregate queries method changed in the same way as the combine criteria queries method
IDriver
added methods for preparing a statement for multi query
and properties for "Parameters to skip when biding" (for oracle is 1-the cursor, for any other driver its 0)
and prefix,suffix
DriverBased - default implementation of the new methods in idriver
OracleDataClientDriver - oracle specific implementations, as well as special treatment for initilizing a parameter when its type is oracle ref cursor
OracleRefCursorSqlType
a new SqlType - special type of oracle ref cursor. The sad thing is that there is no DbType that matches the oracle ref cursor, the ref cursor also doesn't inherit from any meaningful ado.net class or interface, so the DbType is sadly string because there has to be some DB type to give the c'tor of the base class
HaveFun

ns March 26, 2010 at 1:37 PM
ok
i've made a non-dirty patch and attached it
the Driver prepares the sql to be batched for a multi query, so only small changes where made
all the relevent files are attached (6 classes)
good luck to who ever gonna merge this to the SVN
Details
Assignee
UnassignedUnassignedReporter
nsnsComponents
Affects versions
Priority
TrivialWho's Looking?
Open Who's Looking?
Details
Details
Assignee
Reporter

in the files attached there are very specific instructions to what i've done.
my solution is a patch, and is infact pretty ugly. the reason is that multi criteria for oracle is alot different than the current implementation. while the current impl uses a delimitter between each query, for oracle we need something alot different - creating a pl/sql anonymous block, that looks like this:
BEGIN
open :cursor1 for select ... from employees where id = 0;
open :cursor2 for select ... from some_table where id = 1;
END;
we also need to add refcursors parameters to the command with direction=out.
now i assume that the correct design is having two classes for multi criterias derriver from the same class. i also assume that in sessionImpl.CreateMultiCriteria, instead of returning multi criteria, the driver should probably be the one creating the multi criteria instance, or other some kind of factory.
i really didn't want to make such a design decision my self, to not be in a situation where i've wasted time implementing something you guys would appose. so i've just did a patch so i could use multi criteria for ODP fast.
i really belive you can use my code that generates the pl/sql block and attached the cursors, opens them and reads from them
i really hope you'll add it to the next version of NH because when i've sent my NH solution to people who wanted to perform better by reducing the round trips to oracle, they were very happy. multi criteria is a very strong feature as you probobly know.
thanks, nadav