public Result ProcessSelect() { Select select = ParseSelect (); if (select.sIntoTable == null) { // [email protected] begin changes from 1.50 // return select.getResult(cChannel.getMaxRows()); return select.GetResult (select.limitStart, select.limitCount, cChannel); // [email protected] end changes from 1.50 } else { Result r = select.GetResult (0, cChannel); Table t = new Table (dDatabase, true, select.sIntoTable, false); t.AddColumns (r); t.CreatePrimaryKey (); // SELECT .. INTO can't fail because of violation of primary key t.Insert (r, cChannel); dDatabase.LinkTable (t); int i = r.Size; r = new Result (); r.SetUpdateCount (i); return r; } }
private TableFilter ParseTableFilter(bool outerjoin) { string token = tTokenizer.GetString (); Table t = null; if (token.Equals ("(")) { tTokenizer.GetThis ("SELECT"); Select s = ParseSelect (); Result r = s.GetResult (0, null); // it's not a problem that this table has not a unique name t = new Table (dDatabase, false, "SYSTEM_SUBQUERY", false); tTokenizer.GetThis (")"); t.AddColumns (r); t.CreatePrimaryKey (); // subquery creation can't fail because of violation of primary key t.Insert (r, cChannel); } else { cChannel.Check (token, AccessType.Select); t = dDatabase.GetTable (token, cChannel); } string sAlias = null; token = tTokenizer.GetString (); if (token.Equals ("AS")) { sAlias = tTokenizer.GetName (); } else if (tTokenizer.WasName) { sAlias = token; } else { tTokenizer.Back (); } return new TableFilter (t, sAlias, outerjoin); }