580 ('Any X WHERE X eid > 12, X is Note', |
580 ('Any X WHERE X eid > 12, X is Note', |
581 """SELECT X.eid |
581 """SELECT X.eid |
582 FROM entities AS X |
582 FROM entities AS X |
583 WHERE X.type='Note' AND X.eid>12"""), |
583 WHERE X.type='Note' AND X.eid>12"""), |
584 |
584 |
585 ('Any X, T WHERE X eid > 12, X title T', |
585 ('Any X, T WHERE X eid > 12, X title T, X is IN (Bookmark, Card)', |
586 """SELECT X.cw_eid, X.cw_title |
586 """SELECT X.cw_eid, X.cw_title |
587 FROM cw_Bookmark AS X |
587 FROM cw_Bookmark AS X |
588 WHERE X.cw_eid>12 |
588 WHERE X.cw_eid>12 |
589 UNION ALL |
589 UNION ALL |
590 SELECT X.cw_eid, X.cw_title |
590 SELECT X.cw_eid, X.cw_title |
591 FROM cw_Card AS X |
591 FROM cw_Card AS X |
592 WHERE X.cw_eid>12 |
|
593 UNION ALL |
|
594 SELECT X.cw_eid, X.cw_title |
|
595 FROM cw_EmailThread AS X |
|
596 WHERE X.cw_eid>12"""), |
592 WHERE X.cw_eid>12"""), |
597 |
593 |
598 ('Any X', |
594 ('Any X', |
599 '''SELECT X.eid |
595 '''SELECT X.eid |
600 FROM entities AS X'''), |
596 FROM entities AS X'''), |
751 ('Any X WHERE NOT Y evaluee X, Y is CWUser', |
747 ('Any X WHERE NOT Y evaluee X, Y is CWUser', |
752 '''SELECT X.cw_eid |
748 '''SELECT X.cw_eid |
753 FROM cw_Note AS X |
749 FROM cw_Note AS X |
754 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0,cw_CWUser AS Y WHERE rel_evaluee0.eid_from=Y.cw_eid AND rel_evaluee0.eid_to=X.cw_eid)'''), |
750 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0,cw_CWUser AS Y WHERE rel_evaluee0.eid_from=Y.cw_eid AND rel_evaluee0.eid_to=X.cw_eid)'''), |
755 |
751 |
756 ('Any X,T WHERE X title T, NOT X is Bookmark', |
752 ('Any X,RT WHERE X relation_type RT, NOT X is CWAttribute', |
757 '''SELECT X.cw_eid, X.cw_title |
753 '''SELECT X.cw_eid, X.cw_relation_type |
758 FROM cw_Card AS X |
754 FROM cw_CWRelation AS X |
759 UNION ALL |
755 WHERE X.cw_relation_type IS NOT NULL'''), |
760 SELECT X.cw_eid, X.cw_title |
|
761 FROM cw_EmailThread AS X'''), |
|
762 |
756 |
763 ('Any K,V WHERE P is CWProperty, P pkey K, P value V, NOT P for_user U', |
757 ('Any K,V WHERE P is CWProperty, P pkey K, P value V, NOT P for_user U', |
764 '''SELECT P.cw_pkey, P.cw_value |
758 '''SELECT P.cw_pkey, P.cw_value |
765 FROM cw_CWProperty AS P |
759 FROM cw_CWProperty AS P |
766 WHERE P.cw_for_user IS NULL'''), |
760 WHERE P.cw_for_user IS NULL'''), |
771 WHERE NOT EXISTS(SELECT 1 FROM cw_Affaire AS X WHERE X.cw_in_state=S.cw_eid) |
765 WHERE NOT EXISTS(SELECT 1 FROM cw_Affaire AS X WHERE X.cw_in_state=S.cw_eid) |
772 INTERSECT |
766 INTERSECT |
773 SELECT S.cw_eid |
767 SELECT S.cw_eid |
774 FROM cw_State AS S |
768 FROM cw_State AS S |
775 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS X WHERE X.cw_in_state=S.cw_eid)'''), |
769 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS X WHERE X.cw_in_state=S.cw_eid)'''), |
776 ] |
770 |
|
771 ('Any S WHERE NOT(X in_state S, S name "somename"), X is CWUser', |
|
772 '''SELECT S.cw_eid |
|
773 FROM cw_State AS S |
|
774 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS X WHERE X.cw_in_state=S.cw_eid AND S.cw_name=somename)'''), |
|
775 |
|
776 # XXXFIXME fail |
|
777 # ('Any X,RT WHERE X relation_type RT?, NOT X is CWAttribute', |
|
778 # '''SELECT X.cw_eid, X.cw_relation_type |
|
779 # FROM cw_CWRelation AS X'''), |
|
780 ] |
777 |
781 |
778 OUTER_JOIN = [ |
782 OUTER_JOIN = [ |
779 ('Any X,S WHERE X travaille S?', |
783 ('Any X,S WHERE X travaille S?', |
780 '''SELECT X.cw_eid, rel_travaille0.eid_to |
784 '''SELECT X.cw_eid, rel_travaille0.eid_to |
781 FROM cw_Personne AS X LEFT OUTER JOIN travaille_relation AS rel_travaille0 ON (rel_travaille0.eid_from=X.cw_eid)''' |
785 FROM cw_Personne AS X LEFT OUTER JOIN travaille_relation AS rel_travaille0 ON (rel_travaille0.eid_from=X.cw_eid)''' |