/** * Return deep copy of this option object * @return Deep copy of the object */ public Object clone() { Option newOption = new Option(); newOption.setNoCache(noCache); if(this.makeDependentGroups != null) { newOption.makeDependentGroups = new ArrayList<String>(this.makeDependentGroups); newOption.makeDependentOptions = new ArrayList<MakeDep>(this.makeDependentOptions); } if(this.makeIndependentGroups != null) { newOption.makeIndependentGroups = new ArrayList<String>(this.makeIndependentGroups); newOption.makeIndependentOptions = new ArrayList<MakeDep>(this.makeIndependentOptions); } if(getNotDependentGroups() != null) { newOption.makeNotDependentGroups = new ArrayList<String>(getNotDependentGroups()); } if(getNoCacheGroups() != null) { newOption.noCacheGroups = new ArrayList<String>(getNoCacheGroups()); } return newOption; } }
/** * Return deep copy of this option object * @return Deep copy of the object */ public Object clone() { Option newOption = new Option(); newOption.setNoCache(noCache); if(this.makeDependentGroups != null) { newOption.makeDependentGroups = new ArrayList<String>(this.makeDependentGroups); newOption.makeDependentOptions = new ArrayList<MakeDep>(this.makeDependentOptions); } if(this.makeIndependentGroups != null) { newOption.makeIndependentGroups = new ArrayList<String>(this.makeIndependentGroups); newOption.makeIndependentOptions = new ArrayList<MakeDep>(this.makeIndependentOptions); } if(getNotDependentGroups() != null) { newOption.makeNotDependentGroups = new ArrayList<String>(getNotDependentGroups()); } if(getNoCacheGroups() != null) { newOption.noCacheGroups = new ArrayList<String>(getNoCacheGroups()); } return newOption; } }
/** * Return deep copy of this option object * @return Deep copy of the object */ public Object clone() { Option newOption = new Option(); newOption.setNoCache(noCache); if(this.makeDependentGroups != null) { newOption.makeDependentGroups = new ArrayList<String>(this.makeDependentGroups); newOption.makeDependentOptions = new ArrayList<MakeDep>(this.makeDependentOptions); } if(this.makeIndependentGroups != null) { newOption.makeIndependentGroups = new ArrayList<String>(this.makeIndependentGroups); newOption.makeIndependentOptions = new ArrayList<MakeDep>(this.makeIndependentOptions); } if(getNotDependentGroups() != null) { newOption.makeNotDependentGroups = new ArrayList<String>(getNotDependentGroups()); } if(getNoCacheGroups() != null) { newOption.noCacheGroups = new ArrayList<String>(getNoCacheGroups()); } return newOption; } }
static Option mergeOptions(Option parent, Option child) { if (child == null) { return parent; } if (parent != null && parent.isNoCache() && parent != child) { //merge no cache settings if (parent.getNoCacheGroups() == null || parent.getNoCacheGroups().isEmpty()) { if (child.getNoCacheGroups() != null) { child.getNoCacheGroups().clear(); // full no cache } } else if (child.getNoCacheGroups() != null && !child.getNoCacheGroups().isEmpty()) { for (String noCache : parent.getNoCacheGroups()) { child.addNoCacheGroup(noCache); // only groups } } child.setNoCache(true); } return child; }
static Option mergeOptions(Option parent, Option child) { if (child == null) { return parent; } if (parent != null && parent.isNoCache() && parent != child) { //merge no cache settings if (parent.getNoCacheGroups() == null || parent.getNoCacheGroups().isEmpty()) { if (child.getNoCacheGroups() != null) { child.getNoCacheGroups().clear(); // full no cache } } else if (child.getNoCacheGroups() != null && !child.getNoCacheGroups().isEmpty()) { for (String noCache : parent.getNoCacheGroups()) { child.addNoCacheGroup(noCache); // only groups } } child.setNoCache(true); } return child; }
public void testDefect15870() { Option opt1 = new Option(); opt1.setNoCache(true); Option opt2 = (Option) opt1.clone(); UnitTestUtil.helpTestEquivalence(0, opt1, opt2); }
@Test public void testOption9() { Option option = new Option(); option.setNoCache(true); helpTest(option, "OPTION NOCACHE"); //$NON-NLS-1$ }
@Test public void testInsertWithOption() { Insert insert = new Insert(); insert.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$ List<ElementSymbol> vars = new ArrayList<ElementSymbol>(); vars.add(new ElementSymbol("a")); //$NON-NLS-1$ insert.setVariables(vars); List<Reference> values = new ArrayList<Reference>(); values.add(new Reference(0)); insert.setValues(values); Option option = new Option(); option.setNoCache(true); insert.setOption(option); TestParser.helpTest("INSERT INTO m.g (a) VALUES (?) OPTION NOCACHE", //$NON-NLS-1$ "INSERT INTO m.g (a) VALUES (?) OPTION NOCACHE", //$NON-NLS-1$ insert); }
@Test public void testStoredQueryWithOption(){ StoredProcedure storedQuery = new StoredProcedure(); storedQuery.setProcedureName("proc1"); //$NON-NLS-1$ Option option = new Option(); option.setNoCache(true); storedQuery.setOption(option); TestParser.helpTest("exec proc1() option nocache", "EXEC proc1() OPTION NOCACHE", storedQuery); //$NON-NLS-1$ //$NON-NLS-2$ }
option.setNoCache(true);
@Test public void testDeleteWithOption() { Delete delete = new Delete(); delete.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$ Option option = new Option(); option.setNoCache(true); delete.setOption(option); TestParser.helpTest("DELETE FROM m.g OPTION NOCACHE", //$NON-NLS-1$ "DELETE FROM m.g OPTION NOCACHE", //$NON-NLS-1$ delete); }
proc.setCacheHint(null); Option option = new Option(); option.setNoCache(true); option.addNoCacheGroup(fullName); proc.setOption(option);
proc.setCacheHint(null); Option option = new Option(); option.setNoCache(true); option.addNoCacheGroup(fullName); proc.setOption(option);
proc.setCacheHint(null); Option option = new Option(); option.setNoCache(true); option.addNoCacheGroup(fullName); proc.setOption(option);
@Test public void testOptionNoCache3(){ GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$ From from = new From(); from.addGroup(g); Select select = new Select(); ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$ select.addSymbol(a); Option option = new Option(); option.setNoCache(true); Query query = new Query(); query.setSelect(select); query.setFrom(from); query.setOption(option); TestParser.helpTest("Select a From db.g Option nocache", //$NON-NLS-1$ "SELECT a FROM db.g OPTION NOCACHE", //$NON-NLS-1$ query); }
@Test public void testUpdateWithOption() { Update update = new Update(); update.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$ update.addChange(new ElementSymbol("a"), new Reference(0)); Option option = new Option(); option.setNoCache(true); Criteria crit = new CompareCriteria(new ElementSymbol("b"), CompareCriteria.EQ, new Reference(1)); //$NON-NLS-1$ update.setCriteria(crit); update.setOption(option); TestParser.helpTest("UPDATE m.g SET a = ? WHERE b = ? OPTION NOCACHE", //$NON-NLS-1$ "UPDATE m.g SET a = ? WHERE b = ? OPTION NOCACHE", //$NON-NLS-1$ update); }
@Test public void testOptionNoCache1(){ GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$ From from = new From(); from.addGroup(g); Select select = new Select(); ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$ select.addSymbol(a); Option option = new Option(); option.setNoCache(true); option.addNoCacheGroup("a.b.c"); //$NON-NLS-1$ Query query = new Query(); query.setSelect(select); query.setFrom(from); query.setOption(option); TestParser.helpTest("Select a From db.g Option nocache a.b.c", //$NON-NLS-1$ "SELECT a FROM db.g OPTION NOCACHE a.b.c", //$NON-NLS-1$ query); }
@Test public void testOptionNoCache2(){ GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$ From from = new From(); from.addGroup(g); Select select = new Select(); ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$ select.addSymbol(a); Option option = new Option(); option.setNoCache(true); option.addNoCacheGroup("a.b.c"); //$NON-NLS-1$ option.addNoCacheGroup("d.e.f"); //$NON-NLS-1$ Query query = new Query(); query.setSelect(select); query.setFrom(from); query.setOption(option); TestParser.helpTest("Select a From db.g Option nocache a.b.c, d.e.f", //$NON-NLS-1$ "SELECT a FROM db.g OPTION NOCACHE a.b.c, d.e.f", //$NON-NLS-1$ query); }
option.setNoCache( (nocache != null) ); {if (true) return option;} throw new Error("Missing return statement in function");
option.setNoCache( (nocache != null) ); {if (true) return option;} throw new Error("Missing return statement in function");