01: /**
02: * com.mckoi.database.QueryContext 05 Nov 2001
03: *
04: * Mckoi SQL Database ( http://www.mckoi.com/database )
05: * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * Version 2 as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License Version 2 for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * Version 2 along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: * Change Log:
21: *
22: *
23: */package com.mckoi.database;
24:
25: /**
26: * Facts about a particular query including the root table sources, user name
27: * of the controlling context, sequence state, etc.
28: *
29: * @author Tobias Downer
30: */
31:
32: public interface QueryContext {
33:
34: /**
35: * Returns a TransactionSystem object that is used to determine information
36: * about the transactional system.
37: */
38: TransactionSystem getSystem();
39:
40: /**
41: * Returns the user name of the connection.
42: */
43: String getUserName();
44:
45: /**
46: * Returns a FunctionLookup object used to convert FunctionDef objects to
47: * Function objects when evaluating an expression.
48: */
49: FunctionLookup getFunctionLookup();
50:
51: // ---------- Sequences ----------
52:
53: /**
54: * Increments the sequence generator and returns the next unique key.
55: */
56: long nextSequenceValue(String generator_name);
57:
58: /**
59: * Returns the current sequence value returned for the given sequence
60: * generator within the connection defined by this context. If a value was
61: * not returned for this connection then a statement exception is generated.
62: */
63: long currentSequenceValue(String generator_name);
64:
65: /**
66: * Sets the current sequence value for the given sequence generator.
67: */
68: void setSequenceValue(String generator_name, long value);
69:
70: // ---------- Caching ----------
71:
72: /**
73: * Marks a table in a query plan.
74: */
75: void addMarkedTable(String mark_name, Table table);
76:
77: /**
78: * Returns a table that was marked in a query plan or null if no mark was
79: * found.
80: */
81: Table getMarkedTable(String mark_name);
82:
83: /**
84: * Put a Table into the cache.
85: */
86: void putCachedNode(long id, Table table);
87:
88: /**
89: * Returns a cached table or null if it isn't cached.
90: */
91: Table getCachedNode(long id);
92:
93: /**
94: * Clears the cache of any cached tables.
95: */
96: void clearCache();
97:
98: }
|