server/test/unittest_rql2sql.py
changeset 5849 9db65b381028
parent 5811 e77cea9721e7
parent 5844 df7608ecea29
child 5890 141b935a38fc
equal deleted inserted replaced
5840:60880c81e32e 5849:9db65b381028
   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
   964 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'''
   964 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'''
   965      )
   965      )
   966     ]
   966     ]
   967 
   967 
   968 INLINE = [
   968 INLINE = [
       
   969 
       
   970     ('Any P WHERE N eid 1, N ecrit_par P, NOT P owned_by P2',
       
   971      '''SELECT _N.cw_ecrit_par
       
   972 FROM cw_Note AS _N
       
   973 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))'''),
       
   974 
   969     ('Any P, L WHERE N ecrit_par P, P nom L, N eid 0',
   975     ('Any P, L WHERE N ecrit_par P, P nom L, N eid 0',
   970      '''SELECT _P.cw_eid, _P.cw_nom
   976      '''SELECT _P.cw_eid, _P.cw_nom
   971 FROM cw_Note AS _N, cw_Personne AS _P
   977 FROM cw_Note AS _N, cw_Personne AS _P
   972 WHERE _N.cw_ecrit_par=_P.cw_eid AND _N.cw_eid=0'''),
   978 WHERE _N.cw_ecrit_par=_P.cw_eid AND _N.cw_eid=0'''),
   973 
   979 
   995      '''SELECT _P.cw_eid
  1001      '''SELECT _P.cw_eid
   996 FROM cw_Note AS _N, cw_Personne AS _P
  1002 FROM cw_Note AS _N, cw_Personne AS _P
   997 WHERE NOT (_N.cw_ecrit_par=_P.cw_eid) AND _N.cw_eid=512'''),
  1003 WHERE NOT (_N.cw_ecrit_par=_P.cw_eid) AND _N.cw_eid=512'''),
   998 
  1004 
   999     ('Any S,ES,T WHERE S state_of ET, ET name "CWUser", ES allowed_transition T, T destination_state S',
  1005     ('Any S,ES,T WHERE S state_of ET, ET name "CWUser", ES allowed_transition T, T destination_state S',
       
  1006      # XXX "_T.cw_destination_state IS NOT NULL" could be avoided here but it's not worth it
  1000      '''SELECT _T.cw_destination_state, rel_allowed_transition1.eid_from, _T.cw_eid
  1007      '''SELECT _T.cw_destination_state, rel_allowed_transition1.eid_from, _T.cw_eid
  1001 FROM allowed_transition_relation AS rel_allowed_transition1, cw_Transition AS _T, cw_Workflow AS _ET, state_of_relation AS rel_state_of0
  1008 FROM allowed_transition_relation AS rel_allowed_transition1, cw_Transition AS _T, cw_Workflow AS _ET, state_of_relation AS rel_state_of0
  1002 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'''),
  1009 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'''),
  1003 
  1010 
  1004     ('Any O WHERE S eid 0, S in_state O',
  1011     ('Any O WHERE S eid 0, S in_state O',
  1005      '''SELECT _S.cw_in_state
  1012      '''SELECT _S.cw_in_state
  1006 FROM cw_Affaire AS _S
  1013 FROM cw_Affaire AS _S
  1007 WHERE _S.cw_eid=0 AND _S.cw_in_state IS NOT NULL
  1014 WHERE _S.cw_eid=0 AND _S.cw_in_state IS NOT NULL