KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mckoi > database > QueryContext


1 /**
2  * com.mckoi.database.QueryContext 05 Nov 2001
3  *
4  * Mckoi SQL Database ( http://www.mckoi.com/database )
5  * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * 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  */

24
25 package com.mckoi.database;
26
27 /**
28  * Facts about a particular query including the root table sources, user name
29  * of the controlling context, sequence state, etc.
30  *
31  * @author Tobias Downer
32  */

33
34 public interface QueryContext {
35
36   /**
37    * Returns a TransactionSystem object that is used to determine information
38    * about the transactional system.
39    */

40   TransactionSystem getSystem();
41
42   /**
43    * Returns the user name of the connection.
44    */

45   String JavaDoc getUserName();
46
47   /**
48    * Returns a FunctionLookup object used to convert FunctionDef objects to
49    * Function objects when evaluating an expression.
50    */

51   FunctionLookup getFunctionLookup();
52
53   // ---------- Sequences ----------
54

55   /**
56    * Increments the sequence generator and returns the next unique key.
57    */

58   long nextSequenceValue(String JavaDoc generator_name);
59
60   /**
61    * Returns the current sequence value returned for the given sequence
62    * generator within the connection defined by this context. If a value was
63    * not returned for this connection then a statement exception is generated.
64    */

65   long currentSequenceValue(String JavaDoc generator_name);
66
67   /**
68    * Sets the current sequence value for the given sequence generator.
69    */

70   void setSequenceValue(String JavaDoc generator_name, long value);
71   
72   // ---------- Caching ----------
73

74   /**
75    * Marks a table in a query plan.
76    */

77   void addMarkedTable(String JavaDoc mark_name, Table table);
78
79   /**
80    * Returns a table that was marked in a query plan or null if no mark was
81    * found.
82    */

83   Table getMarkedTable(String JavaDoc mark_name);
84
85   /**
86    * Put a Table into the cache.
87    */

88   void putCachedNode(long id, Table table);
89
90   /**
91    * Returns a cached table or null if it isn't cached.
92    */

93   Table getCachedNode(long id);
94
95   /**
96    * Clears the cache of any cached tables.
97    */

98   void clearCache();
99
100 }
101
Popular Tags