server/test/unittest_rql2sql.py
branchstable
changeset 4836 3e3c4917e94e
parent 4467 0e73d299730a
child 4837 54969eec48eb
equal deleted inserted replaced
4828:3e173d598cad 4836:3e3c4917e94e
  1479             yield t
  1479             yield t
  1480 
  1480 
  1481     def test_has_text(self):
  1481     def test_has_text(self):
  1482         for t in self._parse((
  1482         for t in self._parse((
  1483             ('Any X WHERE X has_text "toto tata"',
  1483             ('Any X WHERE X has_text "toto tata"',
  1484              """SELECT appears0.uid
  1484              """SELECT DISTINCT appears0.uid
  1485 FROM appears AS appears0
  1485 FROM appears AS appears0
  1486 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata'))"""),
  1486 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata'))"""),
  1487 
  1487 
  1488             ('Any X WHERE X has_text %(text)s',
  1488             ('Any X WHERE X has_text %(text)s',
  1489              """SELECT appears0.uid
  1489              """SELECT DISTINCT appears0.uid
  1490 FROM appears AS appears0
  1490 FROM appears AS appears0
  1491 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('hip', 'hop', 'momo'))"""),
  1491 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('hip', 'hop', 'momo'))"""),
  1492 
  1492 
  1493             ('Personne X WHERE X has_text "toto tata"',
  1493             ('Personne X WHERE X has_text "toto tata"',
  1494              """SELECT _X.eid
  1494              """SELECT DISTINCT _X.eid
  1495 FROM appears AS appears0, entities AS _X
  1495 FROM appears AS appears0, entities AS _X
  1496 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=_X.eid AND _X.type='Personne'"""),
  1496 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=_X.eid AND _X.type='Personne'"""),
  1497 
  1497 
  1498             ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,Folder)',
  1498             ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,Folder)',
  1499              """SELECT _X.cw_eid
  1499              """SELECT DISTINCT _X.cw_eid
  1500 FROM appears AS appears0, cw_Basket AS _X
  1500 FROM appears AS appears0, cw_Basket AS _X
  1501 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=_X.cw_eid AND _X.cw_name=tutu
  1501 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=_X.cw_eid AND _X.cw_name=tutu
  1502 UNION ALL
  1502 UNION
  1503 SELECT _X.cw_eid
  1503 SELECT DISTINCT _X.cw_eid
  1504 FROM appears AS appears0, cw_Folder AS _X
  1504 FROM appears AS appears0, cw_Folder AS _X
  1505 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=_X.cw_eid AND _X.cw_name=tutu
  1505 WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=_X.cw_eid AND _X.cw_name=tutu
  1506 """),
  1506 """),
  1507             )):
  1507             )):
  1508             yield t
  1508             yield t