server/test/unittest_rql2sql.py
branchstable
changeset 5844 df7608ecea29
parent 5793 1faff41593df
child 5849 9db65b381028
child 5886 00a78298d30d
equal deleted inserted replaced
5843:85c4d5334f2c 5844:df7608ecea29
   270 
   270 
   271     # Any O WHERE NOT S corrected_in O, S eid %(x)s, S concerns P, O version_of P, O in_state ST, NOT ST name "published", O modification_date MTIME ORDERBY MTIME DESC LIMIT 9
   271     # Any O WHERE NOT S corrected_in O, S eid %(x)s, S concerns P, O version_of P, O in_state ST, NOT ST name "published", O modification_date MTIME ORDERBY MTIME DESC LIMIT 9
   272     ('Any O WHERE NOT S ecrit_par O, S eid 1, S inline1 P, O inline2 P',
   272     ('Any O WHERE NOT S ecrit_par O, S eid 1, S inline1 P, O inline2 P',
   273      '''SELECT _O.cw_eid
   273      '''SELECT _O.cw_eid
   274 FROM cw_Note AS _S, cw_Personne AS _O
   274 FROM cw_Note AS _S, cw_Personne AS _O
   275 WHERE NOT (_S.cw_ecrit_par=_O.cw_eid) AND _S.cw_eid=1 AND _O.cw_inline2=_S.cw_inline1'''),
   275 WHERE NOT (_S.cw_ecrit_par=_O.cw_eid) AND _S.cw_eid=1 AND _S.cw_inline1 IS NOT NULL AND _O.cw_inline2=_S.cw_inline1'''),
   276 
   276 
   277     ('DISTINCT Any S ORDERBY stockproc(SI) WHERE NOT S ecrit_par O, S para SI',
   277     ('DISTINCT Any S ORDERBY stockproc(SI) WHERE NOT S ecrit_par O, S para SI',
   278      '''SELECT T1.C0 FROM (SELECT DISTINCT _S.cw_eid AS C0, STOCKPROC(_S.cw_para) AS C1
   278      '''SELECT T1.C0 FROM (SELECT DISTINCT _S.cw_eid AS C0, STOCKPROC(_S.cw_para) AS C1
   279 FROM cw_Note AS _S
   279 FROM cw_Note AS _S
   280 WHERE _S.cw_ecrit_par IS NULL
   280 WHERE _S.cw_ecrit_par IS NULL
   970 WHERE (rel_connait0.eid_from=_P.cw_eid AND rel_connait0.eid_to=_S.cw_eid OR rel_connait0.eid_to=_P.cw_eid AND rel_connait0.eid_from=_S.cw_eid) AND _S.cw_nom=chouette'''
   970 WHERE (rel_connait0.eid_from=_P.cw_eid AND rel_connait0.eid_to=_S.cw_eid OR rel_connait0.eid_to=_P.cw_eid AND rel_connait0.eid_from=_S.cw_eid) AND _S.cw_nom=chouette'''
   971      )
   971      )
   972     ]
   972     ]
   973 
   973 
   974 INLINE = [
   974 INLINE = [
       
   975 
       
   976     ('Any P WHERE N eid 1, N ecrit_par P, NOT P owned_by P2',
       
   977      '''SELECT _N.cw_ecrit_par
       
   978 FROM cw_Note AS _N
       
   979 WHERE _N.cw_eid=1 AND _N.cw_ecrit_par IS NOT NULL AND NOT (EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0 WHERE _N.cw_ecrit_par=rel_owned_by0.eid_from))'''),
       
   980 
   975     ('Any P, L WHERE N ecrit_par P, P nom L, N eid 0',
   981     ('Any P, L WHERE N ecrit_par P, P nom L, N eid 0',
   976      '''SELECT _P.cw_eid, _P.cw_nom
   982      '''SELECT _P.cw_eid, _P.cw_nom
   977 FROM cw_Note AS _N, cw_Personne AS _P
   983 FROM cw_Note AS _N, cw_Personne AS _P
   978 WHERE _N.cw_ecrit_par=_P.cw_eid AND _N.cw_eid=0'''),
   984 WHERE _N.cw_ecrit_par=_P.cw_eid AND _N.cw_eid=0'''),
   979 
   985 
  1001      '''SELECT _P.cw_eid
  1007      '''SELECT _P.cw_eid
  1002 FROM cw_Note AS _N, cw_Personne AS _P
  1008 FROM cw_Note AS _N, cw_Personne AS _P
  1003 WHERE NOT (_N.cw_ecrit_par=_P.cw_eid) AND _N.cw_eid=512'''),
  1009 WHERE NOT (_N.cw_ecrit_par=_P.cw_eid) AND _N.cw_eid=512'''),
  1004 
  1010 
  1005     ('Any S,ES,T WHERE S state_of ET, ET name "CWUser", ES allowed_transition T, T destination_state S',
  1011     ('Any S,ES,T WHERE S state_of ET, ET name "CWUser", ES allowed_transition T, T destination_state S',
       
  1012      # XXX "_T.cw_destination_state IS NOT NULL" could be avoided here but it's not worth it
  1006      '''SELECT _T.cw_destination_state, rel_allowed_transition1.eid_from, _T.cw_eid
  1013      '''SELECT _T.cw_destination_state, rel_allowed_transition1.eid_from, _T.cw_eid
  1007 FROM allowed_transition_relation AS rel_allowed_transition1, cw_Transition AS _T, cw_Workflow AS _ET, state_of_relation AS rel_state_of0
  1014 FROM allowed_transition_relation AS rel_allowed_transition1, cw_Transition AS _T, cw_Workflow AS _ET, state_of_relation AS rel_state_of0
  1008 WHERE _T.cw_destination_state=rel_state_of0.eid_from AND rel_state_of0.eid_to=_ET.cw_eid AND _ET.cw_name=CWUser AND rel_allowed_transition1.eid_to=_T.cw_eid'''),
  1015 WHERE _T.cw_destination_state=rel_state_of0.eid_from AND rel_state_of0.eid_to=_ET.cw_eid AND _ET.cw_name=CWUser AND rel_allowed_transition1.eid_to=_T.cw_eid AND _T.cw_destination_state IS NOT NULL'''),
  1009 
  1016 
  1010     ('Any O WHERE S eid 0, S in_state O',
  1017     ('Any O WHERE S eid 0, S in_state O',
  1011      '''SELECT _S.cw_in_state
  1018      '''SELECT _S.cw_in_state
  1012 FROM cw_Affaire AS _S
  1019 FROM cw_Affaire AS _S
  1013 WHERE _S.cw_eid=0 AND _S.cw_in_state IS NOT NULL
  1020 WHERE _S.cw_eid=0 AND _S.cw_in_state IS NOT NULL