Add LIMIT/OFFSET to random queries

This commit is contained in:
Colin Dellow 2018-03-24 19:02:30 -04:00
parent cafd087113
commit d2c736f25a
1 changed files with 8 additions and 0 deletions

View File

@ -49,6 +49,14 @@ def generate_statement(conn, table, column_values, all_values):
value = values[random.randint(0, len(values) - 1)] value = values[random.randint(0, len(values) - 1)]
query += field + ' ' + op + ' ' + str(value) query += field + ' ' + op + ' ' + str(value)
if random.randint(0, 3) == 0:
how_many = random.randint(0, 15)
query += ' LIMIT {}'.format(how_many)
if random.randint(0, 3) == 0:
how_many = random.randint(0, 30)
query += ' OFFSET {}'.format(how_many)
return query return query
def test_statement(conn, table, column_values, all_values): def test_statement(conn, table, column_values, all_values):