def __init__(self, **kwargs): Case.__init__(self, cache_table='vtocc_cached2', **kwargs)
import datetime from decimal import Decimal from cases_framework import Case, MultiCase cases = [ Case( doc='union', sql= 'select /* union */ eid, id from vtocc_a union select eid, id from vtocc_b', result=[(1L, 1L), (1L, 2L)], rewritten=[ 'select eid, id from vtocc_a where 1 != 1 union select eid, id from vtocc_b where 1 != 1', 'select /* union */ eid, id from vtocc_a union select eid, id from vtocc_b' ]), Case( doc='double union', sql= 'select /* double union */ eid, id from vtocc_a union select eid, id from vtocc_b union select eid, id from vtocc_d', result=[(1L, 1L), (1L, 2L)], rewritten=[ 'select eid, id from vtocc_a where 1 != 1 union select eid, id from vtocc_b where 1 != 1 union select eid, id from vtocc_d where 1 != 1', 'select /* double union */ eid, id from vtocc_a union select eid, id from vtocc_b union select eid, id from vtocc_d' ]), Case(doc="distinct", sql='select /* distinct */ distinct * from vtocc_a', result=[(1L, 1L, 'abcd', 'efgh'), (1L, 2L, 'bcde', 'fghi')], rewritten=[ 'select * from vtocc_a where 1 != 1', 'select /* distinct */ distinct * from vtocc_a limit 10001' ]),
def __init__(self, **kwargs): Case.__init__(self, cache_table="vtocc_cached1", **kwargs)
from cases_framework import Case, MultiCase cases = [ "alter table vtocc_cached comment 'new'", Case( doc="SELECT_PK (null key)", query_plan="SELECT_PK", sql="select * from vtocc_cached where eid = 2 and bid = %(bid)s", bindings={"bid": None}, result=[], rewritten=[ "select * from vtocc_cached where 1 != 1", "select eid, bid, name, foo from vtocc_cached where eid = 2 and bid = null" ], cache_absent=1), Case( doc="SELECT_PK (empty cache)", query_plan="SELECT_PK", sql="select * from vtocc_cached where eid = 2 and bid = 'foo'", result=[(2, 'foo', 'abcd2', 'efgh')], rewritten=[ "select * from vtocc_cached where 1 != 1", "select eid, bid, name, foo from vtocc_cached where eid = 2 and bid = 'foo'" ], cache_misses=1), # (2.foo) is in cache Case( doc="SELECT_PK, use cache", query_plan="SELECT_PK", sql= "select bid, eid, name, foo from vtocc_cached where eid = 2 and bid = 'foo'",