01: /*-------------------------------------------------------------------------
02: *
03: * Copyright (c) 2004-2005, PostgreSQL Global Development Group
04: * Copyright (c) 2004, Open Cloud Limited.
05: *
06: * IDENTIFICATION
07: * $PostgreSQL: pgjdbc/org/postgresql/core/Query.java,v 1.4 2005/01/11 08:25:43 jurka Exp $
08: *
09: *-------------------------------------------------------------------------
10: */
11: package org.postgresql.core;
12:
13: /**
14: * Abstraction of a generic Query, hiding the details of
15: * any protocol-version-specific data needed to execute
16: * the query efficiently.
17: *<p>
18: * Query objects should be explicitly closed when no longer
19: * needed; if resources are allocated on the server for this
20: * query, their cleanup is triggered by closing the Query.
21: *
22: * @author Oliver Jowett (oliver@opencloud.com)
23: */
24: public interface Query {
25: /**
26: * Create a ParameterList suitable for storing parameters
27: * associated with this Query.
28: *<p>
29: * If this query has no parameters, a ParameterList will
30: * be returned, but it may be a shared immutable object.
31: * If this query does have parameters, the returned
32: * ParameterList is a new list, unshared by other callers.
33: *
34: * @return a suitable ParameterList instance for this query
35: */
36: ParameterList createParameterList();
37:
38: /**
39: * Stringize this query to a human-readable form, substituting
40: * particular parameter values for parameter placeholders.
41: *
42: * @param parameters a ParameterList returned by this Query's
43: * {@link #createParameterList} method, or <code>null</code> to
44: * leave the parameter placeholders unsubstituted.
45: * @return a human-readable representation of this query
46: */
47: String toString(ParameterList parameters);
48:
49: /**
50: * Close this query and free any server-side resources associated
51: * with it. The resources may not be immediately deallocated, but
52: * closing a Query may make the deallocation more prompt.
53: *<p>
54: * A closed Query should not be executed.
55: */
56: void close();
57: }
|