moremore0812 / cqengine

Automatically exported from code.google.com/p/cqengine
0 stars 0 forks source link

Add support for SQL EXISTS and exists-based JOIN #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Add support to query against foreign collections, similar to SQL EXISTS.

SELECT * From LocalCollection
WHERE EXISTS (
    SELECT * FROM ForeignCollection
    WHERE LocalCollection.localAttribute = ForeignCollection.foreignAttribute
)

This would enable joins between indexed collections.

Original issue reported on code.google.com by ni...@npgall.com on 27 Jan 2013 at 10:07

GoogleCodeExporter commented 9 years ago
Changes committed to trunk:

QueryFactory.existsIn(IndexedCollection<F> foreignCollection, Attribute<O, A> 
localKeyAttribute, Attribute<F, A> foreignKeyAttribute)
and
QueryFactory.existsIn(IndexedCollection<F> foreignCollection, Attribute<O, A> 
localKeyAttribute, Attribute<F, A> foreignKeyAttribute, Query<F> 
foreignRestrictions)

Example usage: 
http://cqengine.googlecode.com/svn/cqengine/trunk/src/test/java/com/googlecode/c
qengine/examples/join/SqlExists.java

Also, using this support for JOINs between indexed collections: 
http://cqengine.googlecode.com/svn/cqengine/trunk/src/test/java/com/googlecode/c
qengine/examples/join/SqlExistsBasedJoin.java

Original comment by ni...@npgall.com on 27 Jan 2013 at 10:11

GoogleCodeExporter commented 9 years ago

Original comment by ni...@npgall.com on 27 Jan 2013 at 10:12