History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: COR-1086
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Carl Rosenberger
Reporter: Ruihua Jin
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
db4o Core

SODA query returns wrong query result for .NET interfaces

Created: 11/Jan/08 02:57 PM   Updated: 16/Jan/08 09:56 AM
Component/s: Queries
Affects Version/s: 6.4.6
Fix Version/s: 7.1.26

Time Tracking:
Not Specified

Environment: .NET
Issue Links:
Related
 

Order: 3
Iteration: 26
Original IDS Estimate: 0 IDS
Resolution Date: 16/Jan/08 09:56 AM
Labels:
Participants: Carl Rosenberger and Ruihua Jin
Number of Attachments: 0
Number of Comments: 0


 Description  « Hide
The test program has one interface ICar:

interface ICar {}

and two implementation classes of ICar:

class Ferrari : ICar {
    private string name;

    public Ferrari(string n)
    {
        name = n;
    }
}

class Bmw : ICar {
    private string name;

    public Bmw(string n)
    {
        name = n;
    }
}

First of all, four objects are stored in the database:

Ferrari: name = "F430"
Ferrari: name = "F450"
Bmw: name = "Serie 5"
Bmw: name = "Serie 7"

Then the following SODA query returns different sets of objects depending on whether the interface ICar has one or more than one implementation classes:

IQuery query = db.Query();
query.Constrain(typeof(ICar));
query.Descend("name").Constrain("F450");
query.Execute();

The query returns
    * all the four instances of ICar, if Ferrari and Bmw both implement ICar;
    * the Ferrari object with name="F450" if only Ferrari implements ICar.

I checked out the code in QQueryBase.AddInterfaceConstraint, and found out that if I replace

constr = constr.Or(Constrain(yapClass.ClassReflector()));

with

constr = Constrain(yapClass.ClassReflector());

then I get the correct query result.




 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.