Exemple #1
0
 def sql(self):
     sql = 'delete from ' + self.sources.sql()
     if self.where is not None:
         sql += ' where ' + self.where.sql()
     if self.order is not None:
         sql += ' order by ' + self.order.sql()
     if self.slice is not None:
         slc = slice2limit(self.slice)
         if slc:
             sql += ' ' + slc
     return sql
Exemple #2
0
def test_slice2limit_no_args():
    limit = util.slice2limit(slice(None))
    assert limit is None, limit
Exemple #3
0
def test_slice2limit_lower_and_upper():
    limit = util.slice2limit(slice(10, 11))
    assert limit == 'limit 10, 1', limit
Exemple #4
0
def test_slice2limit_lower():
    limit = util.slice2limit(slice(10, None))
    assert limit == 'limit 10, -1', limit
Exemple #5
0
def test_slice2limit_upper():
    limit = util.slice2limit(slice(10))
    assert limit == 'limit 10', limit