208 ("Personne P LIMIT 20 OFFSET 10", |
208 ("Personne P LIMIT 20 OFFSET 10", |
209 '''SELECT _P.cw_eid |
209 '''SELECT _P.cw_eid |
210 FROM cw_Personne AS _P |
210 FROM cw_Personne AS _P |
211 LIMIT 20 |
211 LIMIT 20 |
212 OFFSET 10'''), |
212 OFFSET 10'''), |
|
213 ("Any P ORDERBY N LIMIT 1 WHERE P is Personne, P travaille S, S eid %(eid)s, P nom N, P nom %(text)s", |
|
214 '''SELECT _P.cw_eid |
|
215 FROM cw_Personne AS _P, travaille_relation AS rel_travaille0 |
|
216 WHERE rel_travaille0.eid_from=_P.cw_eid AND rel_travaille0.eid_to=12345 AND _P.cw_nom=hip hop momo |
|
217 ORDER BY _P.cw_nom |
|
218 LIMIT 1'''), |
213 ] |
219 ] |
214 |
220 |
215 |
221 |
216 ADVANCED = [ |
222 ADVANCED = [ |
217 ("Societe S WHERE S nom 'Logilab' OR S nom 'Caesium'", |
223 ("Societe S WHERE S nom 'Logilab' OR S nom 'Caesium'", |
1241 def _norm_sql(self, sql): |
1247 def _norm_sql(self, sql): |
1242 return sql.strip() |
1248 return sql.strip() |
1243 |
1249 |
1244 def _check(self, rql, sql, varmap=None, args=None): |
1250 def _check(self, rql, sql, varmap=None, args=None): |
1245 if args is None: |
1251 if args is None: |
1246 args = {'text': 'hip hop momo'} |
1252 args = {'text': 'hip hop momo', 'eid': 12345} |
1247 try: |
1253 try: |
1248 union = self._prepare(rql) |
1254 union = self._prepare(rql) |
1249 r, nargs, cbs = self.o.generate(union, args, |
1255 r, nargs, cbs = self.o.generate(union, args, |
1250 varmap=varmap) |
1256 varmap=varmap) |
1251 args.update(nargs) |
1257 args.update(nargs) |
1772 ''' |
1778 ''' |
1773 SELECT _O.cw_eid, _O.cw_address, _O.cw_alias, _O.cw_modification_date |
1779 SELECT _O.cw_eid, _O.cw_address, _O.cw_alias, _O.cw_modification_date |
1774 FROM cw_EmailAddress AS _O |
1780 FROM cw_EmailAddress AS _O |
1775 WHERE NOT (EXISTS(SELECT 1 FROM use_email_relation AS rel_use_email0 WHERE rel_use_email0.eid_from=1 AND rel_use_email0.eid_to=_O.cw_eid)) AND EXISTS(SELECT 1 FROM use_email_relation AS rel_use_email1 WHERE rel_use_email1.eid_to=_O.cw_eid AND EXISTS(SELECT 1 FROM cw_CWGroup AS _D WHERE rel_use_email1.eid_from=2 AND NOT (EXISTS(SELECT 1 FROM in_group_relation AS rel_in_group2 WHERE rel_in_group2.eid_from=2 AND rel_in_group2.eid_to=_D.cw_eid)) AND _D.cw_name=guests)) |
1781 WHERE NOT (EXISTS(SELECT 1 FROM use_email_relation AS rel_use_email0 WHERE rel_use_email0.eid_from=1 AND rel_use_email0.eid_to=_O.cw_eid)) AND EXISTS(SELECT 1 FROM use_email_relation AS rel_use_email1 WHERE rel_use_email1.eid_to=_O.cw_eid AND EXISTS(SELECT 1 FROM cw_CWGroup AS _D WHERE rel_use_email1.eid_from=2 AND NOT (EXISTS(SELECT 1 FROM in_group_relation AS rel_in_group2 WHERE rel_in_group2.eid_from=2 AND rel_in_group2.eid_to=_D.cw_eid)) AND _D.cw_name=guests)) |
1776 ORDER BY 4 DESC'''), |
1782 ORDER BY 4 DESC'''), |
|
1783 |
|
1784 ("Any P ORDERBY N LIMIT 1 WHERE P is Personne, P travaille S, S eid %(eid)s, P nom N, P nom %(text)s", |
|
1785 '''WITH orderedrows AS ( |
|
1786 SELECT |
|
1787 _L01 |
|
1788 , ROW_NUMBER() OVER (ORDER BY _L01) AS __RowNumber |
|
1789 FROM ( |
|
1790 SELECT _P.cw_eid AS _L01 FROM cw_Personne AS _P, travaille_relation AS rel_travaille0 |
|
1791 WHERE rel_travaille0.eid_from=_P.cw_eid AND rel_travaille0.eid_to=12345 AND _P.cw_nom=hip hop momo |
|
1792 ) AS _SQ1 ) |
|
1793 SELECT |
|
1794 _L01 |
|
1795 FROM orderedrows WHERE |
|
1796 __RowNumber <= 1'''), |
|
1797 |
|
1798 ("Any P ORDERBY N LIMIT 1 WHERE P is Personne, P nom N", |
|
1799 '''WITH orderedrows AS ( |
|
1800 SELECT |
|
1801 _L01 |
|
1802 , ROW_NUMBER() OVER (ORDER BY _L01) AS __RowNumber |
|
1803 FROM ( |
|
1804 SELECT _P.cw_eid AS _L01 FROM cw_Personne AS _P |
|
1805 ) AS _SQ1 ) |
|
1806 SELECT |
|
1807 _L01 |
|
1808 FROM orderedrows WHERE |
|
1809 __RowNumber <= 1 |
|
1810 '''), |
|
1811 |
|
1812 ("Any PN, N, P ORDERBY N LIMIT 1 WHERE P is Personne, P nom N, P prenom PN", |
|
1813 '''WITH orderedrows AS ( |
|
1814 SELECT |
|
1815 _L01, _L02, _L03 |
|
1816 , ROW_NUMBER() OVER (ORDER BY _L02) AS __RowNumber |
|
1817 FROM ( |
|
1818 SELECT _P.cw_prenom AS _L01, _P.cw_nom AS _L02, _P.cw_eid AS _L03 FROM cw_Personne AS _P |
|
1819 ) AS _SQ1 ) |
|
1820 SELECT |
|
1821 _L01, _L02, _L03 |
|
1822 FROM orderedrows WHERE |
|
1823 __RowNumber <= 1 |
|
1824 '''), |
1777 ] |
1825 ] |
1778 for t in self._parse(WITH_LIMIT):# + ADVANCED_WITH_LIMIT_OR_ORDERBY): |
1826 for t in self._parse(WITH_LIMIT):# + ADVANCED_WITH_LIMIT_OR_ORDERBY): |
1779 yield t |
1827 yield t |
1780 |
1828 |
1781 def test_cast(self): |
1829 def test_cast(self): |