1434 def test_ambigous_exists_no_from_clause(self): |
1434 def test_ambigous_exists_no_from_clause(self): |
1435 self._check('Any COUNT(U) WHERE U eid 1, EXISTS (P owned_by U, P is IN (Note, Affaire))', |
1435 self._check('Any COUNT(U) WHERE U eid 1, EXISTS (P owned_by U, P is IN (Note, Affaire))', |
1436 '''SELECT COUNT(1) |
1436 '''SELECT COUNT(1) |
1437 WHERE EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, cw_Affaire AS P WHERE rel_owned_by0.eid_from=P.cw_eid AND rel_owned_by0.eid_to=1 UNION SELECT 1 FROM owned_by_relation AS rel_owned_by1, cw_Note AS P WHERE rel_owned_by1.eid_from=P.cw_eid AND rel_owned_by1.eid_to=1)''') |
1437 WHERE EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, cw_Affaire AS P WHERE rel_owned_by0.eid_from=P.cw_eid AND rel_owned_by0.eid_to=1 UNION SELECT 1 FROM owned_by_relation AS rel_owned_by1, cw_Note AS P WHERE rel_owned_by1.eid_from=P.cw_eid AND rel_owned_by1.eid_to=1)''') |
1438 |
1438 |
|
1439 def test_attr_map(self): |
|
1440 def generate_ref(gen, linkedvar, rel): |
|
1441 linkedvar.accept(gen) |
|
1442 return 'VERSION_DATA(%s)' % linkedvar._q_sql |
|
1443 self.o.attr_map['Affaire.ref'] = generate_ref |
|
1444 try: |
|
1445 self._check('Any R WHERE X ref R', |
|
1446 '''SELECT VERSION_DATA(X.cw_eid) |
|
1447 FROM cw_Affaire AS X''') |
|
1448 self._check('Any X WHERE X ref 1', |
|
1449 '''SELECT X.cw_eid |
|
1450 FROM cw_Affaire AS X |
|
1451 WHERE VERSION_DATA(X.cw_eid)=1''') |
|
1452 finally: |
|
1453 self.o.attr_map.clear() |
|
1454 |
1439 |
1455 |
1440 class SqliteSQLGeneratorTC(PostgresSQLGeneratorTC): |
1456 class SqliteSQLGeneratorTC(PostgresSQLGeneratorTC): |
1441 |
1457 |
1442 def setUp(self): |
1458 def setUp(self): |
1443 RQLGeneratorTC.setUp(self) |
1459 RQLGeneratorTC.setUp(self) |